* Installing GPAC
+/!\ GPAC won't compile if the 'svnversion' command (shipped with every Subversion package) is not in your path /!\
+
Detailed instruction for Win32 MSVC Compilation are available in gpac/doc/INSTALL.w32
Detailed instruction for WinCE eVC Compilation are available in gpac/doc/INSTALL.wCE
vpath %.c $(SRC_PATH)
-all: lib apps mods
+all: version
+ $(MAKE) -C src all
+ $(MAKE) -C applications all
+ $(MAKE) -C modules all
+
+version:
+ @if which svnversion >/dev/null; then echo "#define GPAC_SVN_REVISION \"$(shell svnversion \"$(SRC_PATH)\")\"" > $(SRC_PATH)/include/gpac/version.h ; else echo "No SVN Version found"; fi
-lib:
+lib: version
$(MAKE) -C src all
apps:
$(INSTALL) $(INSTFLAGS) -m 644 doc/man/gpac.1 $(DESTDIR)$(mandir)/man1/ ; \
$(INSTALL) -d "$(DESTDIR)$(prefix)/share/gpac" ; \
$(INSTALL) $(INSTFLAGS) -m 644 doc/gpac.mp4 $(DESTDIR)$(prefix)/share/gpac/ ; \
+ fi
+ if [ -d gui ] ; then \
$(INSTALL) -d "$(DESTDIR)$(prefix)/share/gpac/gui" ; \
+ $(INSTALL) $(INSTFLAGS) -m 644 gui/gui.bt "$(DESTDIR)$(prefix)/share/gpac/gui/" ; \
+ $(INSTALL) $(INSTFLAGS) -m 644 gui/gui.js "$(DESTDIR)$(prefix)/share/gpac/gui/" ; \
+ $(INSTALL) $(INSTFLAGS) -m 644 gui/gwlib.js "$(DESTDIR)$(prefix)/share/gpac/gui/" ; \
+ $(INSTALL) $(INSTFLAGS) -m 644 gui/mpegu-core.js "$(DESTDIR)$(prefix)/share/gpac/gui/" ; \
$(INSTALL) -d "$(DESTDIR)$(prefix)/share/gpac/gui/icons" ; \
- $(INSTALL) $(INSTFLAGS) -m 644 gui/icons/*.svg "$(DESTDIR)$(prefix)/share/gpac/gui/icons" ; \
+ $(INSTALL) $(INSTFLAGS) -m 644 gui/icons/*.svg "$(DESTDIR)$(prefix)/share/gpac/gui/icons/" ; \
+ cp -R gui/extensions "$(DESTDIR)$(prefix)/share/gpac/gui/" ; \
+ rm -rf "$(DESTDIR)$(prefix)/share/gpac/gui/extensions/*.svn" ; \
fi
uninstall:
rm -rf "$(prefix)/include/gpac/enst"
rm -rf "$(prefix)/include/gpac"
+ifeq ($(CONFIG_DARWIN),yes)
+dmg:
+ rm "bin/gcc/MP4Client"
+ $(MAKE) -C applications/mp4client
+ ./mkdmg.sh
+endif
+
+ifeq ($(CONFIG_LINUX),yes)
+deb:
+ fakeroot debian/rules clean
+ sed -i "s/.DEV/.DEV-r`svnversion \"$(SRC_PATH)\"`/" debian/changelog
+ fakeroot debian/rules configure
+ fakeroot debian/rules binary
+ svn cleanup
+ svn revert debian/changelog
+endif
+
help:
@echo "Input to GPAC make:"
@echo "depend/dep: builds dependencies (dev only)"
@echo
@echo "install: install applications and modules on system"
@echo "uninstall: uninstall applications and modules"
+ifeq ($(CONFIG_DARWIN),yes)
+ @echo "dmg: creates DMG package file for OSX"
+endif
+ifeq ($(CONFIG_LINUX),yes)
+ @echo "dmg: creates DEB package file for debian based systems"
+endif
@echo
@echo "install-lib: install gpac library (dyn and static) and headers <gpac/*.h>, <gpac/modules/*.h> and <gpac/internal/*.h>"
@echo "uninstall-lib: uninstall gpac library (dyn and static) and headers"
gf_cfg_set_key(m_user.config, "Audio", "NumBuffers", "2");
gf_cfg_set_key(m_user.config, "Audio", "TotalDuration", "120");
gf_cfg_set_key(m_user.config, "Video", "DriverName", "dx_hw");
- gf_cfg_set_key(m_user.config, "Video", "UseHardwareMemory", "yes");
+ gf_cfg_set_key(m_user.config, "Video", "HardwareMemory", "Auto");
#ifdef _WIN32_WCE
strcpy((char*)cfg_file, "\\windows");
include ../config.mak
APPDIRS= mp4client
+APPDIRS+=mp42ts
ifeq ($(DISABLE_ISOFF), no)
APPDIRS += mp4box
endif
-
V4STUDIODIR=
INSTDIRS=mp4client
ifeq ($(CONFIG_XUL),no)
else
-INSTDIRS+=osmozilla
-APPDIRS+=osmozilla
+#INSTDIRS+=osmozilla
+#APPDIRS+=osmozilla
endif
+#disable due to version incompatibilities
ifeq ($(USE_WXWIDGETS), yes)
-APPDIRS+=osmo4_wx
-V4STUDIODIR=V4Studio
-INSTDIRS+=osmo4_wx
+#APPDIRS+=osmo4_wx
+#V4STUDIODIR=V4Studio
+#INSTDIRS+=osmo4_wx
endif
ALLDIRS=$(APPDIRS)
vpath %.c $(SRC_PATH)/applications/generators/MPEG4
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#include <stdio.h>
#include <string.h>
+#undef _DEBUG
+#undef DEBUG
+
#include <gpac/list.h>
+
#include <time.h>
}
}
+char *format_bit_string(char *str, u32 val, u32 nb_bits)
+{
+ u32 i, len;
+ strcpy(str, "");
+ while (nb_bits) {
+ strcat(str, (val%2) ? "1" : "0");
+ val>>=1;
+ nb_bits--;
+ }
+ len = strlen(str);
+ for (i=0; i<len/2; i++) {
+ char c = str[i];
+ str[i] = str[len-i-1];
+ str[len-i-1]=c;
+ }
+ return str;
+}
+
+u32 get_nb_bits(u32 MaxVal)
+{
+ u32 k=1;
+ if (!MaxVal) return 0;
+ MaxVal--;
+ while (MaxVal > ((1<<k)-1) ) k+=1;
+ return k;
+}
+
+void generate_ndts(GF_List *NDTs, GF_List *nodes, u32 nbVersion)
+{
+ u32 nb_nodes, nb_ndt, i, j, k, nb_bits, idx, l;
+ char szStr[100];
+ nb_ndt = gf_list_count(NDTs);
+ nb_nodes = gf_list_count(nodes);
+ for (i=0; i<nbVersion;i++) {
+ char szFile[100];
+ FILE *f;
+ sprintf(szFile, "NdtListV%d.html", i+1);
+ f = fopen(szFile, "wt");
+
+ fprintf(f, "<html>\n"\
+"<head>\n"\
+"<meta name=\"Author\" content=\"Jean Le Feuvre - GPAC %s\">\n"\
+"<title>NdtListV%d.html</title>\n"\
+"</head>\n"\
+"<body>\n"\
+"<title>Node Coding Tables for BIFS Version %d group</title>\n"
+ ,GPAC_FULL_VERSION, i+1, i+1);
+
+ for (j=0; j<nb_ndt; j++) {
+ u32 nb_in_ndt = 0;
+ char *ndt = gf_list_get(NDTs, j);
+ for (k=0;k<nb_nodes;k++) {
+ BNode *n = gf_list_get(nodes, k);
+ if (n->version != i+1) continue;
+ if (!IsNodeInTable(n, ndt)) continue;
+ nb_in_ndt ++;
+ }
+
+ if (!nb_in_ndt) continue;
+
+ fprintf(f, "<BR><a name=\"%s\">\n"\
+"<TABLE BORDER COLS=\"10\" CELLSPACING=\"0\" WIDTH=\"100%%\">\n"\
+"<TD COLSPAN=\"2\" width=\"200\"><B>%s</B></TD>\n"\
+"<TD COLSPAN=\"4\"><B>%u nodes</B></TD>\n", ndt, ndt, nb_in_ndt);
+
+ nb_bits = GetBitsCount(nb_in_ndt);
+ fprintf(f, "<TR><TD>reserved</TD><TD><P align=CENTER>%s</TD><TD><P align=RIGHT> </TD><TD><P align=RIGHT> </TD><TD><P align=RIGHT> </TD><TD><P align=RIGHT> </TD></TR>\n", format_bit_string(szStr, 0, nb_bits));
+
+ idx = 1;
+ for (k=0;k<nb_nodes;k++) {
+ BNode *n = gf_list_get(nodes, k);
+ if (n->version != i+1) continue;
+ if (!IsNodeInTable(n, ndt)) continue;
+
+
+ n->hasDef = n->hasIn = n->hasOut = n->hasDyn = 0;
+ for (l=0;l<gf_list_count(n->Fields); l++) {
+ BField *bf = gf_list_get(n->Fields, l);
+ if (!strcmp(bf->type, "field") || !strcmp(bf->type, "exposedField")) {
+ n->hasDef += 1;
+ }
+ if (!strcmp(bf->type, "eventIn") || !strcmp(bf->type, "exposedField")) {
+ n->hasIn += 1;
+ //check for anim
+ if (bf->hasAnim) n->hasDyn += 1;
+ }
+ if (!strcmp(bf->type, "eventOut") || !strcmp(bf->type, "exposedField")) {
+ n->hasOut += 1;
+ }
+ }
+
+ fprintf(f, "<TR><TD>%s</TD><TD><P align=CENTER>%s</TD><TD><P align=RIGHT>%d DEF bits</TD><TD><P align=RIGHT>%d IN bits</TD><TD><P align=RIGHT>%d OUT bits</TD><TD><P align=RIGHT>%d DYN bits</TD></TR>\n", n->name, format_bit_string(szStr, idx, nb_bits), get_nb_bits(n->hasDef), get_nb_bits(n->hasIn), get_nb_bits(n->hasOut), get_nb_bits(n->hasDyn));
+ idx++;
+ }
+
+ fprintf(f, "</TABLE>\n");
+ }
+ fclose(f);
+ }
+
+}
+
int main (int argc, char **argv)
{
+ Bool generate_ndt = 0;
+ char szTempFile[1024];
FILE *nodes, *ndt_c, *ndt_h, *fskip;
GF_List *BNodes, *NDTs;
u32 i, j, nbVersion;
fskip = NULL;
i=1;
- if (argv[i][0]=='-') {
+ if (!strcmp(argv[i], "-ndt")) {
+ generate_ndt = 1;
+ } else if (argv[i][0]=='-') {
fskip = fopen(argv[i+1], "rt");
if (!fskip) {
printf("file %s not found\n", argv[i+1]);
}
i+=2;
}
- nbVersion = 1;
- for (; i<(u32)argc; i++) {
- nodes = fopen(argv[i], "rt");
+ nbVersion=1;
+ while (1) {
+ sprintf(szTempFile, "templates%u.txt", nbVersion);
+ nodes = fopen(szTempFile, "rt");
+ if (!nodes) {
+ sprintf(szTempFile, "template%u.txt", nbVersion);
+ nodes = fopen(szTempFile, "rt");
+ }
+ if (!nodes) break;
+
//all nodes are in the same list but we keep version info
ParseTemplateFile(nodes, BNodes, NDTs, nbVersion);
}
nbVersion--;
printf("BIFS tables parsed: %d versions\n", nbVersion);
-
+
+ if (generate_ndt) {
+ generate_ndts(NDTs, BNodes, nbVersion);
+ goto exit;
+ }
+
if (fskip) {
parse_profile(BNodes, fskip);
fclose(fskip);
EndFile(ndt_h, "NDT", 0);
EndFile(ndt_c, "", 1);
+
+exit:
//free NDTs
while (gf_list_count(NDTs)) {
char *tmp = gf_list_get(NDTs, 0);
vpath %.c $(SRC_PATH)/applications/generators/SVG
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/applications/generators/X3D
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
*\r
*/\r
\r
-#include "../modules/m3u8_in/playlist.h"\r
-#include "../modules/m3u8_in/m3u8_parser.h"\r
+#include "../modules/mpd_in/m3u8.h"\r
+#include <gpac/network.h>\r
#include <gpac/download.h>\r
\r
int main(int argc, char **argv)\r
vpath %.c $(SRC_PATH)/applications/mp42avi
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
--- /dev/null
+include ../../config.mak
+
+vpath %.c $(SRC_PATH)/applications/mp42ts
+
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
+
+ifeq ($(DEBUGBUILD), yes)
+CFLAGS+=-g
+LDFLAGS+=-g
+endif
+
+ifeq ($(GPROFBUILD), yes)
+CFLAGS+=-pg
+LDFLAGS+=-pg
+endif
+
+#common obj
+OBJS= main.o
+
+LINKFLAGS=-L../../bin/gcc
+ifeq ($(CONFIG_WIN32),yes)
+EXE=.exe
+PROG=mp42ts$(EXE)
+else
+EXT=
+PROG=mp42ts
+endif
+LINKFLAGS+=-lgpac
+
+
+SRCS := $(OBJS:.o=.c)
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(LINKFLAGS)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+
+clean:
+ rm -f $(OBJS) ../../bin/gcc/$(PROG)
+
+dep: depend
+
+depend:
+ rm -f .depend
+ $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
+
+distclean: clean
+ rm -f Makefile.bak .depend
+
+
+
+# include dependency files if they exist
+#
+ifneq ($(wildcard .depend),)
+include .depend
+endif
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) ENST 2000-200X
+ * All rights reserved
+ *
+ * This file is part of GPAC / mp4-to-ts (mp42ts) application
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <gpac/media_tools.h>
+#include <gpac/constants.h>
+#include <gpac/base_coding.h>
+#include <gpac/ietf.h>
+#include <gpac/scene_engine.h>
+#include <gpac/mpegts.h>
+
+#define TDMB_PSI_REFRESH_RATE 500 /*repeat PAT/PMT every TDMB_PSI_REFRESH_RATE ms*/
+
+#define UDP_BUFFER_SIZE 0x40000
+
+#define MP42TS_PRINT_FREQ 634 /*refresh printed info every CLOCK_REFRESH ms*/
+#define MP42TS_VIDEO_FREQ 1000 /*meant to send AVC IDR only every CLOCK_REFRESH ms*/
+
+static GFINLINE void usage(const char * progname)
+{
+ fprintf(stderr, "USAGE: %s -rate=R [[-prog=prog1]..[-prog=progn]] [-audio=url] [-video=url] [-mpeg4-carousel=n] [-mpeg4] [-time=n] [-src=file] DST [[DST]]\n"
+ "\n"
+ "\t-rate=R specifies target rate in kbps of the multiplex (mandatory)\n"
+ /* "\t If not set transport stream will be of variable bitrate\n" */
+ "\t-prog=filename specifies an input file used for a TS service\n"
+ "\t * currently only supports ISO files and SDP files\n"
+ "\t * can be used several times, once for each program\n"
+ "\t-audio=url may be mp3/udp or aac/http (shoutcast/icecast)\n"
+ "\t-video=url shall be raw h264\n"
+ "\t-mpeg4-carousel=n carousel period in ms\n"
+ "\t-mpeg4 forces usage of MPEG-4 signaling (IOD and SL Config)\n"
+ "\t-time=n request the program to stop after n ms\n"
+ "\t-src=filename update file: must be either an .sdp or a .bt file\n\n"
+ "\tDST : Destinations, at least one is mandatory\n"
+ "\t -dst-udp UDP_address:port (multicast or unicast)\n"
+ "\t -dst-rtp RTP_address:port\n"
+ "\t -dst-file Supports the following arguments:\n"
+ "\t -segment-dir=dir server local directory to store segments\n"
+ "\t -segment-duration=dur segment duration in seconds\n"
+ "\t -segment-manifest=file m3u8 file basename\n"
+ "\t -segment-http-prefix=p client address for accessing server segments\n"
+ "\t -segment-number=n only n segments are used using a cyclic pattern\n"
+ "\n", progname
+ );
+}
+
+
+#define MAX_MUX_SRC_PROG 100
+typedef struct
+{
+ GF_ISOFile *mp4;
+ u32 nb_streams, pcr_idx;
+ GF_ESInterface streams[40];
+ GF_Descriptor *iod;
+ GF_SceneEngine *seng;
+ GF_Thread *th;
+ char *src_name;
+ u32 rate;
+ Bool repeat;
+ u32 mpeg4_signaling;
+ Bool audio_configured;
+} M2TSProgram;
+
+typedef struct
+{
+ GF_ISOFile *mp4;
+ u32 track, sample_number, sample_count;
+ GF_ISOSample *sample;
+ /*refresh rate for images*/
+ u32 image_repeat_ms, nb_repeat_last;
+ void *dsi;
+ u32 dsi_size;
+ u32 nalu_size;
+ void *dsi_and_rap;
+ Bool loop;
+ u64 ts_offset;
+} GF_ESIMP4;
+
+typedef struct
+{
+ u32 carousel_period, ts_delta;
+ u16 aggregate_on_stream;
+ Bool adjust_carousel_time;
+ Bool discard;
+ Bool rap;
+ Bool critical;
+ Bool vers_inc;
+} GF_ESIStream;
+
+typedef struct
+{
+ u32 size;
+ char *data;
+} GF_SimpleDataDescriptor;
+
+//TODO: find a clean way to save this data
+static u32 audio_OD_stream_id = (u32)-1;
+#define AUDIO_OD_ESID 100
+#define AUDIO_DATA_ESID 101
+#define VIDEO_DATA_ESID 105
+
+/*output types*/
+enum
+{
+ GF_MP42TS_FILE, /*open mpeg2ts file*/
+ GF_MP42TS_UDP, /*open udp socket*/
+ GF_MP42TS_RTP, /*open rtp socket*/
+ GF_MP42TS_HTTP, /*open http downloader*/
+};
+
+static GF_Err mp4_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
+{
+ GF_ESIMP4 *priv = (GF_ESIMP4 *)ifce->input_udta;
+ if (!priv) return GF_BAD_PARAM;
+
+ switch (act_type) {
+ case GF_ESI_INPUT_DATA_FLUSH:
+ {
+ GF_ESIPacket pck;
+ if (!priv->sample)
+ priv->sample = gf_isom_get_sample(priv->mp4, priv->track, priv->sample_number+1, NULL);
+
+ if (!priv->sample) return GF_IO_ERR;
+
+ pck.flags = 0;
+ pck.flags = GF_ESI_DATA_AU_START | GF_ESI_DATA_HAS_CTS;
+ if (priv->sample->IsRAP) pck.flags |= GF_ESI_DATA_AU_RAP;
+ pck.cts = priv->sample->DTS + priv->ts_offset;
+
+ if (priv->nb_repeat_last) {
+ pck.cts += priv->nb_repeat_last*ifce->timescale * priv->image_repeat_ms / 1000;
+ }
+
+ if (priv->sample->CTS_Offset) {
+ pck.dts = pck.cts;
+ pck.cts += priv->sample->CTS_Offset;
+ pck.flags |= GF_ESI_DATA_HAS_DTS;
+ }
+
+ if (priv->sample->IsRAP && priv->dsi) {
+ pck.data = priv->dsi;
+ pck.data_len = priv->dsi_size;
+ ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
+ pck.flags = 0;
+ }
+ if (priv->nalu_size) {
+ u32 remain = priv->sample->dataLength;
+ char *ptr = priv->sample->data;
+ u32 v, size;
+ char sc[4];
+ sc[0] = sc[1] = sc[2] = 0; sc[3] = 1;
+
+ while (remain) {
+ size = 0;
+ v = priv->nalu_size;
+ while (v) {
+ size |= (u8) *ptr;
+ ptr++;
+ remain--;
+ v-=1;
+ if (v) size<<=8;
+ }
+ remain -= size;
+
+ pck.data = sc;
+ pck.data_len = 4;
+ ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
+ pck.flags &= ~GF_ESI_DATA_AU_START;
+
+ if (!remain) pck.flags |= GF_ESI_DATA_AU_END;
+
+ pck.data = ptr;
+ pck.data_len = size;
+ ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
+ ptr += size;
+ }
+
+ } else {
+ pck.flags |= GF_ESI_DATA_AU_END;
+ pck.data = priv->sample->data;
+ pck.data_len = priv->sample->dataLength;
+ ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
+ }
+
+ gf_isom_sample_del(&priv->sample);
+ priv->sample_number++;
+ if (priv->sample_number==priv->sample_count) {
+ if (priv->loop) {
+ Double scale;
+ u64 duration;
+ /*increment ts offset*/
+ scale = gf_isom_get_media_timescale(priv->mp4, priv->track);
+ scale /= gf_isom_get_timescale(priv->mp4);
+ duration = (u64) (gf_isom_get_duration(priv->mp4) * scale);
+ priv->ts_offset += duration;
+ priv->sample_number = 0;
+ }
+ else if (priv->image_repeat_ms) {
+ priv->nb_repeat_last++;
+ priv->sample_number--;
+ } else {
+ ifce->caps |= GF_ESI_STREAM_IS_OVER;
+ }
+ }
+ }
+ return GF_OK;
+
+ case GF_ESI_INPUT_DESTROY:
+ if (priv->dsi) gf_free(priv->dsi);
+ if (ifce->decoder_config) {
+ gf_free(ifce->decoder_config);
+ ifce->decoder_config = NULL;
+ }
+ gf_free(priv);
+ ifce->input_udta = NULL;
+ return GF_OK;
+ default:
+ return GF_BAD_PARAM;
+ }
+}
+
+static void fill_isom_es_ifce(GF_ESInterface *ifce, GF_ISOFile *mp4, u32 track_num)
+{
+ GF_ESIMP4 *priv;
+ char _lan[4];
+ GF_DecoderConfig *dcd;
+ u64 avg_rate, duration;
+
+ GF_SAFEALLOC(priv, GF_ESIMP4);
+
+ priv->mp4 = mp4;
+ priv->track = track_num;
+ priv->loop = 1;
+ priv->sample_count = gf_isom_get_sample_count(mp4, track_num);
+
+ memset(ifce, 0, sizeof(GF_ESInterface));
+ ifce->stream_id = gf_isom_get_track_id(mp4, track_num);
+ dcd = gf_isom_get_decoder_config(mp4, track_num, 1);
+ ifce->stream_type = dcd->streamType;
+ ifce->object_type_indication = dcd->objectTypeIndication;
+ if (dcd->decoderSpecificInfo && dcd->decoderSpecificInfo->dataLength) {
+ switch (dcd->objectTypeIndication) {
+ case GPAC_OTI_AUDIO_AAC_MPEG4:
+ ifce->decoder_config = gf_malloc(sizeof(char)*dcd->decoderSpecificInfo->dataLength);
+ ifce->decoder_config_size = dcd->decoderSpecificInfo->dataLength;
+ memcpy(ifce->decoder_config, dcd->decoderSpecificInfo->data, dcd->decoderSpecificInfo->dataLength);
+ break;
+ case GPAC_OTI_VIDEO_MPEG4_PART2:
+ priv->dsi = gf_malloc(sizeof(char)*dcd->decoderSpecificInfo->dataLength);
+ priv->dsi_size = dcd->decoderSpecificInfo->dataLength;
+ memcpy(priv->dsi, dcd->decoderSpecificInfo->data, dcd->decoderSpecificInfo->dataLength);
+ break;
+ case GPAC_OTI_VIDEO_AVC:
+ {
+#ifndef GPAC_DISABLE_AV_PARSERS
+ GF_AVCConfigSlot *slc;
+ u32 i;
+ GF_BitStream *bs;
+ GF_AVCConfig *avccfg = gf_isom_avc_config_get(mp4, track_num, 1);
+ priv->nalu_size = avccfg->nal_unit_size;
+ bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
+ for (i=0; i<gf_list_count(avccfg->sequenceParameterSets);i++) {
+ slc = gf_list_get(avccfg->sequenceParameterSets, i);
+ gf_bs_write_u32(bs, 1);
+ gf_bs_write_data(bs, slc->data, slc->size);
+ }
+ for (i=0; i<gf_list_count(avccfg->pictureParameterSets);i++) {
+ slc = gf_list_get(avccfg->pictureParameterSets, i);
+ gf_bs_write_u32(bs, 1);
+ gf_bs_write_data(bs, slc->data, slc->size);
+ }
+ gf_bs_get_content(bs, (char **) &priv->dsi, &priv->dsi_size);
+ gf_bs_del(bs);
+#endif
+ }
+ break;
+ }
+ }
+ gf_odf_desc_del((GF_Descriptor *)dcd);
+ gf_isom_get_media_language(mp4, track_num, _lan);
+ ifce->lang = GF_4CC(_lan[0],_lan[1],_lan[2],' ');
+
+ ifce->timescale = gf_isom_get_media_timescale(mp4, track_num);
+ ifce->duration = gf_isom_get_media_timescale(mp4, track_num);
+ avg_rate = gf_isom_get_media_data_size(mp4, track_num);
+ avg_rate *= ifce->timescale * 8;
+ if (0!=(duration=gf_isom_get_media_duration(mp4, track_num)))
+ avg_rate /= duration;
+
+ if (gf_isom_has_time_offset(mp4, track_num)) ifce->caps |= GF_ESI_SIGNAL_DTS;
+
+ ifce->bit_rate = (u32) avg_rate;
+ ifce->duration = (Double) (s64) gf_isom_get_media_duration(mp4, track_num);
+ ifce->duration /= ifce->timescale;
+
+ ifce->input_ctrl = mp4_input_ctrl;
+ if (priv != ifce->input_udta){
+ if (ifce->input_udta)
+ gf_free(ifce->input_udta);
+ ifce->input_udta = priv;
+ }
+}
+
+
+static GF_Err seng_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
+{
+ if (act_type==GF_ESI_INPUT_DESTROY) {
+ //TODO: free my data
+ if (ifce->input_udta)
+ gf_free(ifce->input_udta);
+ ifce->input_udta = NULL;
+ return GF_OK;
+ }
+
+ return GF_OK;
+}
+
+typedef struct
+{
+ /*RTP channel*/
+ GF_RTPChannel *rtp_ch;
+
+ /*depacketizer*/
+ GF_RTPDepacketizer *depacketizer;
+
+ GF_ESIPacket pck;
+
+ GF_ESInterface *ifce;
+
+ Bool cat_dsi;
+ void *dsi_and_rap;
+
+ Bool use_carousel;
+ u32 au_sn;
+} GF_ESIRTP;
+
+static GF_Err rtp_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
+{
+ u32 size, PayloadStart;
+ GF_Err e;
+ GF_RTPHeader hdr;
+ char buffer[8000];
+ GF_ESIRTP *rtp = (GF_ESIRTP*)ifce->input_udta;
+
+ if (!ifce->input_udta) return GF_BAD_PARAM;
+
+ switch (act_type) {
+ case GF_ESI_INPUT_DATA_FLUSH:
+ /*flush rtp channel*/
+ while (1) {
+ size = gf_rtp_read_rtp(rtp->rtp_ch, buffer, 8000);
+ if (!size) break;
+ e = gf_rtp_decode_rtp(rtp->rtp_ch, buffer, size, &hdr, &PayloadStart);
+ if (e) return e;
+ gf_rtp_depacketizer_process(rtp->depacketizer, &hdr, buffer + PayloadStart, size - PayloadStart);
+ }
+ /*flush rtcp channel*/
+ while (1) {
+ size = gf_rtp_read_rtcp(rtp->rtp_ch, buffer, 8000);
+ if (!size) break;
+ e = gf_rtp_decode_rtcp(rtp->rtp_ch, buffer, size, NULL);
+ if (e == GF_EOS) ifce->caps |= GF_ESI_STREAM_IS_OVER;
+ }
+ return GF_OK;
+ case GF_ESI_INPUT_DESTROY:
+ gf_rtp_depacketizer_del(rtp->depacketizer);
+ if (rtp->dsi_and_rap) gf_free(rtp->dsi_and_rap);
+ gf_rtp_del(rtp->rtp_ch);
+ gf_free(rtp);
+ ifce->input_udta = NULL;
+ return GF_OK;
+ }
+ return GF_OK;
+}
+
+static GF_Err void_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
+{
+ return GF_OK;
+}
+
+/*AAC import features*/
+void *audio_prog = NULL;
+static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, u64 ts);
+#define DONT_USE_TERMINAL_MODULE_API
+#include "../../modules/aac_in/aac_in.c"
+AACReader *aac_reader = NULL;
+u64 audio_discontinuity_offset = 0;
+
+/*create an OD codec and encode the descriptor*/
+static GF_Err encode_audio_desc(GF_ESD *esd, GF_SimpleDataDescriptor *audio_desc)
+{
+ GF_Err e;
+ GF_ODCodec *odc = gf_odf_codec_new();
+ GF_ODUpdate *od_com = (GF_ODUpdate*)gf_odf_com_new(GF_ODF_OD_UPDATE_TAG);
+ GF_ObjectDescriptor *od = (GF_ObjectDescriptor*)gf_odf_desc_new(GF_ODF_OD_TAG);
+ assert( esd );
+ assert( audio_desc );
+ gf_list_add(od->ESDescriptors, esd);
+ od->objectDescriptorID = AUDIO_DATA_ESID;
+ gf_list_add(od_com->objectDescriptors, od);
+
+ e = gf_odf_codec_add_com(odc, (GF_ODCom*)od_com);
+ if (e) {
+ fprintf(stderr, "Audio input error add the command to be encoded\n");
+ return e;
+ }
+ e = gf_odf_codec_encode(odc, 0);
+ if (e) {
+ fprintf(stderr, "Audio input error encoding the descriptor\n");
+ return e;
+ }
+ e = gf_odf_codec_get_au(odc, &audio_desc->data, &audio_desc->size);
+ if (e) {
+ fprintf(stderr, "Audio input error getting the descriptor\n");
+ return e;
+ }
+ e = gf_odf_com_del((GF_ODCom**)&od_com);
+ if (e) {
+ fprintf(stderr, "Audio input error deleting the command\n");
+ return e;
+ }
+ gf_odf_codec_del(odc);
+
+ return GF_OK;
+}
+
+static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, u64 ts)
+{
+ u32 i;
+ //fprintf(stderr, "update: ESID=%d - size=%d - ts="LLD"\n", ESID, size, ts);
+
+ if (calling_object) {
+ M2TSProgram *prog = (M2TSProgram *)calling_object;
+
+ if (ESID == AUDIO_DATA_ESID) {
+ if (audio_OD_stream_id != (u32)-1) {
+ /*this is the first time we get some audio data. Therefore we are sure we can retrieve the audio descriptor. Then we'll
+ send it by calling this callback recursively so that a player gets the audio descriptor before audio data.
+ Hack: the descriptor is carried thru the input_udta, you shall delete it*/
+ GF_SimpleDataDescriptor *audio_desc = prog->streams[audio_OD_stream_id].input_udta;
+ if (audio_desc && !audio_desc->data) /*intended for HTTP/AAC: an empty descriptor was set (vs already filled for RTP/UDP MP3)*/
+ {
+ /*get the audio descriptor and encode it*/
+ GF_ESD *esd = AAC_GetESD(aac_reader);
+ assert(esd->slConfig->timestampResolution);
+ esd->slConfig->useAccessUnitStartFlag = 1;
+ esd->slConfig->useAccessUnitEndFlag = 1;
+ esd->slConfig->useTimestampsFlag = 1;
+ esd->slConfig->timestampLength = 33;
+ /*audio stream, all samples are RAPs*/
+ esd->slConfig->useRandomAccessPointFlag = 0;
+ esd->slConfig->hasRandomAccessUnitsOnlyFlag = 1;
+ for (i=0; i<prog->nb_streams; i++) {
+ if (prog->streams[i].stream_id == AUDIO_DATA_ESID) {
+ GF_Err e;
+ prog->streams[i].timescale = esd->slConfig->timestampResolution;
+ e = gf_m2ts_program_stream_update_ts_scale(&prog->streams[i], esd->slConfig->timestampResolution);
+ assert(!e);
+ gf_m2ts_program_stream_update_sl_config(&prog->streams[i], esd->slConfig);
+ break;
+ }
+ }
+ esd->ESID = AUDIO_DATA_ESID;
+ assert(audio_OD_stream_id != (u32)-1);
+ encode_audio_desc(esd, audio_desc);
+
+ /*build the ESI*/
+ {
+ /*audio OD descriptor: rap=1 and vers_inc=0*/
+ GF_SAFEALLOC(prog->streams[audio_OD_stream_id].input_udta, GF_ESIStream);
+ ((GF_ESIStream*)prog->streams[audio_OD_stream_id].input_udta)->rap = 1;
+
+ /*we have the descriptor; now call this callback recursively so that a player gets the audio descriptor before audio data.*/
+ prog->repeat = 1;
+ SampleCallBack(prog, AUDIO_OD_ESID, audio_desc->data, audio_desc->size, 0/*gf_m2ts_get_sys_clock(muxer)*/);
+ prog->repeat = 0;
+
+ /*clean*/
+ gf_free(audio_desc->data);
+ gf_free(audio_desc);
+ gf_free(prog->streams[audio_OD_stream_id].input_udta);
+ prog->streams[audio_OD_stream_id].input_udta = NULL;
+ }
+ }
+ }
+ /*update the timescale if needed*/
+ else if (!prog->audio_configured) {
+ GF_ESD *esd = AAC_GetESD(aac_reader);
+ assert(esd->slConfig->timestampResolution);
+ for (i=0; i<prog->nb_streams; i++) {
+ if (prog->streams[i].stream_id == AUDIO_DATA_ESID) {
+ GF_Err e;
+ prog->streams[i].timescale = esd->slConfig->timestampResolution;
+ prog->streams[i].decoder_config = esd->decoderConfig->decoderSpecificInfo->data;
+ prog->streams[i].decoder_config_size = esd->decoderConfig->decoderSpecificInfo->dataLength;
+ esd->decoderConfig->decoderSpecificInfo->data = NULL;
+ esd->decoderConfig->decoderSpecificInfo->dataLength = 0;
+ e = gf_m2ts_program_stream_update_ts_scale(&prog->streams[i], esd->slConfig->timestampResolution);
+ if (!e)
+ prog->audio_configured = 1;
+ break;
+ }
+ }
+ gf_odf_desc_del((GF_Descriptor *)esd);
+ }
+
+ /*overwrite timing as it is flushed to 0 on discontinuities*/
+ ts += audio_discontinuity_offset;
+ }
+
+ i=0;
+ while (i<prog->nb_streams){
+ if (prog->streams[i].output_ctrl==NULL) {
+ fprintf(stderr, "MULTIPLEX NOT YET CREATED\n");
+ return;
+ }
+ if (prog->streams[i].stream_id == ESID) {
+ GF_ESIStream *priv = (GF_ESIStream *)prog->streams[i].input_udta;
+ GF_ESIPacket pck;
+ memset(&pck, 0, sizeof(GF_ESIPacket));
+ pck.data = data;
+ pck.data_len = size;
+ pck.flags |= GF_ESI_DATA_HAS_CTS;
+ pck.flags |= GF_ESI_DATA_HAS_DTS;
+ pck.flags |= GF_ESI_DATA_AU_START;
+ pck.flags |= GF_ESI_DATA_AU_END;
+ if (ts) pck.cts = pck.dts = ts;
+
+ if (priv->rap)
+ pck.flags |= GF_ESI_DATA_AU_RAP;
+ if (prog->repeat || !priv->vers_inc) {
+ pck.flags |= GF_ESI_DATA_REPEAT;
+ fprintf(stderr, "RAP carousel from scene engine sent: ESID=%d - size=%d - ts="LLD"\n", ESID, size, ts);
+ } else {
+ if (ESID != AUDIO_DATA_ESID && ESID != VIDEO_DATA_ESID) /*don't log A/V inputs*/
+ fprintf(stderr, "Update from scene engine sent: ESID=%d - size=%d - ts="LLD"\n", ESID, size, ts);
+ }
+ prog->streams[i].output_ctrl(&prog->streams[i], GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
+ return;
+ }
+ i++;
+ }
+ }
+ return;
+}
+
+//static gf_seng_callback * SampleCallBack = &mySampleCallBack;
+
+
+static volatile Bool run = 1;
+
+static GF_ESIStream * set_broadcast_params(M2TSProgram *prog, u16 esid, u32 period, u32 ts_delta, u16 aggregate_on_stream, Bool adjust_carousel_time, Bool force_rap, Bool aggregate_au, Bool discard_pending, Bool signal_rap, Bool signal_critical, Bool version_inc)
+{
+ u32 i=0;
+ GF_ESIStream *priv=NULL;
+ GF_ESInterface *esi=NULL;
+
+ /*locate our stream*/
+ if (esid) {
+ while (i<prog->nb_streams) {
+ if (prog->streams[i].stream_id == esid){
+ priv = (GF_ESIStream *)prog->streams[i].input_udta;
+ esi = &prog->streams[i];
+ break;
+ }
+ else{
+ i++;
+ }
+ }
+ /*TODO: stream not found*/
+ }
+
+ /*TODO - set/reset the ESID for the parsers*/
+ if (!priv) return NULL;
+
+ /*TODO - if discard is set, abort current carousel*/
+ if (discard_pending) {
+ }
+
+ /*remember RAP flag*/
+ priv->rap = signal_rap;
+ priv->critical = signal_critical;
+ priv->vers_inc = version_inc;
+
+ priv->ts_delta = ts_delta;
+ priv->adjust_carousel_time = adjust_carousel_time;
+
+ /*change stream aggregation mode*/
+ if ((aggregate_on_stream != (u16)-1) && (priv->aggregate_on_stream != aggregate_on_stream)) {
+ gf_seng_enable_aggregation(prog->seng, esid, aggregate_on_stream);
+ priv->aggregate_on_stream = aggregate_on_stream;
+ }
+ /*change stream aggregation mode*/
+ if (priv->aggregate_on_stream==esi->stream_id) {
+ if (priv->aggregate_on_stream && (period!=(u32)-1) && (esi->repeat_rate != period)) {
+ esi->repeat_rate = period;
+ }
+ } else {
+ esi->repeat_rate = 0;
+ }
+
+ return priv;
+}
+
+static Bool seng_output(void *param)
+{
+ GF_Err e;
+ u64 last_src_modif, mod_time;
+ Bool has_carousel=0;
+ M2TSProgram *prog = (M2TSProgram *)param;
+ GF_SceneEngine *seng = prog->seng;
+ GF_SimpleDataDescriptor *audio_desc;
+ Bool update_context=0;
+ Bool force_rap, adjust_carousel_time, discard_pending, signal_rap, signal_critical, version_inc, aggregate_au;
+ u32 period, ts_delta;
+ u16 es_id, aggregate_on_stream;
+ e = GF_OK;
+ if (prog->rate){
+ has_carousel = 1;
+ }
+ gf_sleep(2000); /*TODO: events instead? What are we waiting for?*/
+ gf_seng_encode_context(seng, SampleCallBack);
+
+ last_src_modif = prog->src_name ? gf_file_modification_time(prog->src_name) : 0;
+
+ /*send the audio descriptor*/
+ if (prog->mpeg4_signaling==GF_M2TS_MPEG4_SIGNALING_FULL && audio_OD_stream_id!=(u32)-1) {
+ audio_desc = prog->streams[audio_OD_stream_id].input_udta;
+ if (audio_desc && audio_desc->data) /*RTP/UDP + MP3 case*/
+ {
+ assert(audio_OD_stream_id != (u32)-1);
+ assert(!aac_reader); /*incompatible with AAC*/
+ prog->repeat = 1;
+ SampleCallBack(prog, AUDIO_OD_ESID, audio_desc->data, audio_desc->size, 0/*gf_m2ts_get_sys_clock(muxer)*/);
+ prog->repeat = 0;
+ gf_free(audio_desc->data);
+ gf_free(audio_desc);
+ prog->streams[audio_OD_stream_id].input_udta = NULL;
+ }
+ }
+
+ while (run) {
+ if (!gf_prompt_has_input()) {
+ if (prog->src_name) {
+ mod_time = gf_file_modification_time(prog->src_name);
+ if (mod_time != last_src_modif) {
+ FILE *srcf;
+ char flag_buf[201], *flag;
+ fprintf(stderr, "Update file modified - processing\n");
+ last_src_modif = mod_time;
+
+ srcf = gf_f64_open(prog->src_name, "rt");
+ if (!srcf) continue;
+
+ /*checks if we have a broadcast config*/
+ if (!fgets(flag_buf, 200, srcf))
+ flag_buf[0] = '\0';
+ fclose(srcf);
+
+ aggregate_au = force_rap = adjust_carousel_time = discard_pending = signal_rap = signal_critical = 0;
+ version_inc = 1;
+ period = -1;
+ aggregate_on_stream = -1;
+ ts_delta = 0;
+ es_id = 0;
+
+ /*find our keyword*/
+ flag = strstr(flag_buf, "gpac_broadcast_config ");
+ if (flag) {
+ flag += strlen("gpac_broadcast_config ");
+ /*move to next word*/
+ while (flag && (flag[0]==' ')) flag++;
+
+ while (1) {
+ char *sep = strchr(flag, ' ');
+ if (sep) sep[0] = 0;
+ if (!strnicmp(flag, "esid=", 5)) {
+ /*ESID on which the update is applied*/
+ es_id = atoi(flag+5);
+ } else if (!strnicmp(flag, "period=", 7)) {
+ /*TODO: target period carousel for ESID ??? (ESID/carousel)*/
+ period = atoi(flag+7);
+ } else if (!strnicmp(flag, "ts=", 3)) {
+ /*TODO: */
+ ts_delta = atoi(flag+3);
+ } else if (!strnicmp(flag, "carousel=", 9)) {
+ /*TODO: why? => sends the update on carousel id specified by this argument*/
+ aggregate_on_stream = atoi(flag+9);
+ } else if (!strnicmp(flag, "restamp=", 8)) {
+ /*CTS is updated when carouselled*/
+ adjust_carousel_time = atoi(flag+8);
+ } else if (!strnicmp(flag, "discard=", 8)) {
+ /*when we receive several updates during a single carousel period, this attribute specifies whether the current update discard pending ones*/
+ discard_pending = atoi(flag+8);
+ } else if (!strnicmp(flag, "aggregate=", 10)) {
+ /*Boolean*/
+ aggregate_au = atoi(flag+10);
+ } else if (!strnicmp(flag, "force_rap=", 10)) {
+ /*TODO: */
+ force_rap = atoi(flag+10);
+ } else if (!strnicmp(flag, "rap=", 4)) {
+ /*TODO: */
+ signal_rap = atoi(flag+4);
+ } else if (!strnicmp(flag, "critical=", 9)) {
+ /*TODO: */
+ signal_critical = atoi(flag+9);
+ } else if (!strnicmp(flag, "vers_inc=", 9)) {
+ /*Boolean to increment m2ts section version number*/
+ version_inc = atoi(flag+9);
+ }
+ if (sep) {
+ sep[0] = ' ';
+ flag = sep+1;
+ } else {
+ break;
+ }
+ }
+
+ set_broadcast_params(prog, es_id, period, ts_delta, aggregate_on_stream, adjust_carousel_time, force_rap, aggregate_au, discard_pending, signal_rap, signal_critical, version_inc);
+ }
+
+ e = gf_seng_encode_from_file(seng, es_id, aggregate_au ? 0 : 1, prog->src_name, SampleCallBack);
+ if (e){
+ fprintf(stderr, "Processing command failed: %s\n", gf_error_to_string(e));
+ } else
+ gf_seng_aggregate_context(seng, 0);
+
+ update_context=1;
+
+
+
+ }
+ }
+ if (update_context) {
+ prog->repeat = 1;
+ e = gf_seng_encode_context(seng, SampleCallBack);
+ prog->repeat = 0;
+ update_context = 0;
+ }
+
+ gf_sleep(10);
+ } else { /*gf_prompt_has_input()*/
+ char c = gf_prompt_get_char();
+ switch (c) {
+ case 'u':
+ {
+ GF_Err e;
+ char szCom[8192];
+ fprintf(stderr, "Enter command to send:\n");
+ fflush(stdin);
+ szCom[0] = 0;
+ if (1 > scanf("%[^\t\n]", szCom)){
+ fprintf(stderr, "No command has been properly entered, aborting.\n");
+ break;
+ }
+ e = gf_seng_encode_from_string(seng, 0, 0, szCom, SampleCallBack);
+ if (e) {
+ fprintf(stderr, "Processing command failed: %s\n", gf_error_to_string(e));
+ }
+ update_context=1;
+ }
+ break;
+ case 'p':
+ {
+ char rad[GF_MAX_PATH];
+ fprintf(stderr, "Enter output file name - \"std\" for stdout: ");
+ if (1 > scanf("%s", rad)){
+ fprintf(stderr, "No outfile name has been entered, aborting.\n");
+ break;
+ }
+ e = gf_seng_save_context(seng, !strcmp(rad, "std") ? NULL : rad);
+ fprintf(stderr, "Dump done (%s)\n", gf_error_to_string(e));
+ }
+ break;
+ case 'q':
+ {
+ run = 0;
+ }
+ }
+ e = GF_OK;
+ }
+ }
+
+
+ return e ? 1 : 0;
+}
+
+
+static void rtp_sl_packet_cbk(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e)
+{
+ GF_ESIRTP *rtp = (GF_ESIRTP*)udta;
+ rtp->pck.data = payload;
+ rtp->pck.data_len = size;
+ rtp->pck.dts = hdr->decodingTimeStamp;
+ rtp->pck.cts = hdr->compositionTimeStamp;
+ rtp->pck.flags = 0;
+ if (hdr->compositionTimeStampFlag) rtp->pck.flags |= GF_ESI_DATA_HAS_CTS;
+ if (hdr->decodingTimeStampFlag) rtp->pck.flags |= GF_ESI_DATA_HAS_DTS;
+ if (hdr->randomAccessPointFlag) rtp->pck.flags |= GF_ESI_DATA_AU_RAP;
+ if (hdr->accessUnitStartFlag) rtp->pck.flags |= GF_ESI_DATA_AU_START;
+ if (hdr->accessUnitEndFlag) rtp->pck.flags |= GF_ESI_DATA_AU_END;
+
+ if (rtp->use_carousel) {
+ if ((hdr->AU_sequenceNumber==rtp->au_sn) && hdr->randomAccessPointFlag) rtp->pck.flags |= GF_ESI_DATA_REPEAT;
+ rtp->au_sn = hdr->AU_sequenceNumber;
+ }
+
+ if (rtp->cat_dsi && hdr->randomAccessPointFlag && hdr->accessUnitStartFlag) {
+ if (rtp->dsi_and_rap) gf_free(rtp->dsi_and_rap);
+ rtp->pck.data_len = size + rtp->depacketizer->sl_map.configSize;
+ rtp->dsi_and_rap = gf_malloc(sizeof(char)*(rtp->pck.data_len));
+ memcpy(rtp->dsi_and_rap, rtp->depacketizer->sl_map.config, rtp->depacketizer->sl_map.configSize);
+ memcpy((char *) rtp->dsi_and_rap + rtp->depacketizer->sl_map.configSize, payload, size);
+ rtp->pck.data = rtp->dsi_and_rap;
+ }
+
+
+ rtp->ifce->output_ctrl(rtp->ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &rtp->pck);
+}
+
+static void fill_rtp_es_ifce(GF_ESInterface *ifce, GF_SDPMedia *media, GF_SDPInfo *sdp)
+{
+ u32 i;
+ GF_Err e;
+ GF_X_Attribute*att;
+ GF_ESIRTP *rtp;
+ GF_RTPMap*map;
+ GF_SDPConnection *conn;
+ GF_RTSPTransport trans;
+
+ /*check connection*/
+ conn = sdp->c_connection;
+ if (!conn) conn = (GF_SDPConnection*)gf_list_get(media->Connections, 0);
+
+ /*check payload type*/
+ map = (GF_RTPMap*)gf_list_get(media->RTPMaps, 0);
+ GF_SAFEALLOC(rtp, GF_ESIRTP);
+
+ memset(ifce, 0, sizeof(GF_ESInterface));
+ rtp->rtp_ch = gf_rtp_new();
+ i=0;
+ while ((att = (GF_X_Attribute*)gf_list_enum(media->Attributes, &i))) {
+ if (!stricmp(att->Name, "mpeg4-esid") && att->Value) ifce->stream_id = atoi(att->Value);
+ }
+
+ memset(&trans, 0, sizeof(GF_RTSPTransport));
+ trans.Profile = media->Profile;
+ trans.source = conn ? conn->host : sdp->o_address;
+ trans.IsUnicast = gf_sk_is_multicast_address(trans.source) ? 0 : 1;
+ if (!trans.IsUnicast) {
+ trans.port_first = media->PortNumber;
+ trans.port_last = media->PortNumber + 1;
+ trans.TTL = conn ? conn->TTL : 0;
+ } else {
+ trans.client_port_first = media->PortNumber;
+ trans.client_port_last = media->PortNumber + 1;
+ }
+
+ if (gf_rtp_setup_transport(rtp->rtp_ch, &trans, NULL) != GF_OK) {
+ gf_rtp_del(rtp->rtp_ch);
+ fprintf(stderr, "Cannot initialize RTP transport\n");
+ return;
+ }
+ /*setup depacketizer*/
+ rtp->depacketizer = gf_rtp_depacketizer_new(media, rtp_sl_packet_cbk, rtp);
+ if (!rtp->depacketizer) {
+ gf_rtp_del(rtp->rtp_ch);
+ fprintf(stderr, "Cannot create RTP depacketizer\n");
+ return;
+ }
+ /*setup channel*/
+ gf_rtp_setup_payload(rtp->rtp_ch, map);
+ ifce->input_udta = rtp;
+ ifce->input_ctrl = rtp_input_ctrl;
+ rtp->ifce = ifce;
+
+ ifce->object_type_indication = rtp->depacketizer->sl_map.ObjectTypeIndication;
+ ifce->stream_type = rtp->depacketizer->sl_map.StreamType;
+ ifce->timescale = gf_rtp_get_clockrate(rtp->rtp_ch);
+ if (rtp->depacketizer->sl_map.config) {
+ switch (ifce->object_type_indication) {
+ case GPAC_OTI_VIDEO_MPEG4_PART2:
+ rtp->cat_dsi = 1;
+ break;
+ }
+ }
+ if (rtp->depacketizer->sl_map.StreamStateIndication) {
+ rtp->use_carousel = 1;
+ rtp->au_sn=0;
+ }
+
+ /*DTS signaling is only supported for MPEG-4 visual*/
+ if (rtp->depacketizer->sl_map.DTSDeltaLength) ifce->caps |= GF_ESI_SIGNAL_DTS;
+
+ gf_rtp_depacketizer_reset(rtp->depacketizer, 1);
+ e = gf_rtp_initialize(rtp->rtp_ch, 0x100000ul, 0, 0, 10, 200, NULL);
+ if (e!=GF_OK) {
+ gf_rtp_del(rtp->rtp_ch);
+ fprintf(stderr, "Cannot initialize RTP channel: %s\n", gf_error_to_string(e));
+ return;
+ }
+ fprintf(stderr, "RTP interface initialized\n");
+}
+
+void fill_seng_es_ifce(GF_ESInterface *ifce, u32 i, GF_SceneEngine *seng, u32 period)
+{
+ GF_Err e = GF_OK;
+ u32 len;
+ GF_ESIStream *stream;
+ char *config_buffer = NULL;
+
+ memset(ifce, 0, sizeof(GF_ESInterface));
+ e = gf_seng_get_stream_config(seng, i, (u16*) &(ifce->stream_id), &config_buffer, &len, (u32*) &(ifce->stream_type), (u32*) &(ifce->object_type_indication), &(ifce->timescale));
+ if (e) {
+ fprintf(stderr, "Cannot set the stream config for stream %d to %d: %s\n", ifce->stream_id, period, gf_error_to_string(e));
+ }
+
+ ifce->repeat_rate = period;
+ GF_SAFEALLOC(stream, GF_ESIStream);
+ memset(stream, 0, sizeof(GF_ESIStream));
+ stream->rap = 1;
+ if (ifce->input_udta)
+ gf_free(ifce->input_udta);
+ ifce->input_udta = stream;
+
+ //fprintf(stderr, "Caroussel period: %d\n", period);
+// e = gf_seng_set_carousel_time(seng, ifce->stream_id, period);
+ if (e) {
+ fprintf(stderr, "Cannot set carousel time on stream %d to %d: %s\n", ifce->stream_id, period, gf_error_to_string(e));
+ }
+ ifce->input_ctrl = seng_input_ctrl;
+
+}
+
+static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, Bool force_mpeg4, char *update, char *audio_input_ip, u16 audio_input_port, char *video_buffer)
+{
+ GF_SDPInfo *sdp;
+ u32 i;
+ GF_Err e;
+
+ memset(prog, 0, sizeof(M2TSProgram));
+ prog->mpeg4_signaling = force_mpeg4 ? GF_M2TS_MPEG4_SIGNALING_FULL : GF_M2TS_MPEG4_SIGNALING_NONE;
+
+ /*open ISO file*/
+ if (gf_isom_probe_file(src)) {
+ u32 nb_tracks;
+ u32 first_audio = 0;
+ prog->mp4 = gf_isom_open(src, GF_ISOM_OPEN_READ, 0);
+ prog->nb_streams = 0;
+ /*on MPEG-2 TS, carry 3GPP timed text as MPEG-4 Part17*/
+ gf_isom_text_set_streaming_mode(prog->mp4, 1);
+ nb_tracks = gf_isom_get_track_count(prog->mp4);
+ for (i=0; i<nb_tracks; i++) {
+ if (gf_isom_get_media_type(prog->mp4, i+1) == GF_ISOM_MEDIA_HINT)
+ continue;
+ fill_isom_es_ifce(&prog->streams[i], prog->mp4, i+1);
+ switch(prog->streams[i].stream_type) {
+ case GF_STREAM_OD:
+ case GF_STREAM_SCENE:
+ prog->mpeg4_signaling = GF_M2TS_MPEG4_SIGNALING_FULL;
+ prog->streams[i].repeat_rate = carousel_rate;
+ break;
+ case GF_STREAM_VISUAL:
+ /*turn on image repeat*/
+ switch (prog->streams[i].object_type_indication) {
+ case GPAC_OTI_IMAGE_JPEG:
+ case GPAC_OTI_IMAGE_PNG:
+ ((GF_ESIMP4 *)prog->streams[i].input_udta)->image_repeat_ms = carousel_rate;
+ break;
+ }
+ break;
+ default:
+ /*log not supported stream type: %s*/
+ break;
+ }
+ prog->nb_streams++;
+ /*get first visual stream as PCR*/
+ if (!prog->pcr_idx &&
+ (gf_isom_get_media_type(prog->mp4, i+1) == GF_ISOM_MEDIA_VISUAL) &&
+ (gf_isom_get_sample_count(prog->mp4, i+1)>1) ) {
+ prog->pcr_idx = i+1;
+ }
+ if (!first_audio && (gf_isom_get_media_type(prog->mp4, i+1) == GF_ISOM_MEDIA_AUDIO) ) {
+ first_audio = i+1;
+ }
+ }
+ /*if no visual PCR found, use first audio*/
+ if (!prog->pcr_idx) prog->pcr_idx = first_audio;
+ if (prog->pcr_idx) {
+ GF_ESIMP4 *priv;
+ prog->pcr_idx-=1;
+ priv = prog->streams[prog->pcr_idx].input_udta;
+ gf_isom_set_default_sync_track(prog->mp4, priv->track);
+ }
+ prog->iod = gf_isom_get_root_od(prog->mp4);
+ if (!prog->iod)
+ fprintf(stderr, "NULL IOD for program !\n");
+ return 1;
+ }
+
+ /*open SDP file*/
+ if (strstr(src, ".sdp")) {
+ GF_X_Attribute *att;
+ char *sdp_buf;
+ u32 sdp_size;
+ FILE *_sdp = fopen(src, "rt");
+ if (!_sdp) {
+ fprintf(stderr, "Error opening %s - no such file\n", src);
+ return 0;
+ }
+ gf_f64_seek(_sdp, 0, SEEK_END);
+ sdp_size = (u32)gf_f64_tell(_sdp);
+ gf_f64_seek(_sdp, 0, SEEK_SET);
+ sdp_buf = (char*)gf_malloc(sizeof(char)*sdp_size);
+ memset(sdp_buf, 0, sizeof(char)*sdp_size);
+ sdp_size = fread(sdp_buf, 1, sdp_size, _sdp);
+ fclose(_sdp);
+
+ sdp = gf_sdp_info_new();
+ e = gf_sdp_info_parse(sdp, sdp_buf, sdp_size);
+ gf_free(sdp_buf);
+ if (e) {
+ fprintf(stderr, "Error opening %s : %s\n", src, gf_error_to_string(e));
+ gf_sdp_info_del(sdp);
+ return 0;
+ }
+
+ i=0;
+ while ((att = (GF_X_Attribute*)gf_list_enum(sdp->Attributes, &i))) {
+ char buf[2000];
+ u32 size;
+ char *buf64;
+ u32 size64;
+ char *iod_str;
+ if (strcmp(att->Name, "mpeg4-iod") ) continue;
+ iod_str = att->Value + 1;
+ if (strnicmp(iod_str, "data:application/mpeg4-iod;base64", strlen("data:application/mpeg4-iod;base64"))) continue;
+
+ buf64 = strstr(iod_str, ",");
+ if (!buf64) break;
+ buf64 += 1;
+ size64 = strlen(buf64) - 1;
+ size = gf_base64_decode(buf64, size64, buf, 2000);
+
+ gf_odf_desc_read(buf, size, &prog->iod);
+ break;
+ }
+
+ prog->nb_streams = gf_list_count(sdp->media_desc);
+ for (i=0; i<prog->nb_streams; i++) {
+ GF_SDPMedia *media = gf_list_get(sdp->media_desc, i);
+ fill_rtp_es_ifce(&prog->streams[i], media, sdp);
+ switch(prog->streams[i].stream_type) {
+ case GF_STREAM_OD:
+ case GF_STREAM_SCENE:
+ prog->mpeg4_signaling = GF_M2TS_MPEG4_SIGNALING_FULL;
+ prog->streams[i].repeat_rate = carousel_rate;
+ break;
+ }
+ if (!prog->pcr_idx && (prog->streams[i].stream_type == GF_STREAM_VISUAL)) {
+ prog->pcr_idx = i+1;
+ }
+ }
+
+ if (prog->pcr_idx) prog->pcr_idx-=1;
+ gf_sdp_info_del(sdp);
+
+ return 2;
+ }
+ else if (strstr(src, ".bt")) //open .bt file
+ {
+ u32 load_type=0;
+ prog->seng = gf_seng_init(prog, src, load_type, NULL, (load_type == GF_SM_LOAD_DIMS) ? 1 : 0);
+ if (!prog->seng) {
+ fprintf(stderr, "Cannot create scene engine\n");
+ exit(1);
+ }
+ else{
+ fprintf(stderr, "Scene engine created.\n");
+ }
+ assert( prog );
+ assert( prog->seng);
+ prog->iod = gf_seng_get_iod(prog->seng);
+ if (! prog->iod){
+ fprintf(stderr, __FILE__": No IOD\n");
+ }
+
+ prog->nb_streams = gf_seng_get_stream_count(prog->seng);
+ prog->rate = carousel_rate;
+ prog->mpeg4_signaling = GF_M2TS_MPEG4_SIGNALING_FULL;
+
+ for (i=0; i<prog->nb_streams; i++) {
+ fill_seng_es_ifce(&prog->streams[i], i, prog->seng, prog->rate);
+ //fprintf(stderr, "Fill interface\n");
+ if (!prog->pcr_idx && (prog->streams[i].stream_type == GF_STREAM_AUDIO)) {
+ prog->pcr_idx = i+1;
+ }
+ }
+
+ /*when an audio input is present, declare it and store OD + ESD_U*/
+ if (audio_input_ip) {
+ /*add the audio program*/
+ prog->pcr_idx = prog->nb_streams;
+ prog->streams[prog->nb_streams].stream_type = GF_STREAM_AUDIO;
+ /*hack: http urls are not decomposed therefore audio_input_port remains null*/
+ if (audio_input_port) { /*UDP/RTP*/
+ prog->streams[prog->nb_streams].object_type_indication = GPAC_OTI_AUDIO_MPEG1;
+ } else { /*HTTP*/
+ aac_reader->oti = prog->streams[prog->nb_streams].object_type_indication = GPAC_OTI_AUDIO_AAC_MPEG4;
+ }
+ prog->streams[prog->nb_streams].input_ctrl = void_input_ctrl;
+ prog->streams[prog->nb_streams].stream_id = AUDIO_DATA_ESID;
+ prog->streams[prog->nb_streams].timescale = 1000;
+
+ GF_SAFEALLOC(prog->streams[prog->nb_streams].input_udta, GF_ESIStream);
+ ((GF_ESIStream*)prog->streams[prog->nb_streams].input_udta)->vers_inc = 1; /*increment version number at every audio update*/
+ assert( prog );
+ //assert( prog->iod);
+ if (prog->iod && ((prog->iod->tag!=GF_ODF_IOD_TAG) || ((GF_InitialObjectDescriptor*)prog->iod)->OD_profileAndLevel!=GPAC_MAGIC_OD_PROFILE_FOR_MPEG4_SIGNALING)) {
+ /*create the descriptor*/
+ GF_ESD *esd;
+ GF_SimpleDataDescriptor *audio_desc;
+ GF_SAFEALLOC(audio_desc, GF_SimpleDataDescriptor);
+ if (audio_input_port) { /*UDP/RTP*/
+ esd = gf_odf_desc_esd_new(0);
+ esd->decoderConfig->streamType = prog->streams[prog->nb_streams].stream_type;
+ esd->decoderConfig->objectTypeIndication = prog->streams[prog->nb_streams].object_type_indication;
+ } else { /*HTTP*/
+ esd = AAC_GetESD(aac_reader); /*in case of AAC, we have to wait the first ADTS chunk*/
+ }
+ assert( esd );
+ esd->ESID = prog->streams[prog->nb_streams].stream_id;
+ if (esd->slConfig->timestampResolution) /*in case of AAC, we have to wait the first ADTS chunk*/
+ encode_audio_desc(esd, audio_desc);
+ else
+ gf_odf_desc_del((GF_Descriptor *)esd);
+
+ /*find the audio OD stream and attach its descriptor*/
+ for (i=0; i<prog->nb_streams; i++) {
+ if (prog->streams[i].stream_id == AUDIO_OD_ESID) {
+ if (prog->streams[i].input_udta)
+ gf_free(prog->streams[i].input_udta);
+ prog->streams[i].input_udta = (void*)audio_desc; /*Hack: the real input_udta type (for our SampleCallBack function) is GF_ESIStream*/
+ audio_OD_stream_id = i;
+ break;
+ }
+ }
+ if (audio_OD_stream_id == (u32)-1) {
+ fprintf(stderr, "Error: could not find an audio OD stream with ESID=100 in '%s'\n", src);
+ return 0;
+ }
+ } else {
+ prog->mpeg4_signaling = GF_M2TS_MPEG4_SIGNALING_SCENE;
+ }
+ prog->nb_streams++;
+ }
+
+ /*when an audio input is present, declare it and store OD + ESD_U*/
+ if (video_buffer) {
+ /*add the video program*/
+ prog->streams[prog->nb_streams].stream_type = GF_STREAM_VISUAL;
+ prog->streams[prog->nb_streams].object_type_indication = GPAC_OTI_VIDEO_AVC;
+ prog->streams[prog->nb_streams].input_ctrl = void_input_ctrl;
+ prog->streams[prog->nb_streams].stream_id = VIDEO_DATA_ESID;
+ prog->streams[prog->nb_streams].timescale = 1000;
+
+ GF_SAFEALLOC(prog->streams[prog->nb_streams].input_udta, GF_ESIStream);
+ ((GF_ESIStream*)prog->streams[prog->nb_streams].input_udta)->vers_inc = 1; /*increment version number at every video update*/
+ assert(prog);
+
+ if (prog->iod && ((prog->iod->tag!=GF_ODF_IOD_TAG) || ((GF_InitialObjectDescriptor*)prog->iod)->OD_profileAndLevel!=GPAC_MAGIC_OD_PROFILE_FOR_MPEG4_SIGNALING)) {
+ assert(0); /*TODO*/
+#if 0
+ /*create the descriptor*/
+ GF_ESD *esd;
+ GF_SimpleDataDescriptor *video_desc;
+ GF_SAFEALLOC(video_desc, GF_SimpleDataDescriptor);
+ esd = gf_odf_desc_esd_new(0);
+ esd->decoderConfig->streamType = prog->streams[prog->nb_streams].stream_type;
+ esd->decoderConfig->objectTypeIndication = prog->streams[prog->nb_streams].object_type_indication;
+ esd->ESID = prog->streams[prog->nb_streams].stream_id;
+
+ /*find the audio OD stream and attach its descriptor*/
+ for (i=0; i<prog->nb_streams; i++) {
+ if (prog->streams[i].stream_id == 103/*TODO: VIDEO_OD_ESID*/) {
+ if (prog->streams[i].input_udta)
+ gf_free(prog->streams[i].input_udta);
+ prog->streams[i].input_udta = (void*)video_desc;
+ audio_OD_stream_id = i;
+ break;
+ }
+ }
+ if (audio_OD_stream_id == (u32)-1) {
+ fprintf(stderr, "Error: could not find an audio OD stream with ESID=100 in '%s'\n", src);
+ return 0;
+ }
+#endif
+ } else {
+ assert (prog->mpeg4_signaling == GF_M2TS_MPEG4_SIGNALING_SCENE);
+ }
+
+ prog->nb_streams++;
+ }
+
+ if (!prog->pcr_idx) prog->pcr_idx=1;
+ prog->th = gf_th_new("Carousel");
+ prog->src_name = update;
+ gf_th_run(prog->th, seng_output, prog);
+ return 1;
+ } else {
+ fprintf(stderr, "Error opening %s - not a supported input media, skipping.\n", src);
+ return 0;
+ }
+}
+
+/*parse MP42TS arguments*/
+static GFINLINE GF_Err parse_args(int argc, char **argv, u32 *mux_rate, u32 *carrousel_rate,
+ M2TSProgram *progs, u32 *nb_progs, char **src_name,
+ Bool *real_time, u32 *run_time, char **video_buffer, u32 *video_buffer_size,
+ u32 *audio_input_type, char **audio_input_ip, u16 *audio_input_port,
+ u32 *output_type, char **ts_out, char **udp_out, char **rtp_out, u16 *output_port,
+ char** segment_dir, u32 *segment_duration, char **segment_manifest, u32 *segment_number, char **segment_http_prefix)
+{
+ Bool rate_found=0, mpeg4_carousel_found=0, prog_found=0, mpeg4_found=0, time_found=0, src_found=0, dst_found=0, audio_input_found=0, video_input_found=0,
+ seg_dur_found=0, seg_dir_found=0, seg_manifest_found=0, seg_number_found=0, seg_http_found = 0, real_time_found=0;
+ char *prog_name, *arg = NULL, *error_msg = "no argument found";
+ Bool mpeg4_signaling = 0;
+ s32 i;
+
+ /*first pass: find audio*/
+ for (i=1; i<argc; i++) {
+ arg = argv[i];
+ if (!strnicmp(arg, "-video=", 7)) {
+ FILE *f;
+ if (video_input_found) {
+ error_msg = "multiple '-video' found";
+ arg = NULL;
+ goto error;
+ }
+ video_input_found = 1;
+ arg+=7;
+ f = fopen(arg, "rb");
+ if (!f) {
+ error_msg = "video file not found: ";
+ goto error;
+ }
+ gf_f64_seek(f, 0, SEEK_END);
+ *video_buffer_size = (u32)gf_f64_tell(f);
+ gf_f64_seek(f, 0, SEEK_SET);
+ assert(*video_buffer_size);
+ *video_buffer = (char*) gf_malloc(*video_buffer_size);
+ {
+ s32 readen = fread(*video_buffer, sizeof(char), *video_buffer_size, f);
+ if (readen != *video_buffer_size)
+ fprintf(stderr, "Error while reading video file, has readen %u chars instead of %u.\n", readen, *video_buffer_size);
+ }
+ fclose(f);
+ } else if (!strnicmp(arg, "-audio=", 7)) {
+ if (audio_input_found) {
+ error_msg = "multiple '-audio' found";
+ arg = NULL;
+ goto error;
+ }
+ audio_input_found = 1;
+ arg+=7;
+ if (!strnicmp(arg, "udp://", 6) || !strnicmp(arg, "rtp://", 6) || !strnicmp(arg, "http://", 7)) {
+ char *sep;
+ /*set audio input type*/
+ if (!strnicmp(arg, "udp://", 6))
+ *audio_input_type = GF_MP42TS_UDP;
+ else if (!strnicmp(arg, "rtp://", 6))
+ *audio_input_type = GF_MP42TS_RTP;
+ else if (!strnicmp(arg, "http://", 7))
+ *audio_input_type = GF_MP42TS_HTTP;
+ /*http needs to get the complete URL*/
+ switch(*audio_input_type) {
+ case GF_MP42TS_UDP:
+ case GF_MP42TS_RTP:
+ sep = strchr(arg+6, ':');
+ *real_time=1;
+ if (sep) {
+ *audio_input_port = atoi(sep+1);
+ sep[0]=0;
+ *audio_input_ip = gf_strdup(arg+6);
+ sep[0]=':';
+ } else {
+ *audio_input_ip = gf_strdup(arg+6);
+ }
+ break;
+ case GF_MP42TS_HTTP:
+ /* No need to dup since it may come from argv */
+ *audio_input_ip = arg;
+ assert(audio_input_port != 0);
+ break;
+ default:
+ assert(0);
+ }
+ }
+ } else if (!strnicmp(arg, "-mpeg4", 6)) {
+ if (mpeg4_found) {
+ error_msg = "multiple '-mpeg4' found";
+ arg = NULL;
+ goto error;
+ }
+ mpeg4_found = 1;
+ mpeg4_signaling = 1;
+ }
+ }
+ /*second pass: other*/
+ for (i=1; i<argc; i++) {
+ arg = argv[i];
+ if (arg[0]=='-') {
+ if (!strnicmp(arg, "-rate=", 6)) {
+ if (rate_found) {
+ error_msg = "multiple '-rate' found";
+ arg = NULL;
+ goto error;
+ }
+ rate_found = 1;
+ *mux_rate = 1024*atoi(arg+6);
+ } else if (!strnicmp(arg, "-mpeg4-carousel=", 16)) {
+ if (mpeg4_carousel_found) {
+ error_msg = "multiple '-mpeg4-carousel' found";
+ arg = NULL;
+ goto error;
+ }
+ mpeg4_carousel_found = 1;
+ *carrousel_rate = atoi(arg+16);
+ } else if (!strnicmp(arg, "-ll=", 4)) {
+ gf_log_set_level(gf_log_parse_level(argv[i]+4));
+ } else if (!strnicmp(arg, "-lt=", 4)) {
+ gf_log_set_tools(gf_log_parse_tools(argv[i]+4));
+ } else if (!strnicmp(arg, "-prog=", 6)) {
+ prog_found = 1;
+ prog_name = arg+6;
+ if (prog_found && rate_found) {
+ u32 res;
+ assert(prog_name);
+ res = open_program(&progs[*nb_progs], prog_name, *carrousel_rate, mpeg4_signaling, *src_name, *audio_input_ip, *audio_input_port, *video_buffer);
+ if (res) {
+ (*nb_progs)++;
+ if (res==2) *real_time=1;
+ }
+ }
+ } else if (!strnicmp(arg, "-real-time", 10)) {
+ if (real_time_found) {
+ goto error;
+ }
+ real_time_found = 1;
+ *real_time = 1;
+ } else if (!strnicmp(arg, "-time=", 6)) {
+ if (time_found) {
+ error_msg = "multiple '-time' found";
+ arg = NULL;
+ goto error;
+ }
+ time_found = 1;
+ *run_time = atoi(arg+6);
+ } else if (!strnicmp(arg, "-segment-dir=", 13)) {
+ if (seg_dir_found) {
+ goto error;
+ }
+ seg_dir_found = 1;
+ *segment_dir = arg+13;
+ /* TODO: add the path separation char, if missing */
+ } else if (!strnicmp(arg, "-segment-duration=", 18)) {
+ if (seg_dur_found) {
+ goto error;
+ }
+ seg_dur_found = 1;
+ *segment_duration = atoi(arg+18);
+ } else if (!strnicmp(arg, "-segment-manifest=", 18)) {
+ if (seg_manifest_found) {
+ goto error;
+ }
+ seg_manifest_found = 1;
+ *segment_manifest = arg+18;
+ } else if (!strnicmp(arg, "-segment-http-prefix=", 21)) {
+ if (seg_http_found) {
+ goto error;
+ }
+ seg_http_found = 1;
+ *segment_http_prefix = arg+21;
+ } else if (!strnicmp(arg, "-segment-number=", 16)) {
+ if (seg_number_found) {
+ goto error;
+ }
+ seg_number_found = 1;
+ *segment_number = atoi(arg+16);
+ }
+ else if (!strnicmp(arg, "-src=", 5)) {
+ if (src_found) {
+ error_msg = "multiple '-src' found";
+ arg = NULL;
+ goto error;
+ }
+ src_found = 1;
+ *src_name = arg+5;
+ }
+ else if (!strnicmp(arg, "-dst-file=", 10)) {
+ dst_found = 1;
+ *ts_out = gf_strdup(arg+10);
+ }
+ else if (!strnicmp(arg, "-dst-udp=", 9)) {
+ char *sep = strchr(arg+9, ':');
+ dst_found = 1;
+ *real_time=1;
+ if (sep) {
+ *output_port = atoi(sep+1);
+ sep[0]=0;
+ *udp_out = gf_strdup(arg+9);
+ sep[0]=':';
+ } else {
+ *udp_out = gf_strdup(arg+9);
+ }
+ }
+ else if (!strnicmp(arg, "-dst-rtp=", 9)) {
+ char *sep = strchr(arg+9, ':');
+ dst_found = 1;
+ *real_time=1;
+ if (sep) {
+ *output_port = atoi(sep+1);
+ sep[0]=0;
+ *rtp_out = gf_strdup(arg+9);
+ sep[0]=':';
+ } else {
+ *rtp_out = gf_strdup(arg+9);
+ }
+ }
+ else if (!strnicmp(arg, "-audio=", 7) || !strnicmp(arg, "-video=", 7) || !strnicmp(arg, "-mpeg4", 6))
+ ; /*already treated on the first pass*/
+ else {
+ error_msg = "unknown option \"%s\"";
+ goto error;
+ }
+ }
+#if 0
+ else { /*"dst" argument (output)*/
+ if (dst_found) {
+ error_msg = "multiple output arguments (no '-') found";
+ arg = NULL;
+ goto error;
+ }
+ dst_found = 1;
+ if (!strnicmp(arg, "rtp://", 6) || !strnicmp(arg, "udp://", 6)) {
+ char *sep = strchr(arg+6, ':');
+ *output_type = (arg[0]=='r') ? 2 : 1;
+ *real_time=1;
+ if (sep) {
+ *output_port = atoi(sep+1);
+ sep[0]=0;
+ *ts_out = gf_strdup(arg+6);
+ sep[0]=':';
+ } else {
+ *ts_out = gf_strdup(arg+6);
+ }
+ } else {
+ *output_type = 0;
+ *ts_out = gf_strdup(arg);
+ }
+ }
+#endif
+ }
+
+ /*syntax is correct; now testing the presence of mandatory arguments*/
+ if (dst_found && prog_found && rate_found) {
+ return GF_OK;
+ } else {
+ if (!dst_found)
+ fprintf(stderr, "Error: Destination argument not found\n\n");
+ if (!prog_found)
+ fprintf(stderr, "Error: Input Program argument not found\n\n");
+ if (!rate_found)
+ fprintf(stderr, "Error: Rate argument not found\n\n");
+ return GF_BAD_PARAM;
+ }
+
+error:
+ if (!arg) {
+ fprintf(stderr, "Error: %s\n\n", error_msg);
+ } else {
+ fprintf(stderr, "Error: %s \"%s\"\n\n", error_msg, arg);
+ }
+ return GF_BAD_PARAM;
+}
+
+/* adapted from http://svn.assembla.com/svn/legend/segmenter/segmenter.c */
+static GF_Err write_manifest(char *manifest, char *segment_dir, u32 segment_duration, char *segment_prefix, char *http_prefix,
+ u32 first_segment, u32 last_segment, Bool end) {
+ FILE *manifest_fp;
+ u32 i;
+ char manifest_tmp_name[GF_MAX_PATH];
+ char manifest_name[GF_MAX_PATH];
+ char *tmp_manifest = manifest_tmp_name;
+
+ if (segment_dir) {
+ sprintf(manifest_tmp_name, "%stmp.m3u8", segment_dir);
+ sprintf(manifest_name, "%s%s", segment_dir, manifest);
+ } else {
+ sprintf(manifest_tmp_name, "tmp.m3u8");
+ sprintf(manifest_name, "%s", manifest);
+ }
+
+ manifest_fp = fopen(tmp_manifest, "w");
+ if (!manifest_fp) {
+ fprintf(stderr, "Could not create m3u8 manifest file (%s)\n", tmp_manifest);
+ return GF_BAD_PARAM;
+ }
+
+ fprintf(manifest_fp, "#EXTM3U\n#EXT-X-TARGETDURATION:%u\n#EXT-X-MEDIA-SEQUENCE:%u\n", segment_duration, first_segment);
+
+ for (i = first_segment; i <= last_segment; i++) {
+ fprintf(manifest_fp, "#EXTINF:%u,\n%s%s_%u.ts\n", segment_duration, http_prefix, segment_prefix, i);
+ }
+
+ if (end) {
+ fprintf(manifest_fp, "#EXT-X-ENDLIST\n");
+ }
+ fclose(manifest_fp);
+
+ if (!rename(tmp_manifest, manifest_name)) {
+ return GF_OK;
+ } else {
+ if (remove(manifest_name)) {
+ fprintf(stdout, "Error removing file %s\n", manifest_name);
+ return GF_IO_ERR;
+ } else if (rename(tmp_manifest, manifest_name)) {
+ fprintf(stderr, "Could not rename temporary m3u8 manifest file (%s) into %s\n", tmp_manifest, manifest_name);
+ return GF_IO_ERR;
+ } else {
+ return GF_OK;
+ }
+ }
+}
+
+int main(int argc, char **argv)
+{
+ /********************/
+ /* declarations */
+ /********************/
+ const char *ts_pck;
+ GF_Err e;
+ u32 run_time;
+ Bool real_time;
+ u32 i, j, mux_rate, nb_progs, cur_pid, carrousel_rate, last_print_time, last_video_time;
+ char *ts_out = NULL, *udp_out = NULL, *rtp_out = NULL, *audio_input_ip = NULL;
+ FILE *ts_output_file = NULL;
+ GF_Socket *ts_output_udp_sk = NULL, *audio_input_udp_sk = NULL;
+ GF_RTPChannel *ts_output_rtp = NULL;
+ GF_RTSPTransport tr;
+ GF_RTPHeader hdr;
+ char *video_buffer;
+ u32 video_buffer_size;
+ u16 output_port = 0, audio_input_port = 0;
+ u32 output_type, audio_input_type;
+ char *audio_input_buffer = NULL;
+ u32 audio_input_buffer_length=65536;
+ char *src_name;
+ M2TSProgram progs[MAX_MUX_SRC_PROG];
+ u32 segment_duration, segment_index, segment_number;
+ char segment_manifest_default[GF_MAX_PATH];
+ char *segment_manifest, *segment_http_prefix, *segment_dir;
+ char segment_prefix[GF_MAX_PATH];
+ char segment_name[GF_MAX_PATH];
+ GF_M2TS_Time prev_seg_time;
+ GF_M2TS_Mux *muxer;
+
+ /*****************/
+ /* gpac init */
+ /*****************/
+ gf_sys_init(0);
+ gf_log_set_level(GF_LOG_ERROR);
+ gf_log_set_tools(0xFFFFFFFF);
+
+ /***********************/
+ /* initialisations */
+ /***********************/
+ real_time = 0;
+ ts_output_file = NULL;
+ video_buffer = NULL;
+ last_video_time = 0;
+ audio_input_type = 0;
+ ts_output_udp_sk = NULL;
+ ts_output_rtp = NULL;
+ src_name = NULL;
+ ts_out = NULL;
+ udp_out = NULL;
+ rtp_out = NULL;
+ nb_progs = 0;
+ mux_rate = 0;
+ run_time = 0;
+ carrousel_rate = 500;
+ output_port = 1234;
+ segment_duration = 0;
+ segment_number = 10; /* by default, we keep the 10 previous segments */
+ segment_index = 0;
+ segment_manifest = NULL;
+ segment_http_prefix = NULL;
+ segment_dir = NULL;
+ prev_seg_time.sec = 0;
+ prev_seg_time.nanosec = 0;
+ video_buffer_size = 0;
+ aac_reader = AAC_Reader_new();
+ muxer = NULL;
+
+ /***********************/
+ /* parse arguments */
+ /***********************/
+ if (GF_OK != parse_args(argc, argv, &mux_rate, &carrousel_rate, progs, &nb_progs, &src_name,
+ &real_time, &run_time, &video_buffer, &video_buffer_size,
+ &audio_input_type, &audio_input_ip, &audio_input_port,
+ &output_type, &ts_out, &udp_out, &rtp_out, &output_port,
+ &segment_dir, &segment_duration, &segment_manifest, &segment_number, &segment_http_prefix)) {
+ usage(argv[0]);
+ goto exit;
+ }
+
+ if (run_time && !mux_rate) {
+ fprintf(stderr, "Cannot specify TS run time for VBR multiplex - disabling run time\n");
+ run_time = 0;
+ }
+
+ /***************************/
+ /* create mp42ts muxer */
+ /***************************/
+ muxer = gf_m2ts_mux_new(mux_rate, TDMB_PSI_REFRESH_RATE, real_time);
+ if (ts_out != NULL) {
+ if (segment_duration) {
+ char *dot;
+ strcpy(segment_prefix, ts_out);
+ dot = strrchr(segment_prefix, '.');
+ dot[0] = 0;
+ if (segment_dir) {
+ if (strchr("\\/", segment_name[strlen(segment_name)-1])) {
+ sprintf(segment_name, "%s%s_%d.ts", segment_dir, segment_prefix, segment_index);
+ } else {
+ sprintf(segment_name, "%s/%s_%d.ts", segment_dir, segment_prefix, segment_index);
+ }
+ } else {
+ sprintf(segment_name, "%s_%d.ts", segment_prefix, segment_index);
+ }
+ ts_out = gf_strdup(segment_name);
+ if (!segment_manifest) {
+ sprintf(segment_manifest_default, "%s.m3u8", segment_prefix);
+ segment_manifest = segment_manifest_default;
+ }
+ //write_manifest(segment_manifest, segment_dir, segment_duration, segment_prefix, segment_http_prefix, segment_index, 0, 0);
+ }
+ ts_output_file = fopen(ts_out, "wb");
+ if (!ts_output_file) {
+ fprintf(stderr, "Error opening %s\n", ts_out);
+ goto exit;
+ }
+ }
+ if (udp_out != NULL) {
+ ts_output_udp_sk = gf_sk_new(GF_SOCK_TYPE_UDP);
+ if (gf_sk_is_multicast_address((char *)udp_out)) {
+ e = gf_sk_setup_multicast(ts_output_udp_sk, (char *)udp_out, output_port, 32, 0, NULL);
+ } else {
+ e = gf_sk_bind(ts_output_udp_sk, NULL, output_port, (char *)udp_out, output_port, GF_SOCK_REUSE_PORT);
+ }
+ if (e) {
+ fprintf(stderr, "Error initializing UDP socket: %s\n", gf_error_to_string(e));
+ goto exit;
+ }
+ }
+ if (rtp_out != NULL) {
+ ts_output_rtp = gf_rtp_new();
+ gf_rtp_set_ports(ts_output_rtp, output_port);
+ memset(&tr, 0, sizeof(GF_RTSPTransport));
+ tr.IsUnicast = gf_sk_is_multicast_address((char *)rtp_out) ? 0 : 1;
+ tr.Profile="RTP/AVP";
+ tr.destination = (char *)rtp_out;
+ tr.source = "0.0.0.0";
+ tr.IsRecord = 0;
+ tr.Append = 0;
+ tr.SSRC = rand();
+ tr.port_first = output_port;
+ tr.port_last = output_port+1;
+ if (tr.IsUnicast) {
+ tr.client_port_first = output_port;
+ tr.client_port_last = output_port+1;
+ } else {
+ tr.source = (char *)rtp_out;
+ }
+ e = gf_rtp_setup_transport(ts_output_rtp, &tr, (char *)ts_out);
+ if (e != GF_OK) {
+ fprintf(stderr, "Cannot setup RTP transport info : %s\n", gf_error_to_string(e));
+ goto exit;
+ }
+ e = gf_rtp_initialize(ts_output_rtp, 0, 1, 1500, 0, 0, NULL);
+ if (e != GF_OK) {
+ fprintf(stderr, "Cannot initialize RTP sockets : %s\n", gf_error_to_string(e));
+ goto exit;
+ }
+ memset(&hdr, 0, sizeof(GF_RTPHeader));
+ hdr.Version = 2;
+ hdr.PayloadType = 33; /*MP2T*/
+ hdr.SSRC = tr.SSRC;
+ hdr.Marker = 0;
+ }
+
+ /************************************/
+ /* create streaming audio input */
+ /************************************/
+ if (audio_input_ip)
+ switch(audio_input_type) {
+ case GF_MP42TS_UDP:
+ audio_input_udp_sk = gf_sk_new(GF_SOCK_TYPE_UDP);
+ if (gf_sk_is_multicast_address((char *)audio_input_ip)) {
+ e = gf_sk_setup_multicast(audio_input_udp_sk, (char *)audio_input_ip, audio_input_port, 32, 0, NULL);
+ } else {
+ e = gf_sk_bind(audio_input_udp_sk, NULL, audio_input_port, (char *)audio_input_ip, audio_input_port, GF_SOCK_REUSE_PORT);
+ }
+ if (e) {
+ fprintf(stdout, "Error initializing UDP socket for %s:%d : %s\n", audio_input_ip, audio_input_port, gf_error_to_string(e));
+ goto exit;
+ }
+ gf_sk_set_buffer_size(audio_input_udp_sk, 0, UDP_BUFFER_SIZE);
+ gf_sk_set_block_mode(audio_input_udp_sk, 0);
+
+ /*allocate data buffer*/
+ audio_input_buffer = (char*)gf_malloc(audio_input_buffer_length);
+ assert(audio_input_buffer);
+ break;
+ case GF_MP42TS_RTP:
+ /*TODO: not implemented*/
+ assert(0);
+ break;
+ case GF_MP42TS_HTTP:
+ audio_prog = (void*)&progs[nb_progs-1];
+ aac_download_file(aac_reader, audio_input_ip);
+ break;
+ case GF_MP42TS_FILE:
+ assert(0); /*audio live input is restricted to realtime/streaming*/
+ break;
+ default:
+ assert(0);
+ }
+
+ /****************************************/
+ /* declare all streams to the muxer */
+ /****************************************/
+ cur_pid = 100; /*PIDs start from 100*/
+ for (i=0; i<nb_progs; i++) {
+ GF_M2TS_Mux_Program *program = gf_m2ts_mux_program_add(muxer, i+1, cur_pid, TDMB_PSI_REFRESH_RATE, progs[i].mpeg4_signaling);
+ if (progs[i].mpeg4_signaling) program->iod = progs[i].iod;
+
+ for (j=0; j<progs[i].nb_streams; j++) {
+ gf_m2ts_program_stream_add(program, &progs[i].streams[j], cur_pid+j+1, (progs[i].pcr_idx==j) ? 1 : 0);
+ }
+
+ cur_pid += progs[i].nb_streams;
+ while (cur_pid % 10)
+ cur_pid ++;
+ }
+
+ gf_m2ts_mux_update_config(muxer, 1);
+
+ /*****************/
+ /* main loop */
+ /*****************/
+ last_print_time = gf_sys_clock();
+ while (run) {
+ u32 ts, status;
+
+ /*check for some audio input from the network*/
+ if (audio_input_ip) {
+ u32 read;
+ switch (audio_input_type) {
+ case GF_MP42TS_UDP:
+ case GF_MP42TS_RTP:
+ /*e =*/gf_sk_receive(audio_input_udp_sk, audio_input_buffer, audio_input_buffer_length, 0, &read);
+ if (read) {
+ SampleCallBack((void*)&progs[nb_progs-1], AUDIO_DATA_ESID, audio_input_buffer, read, gf_m2ts_get_sys_clock(muxer));
+ }
+ break;
+ case GF_MP42TS_HTTP:
+ /*nothing to do: AAC_OnLiveData is called automatically*/
+ /*check we're still alive*/
+ if (gf_dm_is_thread_dead(aac_reader->dnload)) {
+ GF_ESD *esd;
+ aac_download_file(aac_reader, audio_input_ip);
+ esd = AAC_GetESD(aac_reader);
+ if (!esd)
+ break;
+ assert(esd->slConfig->timestampResolution); /*if we don't have this value we won't be able to adjust the timestamps within the MPEG2-TS*/
+ if (esd->slConfig->timestampResolution)
+ audio_discontinuity_offset = gf_m2ts_get_sys_clock(muxer) * (u64)esd->slConfig->timestampResolution / 1000;
+ gf_odf_desc_del((GF_Descriptor *)esd);
+ }
+ break;
+ default:
+ assert(0);
+ }
+ }
+
+ /*flush all packets*/
+ while ((ts_pck = gf_m2ts_mux_process(muxer, &status)) != NULL) {
+ if (ts_output_file != NULL) {
+ fwrite(ts_pck, 1, 188, ts_output_file);
+ if (segment_duration && (muxer->time.sec > prev_seg_time.sec + segment_duration)) {
+ prev_seg_time = muxer->time;
+ fclose(ts_output_file);
+ segment_index++;
+ if (segment_dir) {
+ if (strchr("\\/", segment_name[strlen(segment_name)-1])) {
+ sprintf(segment_name, "%s%s_%d.ts", segment_dir, segment_prefix, segment_index);
+ } else {
+ sprintf(segment_name, "%s/%s_%d.ts", segment_dir, segment_prefix, segment_index);
+ }
+ } else {
+ sprintf(segment_name, "%s_%d.ts", segment_prefix, segment_index);
+ }
+ ts_output_file = fopen(segment_name, "wb");
+ if (!ts_output_file) {
+ fprintf(stderr, "Error opening %s\n", segment_name);
+ goto exit;
+ }
+ /* delete the oldest segment */
+ if (segment_number && ((s32) (segment_index - segment_number - 1) >= 0)){
+ char old_segment_name[GF_MAX_PATH];
+ if (segment_dir) {
+ if (strchr("\\/", segment_name[strlen(segment_name)-1])) {
+ sprintf(old_segment_name, "%s%s_%d.ts", segment_dir, segment_prefix, segment_index - segment_number - 1);
+ } else {
+ sprintf(old_segment_name, "%s/%s_%d.ts", segment_dir, segment_prefix, segment_index - segment_number - 1);
+ }
+ } else {
+ sprintf(old_segment_name, "%s_%d.ts", segment_prefix, segment_index - segment_number - 1);
+ }
+ gf_delete_file(old_segment_name);
+ }
+ write_manifest(segment_manifest, segment_dir, segment_duration, segment_prefix, segment_http_prefix,
+// (segment_index >= segment_number/2 ? segment_index - segment_number/2 : 0), segment_index >1 ? segment_index-1 : 0, 0);
+ ( (segment_index > segment_number ) ? segment_index - segment_number : 0), segment_index >1 ? segment_index-1 : 0, 0);
+ }
+ }
+
+ if (ts_output_udp_sk != NULL) {
+ e = gf_sk_send(ts_output_udp_sk, (char*)ts_pck, 188);
+ if (e) {
+ fprintf(stderr, "Error %s sending UDP packet\n", gf_error_to_string(e));
+ }
+ }
+ if (ts_output_rtp != NULL) {
+ hdr.SequenceNumber++;
+ /*muxer clock at 90k*/
+ ts = muxer->time.sec*90000 + muxer->time.nanosec*9/100000;
+ /*FIXME - better discontinuity check*/
+ hdr.Marker = (ts < hdr.TimeStamp) ? 1 : 0;
+ hdr.TimeStamp = ts;
+ e = gf_rtp_send_packet(ts_output_rtp, &hdr, (char*)ts_pck, 188, 0);
+ if (e) {
+ fprintf(stderr, "Error %s sending RTP packet\n", gf_error_to_string(e));
+ }
+ }
+ if (status>=GF_M2TS_STATE_PADDING) {
+ break;
+ }
+ }
+
+ /*push video*/
+ {
+ u32 now=gf_sys_clock();
+ if (now/MP42TS_VIDEO_FREQ != last_video_time/MP42TS_VIDEO_FREQ) {
+ /*should use carrousel behaviour instead of being pushed manually*/
+ if (video_buffer)
+ SampleCallBack((void*)&progs[nb_progs-1], VIDEO_DATA_ESID, video_buffer, video_buffer_size, gf_m2ts_get_sys_clock(muxer)+1000/*try buffering due to VLC msg*/);
+ last_video_time = now;
+ }
+ }
+
+ if (real_time) {
+ /*refresh every MP42TS_PRINT_FREQ ms*/
+ u32 now=gf_sys_clock();
+ if (now/MP42TS_PRINT_FREQ != last_print_time/MP42TS_PRINT_FREQ) {
+ last_print_time = now;
+ fprintf(stderr, "M2TS: time %d - TS time %d - avg bitrate %d\r", gf_m2ts_get_sys_clock(muxer), gf_m2ts_get_ts_clock(muxer), muxer->avg_br);
+ }
+ }
+
+ /*cpu load regulation*/
+ gf_sleep(1);
+
+ if (run_time) {
+ if (gf_m2ts_get_ts_clock(muxer) > run_time) {
+ fprintf(stderr, "Stopping multiplex at %d ms (requested runtime %d ms)\n", gf_m2ts_get_ts_clock(muxer), run_time);
+ break;
+ }
+ }
+ if (status==GF_M2TS_STATE_EOS) {
+ break;
+ }
+ }
+
+
+exit:
+ run = 0;
+ if (segment_duration) {
+ write_manifest(segment_manifest, segment_dir, segment_duration, segment_prefix, segment_http_prefix, segment_index - segment_number, segment_index, 1);
+ }
+ if (ts_output_file) fclose(ts_output_file);
+ if (ts_output_udp_sk) gf_sk_del(ts_output_udp_sk);
+ if (ts_output_rtp) gf_rtp_del(ts_output_rtp);
+ if (ts_out) gf_free(ts_out);
+ if (audio_input_udp_sk) gf_sk_del(audio_input_udp_sk);
+ if (audio_input_buffer) gf_free (audio_input_buffer);
+ if (video_buffer) gf_free(video_buffer);
+ if (udp_out) gf_free(udp_out);
+ if (rtp_out) gf_free(rtp_out);
+ if (aac_reader) AAC_Reader_del(aac_reader);
+ if (muxer) gf_m2ts_mux_del(muxer);
+
+ for (i=0; i<nb_progs; i++) {
+ for (j=0; j<progs[i].nb_streams; j++) {
+ if (progs[i].streams[j].input_ctrl) progs[i].streams[j].input_ctrl(&progs[i].streams[j], GF_ESI_INPUT_DESTROY, NULL);
+ if (progs[i].streams[j].input_udta){
+ gf_free(progs[i].streams[j].input_udta);
+ }
+ if (progs[i].streams[j].decoder_config)
+ gf_free(progs[i].streams[j].decoder_config);
+ }
+ if (progs[i].iod) gf_odf_desc_del((GF_Descriptor*)progs[i].iod);
+ if (progs[i].mp4) gf_isom_close(progs[i].mp4);
+ if (progs[i].seng){
+ gf_seng_terminate(progs[i].seng);
+ progs[i].seng = NULL;
+ }
+ if (progs[i].th) gf_th_del(progs[i].th);
+ }
+ gf_sys_close();
+ return 1;
+}
+
--- /dev/null
+# Microsoft Developer Studio Project File - Name="mp42ts" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=mp42ts - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "mp42ts.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "mp42ts.mak" CFG="mp42ts - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "mp42ts - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "mp42ts - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "mp42ts - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x40c /d "NDEBUG"\r
+# ADD RSC /l 0x40c /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"../../../bin/w32_rel/mp42ts.exe" /libpath:"../../../extra_lib/lib/w32_rel"\r
+\r
+!ELSEIF "$(CFG)" == "mp42ts - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x40c /d "_DEBUG"\r
+# ADD RSC /l 0x40c /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"../../../bin/w32_deb/mp42ts.exe" /pdbtype:sept /libpath:"../../../extra_lib/lib/w32_deb"\r
+# SUBTRACT LINK32 /nodefaultlib\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "mp42ts - Win32 Release"\r
+# Name "mp42ts - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=.\main.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\mp42ts.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\mp42ts.h\r
+# End Source File\r
+# End Target\r
+# End Project\r
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) ENST 2000-200X
+ * All rights reserved
+ *
+ * This file is part of GPAC / mp42ts application
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#include <gpac/isomedia.h>
+#include <gpac/bifs.h>
+#include <gpac/esi.h>
+#include <gpac/mpegts.h>
+#include <gpac/avparse.h>
+#include <gpac/thread.h>
+
+
+typedef struct __m2ts_mux_program M2TS_Mux_Program;
+typedef struct __m2ts_mux M2TS_Mux;
+
+enum {
+ LOG_NO_LOG = 0,
+ LOG_PES = 1,
+ LOG_SECTION = 2,
+ LOG_TS = 3
+};
+
+
+typedef struct __m2ts_section {
+ struct __m2ts_section *next;
+ u8 *data;
+ u32 length;
+} M2TS_Mux_Section;
+
+typedef struct __m2ts_table {
+ struct __m2ts_table *next;
+ u8 table_id;
+ u8 version_number;
+ struct __m2ts_section *section;
+} M2TS_Mux_Table;
+
+typedef struct
+{
+ u32 sec;
+ u32 nanosec;
+} M2TS_Time;
+
+
+typedef struct __m2ts_mux_pck
+{
+ struct __m2ts_mux_pck *next;
+ char *data;
+ u32 data_len;
+ u32 flags;
+ u64 cts, dts;
+} M2TS_Packet;
+
+
+typedef struct __m2ts_mux_stream {
+ struct __m2ts_mux_stream *next;
+
+ u32 pid;
+ u8 continuity_counter;
+ struct __m2ts_mux_program *program;
+
+ /*average stream bit-rate in bit/sec*/
+ u32 bit_rate;
+
+ /*multiplexer time - NOT THE PCR*/
+ M2TS_Time time;
+
+
+ /* MPEG-4 SL Config */
+ GF_SLConfig sl_config;
+
+ /*table tools*/
+ M2TS_Mux_Table *tables;
+ /*total table sizes for bitrate estimation (PMT/PAT/...)*/
+ u32 total_table_size;
+ /* used for on-the-fly packetization of sections */
+ M2TS_Mux_Table *current_table;
+ M2TS_Mux_Section *current_section;
+ u32 current_section_offset;
+ u32 refresh_rate_ms;
+ Bool table_needs_update;
+
+ Bool (*process)(struct __m2ts_mux *muxer, struct __m2ts_mux_stream *stream);
+
+ /*PES tools*/
+ void *pes_packetizer;
+ u32 mpeg2_stream_type;
+ u32 mpeg2_stream_id;
+
+ GF_ESIPacket pck;
+ u32 pck_offset;
+ Bool force_new;
+
+ struct __elementary_stream_ifce *ifce;
+ Double ts_scale;
+ u64 initial_ts;
+
+ /*packet fifo*/
+ M2TS_Packet *pck_first, *pck_last;
+ /*packet reassembler (PES packets are most of the time full frames)*/
+ M2TS_Packet *pck_reassembler;
+ GF_Mutex *mx;
+ /*avg bitrate compute*/
+ u64 last_br_time;
+ u32 bytes_since_last_time;
+
+ /*MPEG-4 over MPEG-2*/
+ u8 table_id;
+ GF_SLHeader sl_header;
+ //GF_SLConfig sl_config;
+
+ u32 last_aac_time;
+} M2TS_Mux_Stream;
+
+
+struct __m2ts_mux_program {
+ struct __m2ts_mux_program *next;
+
+ struct __m2ts_mux *mux;
+ u16 number;
+ /*all streams but PMT*/
+ M2TS_Mux_Stream *streams;
+ /*PMT*/
+ M2TS_Mux_Stream *pmt;
+ /*pointer to PCR stream*/
+ M2TS_Mux_Stream *pcr;
+
+ /*TS time at pcr init*/
+ M2TS_Time ts_time_at_pcr_init;
+ u64 pcr_init_time, num_pck_at_pcr_init;
+ u64 last_pcr;
+ u32 last_sys_clock;
+
+ GF_Descriptor *iod;
+};
+
+struct __m2ts_mux {
+ M2TS_Mux_Program *programs;
+ M2TS_Mux_Stream *pat;
+
+ u16 ts_id;
+
+ Bool needs_reconfig;
+
+ /* used to indicate that the input data is pushed to the muxer (i.e. not read from a file)
+ or that the output data is sent on sockets (not written to a file) */
+ Bool real_time;
+
+ /* indicates if the multiplexer shall target a fix bit rate (monitoring timing and produce padding packets)
+ or if the output stream will contain only input data*/
+ Bool fixed_rate;
+
+ /*output bit-rate in bit/sec*/
+ u32 bit_rate;
+
+ char dst_pck[188], null_pck[188];
+
+ /*multiplexer time, incremented each time a packet is sent
+ used to monitor the sending of muxer related data (PAT, ...) */
+ M2TS_Time time;
+
+ /* Time of the muxer when the first call to process is made (first packet sent?) */
+ M2TS_Time init_ts_time;
+
+ /* System time when the muxer is started */
+ u32 init_sys_time;
+
+ Bool eos_found;
+ u32 pck_sent_over_br_window, last_br_time, avg_br;
+ u64 tot_pck_sent, tot_pad_sent;
+
+ Bool mpeg4_signaling;
+};
+
+
+enum
+{
+ GF_M2TS_STATE_IDLE,
+ GF_M2TS_STATE_DATA,
+ GF_M2TS_STATE_PADDING,
+ GF_M2TS_STATE_EOS,
+};
+
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8,00"\r
+ Name="mp42ts"\r
+ ProjectGUID="{F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory=".\Debug"\r
+ IntermediateDirectory=".\Debug"\r
+ ConfigurationType="1"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ TypeLibraryName=".\Debug/mp42ts.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile=".\Debug/mp42ts.pch"\r
+ AssemblerListingLocation=".\Debug/"\r
+ ObjectFile=".\Debug/"\r
+ ProgramDataBaseFileName=".\Debug/"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="odbc32.lib odbccp32.lib"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/MP42TS.exe"\r
+ LinkIncremental="2"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../../extra_lib/lib/w32_deb"\r
+ GenerateDebugInformation="true"\r
+ ProgramDatabaseFile=".\Debug/mp42ts.pdb"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile=".\Debug/mp42ts.bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory=".\Release"\r
+ IntermediateDirectory=".\Release"\r
+ ConfigurationType="1"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ TypeLibraryName=".\Release/mp42ts.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="2"\r
+ InlineFunctionExpansion="1"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ EnableFunctionLevelLinking="true"\r
+ PrecompiledHeaderFile=".\Release/mp42ts.pch"\r
+ AssemblerListingLocation=".\Release/"\r
+ ObjectFile=".\Release/"\r
+ ProgramDataBaseFileName=".\Release/"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="NDEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="odbc32.lib odbccp32.lib"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/MP42TS.exe"\r
+ LinkIncremental="1"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../../extra_lib/lib/w32_rel"\r
+ ProgramDatabaseFile=".\Release/mp42ts.pdb"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile=".\Release/mp42ts.bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <File\r
+ RelativePath="main.c"\r
+ >\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""\r
+ PreprocessorDefinitions=""\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""\r
+ PreprocessorDefinitions=""\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
vpath %.c $(SRC_PATH)/applications/mp4box
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
PROG=MP4Box
ifeq ($(MP4BOX_STATIC),yes)
LINKFLAGS+=-lgpac_static $(EXTRALIBS) $(GPAC_SH_FLAGS) -lz
+
+# spidermonkey support
+ifeq ($(CONFIG_JS),no)
+else
+SCENEGRAPH_CFLAGS+=$(JS_FLAGS)
+ifeq ($(CONFIG_JS),local)
+NEED_LOCAL_LIB="yes"
+endif
+LINKFLAGS+=$(JS_LIBS)
+endif
+
else
LINKFLAGS+=-lgpac
endif
void DumpTrackInfo(GF_ISOFile *file, u32 trackID, Bool full_dump)
{
Float scale;
- u32 trackNum, i, j, size, max_rate, rate, ts, mtype, msub_type, timescale, sr, nb_ch, count, alt_group, nb_groups;
- u64 time_slice, dur;
+ Bool is_od_track = 0;
+ u32 trackNum, i, j, max_rate, rate, ts, mtype, msub_type, timescale, sr, nb_ch, count, alt_group, nb_groups;
+ u64 time_slice, dur, size;
u8 bps;
GF_ESD *esd;
char sType[5], szDur[50];
fprintf(stdout, "Handler name: %s\n", handler_name);
}
+ if (mtype==GF_ISOM_MEDIA_VISUAL) {
+ s32 tx, ty;
+ u32 w, h;
+ gf_isom_get_track_layout_info(file, trackNum, &w, &h, &tx, &ty, NULL);
+ fprintf(stdout, "Visual Track layout: x=%d y=%d width=%d height=%d\n", tx, ty, w, h);
+ }
+
gf_isom_get_audio_info(file, trackNum, 1, &sr, &nb_ch, &bps);
msub_type = gf_isom_get_media_subtype(file, trackNum, 1);
fprintf(stdout, "MPEG-4 Config%sStream Type 0x%02x - ObjectTypeIndication 0x%02x\n",
full_dump ? "\n\t" : ": ", esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication);
}
+ if (esd->decoderConfig->streamType==GF_STREAM_OD)
+ is_od_track=1;
+
if (esd->decoderConfig->streamType==GF_STREAM_VISUAL) {
u32 w, h;
w = h = 0;
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
if (full_dump) fprintf(stdout, "\t");
- fprintf(stdout, "AVC/H264 Video - Visual Size %d x %d", w, h);
+ fprintf(stdout, "AVC/H264 Video - Visual Size %d x %d\n", w, h);
#ifndef GPAC_DISABLE_AV_PARSERS
avccfg = gf_isom_avc_config_get(file, trackNum, 1);
svccfg = gf_isom_svc_config_get(file, trackNum, 1);
if (!avccfg && !svccfg) {
fprintf(stdout, "\n\n\tNon-compliant AVC track: SPS/PPS not found in sample description\n");
} else if (avccfg) {
+ fprintf(stdout, "\tAVC Info: %d SPS - %d PPS", gf_list_count(avccfg->sequenceParameterSets) , gf_list_count(avccfg->pictureParameterSets) );
fprintf(stdout, " - Profile %s @ Level %g\n", gf_avc_get_profile_name(avccfg->AVCProfileIndication), ((Double)avccfg->AVCLevelIndication)/10.0 );
- fprintf(stdout, "NAL Unit length bits: %d\n", 8*avccfg->nal_unit_size);
+ fprintf(stdout, "\tNAL Unit length bits: %d\n", 8*avccfg->nal_unit_size);
slc = gf_list_get(avccfg->sequenceParameterSets, 0);
if (slc) {
- gf_avc_get_sps_info(slc->data, slc->size, NULL, NULL, &par_n, &par_d);
+ gf_avc_get_sps_info(slc->data, slc->size, NULL, NULL, NULL, &par_n, &par_d);
if ((par_n>0) && (par_d>0)) {
u32 tw, th;
gf_isom_get_track_layout_info(file, trackNum, &tw, &th, NULL, NULL, NULL);
- fprintf(stdout, "Pixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", par_n, par_d, tw, th);
+ fprintf(stdout, "\tPixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", par_n, par_d, tw, th);
}
}
gf_odf_avc_cfg_del(avccfg);
}
if (svccfg) {
- fprintf(stdout, "\nSVC Profile %s @ Level %g\n", gf_avc_get_profile_name(svccfg->AVCProfileIndication), ((Double)svccfg->AVCLevelIndication)/10.0 );
- fprintf(stdout, "SVC NAL Unit length bits: %d\n", 8*svccfg->nal_unit_size);
- slc = gf_list_get(svccfg->sequenceParameterSets, 0);
- if (slc) {
- gf_avc_get_sps_info(slc->data, slc->size, NULL, NULL, &par_n, &par_d);
- if ((par_n>0) && (par_d>0)) {
- u32 tw, th;
- gf_isom_get_track_layout_info(file, trackNum, &tw, &th, NULL, NULL, NULL);
- fprintf(stdout, "Pixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", par_n, par_d, tw, th);
+ fprintf(stdout, "\n\tSVC Info: %d SPS - %d PPS - Profile %s @ Level %g\n", gf_list_count(svccfg->sequenceParameterSets) , gf_list_count(svccfg->pictureParameterSets), gf_avc_get_profile_name(svccfg->AVCProfileIndication), ((Double)svccfg->AVCLevelIndication)/10.0 );
+ fprintf(stdout, "\tSVC NAL Unit length bits: %d\n", 8*svccfg->nal_unit_size);
+ for (i=0; i<gf_list_count(svccfg->sequenceParameterSets); i++) {
+ slc = gf_list_get(svccfg->sequenceParameterSets, i);
+ if (slc) {
+ u32 s_w, s_h, sps_id;
+ gf_avc_get_sps_info(slc->data, slc->size, &sps_id, &s_w, &s_h, &par_n, &par_d);
+ fprintf(stdout, "\t\tSSPS ID %d - Visual Size %d x %d\n", sps_id, s_w, s_h);
+ if ((par_n>0) && (par_d>0)) {
+ u32 tw, th;
+ gf_isom_get_track_layout_info(file, trackNum, &tw, &th, NULL, NULL, NULL);
+ fprintf(stdout, "\tPixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", par_n, par_d, tw, th);
+ }
}
}
gf_odf_avc_cfg_del(svccfg);
else szName = "Unknown";
fprintf(stdout, "Ogg/%s video / GPAC Mux - Visual Size %d x %d\n", szName, w, h);
}
+ else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_JPEG) {
+ gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
+ fprintf(stdout, "JPEG Stream - Visual Size %d x %d\n", w, h);
+ }
+ else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_PNG) {
+ gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
+ fprintf(stdout, "PNG Stream - Visual Size %d x %d\n", w, h);
+ }
+ else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_JPEG_2000) {
+ gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
+ fprintf(stdout, "JPEG2000 Stream - Visual Size %d x %d\n", w, h);
+ }
if (!w || !h) {
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
if (full_dump) fprintf(stdout, "\t");
is_mp2 = 1;
case GPAC_OTI_AUDIO_AAC_MPEG4:
#ifndef GPAC_DISABLE_AV_PARSERS
- e = gf_m4a_get_config(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg);
+ if (!esd->decoderConfig->decoderSpecificInfo)
+ e = GF_NON_COMPLIANT_BITSTREAM;
+ else
+ e = gf_m4a_get_config(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg);
if (full_dump) fprintf(stdout, "\t");
if (e) fprintf(stdout, "Corrupted AAC Config\n");
else {
} else {
#ifndef GPAC_DISABLE_AV_PARSERS
GF_ISOSample *samp = gf_isom_get_sample(file, trackNum, 1, &oti);
- oti = GF_4CC((u8)samp->data[0], (u8)samp->data[1], (u8)samp->data[2], (u8)samp->data[3]);
- if (full_dump) fprintf(stdout, "\t");
- fprintf(stdout, "%s Audio - %d Channel(s) - SampleRate %d - Layer %d\n",
- gf_mp3_version_name(oti),
- gf_mp3_num_channels(oti),
- gf_mp3_sampling_rate(oti),
- gf_mp3_layer(oti)
- );
- gf_isom_sample_del(&samp);
+ if (samp) {
+ oti = GF_4CC((u8)samp->data[0], (u8)samp->data[1], (u8)samp->data[2], (u8)samp->data[3]);
+ if (full_dump) fprintf(stdout, "\t");
+ fprintf(stdout, "%s Audio - %d Channel(s) - SampleRate %d - Layer %d\n",
+ gf_mp3_version_name(oti),
+ gf_mp3_num_channels(oti),
+ gf_mp3_sampling_rate(oti),
+ gf_mp3_layer(oti)
+ );
+ gf_isom_sample_del(&samp);
+ } else {
+ fprintf(stdout, "\n\tError fetching sample: %s\n", gf_error_to_string(gf_isom_last_error(file)) );
+ }
#else
fprintf(stdout, "MPEG-1/2 Audio - %d Channels - SampleRate %d\n", nb_ch, sr);
#endif
}
}
else if (esd->decoderConfig->streamType==GF_STREAM_SCENE) {
- if (esd->decoderConfig->objectTypeIndication<=6) {
+ if (esd->decoderConfig->objectTypeIndication<=4) {
GF_BIFSConfig *b_cfg = gf_odf_get_bifs_config(esd->decoderConfig->decoderSpecificInfo, esd->decoderConfig->objectTypeIndication);
fprintf(stdout, "BIFS Scene description - %s stream\n", b_cfg->elementaryMasks ? "Animation" : "Command");
if (full_dump && !b_cfg->elementaryMasks) {
fprintf(stdout, "\tWidth %d Height %d Pixel Metrics %s\n", b_cfg->pixelWidth, b_cfg->pixelHeight, b_cfg->pixelMetrics ? "yes" : "no");
}
gf_odf_desc_del((GF_Descriptor *)b_cfg);
+ } else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_AFX) {
+ u8 tag = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data[0] : 0xFF;
+ const char *afxtype = gf_afx_get_type_description(tag);
+ fprintf(stdout, "AFX Stream - type %s (%d)\n", afxtype, tag);
+ } else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_FONT) {
+ fprintf(stdout, "Font Data stream\n");
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_LASER) {
GF_LASERConfig l_cfg;
gf_odf_get_laser_config(esd->decoderConfig->decoderSpecificInfo, &l_cfg);
fprintf(stdout, "LASER Stream - %s\n", l_cfg.newSceneIndicator ? "Full Scene" : "Scene Segment");
+ } else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_TEXT_MPEG4) {
+ fprintf(stdout, "MPEG-4 Streaming Text stream\n");
+ } else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE) {
+ fprintf(stdout, "Synthetized Texture stream stream\n");
+ } else {
+ fprintf(stdout, "Unknown Systems stream OTI %d\n", esd->decoderConfig->objectTypeIndication);
}
}
time_slice = 0;
ts = gf_isom_get_media_timescale(file, trackNum);
for (j=0; j<gf_isom_get_sample_count(file, trackNum); j++) {
- GF_ISOSample *samp = gf_isom_get_sample_info(file, trackNum, j+1, NULL, NULL);
+ GF_ISOSample *samp;
+ if (is_od_track) {
+ samp = gf_isom_get_sample(file, trackNum, j+1, NULL);
+ } else {
+ samp = gf_isom_get_sample_info(file, trackNum, j+1, NULL, NULL);
+ }
dur = samp->DTS+samp->CTS_Offset;
size += samp->dataLength;
rate += samp->dataLength;
scale = 1000;
scale /= ts;
dur = (u64) (scale * (s64)dur);
- fprintf(stdout, "\tTotal size %d bytes - Total samples duration %d ms\n", size, (u32) dur);
+ fprintf(stdout, "\tTotal size "LLU" bytes - Total samples duration "LLU" ms\n", size, dur);
if (!dur) {
fprintf(stdout, "\n");
return;
}
- rate = (u32) (size * 8 / (dur/1000));
+ /*rate in byte, dur is in ms*/
+ rate = (u32) ((size * 8 * 1000) / dur);
max_rate *= 8;
if (rate >= 1500) {
rate /= 1000;
iod = (GF_InitialObjectDescriptor *) gf_isom_get_root_od(file);
if (iod) {
+ u32 desc_size = gf_odf_desc_size((GF_Descriptor *)iod);
if (iod->tag == GF_ODF_IOD_TAG) {
- fprintf(stdout, "File has root IOD\n");
+ fprintf(stdout, "File has root IOD (%d bytes)\n", desc_size);
fprintf(stdout, "Scene PL 0x%02x - Graphics PL 0x%02x - OD PL 0x%02x\n", iod->scene_profileAndLevel, iod->graphics_profileAndLevel, iod->OD_profileAndLevel);
fprintf(stdout, "Visual PL: %s (0x%02x)\n", gf_m4v_get_profile_name(iod->visual_profileAndLevel), iod->visual_profileAndLevel);
fprintf(stdout, "Audio PL: %s (0x%02x)\n", gf_m4a_get_profile_name(iod->audio_profileAndLevel), iod->audio_profileAndLevel);
//fprintf(stdout, "inline profiles included %s\n", iod->inlineProfileFlag ? "yes" : "no");
} else {
- fprintf(stdout, "File has root OD\n");
+ fprintf(stdout, "File has root OD (%d bytes)\n", desc_size);
}
if (!gf_list_count(iod->ESDescriptors)) fprintf(stdout, "No streams included in root OD\n");
gf_odf_desc_del((GF_Descriptor *) iod);
}
}
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COMPILATION, &tag, &tag_len)==GF_OK) fprintf(stdout, "\tCompilation: %s\n", tag[0] ? "Yes" : "No");
- if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_GAPELESS, &tag, &tag_len)==GF_OK) fprintf(stdout, "\tGapeless album: %s\n", tag[0] ? "Yes" : "No");
+ if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_GAPLESS, &tag, &tag_len)==GF_OK) fprintf(stdout, "\tGapless album: %s\n", tag[0] ? "Yes" : "No");
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_CREATED, &tag, &tag_len)==GF_OK) fprintf(stdout, "\tCreated: %s\n", tag);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_DISK, &tag, &tag_len)==GF_OK) fprintf(stdout, "\tDisk: %d / %d\n", tag[3], tag[5]);
#ifndef GPAC_DISABLE_MPEG2TS
+#include <gpac/internal/isomedia_dev.h>
+
+typedef struct
+{
+ Bool start_indexing;
+
+ /* For indexing the TS*/
+ Double segment_duration;
+ Bool segment_at_rap;
+ u32 subsegs_per_segment;
+ char *seg_name;
+ Bool use_url_template;
+ char *init_seg_name;
+ Bool use_index_segment;
+
+ FILE *index_file;
+ char index_file_name[100];
+ GF_BitStream *index_bs;
+
+ char mpd_file_name[100];
+ FILE *mpd_file;
+ /* temporary file to store the MPD segment description before writing the header */
+ FILE *mpd_segs;
+
+ u32 reference_pid;
+ GF_M2TS_PES *reference_stream;
+
+ /* earliest presentation time for the whole segment */
+ u64 first_PTS;
+
+ /* earliest presentation time for the subsegment being processed */
+ u64 base_PTS;
+ /* byte offset for the start of subsegment being processed */
+ u32 base_offset;
+ /* last presentation time for the subsegment being processed (before the next subsegment is started) */
+ u64 last_PTS;
+ /* byte offset for the last PES packet for the subsegment being processed */
+ u32 last_offset;
+
+ /* earliest presentation time for the previous subsegment */
+ u64 prev_base_PTS;
+ /* byte offset for the start of the previous subsegment */
+ u32 prev_base_offset;
+ /* last presentation time for the previous subsegment */
+ u64 prev_last_PTS;
+ /* byte offset for the last PES packet for the previous subsegment */
+ u32 prev_last_offset;
+
+ /* boolean indicating if the current subsegment contains a RAP */
+ Bool has_rap;
+ /* Presentation time for the first RAP encountered in the subsegment */
+ u64 first_RAP_PTS;
+ /* byte offset for the first RAP encountered in the subsegment */
+ u32 first_RAP_offset;
+ u64 prev_last_RAP_PTS;
+ u32 prev_last_RAP_offset;
+ u64 last_RAP_PTS;
+ u32 last_RAP_offset;
+
+ /* information about the first PAT found in the subsegment */
+ u32 last_pat_position;
+ u32 first_pat_position;
+ u32 prev_last_pat_position;
+ Bool first_pat_position_valid;
+ u32 pat_version;
+
+ /* information about the first CAT found in the subsegment */
+ u32 last_cat_position;
+ u32 first_cat_position;
+ u32 prev_last_cat_position;
+ Bool first_cat_position_valid;
+ u32 cat_version;
+
+ /* information about the first PMT found in the subsegment */
+ u32 last_pmt_position;
+ u32 first_pmt_position;
+ u32 prev_last_pmt_position;
+ Bool first_pmt_position_valid;
+ u32 pmt_version;
+
+ /* information about the first PCR found in the subsegment */
+ u32 last_pcr_position;
+ u32 first_pcr_position;
+ Bool first_pcr_position_valid;
+ u32 prev_last_pcr_position;
+
+ //GF_List *sidxs;
+ GF_SegmentIndexBox *sidx;
+} GF_M2TS_IndexingInfo;
typedef struct
{
FILE *pes_out_info;
char info[100];
Bool is_info_dumped;
+
+ u32 prog_number;
+ /* For logging timing information (PCR, PTS/DTS) */
+ FILE *timestamps_info_file;
+ char timestamps_info_name[100];
/* when dumping TS information */
u32 dump_pid;
Bool has_seen_pat;
+
+ GF_M2TS_IndexingInfo index_info;
+
} GF_M2TS_Dump;
+/* Initializes an SIDX */
+static GF_SegmentIndexBox *m2ts_sidx_new(u32 pid, u64 PTS, u64 position)
+{
+ GF_SegmentIndexBox *sidx = (GF_SegmentIndexBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_SIDX);
+ sidx->reference_ID = pid;
+ /* timestamps in MPEG-2 are expressed in 90 kHz timescale */
+ sidx->timescale = 90000;
+ /* first encountered PTS on the PID for this subsegment */
+ sidx->earliest_presentation_time = PTS;
+ sidx->first_offset = position;
+ return sidx;
+}
+
+static void m2ts_sidx_add_entry(GF_SegmentIndexBox *sidx, Bool type,
+ u32 size, u32 duration, Bool has_rap, u32 RAP_delta_time)
+{
+ GF_SIDXReference *ref;
+ sidx->nb_refs++;
+ sidx->refs = gf_realloc(sidx->refs, sidx->nb_refs*sizeof(GF_SIDXReference));
+ ref = &(sidx->refs[sidx->nb_refs-1]);
+ ref->reference_type = type;
+ ref->contains_RAP = has_rap;
+ ref->reference_offset = size;
+ ref->subsegment_duration = duration;
+ ref->RAP_delta_time = (has_rap ? RAP_delta_time: 0);
+}
+
+static void m2ts_sidx_update_prev_entry_duration(GF_SegmentIndexBox *sidx, u32 duration)
+{
+ GF_SIDXReference *ref;
+ if (sidx->nb_refs == 0) return;
+ ref = &(sidx->refs[sidx->nb_refs-1]);
+ ref->subsegment_duration = duration;
+}
+
+static void m2ts_sidx_finalize_size(GF_M2TS_IndexingInfo *index_info, u64 file_size)
+{
+ GF_SIDXReference *ref;
+ if (index_info->sidx->nb_refs == 0) return;
+ ref = &(index_info->sidx->refs[index_info->sidx->nb_refs-1]);
+ ref->reference_offset = (u32)(file_size - index_info->prev_base_offset);
+ fprintf(stderr, "Subsegment: position-range ajdustment:%d-%d (%d bytes)\n",
+ index_info->prev_base_offset, (u32)file_size, ref->reference_offset);
+}
+
+static void m2ts_sidx_flush_entry(GF_M2TS_IndexingInfo *index_info)
+{
+ u32 size;
+ u32 duration, prev_duration;
+ u32 RAP_delta_time;
+ u32 RAP_offset;
+
+ u32 end_offset;
+
+ if (!index_info->sidx) {
+ fprintf(stderr, "Segment: Reference PID: %d, EPTime: "LLU", Start Offset: %d bytes\n",
+ index_info->reference_pid, index_info->base_PTS, index_info->base_offset);
+ index_info->sidx = m2ts_sidx_new(index_info->reference_pid, index_info->base_PTS, index_info->base_offset);
+ }
+
+ /* determine the end of the current index */
+ if (index_info->segment_at_rap) {
+ /*split at PAT*/
+ end_offset = index_info->last_pat_position;
+ } else {
+ /* split at PES header */
+ end_offset = index_info->last_offset;
+ }
+
+ /* close the current index */
+ size = (u32)(end_offset - index_info->base_offset);
+ duration = (u32)(index_info->last_PTS - index_info->base_PTS);
+ RAP_delta_time= (u32)(index_info->first_RAP_PTS - index_info->base_PTS);
+ RAP_offset = (u32)(index_info->first_RAP_offset - index_info->base_offset);
+ m2ts_sidx_add_entry(index_info->sidx, 0, size, duration, index_info->has_rap, RAP_delta_time);
+
+ /* adjust the previous index duration */
+ if (index_info->sidx->nb_refs > 0 && (index_info->base_PTS < index_info->prev_last_PTS) ) {
+ prev_duration = (u32)(index_info->base_PTS-index_info->prev_base_PTS);
+ fprintf(stderr, " time-range adj.: %.03f-%.03f / %.03f sec.\n",
+ (index_info->prev_base_PTS - index_info->first_PTS)/90000.0,
+ (index_info->base_PTS - index_info->first_PTS)/90000.0, prev_duration/90000.0);
+ m2ts_sidx_update_prev_entry_duration(index_info->sidx, prev_duration);
+ }
+
+ /* Printing result */
+ fprintf(stderr, "Subsegment:");
+ //time-range:position-range:
+ //fprintf(stderr, LLD"-"LLD,index_info->base_PTS, index_info->last_PTS);
+ fprintf(stderr, " %.03f-%0.3f / %.03f sec., %d-%d / %d bytes, ",
+ (index_info->base_PTS - index_info->first_PTS)/90000.0,
+ (index_info->last_PTS - index_info->first_PTS)/90000.0, duration/90000.0,
+ index_info->base_offset, end_offset, size);
+ if (index_info->has_rap) {
+ fprintf(stderr, "RAP @ %.03f sec. / %d bytes", (index_info->first_RAP_PTS - index_info->first_PTS)/90000.0,
+ RAP_offset);
+ }
+ if (index_info->first_pat_position_valid) {
+ fprintf(stderr, ", PAT @ %d bytes", (u32)(index_info->first_pat_position - index_info->base_offset));
+ } else {
+ fprintf(stderr, ", No PAT");
+ }
+ if (index_info->first_cat_position_valid) {
+ fprintf(stderr, ", CAT @ %d bytes", (u32)(index_info->first_cat_position - index_info->base_offset));
+ } else {
+ fprintf(stderr, ", No CAT");
+ }
+ if (index_info->first_pmt_position_valid) {
+ fprintf(stderr, ", PMT @ %d bytes", (u32)(index_info->first_pmt_position - index_info->base_offset));
+ } else {
+ fprintf(stderr, ", No PMT");
+ }
+ if (index_info->first_pcr_position_valid) {
+ fprintf(stderr, ", PCR @ %d bytes", (u32)(index_info->first_pcr_position - index_info->base_offset));
+ } else {
+ fprintf(stderr, ", No PCR");
+ }
+ fprintf(stderr, "\n");
+
+ /* save the current values for later adjustments */
+ index_info->prev_last_RAP_PTS = index_info->last_RAP_PTS;
+ index_info->prev_last_RAP_offset = index_info->last_RAP_offset;
+ index_info->prev_last_PTS = index_info->last_PTS;
+ index_info->prev_last_offset = index_info->last_offset;
+ index_info->prev_base_PTS = index_info->base_PTS;
+ index_info->base_PTS = index_info->last_PTS;
+ index_info->prev_base_offset = index_info->base_offset;
+ index_info->prev_last_pat_position = index_info->last_pat_position;
+ index_info->prev_last_cat_position = index_info->last_cat_position;
+ index_info->prev_last_pmt_position = index_info->last_pmt_position;
+ index_info->prev_last_pcr_position = index_info->last_pcr_position;
+
+ /* update the values for the new index*/
+ index_info->base_offset = end_offset;
+ index_info->has_rap = 0;
+ index_info->first_RAP_PTS = 0;
+ index_info->first_RAP_offset = 0;
+ if (index_info->last_pat_position >= index_info->base_offset) {
+ index_info->first_pat_position_valid = 1;
+ index_info->first_pat_position = index_info->last_pat_position;
+ } else {
+ index_info->first_pat_position_valid = 0;
+ index_info->first_pat_position = 0;
+ }
+ if (index_info->last_cat_position >= index_info->base_offset) {
+ index_info->first_cat_position_valid = 1;
+ index_info->first_cat_position = index_info->last_cat_position;
+ } else {
+ index_info->first_cat_position_valid = 0;
+ index_info->first_cat_position = 0;
+ }
+ if (index_info->last_pmt_position >= index_info->base_offset) {
+ index_info->first_pmt_position_valid = 1;
+ index_info->first_pmt_position = index_info->last_pmt_position;
+ } else {
+ index_info->first_pmt_position_valid = 0;
+ index_info->first_pmt_position = 0;
+ }
+ if (index_info->last_pcr_position >= index_info->base_offset) {
+ index_info->first_pcr_position_valid = 1;
+ index_info->first_pcr_position = index_info->last_pcr_position;
+ } else {
+ index_info->first_pcr_position_valid = 0;
+ index_info->first_pcr_position = 0;
+ }
+}
+
+static void m2ts_check_indexing(GF_M2TS_IndexingInfo *index_info)
+{
+ u32 delta_time = (u32)(index_info->last_PTS - index_info->base_PTS);
+ u32 segment_duration = (u32)(index_info->segment_duration*90000);
+ /* we need to create an SIDX entry when the duration of the previous entry is too big */
+ if (delta_time >= segment_duration) {
+ m2ts_sidx_flush_entry(index_info);
+ }
+}
+
static void on_m2ts_dump_event(GF_M2TS_Demuxer *ts, u32 evt_type, void *par)
{
u32 i, count;
GF_M2TS_Program *prog;
GF_M2TS_PES_PCK *pck;
GF_M2TS_Dump *dumper = (GF_M2TS_Dump *)ts->user;
+ GF_M2TS_IndexingInfo *index_info = &dumper->index_info;
switch (evt_type) {
case GF_M2TS_EVT_PAT_FOUND:
fprintf(stdout, "Initial PAT found - %d programs\n", gf_list_count(ts->programs) );
+ if (index_info->start_indexing) {
+ if (!index_info->first_pat_position_valid) {
+ index_info->first_pat_position_valid = 1;
+ index_info->first_pat_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pat_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, 0);
+ }
break;
case GF_M2TS_EVT_PAT_UPDATE:
fprintf(stdout, "PAT updated - %d programs\n", gf_list_count(ts->programs) );
+ if (index_info->start_indexing) {
+ if (!index_info->first_pat_position_valid) {
+ index_info->first_pat_position_valid = 1;
+ index_info->first_pat_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pat_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, 0);
+ }
break;
case GF_M2TS_EVT_PAT_REPEAT:
+ /* WARNING: We detect the pat on a repetition, probably to ensure that we also have seen all the PMT
+ To be checked */
dumper->has_seen_pat = 1;
+ if (index_info->start_indexing) {
+ if (!index_info->first_pat_position_valid) {
+ index_info->first_pat_position_valid = 1;
+ index_info->first_pat_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pat_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, 0);
+ }
// fprintf(stdout, "Repeated PAT found - %d programs\n", gf_list_count(ts->programs) );
break;
+ case GF_M2TS_EVT_CAT_FOUND:
+ fprintf(stdout, "Initial CAT found\n");
+ if (index_info->start_indexing) {
+ if (!index_info->first_cat_position_valid) {
+ index_info->first_cat_position_valid = 1;
+ index_info->first_cat_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_cat_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, 0);
+ }
+ break;
+ case GF_M2TS_EVT_CAT_UPDATE:
+ fprintf(stdout, "CAT updated\n");
+ if (index_info->start_indexing) {
+ if (!index_info->first_cat_position_valid) {
+ index_info->first_cat_position_valid = 1;
+ index_info->first_cat_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_cat_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, 0);
+ }
+ break;
+ case GF_M2TS_EVT_CAT_REPEAT:
+ if (index_info->start_indexing) {
+ if (!index_info->first_cat_position_valid) {
+ index_info->first_cat_position_valid = 1;
+ index_info->first_cat_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_cat_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, 0);
+ }
+ break;
case GF_M2TS_EVT_PMT_FOUND:
prog = (GF_M2TS_Program*)par;
+ if (prog->number != dumper->prog_number) break;
+ if (index_info->start_indexing) {
+ if (!index_info->first_pmt_position_valid) {
+ index_info->first_pmt_position_valid = 1;
+ index_info->first_pmt_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pmt_position = (ts->pck_number-1)*188;
+ }
count = gf_list_count(prog->streams);
fprintf(stdout, "Program number %d found - %d streams:\n", prog->number, count);
for (i=0; i<count; i++) {
GF_M2TS_ES *es = gf_list_get(prog->streams, i);
- if (es->pid == prog->pmt_pid) fprintf(stdout, "\tPID %d: Program Map Table\n", es->pid);
- else {
+ if (es->pid == prog->pmt_pid) {
+ fprintf(stdout, "\tPID %d: Program Map Table\n", es->pid);
+ } else {
GF_M2TS_PES *pes = (GF_M2TS_PES *)es;
+ gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_DEFAULT);
fprintf(stdout, "\tPID %d: %s ", pes->pid, gf_m2ts_get_stream_name(pes->stream_type) );
if (pes->mpeg4_es_id) fprintf(stdout, " - MPEG-4 ES ID %d", pes->mpeg4_es_id);
fprintf(stdout, "\n");
+ }
+ if (es->pid == prog->pcr_pid) {
+ /* we create indexing information on the stream used for carrying the PCR */
+ index_info->reference_pid = prog->pcr_pid;
+ index_info->reference_stream = (GF_M2TS_PES *)es;
}
}
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, prog->pmt_pid);
+ }
break;
case GF_M2TS_EVT_PMT_UPDATE:
+ prog = (GF_M2TS_Program*)par;
+ if (prog->number != dumper->prog_number) break;
fprintf(stdout, "Program list updated - %d streams\n", gf_list_count( ((GF_M2TS_Program*)par)->streams) );
+ if (index_info->start_indexing) {
+ if (!index_info->first_pmt_position_valid) {
+ index_info->first_pmt_position_valid = 1;
+ index_info->first_pmt_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pmt_position = (ts->pck_number-1)*188;
+ }
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, prog->pmt_pid);
+ }
break;
case GF_M2TS_EVT_PMT_REPEAT:
+ prog = (GF_M2TS_Program*)par;
+ if (prog->number != dumper->prog_number) break;
+ if (index_info->start_indexing) {
+ if (!index_info->first_pmt_position_valid) {
+ index_info->first_pmt_position_valid = 1;
+ index_info->first_pmt_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pmt_position = (ts->pck_number-1)*188;
+ }
// fprintf(stdout, "Repeated Program list found - %d streams\n", gf_list_count( ((GF_M2TS_Program*)par)->streams) );
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\n", ts->pck_number, prog->pmt_pid);
+ }
break;
case GF_M2TS_EVT_SDT_FOUND:
count = gf_list_count(ts->SDTs) ;
break;
case GF_M2TS_EVT_SDT_REPEAT:
// fprintf(stdout, "Repeated Program Description - %d desc\n", gf_list_count(ts->SDTs) );
+ break;
+ case GF_M2TS_EVT_PES_TIMING:
+ pck = par;
+ if (pck->stream->program->number != dumper->prog_number) break;
+
break;
case GF_M2TS_EVT_PES_PCK:
pck = par;
- //fprintf(stdout, "PES(%d): DTS "LLD" PTS" LLD" RAP %d size %d\n", pck->stream->pid, pck->DTS, pck->PTS, pck->rap, pck->data_len);
+ if (pck->stream->program->number != dumper->prog_number) break;
+ if (dumper->has_seen_pat) {
+ if (dumper->timestamps_info_file) {
+ GF_M2TS_PES *pes = pck->stream;
+ /*FIXME : not used GF_M2TS_Program *prog = pes->program; */
+ /* Interpolated PCR value for the TS packet containing the PES header start */
+ u64 interpolated_pcr_value = 0;
+ if (pes->last_pcr_value && pes->before_last_pcr_value && pes->last_pcr_value > pes->before_last_pcr_value) {
+ u32 delta_pcr_pck_num = pes->last_pcr_value_pck_number - pes->before_last_pcr_value_pck_number;
+ u32 delta_pts_pcr_pck_num = pes->pes_start_packet_number - pes->last_pcr_value_pck_number;
+ u64 delta_pcr_value = pes->last_pcr_value - pes->before_last_pcr_value;
+ /* we can compute the interpolated pcr value for the packet containing the PES header */
+ interpolated_pcr_value = pes->last_pcr_value + (u64)((delta_pcr_value*delta_pts_pcr_pck_num*1.0)/delta_pcr_pck_num);
+ }
+
+ fprintf(dumper->timestamps_info_file, "%u\t%d\t", pck->stream->pes_start_packet_number, pck->stream->pid);
+ if (interpolated_pcr_value) fprintf(dumper->timestamps_info_file, "%f", interpolated_pcr_value/(300.0 * 90000));
+ fprintf(dumper->timestamps_info_file, "\t");
+ if (pck->DTS) fprintf(dumper->timestamps_info_file, "%f", (pck->DTS / 90000.0));
+ fprintf(dumper->timestamps_info_file, "\t%f\t%d\t%d\n", pck->PTS / 90000.0, (pck->flags & GF_M2TS_PES_PCK_RAP ? 1 : 0), (pck->flags & GF_M2TS_PES_PCK_DISCONTINUITY ? 1 : 0));
+ }
+ }
+ if (index_info->start_indexing) {
+ /* we process packets only for the given PID */
+ if (pck->stream->pid != index_info->reference_pid) {
+ break;
+ } else {
+ /* we store the fact that there is at least a RAP for the index
+ and we store the PTS of the first encountered RAP in the index*/
+ if (pck->flags & GF_M2TS_PES_PCK_RAP) {
+ index_info->has_rap = 1;
+ if (!index_info->first_RAP_PTS || (index_info->first_RAP_PTS > pck->PTS)) {
+ index_info->first_RAP_PTS = pck->PTS;
+ index_info->first_RAP_offset = (pck->stream->pes_start_packet_number-1)*188;
+ }
+ index_info->last_RAP_PTS = pck->PTS;
+ index_info->last_RAP_offset = (pck->stream->pes_start_packet_number-1)*188;
+ }
+ /* we need to know the earliest PTS value (RAP or not) in the index*/
+ if (!index_info->base_PTS || (index_info->base_PTS > pck->PTS)) {
+ index_info->base_PTS = pck->PTS;
+ }
+ /* we need to know the earliest PTS value for the whole file (segment) */
+ if (!index_info->first_PTS || (index_info->first_PTS > pck->PTS)) {
+ index_info->first_PTS = pck->PTS;
+ }
+ if (pck->PTS > index_info->last_PTS) {
+ /* we use the last PTS for first approximation of the duration */
+ index_info->last_PTS = pck->PTS;
+ index_info->last_offset = (index_info->reference_stream->pes_start_packet_number-1)*188;
+ }
+ m2ts_check_indexing(index_info);
+ }
+ }
if (dumper->pes_out && (dumper->dump_pid == pck->stream->pid)) {
fwrite(pck->data, pck->data_len, 1, dumper->pes_out);
}
break;
+ case GF_M2TS_EVT_PES_PCR:
+ pck = par;
+ if (pck->stream->program->number != dumper->prog_number) break;
+ if (dumper->timestamps_info_file) {
+ fprintf(dumper->timestamps_info_file, "%u\t%d\t%f\t\t\t\t%d\n", pck->stream->program->last_pcr_value_pck_number, pck->stream->pid, pck->PTS / (300*90000.0), (pck->flags & GF_M2TS_PES_PCK_DISCONTINUITY ? 1 : 0));
+ }
+ if (index_info->start_indexing) {
+ if (!index_info->first_pcr_position_valid) {
+ index_info->first_pcr_position_valid = 1;
+ index_info->first_pcr_position = (ts->pck_number-1)*188;
+ }
+ index_info->last_pcr_position = (ts->pck_number-1)*188;
+ }
+ break;
case GF_M2TS_EVT_SL_PCK:
#if 0
{
}
}
-void dump_mpeg2_ts(char *mpeg2ts_file, char *pes_out_name)
+static void mpd_duration(Double duration, char *duration_string)
+{
+ u32 h, m;
+ Double s;
+
+ h = (u32) (duration/3600);
+ m = (u32) (duration-h*60)/60;
+ s = (duration - h*3600 - m*60);
+ if (h) sprintf(duration_string, "PT%dH%dM%.2fS", h, m, s);
+ else if (m) sprintf(duration_string, "PT%dM%.2fS", m, s);
+ else if (s) sprintf(duration_string, "PT%.2fS", s);
+ else sprintf(duration_string, "PT0S");
+}
+
+void mpd_start(FILE *mpd, Bool on_demand, const char *media_file_name,
+ Double file_duration, const char *media_mime, const char *media_codecs,
+ u32 width, u32 height, u32 sample_rate, u32 nb_channels, char *langCode,
+ Bool split_seg_at_rap, u64 file_size, Double bufferTime)
+{
+ char duration_string[100];
+ char buffer_string[100];
+ u32 bandwidth;
+ bandwidth = (u32) (file_size * 8 / file_duration);
+ fprintf(mpd, "<MPD type=\"%s\" xmlns=\"urn:mpeg:mpegB:schema:DASH:MPD:DIS2011\">\n", (on_demand ? "OnDemand": "Live"));
+ fprintf(mpd, " <ProgramInformation moreInformationURL=\"http://gpac.sourceforge.net\">\n");
+ fprintf(mpd, " <Title>Media Presentation Description for file %s generated with GPAC </Title>\n", media_file_name);
+ fprintf(mpd, " </ProgramInformation>\n");
+ mpd_duration(file_duration, duration_string);
+ mpd_duration(bufferTime, buffer_string);
+ fprintf(mpd, " <Period start=\"PT0S\" duration=\"%s\" minBufferTime=\"%s\">\n", duration_string, buffer_string);
+ fprintf(mpd, " <Representation id=\"rep1\"");
+ if (!media_codecs) fprintf(mpd, " mimeType=\"%s\"", media_mime);
+ else fprintf(mpd, " mimeType=\"%s; codecs=%s\"", media_mime, media_codecs);
+ if (width && height) fprintf(mpd, " width=\"%d\" height=\"%d\"", width, height);
+ if (sample_rate && nb_channels) fprintf(mpd, " sampleRate=\"%d\" numChannels=\"%d\"", sample_rate, nb_channels);
+ if (langCode[0]) fprintf(mpd, " lang=\"%s\"", langCode);
+ fprintf(mpd, " startWithRAP=\"%s\"", split_seg_at_rap ? "true" : "false");
+ fprintf(mpd, " bandwidth=\"%d\"", bandwidth);
+ fprintf(mpd, ">\n");
+
+}
+
+void mpd_end(FILE *mpd)
+{
+ fprintf(mpd, " </Representation>\n");
+ fprintf(mpd, " </Period>\n");
+ fprintf(mpd, "</MPD>");
+}
+
+static void write_mpd_segment_info(GF_M2TS_IndexingInfo *index_info, char *media_file_name)
+{
+ u32 i;
+ u64 start;
+ char duration_string[100];
+
+ mpd_duration(index_info->segment_duration, duration_string);
+ fprintf(index_info->mpd_file, " <SegmentInfo duration=\"%s\">\n", duration_string);
+ /* add startIndex for live scenarios */
+
+ if (index_info->init_seg_name) {
+ fprintf(index_info->mpd_file, " <InitialisationSegmentURL sourceURL=\"%s\"/>\n", index_info->init_seg_name);
+ }
+
+ if (!index_info->use_index_segment) {
+ fprintf(index_info->mpd_file, " <BaseURL>%s</BaseURL>\n", media_file_name);
+ start=index_info->sidx->first_offset;
+ for (i=0; i<index_info->sidx->nb_refs; i++) {
+ GF_SIDXReference *ref = &index_info->sidx->refs[i];
+ fprintf(index_info->mpd_file, " <Url range=\""LLD"-"LLD"\"/>\n", start, start+ref->reference_offset-1);
+ start += ref->reference_offset;
+ }
+ } else {
+ fprintf(index_info->mpd_file, " <Url sourceURL=\"%s\"/>\n", media_file_name);
+ fprintf(index_info->mpd_file, " <Index sourceURL=\"%s\"/>\n", index_info->index_file_name);
+ }
+ fprintf(index_info->mpd_file, " </SegmentInfo>\n");
+}
+
+void dump_mpeg2_ts(char *mpeg2ts_file, char *pes_out_name, Bool prog_num,
+ Double dash_duration, Bool seg_at_rap, u32 subseg_per_seg,
+ char *seg_name, char *seg_ext, Bool use_url_template, Bool use_index_segment)
{
char data[188];
GF_M2TS_Dump dumper;
u32 size;
u64 fsize, fdone;
GF_M2TS_Demuxer *ts;
+ FILE *src;
- FILE *src = gf_f64_open(mpeg2ts_file, "rb");
+ src = gf_f64_open(mpeg2ts_file, "rb");
ts = gf_m2ts_demux_new();
ts->on_event = on_m2ts_dump_event;
memset(&dumper, 0, sizeof(GF_M2TS_Dump));
ts->user = &dumper;
+ dumper.prog_number = prog_num;
+ if (dash_duration) {
+ char *c;
+ dumper.index_info.segment_duration = dash_duration;
+ dumper.index_info.segment_at_rap = seg_at_rap;
+ dumper.index_info.subsegs_per_segment = subseg_per_seg;
+ dumper.index_info.seg_name = gf_strdup(seg_name);
+ dumper.index_info.use_url_template = use_url_template;
+ dumper.index_info.init_seg_name = NULL;
+ dumper.index_info.use_index_segment = use_index_segment;
+ c = strrchr(mpeg2ts_file, '.');
+ if (c) *c = 0;
+ sprintf(dumper.index_info.index_file_name, "%s_index.%s", mpeg2ts_file, (seg_ext?seg_ext:"m4s"));
+ if (c) *c = '.';
+ dumper.index_info.index_file = gf_f64_open(dumper.index_info.index_file_name, "wb");
+ dumper.index_info.index_bs = gf_bs_from_file(dumper.index_info.index_file, GF_BITSTREAM_WRITE);
+ {
+ GF_SegmentTypeBox *styp = (GF_SegmentTypeBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_STYP);
+ styp->majorBrand = GF_4CC('i','s','s','s');
+ styp->minorVersion = 0;
+ styp->altBrand = (u32*)gf_malloc(sizeof(u32));
+ styp->altBrand[0] = styp->majorBrand;
+ styp->altCount = 1;
+ gf_isom_box_size((GF_Box *)styp);
+ gf_isom_box_write((GF_Box *)styp, dumper.index_info.index_bs);
+ gf_isom_box_del((GF_Box *)styp);
+ }
+ }
+
gf_f64_seek(src, 0, SEEK_END);
fsize = gf_f64_tell(src);
gf_f64_seek(src, 0, SEEK_SET);
fdone = 0;
+ /* first loop to process all packets between two PAT, and assume all signaling was found between these 2 PATs */
+ while (!feof(src)) {
+ size = fread(data, 1, 188, src);
+ if (size<188) break;
+
+ gf_m2ts_process_data(ts, data, size);
+ if (dumper.has_seen_pat) break;
+ }
+
+ if (prog_num && !dash_duration) {
+ sprintf(dumper.timestamps_info_name, "%s_prog_%d_timestamps.txt", mpeg2ts_file, prog_num/*, mpeg2ts_file*/);
+ dumper.timestamps_info_file = gf_f64_open(dumper.timestamps_info_name, "wt");
+ if (!dumper.timestamps_info_file) {
+ fprintf(stderr, "Cannot open file %s\n", dumper.timestamps_info_name);
+ return;
+ }
+ fprintf(dumper.timestamps_info_file, "PCK#\tPID\tPCR\tDTS\tPTS\tRAP\tDiscontinuity\n");
+ }
+
if (pes_out_name) {
char *pid = strrchr(pes_out_name, '#');
if (pid) {
}
}
- while (!feof(src)) {
- size = fread(data, 1, 188, src);
- if (size<188) break;
-
- gf_m2ts_process_data(ts, data, size);
- if (dumper.has_seen_pat) break;
- }
-
gf_m2ts_reset_parsers(ts);
gf_f64_seek(src, 0, SEEK_SET);
fdone = 0;
+ if (dumper.index_info.segment_duration) {
+ dumper.index_info.start_indexing = 1;
+ fprintf(stderr, "Starting indexing ...\n");
+ sprintf(dumper.index_info.mpd_file_name, "%s.mpd", mpeg2ts_file);
+ dumper.index_info.mpd_file = gf_f64_open(dumper.index_info.mpd_file_name, "wt");
+ }
while (!feof(src)) {
size = fread(data, 1, 188, src);
if (size<188) break;
gf_set_progress("MPEG-2 TS Parsing", fdone, fsize);
}
+ if (dumper.index_info.segment_duration) {
+ u64 file_size;
+ /* flush SIDX entry for the last packets */
+ m2ts_sidx_flush_entry(&dumper.index_info);
+ gf_f64_seek(src, 0, SEEK_END);
+ file_size = gf_f64_tell(src);
+ m2ts_sidx_finalize_size(&dumper.index_info, file_size);
+ fprintf(stderr, "Indexing done (1 sidx, %d entries).\n", dumper.index_info.sidx->nb_refs);
+
+ mpd_start(dumper.index_info.mpd_file, 1, mpeg2ts_file, (dumper.index_info.last_PTS-dumper.index_info.first_PTS)/90000.0,
+ "video/mp2t", NULL, 0, 0, 0, 0, "", dumper.index_info.segment_at_rap, file_size, dumper.index_info.segment_duration);
+ write_mpd_segment_info(&dumper.index_info, mpeg2ts_file);
+ mpd_end(dumper.index_info.mpd_file);
+ }
+
fclose(src);
gf_m2ts_demux_del(ts);
if (dumper.pes_out) fclose(dumper.pes_out);
fclose(dumper.pes_out_nhml);
fclose(dumper.pes_out_info);
}
+ if (dumper.timestamps_info_file) fclose(dumper.timestamps_info_file);
+ if (dumper.index_info.sidx) {
+ gf_isom_box_size((GF_Box *)dumper.index_info.sidx);
+ if (dumper.index_info.index_bs) gf_isom_box_write((GF_Box *)dumper.index_info.sidx, dumper.index_info.index_bs);
+ gf_isom_box_del((GF_Box *)dumper.index_info.sidx);
+ }
+ if (dumper.index_info.seg_name) gf_free(dumper.index_info.seg_name);
+ if (dumper.index_info.mpd_file) fclose(dumper.index_info.mpd_file);
+ if (dumper.index_info.index_file) fclose(dumper.index_info.index_file);
+ if (dumper.index_info.index_bs) gf_bs_del(dumper.index_info.index_bs);
}
#endif /*GPAC_DISABLE_MPEG2TS*/
const char *szLan;
GF_Err e;
GF_MediaImporter import;
- char *ext, szName[1000], *fmt, *handler_name;
+ char *ext, szName[1000], *fmt, *handler_name, *rvc_config;
memset(&import, 0, sizeof(GF_MediaImporter));
if (ext && ext[1]=='\\') ext = strchr(szName+2, ':');
handler_name = NULL;
+ rvc_config = NULL;
fmt = NULL;
while (ext) {
char *ext2 = strchr(ext+1, ':');
if (!strcmp(ext+5, "auto")) force_fps = 10000.0;
else if (strchr(ext+5, '-')) {
u32 ticks, dts_inc;
- sscanf(ext+5, "%d-%d", &ticks, &dts_inc);
+ sscanf(ext+5, "%u-%u", &ticks, &dts_inc);
if (!dts_inc) dts_inc=1;
force_fps = ticks;
force_fps /= dts_inc;
}
}
else if (!strnicmp(ext+1, "name=", 5)) handler_name = gf_strdup(ext+6);
+ else if (!strnicmp(ext+1, "rvc=", 4)) rvc_config = gf_strdup(ext+5);
else if (!strnicmp(ext+1, "font=", 5)) import.fontName = gf_strdup(ext+6);
else if (!strnicmp(ext+1, "size=", 5)) import.fontSize = atoi(ext+6);
else if (!strnicmp(ext+1, "fmt=", 4)) import.streamFormat = gf_strdup(ext+5);
handler = GF_4CC(ext[6], ext[7], ext[8], ext[9]);
else if (!strnicmp(ext+1, "layout=", 7)) {
- sscanf(ext+8, "%dx%dx%dx%d", &tw, &th, &tx, &ty);
- track_layout = 1;
+ if ( sscanf(ext+8, "%dx%dx%dx%d", &tw, &th, &tx, &ty)==4) {
+ track_layout = 1;
+ } else if ( sscanf(ext+8, "%dx%d", &tw, &th)==2) {
+ track_layout = 1;
+ tx = ty = 0;
+ }
}
else if (!strnicmp(ext+1, "stype=", 6)) {
stype = GF_4CC(ext[7], ext[8], ext[9], ext[10]);
else if (!strnicmp(ext+1, "profile=", 8)) profile = atoi(ext+9);
else if (!strnicmp(ext+1, "level=", 6)) level = atoi(ext+7);
-
/*unrecognized, assume name has colon in it*/
else {
ext = ext2;
if (gf_isom_get_mpeg4_subtype(import.dest, track, 1))
keep_sys_tracks = 1;
+
+ if (rvc_config) {
+ FILE *f = gf_f64_open(rvc_config, "rb");
+ if (f) {
+ char *data;
+ u32 size;
+ gf_f64_seek(f, 0, SEEK_END);
+ size = (u32) gf_f64_tell(f);
+ gf_f64_seek(f, 0, SEEK_SET);
+ data = gf_malloc(sizeof(char)*size);
+ fread(data, 1, size, f);
+ fclose(f);
+ gf_gz_compress_payload(&data, size, &size);
+
+ e = gf_isom_set_meta_type(import.dest, 0, track, GF_4CC('r','v','c','z'));
+ gf_isom_modify_alternate_brand(import.dest, GF_ISOM_BRAND_ISO2, 1);
+ gf_isom_set_meta_xml_memory(import.dest, 0, track, data, size, 1);
+ gf_free(data);
+ }
+ }
}
if (track_id) fprintf(stdout, "WARNING: Track ID %d not found in file\n", track_id);
else if (do_video) fprintf(stdout, "WARNING: Video track not found\n");
if (import.fontName) gf_free(import.fontName);
if (import.streamFormat) gf_free(import.streamFormat);
if (import.force_ext) gf_free(import.force_ext);
+ if (rvc_config) gf_free(rvc_config);
return e;
}
/*we only support cat with the same number of sample descriptions*/
if (gf_isom_get_sample_description_count(orig, i+1) != gf_isom_get_sample_description_count(dest, dst_tk)) dst_tk = 0;
/*if not forcing cat, check the media codec config is the same*/
- if (!force_cat && !gf_isom_is_same_sample_description(orig, i+1, dest, dst_tk)) dst_tk = 0;
+ if (!gf_isom_is_same_sample_description(orig, i+1, dest, dst_tk)) {
+ if (!force_cat) {
+ dst_tk = 0;
+ } else {
+ fprintf(stdout, "WARNING: Concatenating track ID %d even though sample descriptions do not match\n", tk_id);
+ }
+ }
/*we force the same visual resolution*/
else if (mtype==GF_ISOM_MEDIA_VISUAL) {
u32 w, h, ow, oh;
gf_isom_get_visual_info(orig, i+1, 1, &ow, &oh);
gf_isom_get_visual_info(dest, dst_tk, 1, &w, &h);
- if ((ow!=w) || (oh!=h)) dst_tk = 0;
+ if ((ow!=w) || (oh!=h)) {
+ if (!force_cat) {
+ dst_tk = 0;
+ } else {
+ fprintf(stdout, "WARNING: Concatenating track ID %d even though visual sizes do not match\n", tk_id);
+ }
+ }
}
if (!dst_tk && ((stype == GF_ISOM_SUBTYPE_AVC_H264) || (stype == GF_ISOM_SUBTYPE_AVC2_H264)) ) {
char *inName = NULL;
u16 port = 7000;
u32 ttl = 1;
- Bool loop = 1, stream_rtp = 0;
+ Bool loop = 1;
Bool force_mpeg4 = 0;
u32 path_mtu = 1450;
u32 i;
}
/*send data*/
else {
+ Bool rap = rtpch->rap;
+ if (livesess->carousel_generation) rap = 1;
ts += rtpch->timescale*(gf_sys_clock()-rtpch->init_time + rtpch->ts_delta)/1000;
- gf_rtp_streamer_send_au_with_sn(rtpch->rtp, data, size, ts, ts, rtpch->rap ? 1 : 0, (livesess->critical || rtpch->critical) ? 1 : 0 );
- fprintf(stdout, "Stream %d: Sending update at TS "LLD", %d bytes - RAP %d - critical %d\n", ESID, ts, size, rtpch->rap, (livesess->critical || rtpch->critical) ? 1 : 0);
+ gf_rtp_streamer_send_au_with_sn(rtpch->rtp, data, size, ts, ts, rap, (livesess->critical || rtpch->critical) ? 1 : 0 );
+ fprintf(stdout, "Stream %d: Sending update at TS "LLD", %d bytes - RAP %d - critical %d\n", ESID, ts, size, rap, (livesess->critical || rtpch->critical) ? 1 : 0);
rtpch->rap = rtpch->critical = 0;
if (rtpch->manual_rtcp) gf_rtp_streamer_send_rtcp(rtpch->rtp, 0, 0);
}
} else {
u32 i=0;
- while (ch = gf_list_enum(livesess->streams, &i)) {
+ while (NULL != (ch = gf_list_enum(livesess->streams, &i))) {
if (ch->carousel_size) {
if (ch->adjust_carousel_time) {
ts = ch->carousel_ts + ch->timescale*(gf_sys_clock()-ch->init_time + ch->ts_delta)/1000;
for (i=0; i<count; i++) {
u16 ESID;
u32 st, oti, ts;
- const char *config;
+ char *config = NULL;
u32 config_len;
gf_seng_get_stream_config(livesess->seng, i, &ESID, &config, &config_len, &st, &oti, &ts);
s32 next_time;
u64 last_src_modif, mod_time;
char *src_name = NULL;
- Bool run, has_carousel;
+ Bool run, has_carousel, skip_init_scene;
Bool udp = 0;
u16 sk_port=0;
GF_Socket *sk = NULL;
Bool update_context;
u32 period, ts_delta;
u16 es_id;
-
+ e = GF_OK;
+ /* souchay : needs to initialize those two vars... */
+ aggregate_au = 1;
+ es_id = 0;
+ skip_init_scene = 0;
gf_sys_init(0);
memset(&livesess, 0, sizeof(LiveSession));
else if (!strnicmp(arg, "-ttl=", 5)) ttl = atoi(arg+5);
else if (!strnicmp(arg, "-ifce=", 6)) ifce_addr = arg+6;
+ else if (!strnicmp(arg, "-dims-stream", 12)) {
+ load_type = GF_SM_LOAD_DIMS;
+ skip_init_scene = 1;
+ }
else if (!strnicmp(arg, "-dims", 5)) load_type = GF_SM_LOAD_DIMS;
else if (!strnicmp(arg, "-src=", 5)) src_name = arg+5;
else if (!strnicmp(arg, "-udp=", 5)) { sk_port = atoi(arg+5); udp = 1; }
RTPChannel *ch;
period = id = 0;
if (strchr(arg, ':')) {
- sscanf(arg, "-rap=ESID=%d:%d", &id, &period);
+ sscanf(arg, "-rap=ESID=%u:%u", &id, &period);
e = gf_seng_enable_aggregation(livesess.seng, id, 1);
if (e) {
- fprintf(stdout, "Cannot enable aggregation on stream %d: %s\n", id, gf_error_to_string(e));
+ fprintf(stdout, "Cannot enable aggregation on stream %u: %s\n", id, gf_error_to_string(e));
goto exit;
}
} else {
- sscanf(arg, "-rap=%d", &period);
+ sscanf(arg, "-rap=%u", &period);
}
j=0;
- while (ch = gf_list_enum(livesess.streams, &j)) {
+ while (NULL != (ch = gf_list_enum(livesess.streams, &j))) {
if (!id || (ch->ESID==id))
ch->carousel_period = period;
}
}
i=0;
- while (ch = gf_list_enum(livesess.streams, &i)) {
+ while (NULL != (ch = gf_list_enum(livesess.streams, &i))) {
if (ch->carousel_period) {
has_carousel = 1;
break;
}
}
+
update_context = 0;
- livesess.carousel_generation = 1;
- gf_seng_encode_context(livesess.seng, live_session_callback);
- livesess.carousel_generation = 0;
+
+ if (has_carousel || !skip_init_scene) {
+ livesess.carousel_generation = 1;
+ gf_seng_encode_context(livesess.seng, live_session_callback);
+ livesess.carousel_generation = 0;
+ }
live_session_send_carousel(&livesess, NULL);
char szCom[8192];
fprintf(stdout, "Enter command to send:\n");
szCom[0] = 0;
- scanf("%[^\t\n]", szCom);
+ if (1 > scanf("%[^\t\n]", szCom)){
+ fprintf(stderr, "No command entered properly, aborting.\n");
+ break;
+ }
/*stdin flush bug*/
while (getchar()!='\n') {}
e = gf_seng_encode_from_string(livesess.seng, 0, 0, szCom, live_session_callback);
char szCom[8192];
fprintf(stdout, "Enter command to send:\n");
szCom[0] = 0;
- scanf("%[^\t\n]", szCom);
+ if (1 > scanf("%[^\t\n]", szCom)){
+ printf("No command entered properly, aborting.\n");
+ break;
+ }
/*stdin flush bug*/
while (getchar()!='\n') {}
e = gf_seng_encode_from_string(livesess.seng, 0, 1, szCom, live_session_callback);
{
char rad[GF_MAX_PATH];
fprintf(stdout, "Enter output file name - \"std\" for stdout: ");
- scanf("%s", rad);
+ if (1 > scanf("%s", rad)){
+ fprintf(stderr, "No ouput file name entered, aborting.\n");
+ break;
+ }
e = gf_seng_save_context(livesess.seng, !strcmp(rad, "std") ? NULL : rad);
fprintf(stdout, "Dump done (%s)\n", gf_error_to_string(e));
}
if (!srcf) continue;
/*checks if we have a broadcast config*/
- fgets(flag_buf, 200, srcf);
+ if (!fgets(flag_buf, 200, srcf))
+ flag_buf[0] = '\0';
fclose(srcf);
aggregate_on_stream = (u16) -1;
#include <gpac/scene_manager.h>
+#include <gpac/download.h>
#ifdef GPAC_DISABLE_ISOM
#include <gpac/ismacryp.h>
#include <gpac/constants.h>
+#include <gpac/internal/mpd.h>
+
#include <time.h>
#define BUFFSIZE 8192
const char *GetLanguageCode(char *lang);
#ifndef GPAC_DISABLE_MPEG2TS
-void dump_mpeg2_ts(char *mpeg2ts_in, char *pes_out_name);
+void dump_mpeg2_ts(char *mpeg2ts_file, char *pes_out_name, Bool prog_num,
+ Double dash_duration, Bool seg_at_rap, u32 subseg_per_seg,
+ char *seg_name, char *seg_ext, Bool use_url_template, Bool use_index_segment);
#endif
void PrintLiveUsage();
-Bool quiet = 0;
+u32 quiet = 0;
Bool dvbhdemux =0;
Bool keep_sys_tracks = 0;
{GF_ISOM_ITUNE_COMMENT, "comment", "usage: comment=any comment"},
{GF_ISOM_ITUNE_COMPILATION, "compilation", "usage: compilation=yes,no"},
{GF_ISOM_ITUNE_COMPOSER, "composer", "usage: composer=name"},
- {GF_ISOM_ITUNE_CREATED, "created", ""},
+ {GF_ISOM_ITUNE_CREATED, "created", "usage: created=time"},
{GF_ISOM_ITUNE_DISK, "disk", "usage: disk=x/N"},
{GF_ISOM_ITUNE_TOOL, "tool", "usage: tool=name"},
{GF_ISOM_ITUNE_GENRE, "genre", "usage: genre=name"},
{GF_ISOM_ITUNE_TEMPO, "tempo", "usage: tempo=integer"},
{GF_ISOM_ITUNE_WRITER, "writer", "usage: writer=name"},
{GF_ISOM_ITUNE_GROUP, "group", "usage: group=name"},
- {GF_ISOM_ITUNE_COVER_ART, "cover", "usage: covber=file.jpg,file.png"},
+ {GF_ISOM_ITUNE_COVER_ART, "cover", "usage: cover=file.jpg,file.png"},
{GF_ISOM_ITUNE_ENCODER, "encoder", "usage: encoder=name"},
- {GF_ISOM_ITUNE_GAPELESS, "gapeless", "usage: artist=yes,no"},
+ {GF_ISOM_ITUNE_GAPLESS, "gapless", "usage: gapless=yes,no"},
};
u32 nb_itunes_tags = sizeof(itags) / sizeof(itunes_tag);
" -enable trackID enables track\n"
" -disable trackID disables track\n"
" -new forces creation of a new destination file\n"
- " -rem trackID removes track from file\n"
" -lang [tkID=]LAN sets track language. LAN is the ISO 639-2 code (eng, und)\n"
" -delay tkID=TIME sets track start delay in ms.\n"
" -par tkID=PAR sets visual track pixel aspect ratio (PAR=N:D or \"none\")\n"
" -group-rem ID removes the track's group\n"
" -group-clean removes all group information from all tracks\n"
" -ref id:XXXX:refID adds a reference of type 4CC from track ID to track refID\n"
+ "\n"
+ " -dash dur enables DASH-ing of the file with a segment duration of DUR\n"
+ " Note: the duration of a fragment (subsegment) is set\n"
+ " using the interleaver (-inter) switch.\n"
+ " Note: You can specify -rap switch to split segments at RAP boundaries\n"
+ " -frags-per-sidx N sets the number of segments to be written in each SIDX box\n"
+ " If 0, SIDX box is not used\n"
+ " -segment-name name sets the segment name for generated segments\n"
+ " If not set (default), segments are concatenated in output file\n"
+ " -segment-ext name sets the segment extension. Default is m4s\n"
+ " -url-template uses UrlTemplate instead of explicit sources in segments.\n"
+ " Ignored if segments are stored in the output file.\n"
"\n");
}
" the tracks in the file are used.\n"
" - if Y=-1, the layout is moved to the bottom of the\n"
" track area\n"
+ " - X and Y can be omitted (:layout=WxH)\n"
"\n"
" -add file add file tracks to (new) output file\n"
" -cat file concatenates file samples to (new) output file\n"
" -languages lists supported ISO 639 languages\n"
"\n"
"-quiet quiet mode\n"
+ "-noprog disables progress\n"
" -v verbose mode\n"
" -version gets build version\n"
);
}
#endif
-static void progress_quiet(void *cbck, char *title, u64 done, u64 total) { }
+static void progress_quiet(const void *cbck, const char *title, u64 done, u64 total) { }
typedef struct
if (next) next[0] = 0;
if (!strnicmp(szSlot, "tk=", 3)) {
- sscanf(szSlot, "tk=%d", &meta->trackID);
+ sscanf(szSlot, "tk=%u", &meta->trackID);
meta->root_meta = 0;
ret = 1;
}
TSELAction tsel_acts[MAX_CUMUL_OPS];
u64 movie_time;
u32 brand_add[MAX_CUMUL_OPS], brand_rem[MAX_CUMUL_OPS];
- u32 i, MTUSize, stat_level, hint_flags, info_track_id, import_flags, nb_add, nb_cat, ismaCrypt, agg_samples, nb_sdp_ex, max_ptime, raw_sample_num, split_size, nb_meta_act, nb_track_act, rtp_rate, major_brand, nb_alt_brand_add, nb_alt_brand_rem, old_interleave, car_dur, minor_version, conv_type, nb_tsel_acts, frags_per_sidx;
+ u32 i, MTUSize, stat_level, hint_flags, info_track_id, import_flags, nb_add, nb_cat, ismaCrypt, agg_samples, nb_sdp_ex, max_ptime, raw_sample_num, split_size, nb_meta_act, nb_track_act, rtp_rate, major_brand, nb_alt_brand_add, nb_alt_brand_rem, old_interleave, car_dur, minor_version, conv_type, nb_tsel_acts, frags_per_sidx, program_number;
Bool HintIt, needSave, FullInter, Frag, HintInter, dump_std, dump_rtp, dump_mode, regular_iod, trackID, HintCopy, remove_sys_tracks, remove_hint, force_new, remove_root_od, import_subtitle, dump_chap;
- Bool print_sdp, print_info, open_edit, track_dump_type, dump_isom, dump_cr, force_ocr, encode, do_log, do_flat, dump_srt, dump_ttxt, x3d_info, chunk_mode, dump_ts, do_saf, dump_m2ts, dump_cart, do_hash, verbose, force_cat, pack_wgt;
+ Bool print_sdp, print_info, open_edit, track_dump_type, dump_isom, dump_cr, force_ocr, encode, do_log, do_flat, dump_srt, dump_ttxt, x3d_info, chunk_mode, dump_ts, do_saf, do_mpd, dump_m2ts, dump_cart, do_hash, verbose, force_cat, pack_wgt, dash_ts_use_index;
char *inName, *outName, *arg, *mediaSource, *tmpdir, *input_ctx, *output_ctx, *drm_file, *avi2raw, *cprt, *chap_file, *pes_dump, *itunes_tags, *pack_file, *raw_cat, *seg_name;
GF_ISOFile *file;
Bool stream_rtp=0;
Bool live_scene=0;
Bool dump_iod=0;
+ Bool use_url_template=0;
Bool seg_at_rap =0;
+ char *seg_ext = "m4s";
if (argc < 2) {
PrintUsage();
split_start = -1.0;
InterleavingTime = 0.5;
dash_duration = 0.0;
+ dash_ts_use_index = 0;
import_fps = 0;
import_flags = 0;
split_size = 0;
movie_time = 0;
MTUSize = 1450;
- HintCopy = FullInter = HintInter = encode = do_log = old_interleave = do_saf = do_hash = verbose = 0;
+ HintCopy = FullInter = HintInter = encode = do_log = old_interleave = do_saf = do_mpd = do_hash = verbose = 0;
chunk_mode = dump_mode = Frag = force_ocr = remove_sys_tracks = agg_samples = remove_hint = keep_sys_tracks = remove_root_od = 0;
x3d_info = conv_type = HintIt = needSave = print_sdp = print_info = regular_iod = dump_std = open_edit = dump_isom = dump_rtp = dump_cr = dump_chap = dump_srt = dump_ttxt = force_new = dump_ts = dump_m2ts = dump_cart = import_subtitle = force_cat = pack_wgt = 0;
frags_per_sidx = 1;
#endif
trackID = stat_level = hint_flags = 0;
+ program_number = 0;
info_track_id = 0;
do_flat = 0;
inName = outName = mediaSource = input_ctx = output_ctx = drm_file = avi2raw = cprt = chap_file = pack_file = raw_cat = NULL;
else if (!stricmp(arg, "-?")) { PrintUsage(); return 0; }
else if (!stricmp(arg, "-version")) { PrintVersion(); return 0; }
else if (!stricmp(arg, "-sdp")) print_sdp = 1;
- else if (!stricmp(arg, "-quiet")) quiet = 1;
+ else if (!stricmp(arg, "-quiet")) quiet = 2;
+ else if (!stricmp(arg, "-noprog")) quiet = 1;
else if (!stricmp(arg, "-info")) {
print_info = 1;
- if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%d", &info_track_id)==1)) {
+ if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%u", &info_track_id)==1)) {
char szTk[20];
- sprintf(szTk, "%d", info_track_id);
+ sprintf(szTk, "%u", info_track_id);
if (!strcmp(szTk, argv[i+1])) i++;
else info_track_id=0;
} else {
CHECK_NEXT_ARG
track_dump_type = GF_EXPORT_RAW_SAMPLES;
if (strchr(argv[i+1], ':')) {
- sscanf(argv[i+1], "%d:%d", &trackID, &raw_sample_num);
+ sscanf(argv[i+1], "%u:%u", &trackID, &raw_sample_num);
} else {
trackID = atoi(argv[i+1]);
}
fprintf(stdout, "WARNING: \"-dmp4\" is deprecated - use \"-diso\" option\n");
}
else if (!stricmp(arg, "-drtp")) dump_rtp = 1;
- else if (!stricmp(arg, "-dts")) dump_ts = 1;
- else if (!stricmp(arg, "-dcr")) dump_cr = 1;
+ else if (!stricmp(arg, "-dts")) {
+ dump_ts = 1;
+ if ( ((i+1<(u32) argc) && inName) || (i+2<(u32) argc) ) {
+ if (argv[i+1][0] != '-') program_number = atoi(argv[i+1]);
+ i++;
+ }
+ } else if (!stricmp(arg, "-dcr")) dump_cr = 1;
else if (!stricmp(arg, "-ttxt") || !stricmp(arg, "-srt")) {
- if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%d", &trackID)==1)) {
+ if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%u", &trackID)==1)) {
char szTk[20];
sprintf(szTk, "%d", trackID);
if (!strcmp(szTk, argv[i+1])) i++;
dash_duration = atof(argv[i+1]) / 1000;
needSave = 1;
i++;
+ } else if (!stricmp(arg, "-dash-ts-prog")) {
+ CHECK_NEXT_ARG
+ program_number = atoi(argv[i+1]);
+ i++;
+ } else if (!stricmp(arg, "-dash-ts-use-index")) {
+ dash_ts_use_index = 1;
} else if (!stricmp(arg, "-frags-per-sidx")) {
CHECK_NEXT_ARG
frags_per_sidx = atoi(argv[i+1]);
CHECK_NEXT_ARG
seg_name = argv[i+1];
i++;
- }
+ } else if (!stricmp(arg, "-segment-ext")) {
+ CHECK_NEXT_ARG
+ seg_ext = argv[i+1];
+ i++;
+ } else if (!stricmp(arg, "-url-template")) {
+ use_url_template = 1;
+ }
else if (!stricmp(arg, "-itags")) { CHECK_NEXT_ARG itunes_tags = argv[i+1]; i++; open_edit = 1; }
#ifndef GPAC_DISABLE_ISOM_HINTING
else if (!stricmp(arg, "-hint")) { open_edit = 1; HintIt = 1; }
else if (!stricmp(arg, "-static")) hint_flags |= GP_RTP_PCK_USE_STATIC_ID;
else if (!stricmp(arg, "-multi")) {
hint_flags |= GP_RTP_PCK_USE_MULTI;
- if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%d", &max_ptime)==1)) {
+ if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%u", &max_ptime)==1)) {
char szPt[20];
- sprintf(szPt, "%d", max_ptime);
+ sprintf(szPt, "%u", max_ptime);
if (!strcmp(szPt, argv[i+1])) i++;
else max_ptime=0;
}
id = strchr(argv[i+1], ':');
if (id) {
id[0] = 0;
- if (sscanf(argv[i+1], "%d", &sdp_lines[0].trackID)==1) {
+ if (sscanf(argv[i+1], "%u", &sdp_lines[0].trackID)==1) {
id[0] = ':';
sdp_lines[nb_sdp_ex].line = id+1;
} else {
if (!strcmp(argv[i+1], "auto")) import_fps = 10000.0;
else if (strchr(argv[i+1], '-')) {
u32 ticks, dts_inc;
- sscanf(argv[i+1], "%d-%d", &ticks, &dts_inc);
+ sscanf(argv[i+1], "%u-%u", &ticks, &dts_inc);
if (!dts_inc) dts_inc=1;
import_fps = ticks;
import_fps /= dts_inc;
else if (!stricmp(arg, "-ms")) { CHECK_NEXT_ARG mediaSource = argv[i+1]; i++; }
else if (!stricmp(arg, "-mp4")) { encode = 1; open_edit = 1; }
else if (!stricmp(arg, "-saf")) { do_saf = 1; }
- else if (!stricmp(arg, "-log")) do_log = 1;
+ else if (!stricmp(arg, "-log")) { do_log = 1; }
+ else if (!stricmp(arg, "-mpd")) {
+ do_mpd = 1;
+ CHECK_NEXT_ARG
+ outName = argv[i+1];
+ i++;
+ }
#ifndef GPAC_DISABLE_SCENE_ENCODER
else if (!stricmp(arg, "-def")) opts.flags |= GF_SM_ENCODE_USE_NAMES;
else if (!stricmp(arg, "-sync")) {
gf_log_set_level(verbose ? GF_LOG_DEBUG : GF_LOG_INFO);
gf_log_set_tools(GF_LOG_CONTAINER|GF_LOG_SCENE|GF_LOG_PARSER|GF_LOG_AUTHOR|GF_LOG_CODING);
if (quiet) {
- gf_log_set_level(0);
+ if (quiet==2) gf_log_set_level(0);
gf_set_progress_callback(NULL, progress_quiet);
}
/*init libgpac*/
- gf_sys_init(0);
-
+ gf_sys_init(1);
+
+ if (do_mpd) {
+ Bool remote = 0;
+ char *mpd_base_url = gf_strdup(inName);
+ if (strcmp(inName, "http://")) {
+ e = gf_dm_wget(inName, "tmp_main.m3u8");
+ if (e != GF_OK) {
+ fprintf(stdout, "Cannot retrieve M3U8 (%s): %s\n", inName, gf_error_to_string(e));
+ gf_free(mpd_base_url);
+ return 1;
+ }
+ inName = "tmp_main.m3u8";
+ remote = 1;
+ }
+ e = gf_m3u8_to_mpd(NULL, inName, mpd_base_url, (outName ? outName : inName), 0, "video/mp2t");
+ gf_free(mpd_base_url);
+ if (remote) {
+ //gf_delete_file("tmp_main.m3u8");
+ }
+ if (e != GF_OK) {
+ fprintf(stdout, "Error converting M3U8 (%s) to MPD (%s): %s\n", inName, outName, gf_error_to_string(e));
+ return 1;
+ } else {
+ return 0;
+ }
+ }
if (do_saf && !encode) {
switch (get_file_type_by_ext(inName)) {
}
}
- if (dump_m2ts) {
+ if (dash_duration) {
+#ifndef GPAC_DISABLE_MPEG2TS
+ dump_mpeg2_ts(inName, NULL, program_number, dash_duration, seg_at_rap, frags_per_sidx,
+ seg_name, seg_ext, use_url_template, dash_ts_use_index);
+#endif
+ } else if (dump_m2ts) {
+#ifndef GPAC_DISABLE_MPEG2TS
+ dump_mpeg2_ts(inName, pes_dump, program_number, 0, 0, 0, NULL, NULL, 0, 0);
+#endif
+ } else if (dump_ts) { /* dump_ts means dump time stamp information */
#ifndef GPAC_DISABLE_MPEG2TS
- dump_mpeg2_ts(inName, pes_dump);
+ dump_mpeg2_ts(inName, pes_dump, program_number, 0, 0, 0, NULL, NULL, 0, 0);
#endif
} else {
convert_file_info(inName, info_track_id);
fwrite(desc, 1, size, iodf);
gf_free(desc);
} else {
- fprintf(stdout, "Error writing IOD\n", szName);
+ fprintf(stdout, "Error writing IOD %s\n", szName);
}
fclose(iodf);
}
needSave = 1;
break;
case 6:
- e = gf_isom_remove_meta_xml(file, meta->root_meta, tk);
- needSave = 1;
+ if (gf_isom_get_meta_item_count(file, meta->root_meta, tk)) {
+ e = gf_isom_remove_meta_xml(file, meta->root_meta, tk);
+ needSave = 1;
+ } else {
+ fprintf(stdout, "No meta box in input file\n");
+ }
break;
case 8:
- e = gf_isom_extract_meta_item(file, meta->root_meta, tk, meta->item_id, strlen(meta->szPath) ? meta->szPath : NULL);
+ if (gf_isom_get_meta_item_count(file, meta->root_meta, tk)) {
+ e = gf_isom_extract_meta_item(file, meta->root_meta, tk, meta->item_id, strlen(meta->szPath) ? meta->szPath : NULL);
+ } else {
+ fprintf(stdout, "No meta box in input file\n");
+ }
break;
#endif
case 7:
- e = gf_isom_extract_meta_xml(file, meta->root_meta, tk, meta->szPath, NULL);
+ if (gf_isom_get_meta_item_count(file, meta->root_meta, tk)) {
+ e = gf_isom_extract_meta_xml(file, meta->root_meta, tk, meta->szPath, NULL);
+ } else {
+ fprintf(stdout, "No meta box in input file\n");
+ }
break;
}
if (e) goto err_exit;
}
- if (!open_edit) {
+ if (!open_edit && !needSave) {
if (file) gf_isom_delete(file);
gf_sys_close();
return 0;
n = t = 0;
memset(_t, 0, sizeof(char)*8);
tlen = (itag==GF_ISOM_ITUNE_DISK) ? 6 : 8;
- if (sscanf(val, "%d/%d", &n, &t) == 2) { _t[3]=n; _t[5]=t;}
- else if (sscanf(val, "%d", &n) == 1) { _t[3]=n;}
+ if (sscanf(val, "%u/%u", &n, &t) == 2) { _t[3]=n; _t[5]=t;}
+ else if (sscanf(val, "%u", &n) == 1) { _t[3]=n;}
else tlen = 0;
if (tlen) gf_isom_apple_set_tag(file, itag, _t, tlen);
}
break;
- case GF_ISOM_ITUNE_GAPELESS:
+ case GF_ISOM_ITUNE_GAPLESS:
case GF_ISOM_ITUNE_COMPILATION:
{
char _t[1];
while (outfile[strlen(outfile)-1] != '.') outfile[strlen(outfile)-1] = 0;
outfile[strlen(outfile)-1] = 0;
if (!outName) strcat(outfile, "_dash");
- e = gf_media_fragment_file(file, outfile, InterleavingTime, seg_at_rap ? 2 : 1, dash_duration, seg_name, frags_per_sidx, 0);
+ e = gf_media_fragment_file(file, outfile, InterleavingTime, seg_at_rap ? 2 : 1, dash_duration, seg_name, seg_ext, frags_per_sidx, 0, use_url_template);
if (e) fprintf(stdout, "Error while DASH-ing file: %s\n", gf_error_to_string(e));
gf_isom_delete(file);
gf_sys_close();
if (!InterleavingTime) InterleavingTime = 0.5;
if (HintIt) fprintf(stdout, "Warning: cannot hint and fragment - ignoring hint\n");
fprintf(stdout, "Fragmenting file (%.3f seconds fragments)\n", InterleavingTime);
- e = gf_media_fragment_file(file, outfile, InterleavingTime, 0, 0, NULL, 0, 0);
+ e = gf_media_fragment_file(file, outfile, InterleavingTime, 0, 0, NULL, NULL, 0, 0, 0);
if (e) fprintf(stdout, "Error while fragmenting file: %s\n", gf_error_to_string(e));
gf_isom_delete(file);
if (!e && !outName && !force_new) {
vpath %.c $(SRC_PATH)/applications/mp4client
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include -I../../
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" -I../../
LINKLIBS=$(OGL_LIBS)
endif
ifneq ($(CONFIG_JPEG), no)
-LINKLIBS+= -L$(prefix)/lib
+#LINKLIBS+= -L$(prefix)/lib
else
ifneq ($(CONFIG_PNG), no)
-LINKLIBS+= -L$(prefix)/lib
+#LINKLIBS+= -L$(prefix)/lib
else
ifeq ($(CONFIG_JS),prefix)
-LINKLIBS+= -L$(prefix)/lib
+#LINKLIBS+= -L$(prefix)/lib
endif
endif
endif
ifeq ($(CONFIG_JPEG), no)
else
-LINKLIBS+= -ljpeg
+#LINKLIBS+= -ljpeg
endif
-ifeq ($(CONFIG_JS), prefix)
-LINKLIBS+= -ljs
-else
-endif
ifeq ($(CONFIG_PNG), no)
else
-LINKLIBS+= -lpng
+#LINKLIBS+= -lpng
endif
all: $(PROG)
MP4Client$(EXE): $(OBJS)
- $(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -L../../extra_lib/lib/gcc -lgpac -lz $(LINKLIBS)
+ $(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -lgpac $(LINKLIBS)
%.o: %.c
$(CC) $(CFLAGS) $(INSTALL_FLAGS) -c -o $@ $<
fclose(fout);
}
+#include <gpac/avparse.h>
+
+void write_png(GF_VideoSurface *fb, char *rad_name, u32 img_num)
+{
+ char str[GF_MAX_PATH];
+ FILE *fout;
+ u32 dst_size;
+ char *dst;
+ char *prev = strrchr(rad_name, '.');
+ if (prev) prev[0] = '\0';
+ sprintf(str, "%s_%d.png", rad_name, img_num);
+ if (prev) prev[0] = '.';
+
+ switch (fb->pixel_format) {
+ case GF_PIXEL_ARGB:
+ case GF_PIXEL_RGBA:
+ dst_size = fb->width*fb->height*4;
+ break;
+ default:
+ dst_size = fb->width*fb->height*3;
+ break;
+ }
+ dst = (char*)gf_malloc(sizeof(char)*dst_size);
+
+
+ fout = gf_f64_open(str, "wb");
+ if (fout) {
+ GF_Err e = gf_img_png_enc(fb->video_buffer, fb->width, fb->height, fb->pitch_y, fb->pixel_format, dst, &dst_size);
+ if (!e) {
+ fwrite(dst, dst_size, 1, fout);
+ fclose(fout);
+ }
+ }
+
+ gf_free(dst);
+}
+
+
+
/*writes onto a file the content of the framebuffer in *fb interpreted as the byte depthbuffer */
/*it's also possible to write a float depthbuffer by passing the floats to strings and writing chars in putpixel - see comments*/
void write_depthfile(GF_VideoSurface *fb, char *rad_name, u32 img_num)
case 2:
write_bmp(&fb, rad_name, frameNum);
break;
+ case 11:
+ write_png(&fb, rad_name, frameNum);
+ break;
case 3:
write_raw(&fb, rad_name, frameNum);
break;
else e = gf_sc_get_screen_buffer(term->compositor, &fb, 0);
if (e) fprintf(stdout, "Error grabbing frame buffer: %s\n", gf_error_to_string(e));
- if (dump_type!=5 && dump_type!= 10) {
- out_size = fb.height*fb.width*3;
- } else {
- out_size = fb.height*fb.width*4;
- }
/*export frame*/
switch (dump_type) {
case 1:
break;
}
}
+ if (dump_type!=5 && dump_type!= 10 && dump_type!= 11) {
+ out_size = fb.height*fb.width*3;
+ } else {
+ out_size = fb.height*fb.width*4;
+ }
#ifndef GPAC_DISABLE_AVILIB
if (dump_type!=5 && dump_type!= 10) {
if (AVI_write_frame(avi_out, conv_buf, out_size, 1) <0)
case 2:
write_bmp(&fb, rad_name, frameNum);
break;
+ case 11:
+ write_png(&fb, rad_name, frameNum);
+ break;
case 6:
case 9:
write_texture_file(&fb, rad_name, frameNum, dump_type);
#include <gpac/iso639.h>
#ifndef WIN32
+#include <dlfcn.h>
#include <pwd.h>
#include <unistd.h>
+#if defined(__DARWIN__) || defined(__APPLE__)
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
#else
#include <windows.h> /*for GetModuleFileName*/
#define SHGFP_TYPE_CURRENT 0 /*needed for MinGW*/
#endif
-#ifdef _MSC_VER
-/*get rid of console*/
-#if 0
-#pragma comment(linker,"/SUBSYSTEM:WINDOWS")
-#pragma comment(linker,"/ENTRY:main")
-#else
-#pragma comment(linker,"/SUBSYSTEM:CONSOLE")
-#endif
-
-#endif // _MSC_VER
-
#endif //WIN32
/*local prototypes*/
void ViewODs(GF_Terminal *term, Bool show_timing);
void PrintGPACConfig();
+static Bool gui_mode = 0;
+
static Bool restart = 0;
#if defined(__DARWIN__) || defined(__APPLE__)
-static Bool not_threaded = 1;
+//we keep no decoder thread because of JS_GC deadlocks between threads ...
+static u32 threading_flags = GF_TERM_NO_COMPOSITOR_THREAD | GF_TERM_NO_DECODER_THREAD;
#else
-static Bool not_threaded = 0;
+static u32 threading_flags = 0;
#endif
static Bool no_audio = 0;
+static Bool term_step = 0;
static Bool no_regulation = 0;
static Bool bench_mode = 0;
Bool is_connected = 0;
static Bool display_rti = 0;
static Bool Run;
static Bool CanSeek = 0;
-static u32 Volume=100;
static char the_url[GF_MAX_PATH];
static char pl_path[GF_MAX_PATH];
static Bool no_mime_check = 1;
static Bool be_quiet = 0;
static u32 log_time_start = 0;
-
+static Bool loop_at_end = 0;
static u32 forced_width=0;
static u32 forced_height=0;
void dump_frame(GF_Terminal *term, char *rad_path, u32 dump_type, u32 frameNum);
Bool dump_file(char *the_url, u32 dump_mode, Double fps, u32 width, u32 height, Float scale, u32 *times, u32 nb_times);
+
+void hide_shell(u32 cmd_type)
+{
+#if defined(WIN32) && !defined(_WIN32_WCE)
+ typedef HWND (WINAPI *GetConsoleWindowT)(void);
+ HMODULE hk32 = GetModuleHandle("kernel32.dll");
+ GetConsoleWindowT GetConsoleWindow = (GetConsoleWindowT ) GetProcAddress(hk32,"GetConsoleWindow");
+ if (cmd_type==0) ShowWindow( GetConsoleWindow(), SW_SHOW);
+ else if (cmd_type==1) ShowWindow( GetConsoleWindow(), SW_HIDE);
+ else if (cmd_type==2) PostMessage(GetConsoleWindow(), WM_CLOSE, 0, 0);
+#endif
+}
+
+
+
+
void PrintUsage()
{
fprintf(stdout, "Usage MP4Client [options] [filename]\n"
" default alignment is top-left\n"
" default alignment is top-left\n"
"\t-pause: pauses at first frame\n"
+ "\t-loop: loops presentation\n"
"\n"
"Dumper Options:\n"
"\t-bmp [times]: dumps given frames to bmp\n"
- "\t-raw [times]: dumps given frames to bmp\n"
+ "\t-png [times]: dumps given frames to png\n"
+ "\t-raw [times]: dumps given frames to raw\n"
"\t-avi [times]: dumps given file to raw avi\n"
"\t-rgbds: dumps the RGBDS pixel format texture\n"
" with -avi [times]: dumps an rgbds-format .avi\n"
{
GF_Config *cfg;
char szPath[GF_MAX_PATH];
+ char gui_path[GF_MAX_PATH];
#ifdef WIN32
FILE *f;
Bool write_access = 0;
+ strcpy(gui_path, file_path);
+
/*following code is highly inspired by Osmo4*/
/*do we have the write privileges on this dir ? if not, use user local data directory*/
strcpy(szPath, file_path);
}
#else
FILE *f;
+ strcpy(gui_path, "");
+
sprintf(szPath, "%s%c%s", file_path, GF_PATH_SEPARATOR, file_name);
f = gf_f64_open(szPath, "wt");
fprintf(stdout, "create %s: %s\n", szPath, (f==NULL) ? "Error" : "OK");
cfg = gf_cfg_new(file_path, file_name);
if (!cfg) return NULL;
-#ifdef GPAC_MODULES_PATH
+#if defined(WIN32)
+ //szPath still contains the executable directory
+#elif defined(GPAC_MODULES_PATH) /* Mac OS and UNIX */
fprintf(stdout, "Using module directory %s \n", GPAC_MODULES_PATH);
strcpy(szPath, GPAC_MODULES_PATH);
-#elif defined(WIN32)
- //szPath still contains the executable directory
#else
fprintf(stdout, "Please enter full path to GPAC modules directory:\n");
- scanf("%s", szPath);
+ while ( 1 > scanf("%s", szPath));
#endif
gf_cfg_set_key(cfg, "General", "ModulesDirectory", szPath);
+ gf_cfg_set_key(cfg, "Compositor", "Raster2D", "GPAC 2D Raster");
gf_cfg_set_key(cfg, "Audio", "ForceConfig", "yes");
gf_cfg_set_key(cfg, "Audio", "NumBuffers", "2");
gf_cfg_set_key(cfg, "Audio", "TotalDuration", "120");
if (szPath[strlen((char*)szPath)-1] != '\\') strcat((char*)szPath, "\\");
strcat((char *)szPath, "Fonts");
#elif defined(__DARWIN__) || defined(__APPLE__)
- fprintf(stdout, "Please enter full path to a TrueType font directory (.ttf, .ttc) - enter to default:\n");
- scanf("%s", szPath);
+ strcpy(szPath, "/Library/Fonts");
#else
- /*these fonts seems installed by default on many systems...*/
- gf_cfg_set_key(cfg, "FontEngine", "FontSerif", "Bitstream Vera Serif");
- gf_cfg_set_key(cfg, "FontEngine", "FontSans", "Bitstream Vera Sans");
- gf_cfg_set_key(cfg, "FontEngine", "FontFixed", "Bitstream Vera Monospace");
strcpy(szPath, "/usr/share/fonts/truetype/");
#endif
fprintf(stdout, "Using default font directory %s\n", szPath);
gf_cfg_set_key(cfg, "FontEngine", "FontDirectory", szPath);
-#ifdef WIN32
-/* fprintf(stdout, "Please enter full path to a cache directory for HTTP downloads:\n");
- scanf("%s", szPath);
-*/
- GetWindowsDirectory((char*)szPath, MAX_PATH);
- if (szPath[strlen((char*)szPath)-1] != '\\') strcat((char*)szPath, "\\");
- strcat((char *)szPath, "Temp");
-
- gf_cfg_set_key(cfg, "General", "CacheDirectory", szPath);
- fprintf(stdout, "Using default cache directory %s\n", szPath);
-#else
- fprintf(stdout, "Using /tmp as a cache directory for HTTP downloads:\n");
- gf_cfg_set_key(cfg, "General", "CacheDirectory", "/tmp");
-#endif
+ {
+ char * tmp = gf_get_default_cache_directory();
+ gf_cfg_set_key(cfg, "General", "CacheDirectory", tmp);
+ fprintf(stdout, "Using default cache directory %s\n", tmp);
+ gf_free(tmp);
+ }
gf_cfg_set_key(cfg, "Downloader", "CleanCache", "yes");
gf_cfg_set_key(cfg, "Compositor", "AntiAlias", "All");
gf_cfg_set_key(cfg, "Network", "UDPTimeout", "10000");
gf_cfg_set_key(cfg, "Network", "BufferLength", "3000");
+#if defined(__DARWIN__) || defined(__APPLE__)
+ gf_cfg_set_key(cfg, "Video", "DriverName", "SDL Video Output");
+#endif
+
+ if (gui_path[0]) {
+ FILE *f;
+ strcat(gui_path, "gui/gui.bt");
+ f = fopen(gui_path, "rt");
+ if (f) {
+ fclose(f);
+ gf_cfg_set_key(cfg, "General", "StartupFile", gui_path);
+ }
+ }
+
+
/*store and reload*/
gf_cfg_del(cfg);
return gf_cfg_new(file_path, file_name);
}
+#if (defined(__DARWIN__) || defined(__APPLE__) )
+#include <mach-o/dyld.h>
+#endif /* Apple, needs this for _NSGetExecutablePath on Mac OS X */
+
+static void check_config_directories(GF_Config *cfg)
+{
+#if (defined(__DARWIN__) || defined(__APPLE__) )
+ char mod_path[GF_MAX_PATH];
+ char gui_path[GF_MAX_PATH];
+ char root_path[GF_MAX_PATH];
+ char *sep;
+ const char *opt;
+ u32 size = GF_MAX_PATH;
+ if (_NSGetExecutablePath(root_path, &size)!=0) return;
+ /*installed or symlink on system, do not attempt to modify the path*/
+ if (!strnicmp(root_path, "/usr/", 5)) return;
+ sep = strstr(root_path, ".app/");
+ if (sep) {
+ sep[4] = 0;
+ }
+ gui_path[0] = '\0';
+ strcpy(mod_path, root_path);
+ strcat(mod_path, "/Contents/MacOS/modules/");
+ {
+ struct stat buf;
+ int status_dir;
+ memset(&buf, 0, sizeof(struct stat));
+ status_dir = stat(mod_path, &buf);
+ if (!status_dir){
+ if (!(buf.st_mode & S_IFDIR)){
+#ifdef GPAC_MODULES_PATH
+ strcpy(mod_path, GPAC_MODULES_PATH);
+ gui_path[0] = '\0';
+#endif
+ } else {
+ /* OK, it means we are in an .app directory ! */
+ strcpy(gui_path, root_path);
+ strcat(gui_path, "/Contents/MacOS/gui/gui.bt");
+ }
+ } else {
+#ifdef GPAC_MODULES_PATH
+ strcpy(mod_path, GPAC_MODULES_PATH);
+ gui_path[0] = '\0';
+#endif
+ }
+ }
+ opt = gf_cfg_get_key(cfg, "General", "ModulesDirectory");
+ /*modules directory has changed, forced to new location*/
+ if (!opt || strcmp(opt, mod_path)) {
+ gf_cfg_set_key(cfg, "General", "ModulesDirectory", mod_path);
+ if (gui_path[0])
+ gf_cfg_set_key(cfg, "General", "StartupFile", gui_path);
+ }
+#endif
+}
+
+
static void PrintTime(u64 time)
{
u32 ms, h, m, s;
return;
if (display_rti) {
+ char szMsg[1024];
if (!rti.process_memory) rti.process_memory = (u32) (memory_at_gpac_startup-rti.physical_memory_avail);
if (!rti.gpac_memory) rti.gpac_memory = (u32) (memory_at_gpac_startup-rti.physical_memory_avail);
+
+ if (rti.total_cpu_usage) {
+ sprintf(szMsg, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB",
+ gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) );
+ } else {
+ sprintf(szMsg, "FPS %02.2f - CPU %02d - Mem %d kB",
+ gf_term_get_framerate(term, 0), rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) );
+ }
+
if (display_rti==2) {
- fprintf(stdout, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB\r",
- gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) );
+ fprintf(stdout, "%s\r", szMsg);
} else {
- char szMsg[1024];
GF_Event evt;
-
- sprintf(szMsg, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB",
- gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) );
evt.type = GF_EVENT_SET_CAPTION;
evt.caption.caption = szMsg;
gf_term_user_event(term, &evt);
gf_term_set_speed(term, bench_mode ? bench_speed : FIX_ONE);
}
}
+#ifndef WIN32
+#include <termios.h>
+int getch() {
+ struct termios old;
+ struct termios new;
+ int rc;
+ if (tcgetattr(0, &old) == -1) {
+ return -1;
+ }
+ new = old;
+ new.c_lflag &= ~(ICANON | ECHO);
+ new.c_cc[VMIN] = 1;
+ new.c_cc[VTIME] = 0;
+ if (tcsetattr(0, TCSANOW, &new) == -1) {
+ return -1;
+ }
+ rc = getchar();
+ (void) tcsetattr(0, TCSANOW, &old);
+ return rc;
+}
+#else
+int getch(){
+ return getchar();
+}
+#endif
+
+/**
+ * Reads a line of input from stdin
+ * @param line the buffer to fill
+ * @param
+ */
+static const char * read_line_input(char * line, int maxSize, Bool showContent){
+ char read;
+ int i = 0;
+ if (fflush( stdout ))
+ perror("Failed to flush buffer %s");
+ do {
+ line[i] = '\0';
+ if (i >= maxSize - 1)
+ return line;
+ read = getch();
+ if (read == 8 || read == 127){
+ if (i > 0){
+ fprintf(stdout, "\b \b");
+ i--;
+ }
+ } else if (read > 32){
+ fputc(showContent ? read : '*', stdout);
+ line[i++] = read;
+ }
+ fflush(stdout);
+ } while (read != '\n');
+ if (!read)
+ return 0;
+ return line;
+}
Bool GPAC_EventProc(void *ptr, GF_Event *evt)
{
if (!term) return 0;
+
+ if (gui_mode) {
+ if (evt->type==GF_EVENT_QUIT) Run = 0;
+ return 0;
+ }
switch (evt->type) {
case GF_EVENT_DURATION:
} else {
servName = evt->message.service;
}
+ servName = "";
+
if (!evt->message.message) return 0;
if (evt->message.error==GF_SCRIPT_INFO) {
GF_LOG(GF_LOG_INFO, GF_LOG_SCRIPT, ("[Script] %s\n", evt->message.message));
ResetCaption();
break;
case GF_EVENT_EOS:
- restart = 1;
+ if (loop_at_end) restart = 1;
break;
case GF_EVENT_SIZE:
if (user.init_flags & GF_TERM_WINDOWLESS) {
gf_term_user_event(term, evt);
break;
case GF_EVENT_AUTHORIZATION:
- if (!strlen(evt->auth.user)) {
- fprintf(stdout, "Authorization required for site %s\n", evt->auth.site_url);
- fprintf(stdout, "login: ");
- scanf("%s", evt->auth.user);
- } else {
- fprintf(stdout, "Authorization required for %s@%s\n", evt->auth.user, evt->auth.site_url);
+ {
+ int maxTries = 1;
+ assert( evt->type == GF_EVENT_AUTHORIZATION);
+ assert( evt->auth.user);
+ assert( evt->auth.password);
+ assert( evt->auth.site_url);
+ while ((!strlen(evt->auth.user) || !strlen(evt->auth.password)) && (maxTries--) >= 0){
+ fprintf(stdout, "**** Authorization required for site %s ****\n", evt->auth.site_url);
+ fprintf(stdout, "login : ");
+ read_line_input(evt->auth.user, 50, 1);
+ fprintf(stdout, "\npassword: ");
+ read_line_input(evt->auth.password, 50, 0);
+ printf("*********\n");
+ }
+ if (maxTries < 0){
+ printf("**** No User or password has been filled, aborting ***\n");
+ return 0;
}
- fprintf(stdout, "password: ");
- gf_prompt_set_echo_off(1);
- scanf("%s", evt->auth.password);
- gf_prompt_set_echo_off(0);
- return 1;
- case GF_EVENT_SYS_COLORS:
-#ifdef WIN32
- evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
- evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION);
- evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE);
- evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND);
- evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE);
- evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT);
- evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW);
- evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT);
- evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT);
- evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT);
- evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT);
- evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT);
- evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER);
- evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION);
- evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT);
- evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK);
- evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT);
- evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU);
- evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT);
- evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR);
- evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW);
- evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE);
- evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT);
- evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT);
- evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW);
- evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW);
- evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME);
- evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT);
- return 1;
-#else
- memset(evt->sys_cols.sys_colors, 0, sizeof(u32)*28);
return 1;
-#endif
- break;
+ }
+
}
return 0;
}
}
success:
fprintf(stdout, "Using config file in %s directory\n", szPath);
+ check_config_directories(cfg);
return cfg;
}
void set_navigation()
{
GF_Err e;
- char navstr[20], nav;
+ char nav;
u32 type = gf_term_get_option(term, GF_OPT_NAVIGATION_TYPE);
e = GF_OK;
+ fflush(stdin);
+
if (!type) {
fprintf(stdout, "Content/compositor doesn't allow user-selectable navigation\n");
} else if (type==1) {
fprintf(stdout, "Select Navigation (\'N\'one, \'E\'xamine, \'S\'lide): ");
- scanf("%s", navstr);
- nav = navstr[0];
+ nav = getch();
if (nav=='N') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
else if (nav=='E') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE);
else if (nav=='S') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
else fprintf(stdout, "Unknown selector \'%c\' - only \'N\',\'E\',\'S\' allowed\n", nav);
} else if (type==2) {
fprintf(stdout, "Select Navigation (\'N\'one, \'W\'alk, \'F\'ly, \'E\'xamine, \'P\'an, \'S\'lide, \'G\'ame, \'V\'R, \'O\'rbit): ");
- scanf("%s", navstr);
- nav = navstr[0];
+ nav = getch();
if (nav=='N') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
else if (nav=='W') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_WALK);
else if (nav=='F') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_FLY);
/*SMPTE time code*/
if (strchr(arg, ':') && strchr(arg, ';') && strchr(arg, '/')) {
- if (sscanf(arg, "%02d:%02d:%02d;%02d/%02d", &h, &m, &s, &f, &fps)==5) {
+ if (sscanf(arg, "%02ud:%02ud:%02ud;%02ud/%02ud", &h, &m, &s, &f, &fps)==5) {
sec = 0;
if (fps) sec = ((Double)f) / fps;
sec += 3600*h + 60*m + s;
str = strchr(arg, '-');
if (str) str[0] = 0;
/*HH:MM:SS:MS time code*/
- if (strchr(arg, ':') && (sscanf(arg, "%02d:%02d:%02d:%02d", &h, &m, &s, &ms)==4)) {
+ if (strchr(arg, ':') && (sscanf(arg, "%02ud:%02ud:%02ud:%02ud", &h, &m, &s, &ms)==4)) {
sec = ms;
sec /= 1000;
sec += 3600*h + 60*m + s;
}
}
+#ifdef WIN32
+#include <wincon.h>
+#endif
+
int main (int argc, char **argv)
{
char c;
FILE *playlist = NULL;
FILE *logfile = NULL;
Float scale = 1;
+#ifndef WIN32
+ dlopen(NULL, RTLD_NOW|RTLD_GLOBAL);
+#endif
/*by default use current dir*/
strcpy(the_url, ".");
i++;
}
else if (!strcmp(arg, "-mem-track")) enable_mem_tracker = 1;
+ else if (!strcmp(arg, "-h") || !strcmp(arg, "-help")) {
+ PrintUsage();
+ return 1;
+ }
}
gf_sys_init(enable_mem_tracker);
use_rtix = 1;
} else if (!strcmp(arg, "-fill")) {
fill_ar = 1;
+ } else if (!strcmp(arg, "-gui")) {
+ gui_mode = 1;
+ } else if (!strcmp(arg, "-guid")) {
+ gui_mode = 2;
} else if (!strcmp(arg, "-show")) {
visible = 1;
} else if (!strcmp(arg, "-avi")) {
if(depth_dump) dump_mode=7; /*grayscale depth .bmp dump*/
else dump_mode=2;
if ((url_arg || (i+2<(u32)argc)) && get_time_list(argv[i+1], times, &nb_times)) i++;
+ } else if (!strcmp(arg, "-png")) {
+ dump_mode=11;
+ if ((url_arg || (i+2<(u32)argc)) && get_time_list(argv[i+1], times, &nb_times)) i++;
} else if (!strcmp(arg, "-raw")) {
dump_mode = 3;
if ((url_arg || (i+2<(u32)argc)) && get_time_list(argv[i+1], times, &nb_times)) i++;
} else if (!stricmp(arg, "-size")) {
+ /*usage of %ud breaks sscanf on MSVC*/
if (sscanf(argv[i+1], "%dx%d", &forced_width, &forced_height) != 2) {
forced_width = forced_height = 0;
}
i++;
}
else if (!strcmp(arg, "-no-wnd")) user.init_flags |= GF_TERM_WINDOWLESS;
+ else if (!strcmp(arg, "-no-back")) user.init_flags |= GF_TERM_WINDOW_TRANSPARENT;
#if defined(__DARWIN__) || defined(__APPLE__)
- else if (!strcmp(arg, "-thread")) not_threaded = 0;
+ else if (!strcmp(arg, "-thread")) threading_flags = 0;
#else
- else if (!strcmp(arg, "-no-thread")) not_threaded = 1;
+ else if (!strcmp(arg, "-no-thread")) threading_flags = GF_TERM_NO_DECODER_THREAD | GF_TERM_NO_COMPOSITOR_THREAD | GF_TERM_WINDOW_NO_THREAD;
#endif
else if (!strcmp(arg, "-no-audio")) no_audio = 1;
else if (!strcmp(arg, "-no-regulation")) no_regulation = 1;
else if (!strcmp(arg, "-pause")) pause_at_first = 1;
else if (!strcmp(arg, "-exit")) auto_exit = 1;
else if (!strcmp(arg, "-mem-track")) enable_mem_tracker = 1;
+ else if (!strcmp(arg, "-loop")) loop_at_end = 1;
else if (!strcmp(arg, "-opt")) {
char *sep, *sep2, szSec[1024], szKey[1024], szVal[1024];
sep = strchr(argv[i+1], ':');
i++;
}
else if (!strncmp(arg, "-run-for=", 9)) simulation_time = atoi(arg+9);
- else {
+ else if (!stricmp(arg, "-help")) {
PrintUsage();
return 1;
+ } else {
+ fprintf(stdout, "Unrecognized option %s - skipping\n", arg);
}
}
if (dump_mode && !url_arg) {
if (logfile) fclose(logfile);
return 1;
}
+
+
+ if (!gui_mode) {
+ str = gf_cfg_get_key(cfg_file, "General", "ForceGUI");
+ if (str && !strcmp(str, "yes")) gui_mode = 1;
+ }
+
+ if (gui_mode) {
+ threading_flags = GF_TERM_NO_DECODER_THREAD | GF_TERM_NO_COMPOSITOR_THREAD;
+ if (gui_mode==1) {
+ hide_shell(1);
+ user.init_flags |= GF_TERM_WINDOW_NO_DECORATION;
+ }
+ }
+
+
if (dump_mode) rti_file = NULL;
if (!logs_set) {
/*setup dumping options*/
if (dump_mode) {
- user.init_flags |= GF_TERM_NO_AUDIO | GF_TERM_NO_THREAD | GF_TERM_NO_REGULATION /*| GF_TERM_INIT_HIDE*/;
+ user.init_flags |= GF_TERM_NO_AUDIO | GF_TERM_NO_DECODER_THREAD | GF_TERM_NO_COMPOSITOR_THREAD | GF_TERM_NO_REGULATION /*| GF_TERM_INIT_HIDE*/;
if (visible || dump_mode==8) user.init_flags |= GF_TERM_INIT_HIDE;
} else {
init_w = forced_width;
fprintf(stdout, "Loading modules\n");
str = gf_cfg_get_key(cfg_file, "General", "ModulesDirectory");
+ assert( str );
user.modules = gf_modules_new((const unsigned char *) str, cfg_file);
if (user.modules) i = gf_modules_get_count(user.modules);
user.EventProc = GPAC_EventProc;
/*dummy in this case (global vars) but MUST be non-NULL*/
user.opaque = user.modules;
- if (not_threaded) user.init_flags |= GF_TERM_NO_THREAD;
+ if (threading_flags) user.init_flags |= threading_flags;
if (no_audio) user.init_flags |= GF_TERM_NO_AUDIO;
if (no_regulation) user.init_flags |= GF_TERM_NO_REGULATION;
+ if (threading_flags & (GF_TERM_NO_DECODER_THREAD|GF_TERM_NO_COMPOSITOR_THREAD) ) term_step = 1;
+
fprintf(stdout, "Loading GPAC Terminal\n");
term = gf_term_new(&user);
if (!term) {
}
fprintf(stdout, "Terminal Loaded\n");
-
if (dump_mode) {
// gf_term_set_option(term, GF_OPT_VISIBLE, 0);
if (fill_ar) gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);
} else
/*connect if requested*/
- if (url_arg) {
+ if (!gui_mode && url_arg) {
char *ext;
+
strcpy(the_url, url_arg);
ext = strrchr(the_url, '.');
- if (ext && (!stricmp(ext, ".m3u") || !stricmp(ext, ".pls"))) {
+ if (ext && strncmp("http:", the_url, 5) && (!stricmp(ext, ".m3u") || !stricmp(ext, ".pls"))) {
fprintf(stdout, "Opening Playlist %s\n", the_url);
playlist = gf_f64_open(the_url, "rt");
if (playlist) {
strcpy(pl_path, the_url);
- fscanf(playlist, "%s", the_url);
- fprintf(stdout, "Opening URL %s\n", the_url);
- gf_term_connect_with_path(term, the_url, pl_path);
+ if (1 > fscanf(playlist, "%s", the_url))
+ fprintf(stderr, "Cannot read any URL from playlist\n");
+ else {
+ fprintf(stdout, "Opening URL %s\n", the_url);
+ gf_term_connect_with_path(term, the_url, pl_path);
+ }
} else {
fprintf(stdout, "Hit 'h' for help\n\n");
}
gf_term_connect(term, str);
startup_file = 1;
}
+ if (url_arg) {
+ gf_cfg_set_key(cfg_file, "Temp", "GUIStartupFile", url_arg);
+ }
}
+ if (gui_mode==2) gui_mode=0;
+
if (start_fs) gf_term_set_option(term, GF_OPT_FULLSCREEN, 1);
while (Run) {
/*we don't want getchar to block*/
- if (!gf_prompt_has_input()) {
+ if (gui_mode || !gf_prompt_has_input()) {
if (restart) {
restart = 0;
gf_term_play_from_time(term, 0, 0);
goto force_input;
}
if (!use_rtix || display_rti) UpdateRTInfo(NULL);
- if (not_threaded) {
+ if (term_step) {
gf_term_process_step(term);
if (auto_exit && gf_term_get_option(term, GF_OPT_IS_OVER)) {
Run = 0;
startup_file = 0;
gf_term_disconnect(term);
fprintf(stdout, "Enter the absolute URL\n");
- scanf("%s", the_url);
+ if (1 > scanf("%s", the_url)){
+ fprintf(stderr, "Cannot read absolute URL, aborting\n");
+ break;
+ }
if (rti_file) init_rti_logs(rti_file, the_url, use_rtix);
gf_term_connect(term, the_url);
break;
case 'O':
gf_term_disconnect(term);
fprintf(stdout, "Enter the absolute URL to the playlist\n");
- scanf("%s", the_url);
+ if (1 > scanf("%s", the_url)){
+ fprintf(stderr, "Cannot read the absolute URL, aborting.\n");
+ break;
+ }
playlist = gf_f64_open(the_url, "rt");
if (playlist) {
- fscanf(playlist, "%s", the_url);
+ if (1 > fscanf(playlist, "%s", the_url)){
+ fprintf(stderr, "Cannot read any URL from playlist, aborting.\n");
+ fclose( playlist);
+ break;
+ }
fprintf(stdout, "Opening URL %s\n", the_url);
gf_term_connect(term, the_url);
}
if (playlist) {
u32 count;
gf_term_disconnect(term);
- scanf("%d", &count);
+ if (1 > scanf("%u", &count)){
+ fprintf(stderr, "Cannot read number, aborting.\n");
+ break;
+ }
while (count) {
- fscanf(playlist, "%s", the_url);
+ if (fscanf(playlist, "%s", the_url)){
+ fprintf(stderr, "Failed to read line, aborting\n");
+ break;
+ }
count--;
}
fprintf(stdout, "Opening URL %s\n", the_url);
case 'i':
if (is_connected) {
u32 ID;
- fprintf(stdout, "Enter OD ID (0 for main OD): ");
- fflush(stdout);
- scanf("%d", &ID);
+ do {
+ fprintf(stdout, "Enter OD ID (0 for main OD): ");
+ fflush(stdout);
+ } while( 1 > scanf("%ud", &ID));
ViewOD(term, ID, (u32)-1);
}
break;
case 'j':
if (is_connected) {
u32 num;
- fprintf(stdout, "Enter OD number (0 for main OD): ");
- fflush(stdout);
- scanf("%d", &num);
+ do {
+ fprintf(stdout, "Enter OD number (0 for main OD): ");
+ fflush(stdout);
+ } while( 1 > scanf("%ud", &num));
ViewOD(term, (u32)-1, num);
}
break;
GF_Err e;
u32 i, count, odid;
Bool xml_dump, std_out;
- fprintf(stdout, "Enter Inline OD ID if any or 0");
- fflush(stdout);
radname[0] = 0;
- scanf("%d", &odid);
+ do {
+ fprintf(stdout, "Enter Inline OD ID if any or 0 : ");
+ fflush(stdout);
+ } while( 1 > scanf("%ud", &odid));
if (odid) {
GF_ObjectManager *root_odm = gf_term_get_root_object(term);
if (!root_odm) break;
odm = NULL;
}
}
- fprintf(stdout, "Enter file radical name (+\'.x\' for XML dumping) - \"std\" for stdout: ");
- fflush(stdout);
- scanf("%s", radname);
+ do{
+ fprintf(stdout, "Enter file radical name (+\'.x\' for XML dumping) - \"std\" for stdout: ");
+ fflush(stdout);
+ } while( 1 > scanf("%s", radname));
sExt = strrchr(radname, '.');
xml_dump = 0;
if (sExt) {
fprintf(stdout, "Enter command to send:\n");
fflush(stdin);
szCom[0] = 0;
- scanf("%[^\t\n]", szCom);
+ if (1 > scanf("%[^\t\n]", szCom)){
+ fprintf(stderr, "Cannot read command to send, aborting.\n");
+ break;
+ }
e = gf_term_scene_update(term, NULL, szCom);
if (e) fprintf(stdout, "Processing command failed: %s\n", gf_error_to_string(e));
}
{
char szLog[1024];
fprintf(stdout, "Enter new log level:\n");
- scanf("%s", szLog);
+ if (1 > scanf("%s", szLog)){
+ fprintf(stderr, "Cannot read new log level, aborting.\n");
+ break;
+ }
gf_log_set_level(gf_log_parse_level(szLog));
}
break;
{
char szLog[1024];
fprintf(stdout, "Enter new log tools:\n");
- scanf("%s", szLog);
+ if (1 > scanf("%s", szLog)){
+ fprintf(stderr, "Cannot read new log tools, aborting.\n");
+ break;
+ }
gf_log_set_tools(gf_log_parse_tools(szLog));
}
break;
case 'M':
{
u32 size;
- fprintf(stdout, "Enter new video cache memory in kBytes (current %d):\n", gf_term_get_option(term, GF_OPT_VIDEO_CACHE_SIZE));
- scanf("%d", &size);
+ do {
+ fprintf(stdout, "Enter new video cache memory in kBytes (current %ud):\n", gf_term_get_option(term, GF_OPT_VIDEO_CACHE_SIZE));
+ } while (1 > scanf("%ud", &size));
gf_term_set_option(term, GF_OPT_VIDEO_CACHE_SIZE, size);
}
break;
fprintf(stdout, "Error dumping screen buffer %s\n", gf_error_to_string(e) );
} else {
u32 dst_size = fb.width*fb.height*3;
- char *dst=malloc(sizeof(char)*dst_size);
+ char *dst = (char*)gf_malloc(sizeof(char)*dst_size);
e = gf_img_png_enc(fb.video_buffer, fb.width, fb.height, fb.pitch_y, fb.pixel_format, dst, &dst_size);
if (e) {
fprintf(stdout, "Writing file dump.png\n");
}
}
- if (dst) free(dst);
+ if (dst) gf_free(dst);
gf_term_release_screen_buffer(term, &fb);
}
}
gf_sys_close();
if (rti_logs) fclose(rti_logs);
if (logfile) fclose(logfile);
- fprintf(stdout, "Bye\n");
+
+ if (gui_mode) {
+ hide_shell(2);
+ }
return 0;
}
char *secName = NULL;
fprintf(stdout, "Enter section name (\"*\" for complete dump):\n");
- scanf("%s", szName);
+ if (1 > scanf("%s", szName)){
+ fprintf(stderr, "No section name, aborting.\n");
+ return;
+ }
if (strcmp(szName, "*")) secName = szName;
fprintf(stdout, "\n\n*** GPAC Configuration ***\n\n");
--- /dev/null
+// Microsoft Visual C++ generated resource script.\r
+//\r
+#include "resource.h"\r
+\r
+#define APSTUDIO_READONLY_SYMBOLS\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 2 resource.\r
+//\r
+#include "afxres.h"\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#undef APSTUDIO_READONLY_SYMBOLS\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+// Français (France) resources\r
+\r
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r
+#ifdef _WIN32\r
+LANGUAGE LANG_FRENCH, SUBLANG_FRENCH\r
+#pragma code_page(1252)\r
+#endif //_WIN32\r
+\r
+#ifdef APSTUDIO_INVOKED\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// TEXTINCLUDE\r
+//\r
+\r
+1 TEXTINCLUDE \r
+BEGIN\r
+ "resource.h\0"\r
+END\r
+\r
+2 TEXTINCLUDE \r
+BEGIN\r
+ "#include ""afxres.h""\r\n"\r
+ "\0"\r
+END\r
+\r
+3 TEXTINCLUDE \r
+BEGIN\r
+ "\r\n"\r
+ "\0"\r
+END\r
+\r
+#endif // APSTUDIO_INVOKED\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Icon\r
+//\r
+\r
+// Icon with lowest ID value placed first to ensure application icon\r
+// remains consistent on all systems.\r
+IDI_ICON3 ICON "..\\..\\doc\\osmo4.ico"\r
+#endif // Français (France) resources\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+\r
+\r
+#ifndef APSTUDIO_INVOKED\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 3 resource.\r
+//\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#endif // not APSTUDIO_INVOKED\r
+\r
--- /dev/null
+//{{NO_DEPENDENCIES}}\r
+// Microsoft Visual C++ generated include file.\r
+// Used by mp4client.rc\r
+//\r
+#define IDI_ICON1 102\r
+#define IDI_ICON2 103\r
+#define IDI_ICON3 105\r
+\r
+// Next default values for new objects\r
+// \r
+#ifdef APSTUDIO_INVOKED\r
+#ifndef APSTUDIO_READONLY_SYMBOLS\r
+#define _APS_NEXT_RESOURCE_VALUE 106\r
+#define _APS_NEXT_COMMAND_VALUE 40001\r
+#define _APS_NEXT_CONTROL_VALUE 1001\r
+#define _APS_NEXT_SYMED_VALUE 101\r
+#endif\r
+#endif\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK">
+ <attributes>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="Osmo4/libs/armeabi"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Osmo4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+#Fri Oct 08 13:52:16 CEST 2010
+activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF
+addNewLine=true
+convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
+eclipse.preferences.version=1
+inActiveContentFilterList=
+javaTabWidthForJava=true
+org.eclipse.jdt.ui.editor.tab.width=2
+projectPropsEnabled=false
+removeTrailingSpaces=true
+replaceAllSpaces=false
+replaceAllTabs=false
+saveAndAddLine=false
+saveAndConvert=false
+saveAndTrim=true
+useModulo4Tabs=false
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.artemis.Osmo4"
+ android:versionCode="1" android:versionName="1.0">
+ <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
+ <activity android:name=".Osmo4" android:label="@string/app_name" android:configChanges="orientation">
+ <!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> -->
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ <intent-filter android:label="View in Osmo">
+ <action android:name="android.intent.action.VIEW"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ <data android:mimeType="audio/*" android:scheme="http"/>
+ <data android:mimeType="audio/*"/>
+ <data android:mimeType="video/*" android:scheme="http"/>
+ <data android:mimeType="video/*"/>
+ <data android:mimeType="x-subtitle/*" android:scheme="http"/>
+ <data android:mimeType="x-subtitle/*"/>
+ <data android:mimeType="application/x-mpegurl" android:scheme="http"/>
+ <data android:mimeType="application/x-mpegurl"/>
+ <data android:scheme="udp"/>
+ <data android:scheme="rtsp"/>
+ <data android:mimeType="application/vnd.apple.mpegurl" android:scheme="http"/>
+ <data android:mimeType="application/vnd.apple.mpegurl"/>
+ <data android:mimeType="application/x-isomedia" android:scheme="http"/>
+ <data android:mimeType="application/x-isomedia"/>
+ <data android:mimeType="application/mp4" android:scheme="http"/>
+ <data android:mimeType="application/mp4"/>
+ <data android:mimeType="application/sdp" android:scheme="http"/>
+ <data android:mimeType="application/sdp"/>
+ <data android:mimeType="application/x-bt" android:scheme="http"/>
+ <data android:mimeType="application/x-bt"/>
+ <data android:mimeType="application/x-xmt" android:scheme="http"/>
+ <data android:mimeType="application/x-xmt"/>
+ </intent-filter>
+ </activity>
+ <activity android:label="@string/app_name" android:configChanges="orientation"
+ android:permission="android.permission.WRITE_EXTERNAL_STORAGE" android:name=".extra.FileChooserActivity">
+ <intent-filter android:priority="1">
+ <action android:name="org.openintents.action.PICK_FILE"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ <data android:scheme="file"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+ <uses-sdk android:targetSdkVersion="4" android:minSdkVersion="4"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Osmo4" default="help">
+
+<!-- The local.properties file is created and updated by the 'android'
+ tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <property file="local.properties" />
+
+ <!-- The build.properties file can be created by you and is never touched
+ by the 'android' tool. This is the place to change some of the
+ default property values used by the Ant rules.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="build.properties" />
+
+ <!-- The default.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <property file="default.properties" />
+
+ <!-- Custom Android task to deal with the project target, and import the
+ proper rules.
+ This requires ant 1.6.0 or above. -->
+ <path id="android.antlibs">
+ <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
+ </path>
+
+ <target name="help">
+ <!-- displays starts at col 13
+ |13 80| -->
+ <echo>Android Ant Build. Available targets:</echo>
+ <echo> help: Displays this help.</echo>
+ <echo> clean: Removes output files created by other targets.</echo>
+ <echo> compile: Compiles project's .java files into .class files.</echo>
+ <echo> debug: Builds the application and signs it with a debug key.</echo>
+ <echo> release: Builds the application. The generated apk file must be</echo>
+ <echo> signed before it is published.</echo>
+ <echo> install: Installs/reinstalls the debug package onto a running</echo>
+ <echo> emulator or device.</echo>
+ <echo> If the application was previously installed, the</echo>
+ <echo> signatures must match.</echo>
+ <echo> uninstall: Uninstalls the application from a running emulator or</echo>
+ <echo> device.</echo>
+ </target>
+
+ <taskdef name="setup"
+ classname="com.android.ant.SetupTask"
+ classpathref="android.antlibs" />
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+ in between standard targets -->
+<!--
+ <target name="-pre-build">
+ </target>
+ <target name="-pre-compile">
+ </target>
+
+ [This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir}]
+ <target name="-post-compile">
+ </target>
+-->
+
+
+ <!-- Execute the Android Setup task that will setup some properties
+ specific to the target, and import the build rules files.
+
+ The rules file is imported from
+ <SDK>/platforms/<target_platform>/ant/ant_rules_r#.xml
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <setup> task.
+ - customize it to your needs.
+ - Customize the whole script.
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, *after* the <setup> task
+ - disable the import of the rules by changing the setup task
+ below to <setup import="false" />.
+ - customize to your needs.
+ -->
+ <setup />
+
+</project>
--- /dev/null
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-4
--- /dev/null
+To build Android version, Please execute the script :
+../../../build/android/jni/gpac_build_android <PATH_TO_ANDROID_NDK>
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen, Ivica ARSOV / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#include <jni.h>\r
+\r
+#include <gpac/terminal.h>\r
+#include <gpac/thread.h>\r
+#include <gpac/options.h>\r
+#include <gpac/modules/service.h>\r
+#include <gpac/internal/terminal_dev.h>\r
+#include <gpac/internal/compositor_dev.h>\r
+\r
+#include "wrapper.h"\r
+\r
+#include <math.h>\r
+\r
+#undef PI\r
+#define PI 3.1415926535897932f\r
+\r
+#include <GLES/gl.h>\r
+#ifndef ANDROID_NDK\r
+//#include <GLES/egl.h>\r
+#endif /* !ANDROID_NDK */\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+//CPeriodic\r
+//-------------------------------\r
+CPeriodic::CPeriodic(){}\r
+//-------------------------------\r
+CPeriodic::~CPeriodic(){}\r
+//-------------------------------\r
+void CPeriodic::Start(){\r
+}\r
+//-------------------------------\r
+void CPeriodic::Cancel(){}\r
+//---------------------------------------------------------------------------------------------------\r
+\r
+void initGL()\r
+{\r
+ /* Enable smooth shading */\r
+ glShadeModel(GL_SMOOTH);\r
+\r
+ /* Set the background black */\r
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);\r
+\r
+ /* Depth buffer setup */\r
+ glClearDepthf(1.0f);\r
+\r
+ /* Enables Depth Testing */\r
+ glEnable(GL_DEPTH_TEST);\r
+\r
+ /* The Type Of Depth Test To Do */\r
+ glDepthFunc(GL_LEQUAL);\r
+\r
+ /* Really Nice Perspective Calculations */\r
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);\r
+}\r
+\r
+void gluPerspective(GLfloat fovy, GLfloat aspect,\r
+ GLfloat zNear, GLfloat zFar)\r
+{\r
+ GLfloat xmin, xmax, ymin, ymax;\r
+\r
+ ymax = zNear * (GLfloat)tan(fovy * PI / 360);\r
+ ymin = -ymax;\r
+ xmin = ymin * aspect;\r
+ xmax = ymax * aspect;\r
+\r
+ glFrustumx((GLfixed)(xmin * 65536), (GLfixed)(xmax * 65536),\r
+ (GLfixed)(ymin * 65536), (GLfixed)(ymax * 65536),\r
+ (GLfixed)(zNear * 65536), (GLfixed)(zFar * 65536));\r
+}\r
+\r
+void resizeWindow(int width, int height)\r
+{\r
+ /* Height / width ration */\r
+ GLfloat ratio;\r
+\r
+ /* Protect against a divide by zero */\r
+ if (height==0)\r
+ {\r
+ height=1;\r
+ }\r
+\r
+ ratio=(GLfloat)width/(GLfloat)height;\r
+\r
+ /* Setup our viewport. */\r
+ glViewport(0, 0, (GLsizei)width, (GLsizei)height);\r
+\r
+ /* change to the projection matrix and set our viewing volume. */\r
+ glMatrixMode(GL_PROJECTION);\r
+ glLoadIdentity();\r
+\r
+ /* Set our perspective */\r
+ gluPerspective(45.0f, ratio, 0.1f, 100.0f);\r
+\r
+ /* Make sure we're chaning the model view and not the projection */\r
+ glMatrixMode(GL_MODELVIEW);\r
+\r
+ /* Reset The View */\r
+ glLoadIdentity();\r
+}\r
+\r
+void drawGLScene()\r
+{\r
+ GLfloat vertices[4][3];\r
+\r
+ /* Clear The Screen And The Depth Buffer */\r
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\r
+\r
+ /* Enable VERTEX array */\r
+ glEnableClientState(GL_VERTEX_ARRAY);\r
+\r
+ /* Setup pointer to VERTEX array */\r
+ glVertexPointer(3, GL_FLOAT, 0, vertices);\r
+\r
+ /* Move Left 1.5 Units And Into The Screen 6.0 */\r
+ glLoadIdentity();\r
+ glTranslatef(-1.5f, 0.0f, -6.0f);\r
+\r
+ /* Top Of Triangle */\r
+ vertices[0][0]=0.0f; vertices[0][1]=1.0f; vertices[0][2]=0.0f;\r
+ /* Left Of Triangle */\r
+ vertices[1][0]=-1.0f; vertices[1][1]=-1.0f; vertices[1][2]=0.0f;\r
+ /* Right Of Triangle */\r
+ vertices[2][0]=1.0f; vertices[2][1]=-1.0f; vertices[2][2]=0.0f;\r
+\r
+ /* Drawing Using Triangles, draw triangles using 3 vertices */\r
+ glDrawArrays(GL_TRIANGLES, 0, 3);\r
+\r
+ /* Move Right 3 Units */\r
+ glLoadIdentity();\r
+ glTranslatef(1.5f, 0.0f, -6.0f);\r
+\r
+ /* Top Right Of The Quad */\r
+ vertices[0][0]=1.0f; vertices[0][1]=1.0f; vertices[0][2]=0.0f;\r
+ /* Top Left Of The Quad */\r
+ vertices[1][0]=-1.0f; vertices[1][1]=1.0f; vertices[1][2]=0.0f;\r
+ /* Bottom Left Of The Quad */\r
+ vertices[2][0]=1.0f; vertices[2][1]=-1.0f; vertices[2][2]=0.0f;\r
+ /* Bottom Right Of The Quad */\r
+ vertices[3][0]=-1.0f; vertices[3][1]=-1.0f; vertices[3][2]=0.0f;\r
+\r
+ /* Drawing using triangle strips, draw triangles using 4 vertices */\r
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\r
+\r
+ /* Disable vertex array */\r
+ glDisableClientState(GL_VERTEX_ARRAY);\r
+\r
+ /* Flush all drawings */\r
+ glFinish();\r
+}\r
+\r
+//---------------------------------------------------------------------------------------------------\r
+//CNativeWrapper\r
+//-------------------------------\r
+CNativeWrapper::CNativeWrapper(){\r
+ do_log = 1;\r
+ logfile = NULL;\r
+\r
+ m_pTimer = NULL;\r
+#ifndef GPAC_GUI_ONLY\r
+ memset(&m_user, 0, sizeof(GF_User));\r
+ m_term = NULL;\r
+ m_mx = NULL;\r
+ memset(&m_rti, 0, sizeof(GF_SystemRTInfo));\r
+#endif\r
+\r
+#ifdef DEBUG_MODE\r
+ debug_f = fopen(DEBUG_FILE, "w");\r
+#endif\r
+}\r
+//-------------------------------\r
+CNativeWrapper::~CNativeWrapper(){\r
+ Shutdown();\r
+\r
+ if (logfile) fclose(logfile);\r
+\r
+#ifdef DEBUG_MODE\r
+ if (debug_f){\r
+ debug_log("~CNativeWrapper()\n");\r
+ fclose(debug_f); \r
+ }\r
+ \r
+#endif \r
+}\r
+//-------------------------------\r
+void CNativeWrapper::debug_log(const char* msg){\r
+#ifdef DEBUG_MODE\r
+ fprintf(debug_f, "%s\n", msg);\r
+ fflush(debug_f);\r
+#endif\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::Shutdown()\r
+{\r
+\r
+ if (m_mx) gf_mx_del(m_mx);\r
+\r
+ MessageBox("Osmo4 shutdown request", "");\r
+ if (m_pTimer) {\r
+ m_pTimer->Cancel();\r
+ delete m_pTimer;\r
+ m_pTimer = NULL;\r
+ }\r
+#ifndef GPAC_GUI_ONLY\r
+ if (m_term) {\r
+ GF_Terminal *t = m_term;\r
+ m_term = NULL;\r
+ gf_term_del(t);\r
+ }\r
+ if (m_user.config) {\r
+ gf_cfg_del(m_user.config);\r
+ m_user.config = NULL;\r
+ }\r
+ if (m_user.modules) {\r
+ gf_modules_del(m_user.modules);\r
+ m_user.modules = NULL;\r
+ }\r
+#endif\r
+ MessageBox("Osmo4 shutdown OK", "");\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::MessageBox(const char* msg, const char* title){\r
+ //call java function to display a message box\r
+\r
+ debug_log(msg);\r
+\r
+ return 1;\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::OnTick(){\r
+#ifndef GPAC_GUI_ONLY\r
+ if (m_term) gf_term_process_step(m_term);\r
+\r
+ /*check RTI display*/\r
+ //if (show_rti && gf_sys_get_rti(500, &m_rti, 0)) DisplayRTI();\r
+#endif\r
+ /*never stop...*/\r
+ return 1;\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::DisplayRTI(){\r
+#ifndef GPAC_GUI_ONLY\r
+ // display some system informations ?\r
+#endif\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::Quit(int code){\r
+ \r
+ Shutdown();\r
+ // send shutdown request to java\r
+ return code;\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::on_gpac_log(void *cbk, u32 ll, u32 lm, const char *fmt, va_list list){\r
+ // do log here\r
+ FILE *logs = (FILE*)cbk;\r
+\r
+ /*if (rti_logs && (lm & GF_LOG_RTI)) {\r
+ char szMsg[2048];\r
+ vsprintf(szMsg, fmt, list);\r
+ UpdateRTInfo(szMsg + 6 );\r
+ } else {\r
+ if (log_time_start) fprintf(logs, "[At %d]", gf_sys_clock() - log_time_start);\r
+ vfprintf(logs, fmt, list);\r
+ fflush(logs);\r
+ }*/\r
+ \r
+ vfprintf(logs, fmt, list);\r
+ fflush(logs);\r
+\r
+}\r
+//-------------------------------\r
+Bool CNativeWrapper::GPAC_EventProc(void *ptr, GF_Event *evt){\r
+ //event\r
+ return true;\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::Osmo4_progress_cbk(void *usr, char *title, u32 done, u32 total){\r
+ \r
+}\r
+//-------------------------------\r
+void CNativeWrapper::SetupLogs(){\r
+ const char *opt;\r
+ debug_log("SetupLogs()");\r
+\r
+//#ifndef GPAC_GUI_ONLY\r
+ gf_mx_p(m_mx);\r
+ if (do_log) {\r
+ gf_log_set_level(0);\r
+ do_log = 0;\r
+ }\r
+ /*setup GPAC logs: log all errors*/\r
+ gf_log_set_level(GF_LOG_DEBUG);\r
+ gf_log_set_tools(0xFFFFFFFF);\r
+ opt = gf_cfg_get_key(m_user.config, "General", "LogLevel");\r
+ if ((opt && !stricmp(opt, "debug")) /*|| 1*/) { \r
+ FILE *logs = fopen(GPAC_LOG_FILE, "wt");\r
+ if (!logs) {\r
+ MessageBox("Cannot open log file - disabling logs", "Warning !");\r
+ } else {\r
+ MessageBox("Debug log enabled in \\data\\gpac_logs.txt", "Info");\r
+ fclose(logs);\r
+ do_log = 1;\r
+ gf_log_set_level(GF_LOG_DEBUG);\r
+ gf_log_set_tools(0xFFFFFFFF);\r
+ }\r
+ }\r
+ if (!do_log) {\r
+ gf_log_set_level(GF_LOG_ERROR);\r
+ gf_log_set_tools(0xFFFFFFFF);\r
+ }\r
+ \r
+\r
+ gf_log_set_level(GF_LOG_DEBUG);\r
+ gf_log_set_tools(0xFFFFFFFF);\r
+\r
+ logfile = fopen(GPAC_LOG_FILE, "wt");\r
+\r
+ gf_log_set_callback(logfile, on_gpac_log);\r
+ gf_mx_v(m_mx);\r
+\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Osmo4 logs initialized\n"));\r
+//#endif\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::init(JNIEnv * env, jobject * bitmap){\r
+\r
+ debug_log("int CNativeWrapper::init()");\r
+\r
+ int m_Width = 100, m_Height = 100;\r
+\r
+ int first_launch = 0;\r
+ const char *opt;\r
+\r
+ m_window = env;\r
+ m_session = bitmap;\r
+ \r
+ m_mx = gf_mx_new("Osmo4");\r
+\r
+ //load config file\r
+ m_user.config = gf_cfg_new(GPAC_CFG_DIR, "GPAC.cfg");\r
+ if (!m_user.config) {\r
+ first_launch = 1;\r
+ FILE *ft = fopen(GPAC_CFG_DIR"GPAC.cfg", "wt");\r
+ if (!ft) {\r
+ MessageBox("Cannot create GPAC Config file", "Fatal Error");\r
+ return Quit(KErrGeneral);\r
+ } else {\r
+ fclose(ft);\r
+ }\r
+ m_user.config = gf_cfg_new(GPAC_CFG_DIR, "GPAC.cfg");\r
+ if (!m_user.config) {\r
+ MessageBox("GPAC Configuration file not found", "Fatal Error");\r
+ return Quit(KErrGeneral);\r
+ }\r
+ }\r
+\r
+ SetupLogs();\r
+ gf_set_progress_callback(this, Osmo4_progress_cbk);\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "ModulesDirectory");\r
+ if (!opt) first_launch = 2;\r
+ \r
+ if (first_launch) {\r
+ /*hardcode module directory*/\r
+ gf_cfg_set_key(m_user.config, "General", "ModulesDirectory", GPAC_MODULES_DIR);\r
+ /*hardcode cache directory*/\r
+ gf_cfg_set_key(m_user.config, "General", "CacheDirectory", GPAC_CACHE_DIR);\r
+ gf_cfg_set_key(m_user.config, "Downloader", "CleanCache", "yes");\r
+ /*startup file*/\r
+ //gf_cfg_set_key(m_user.config, "General", "StartupFile", GPAC_CFG_DIR"gpac.mp4");\r
+ /*setup UDP traffic autodetect*/\r
+ gf_cfg_set_key(m_user.config, "Network", "AutoReconfigUDP", "yes");\r
+ gf_cfg_set_key(m_user.config, "Network", "UDPTimeout", "10000");\r
+ gf_cfg_set_key(m_user.config, "Network", "BufferLength", "3000");\r
+ \r
+ gf_cfg_set_key(m_user.config, "Compositor", "TextureTextMode", "Default");\r
+ //gf_cfg_set_key(m_user.config, "Compositor", "FrameRate", "30");\r
+\r
+ gf_cfg_set_key(m_user.config, "Video", "DriverName", "Android Video Output");\r
+\r
+ gf_cfg_set_key(m_user.config, "FontEngine", "FontReader", "ft_font");\r
+\r
+ gf_cfg_set_key(m_user.config, "FontEngine", "FontDirectory", GPAC_FONT_DIR);\r
+\r
+ \r
+ /*save cfg and reload*/\r
+ gf_cfg_del(m_user.config);\r
+ m_user.config = gf_cfg_new(GPAC_CFG_DIR, "GPAC.cfg");\r
+ if (!m_user.config) {\r
+ MessageBox("Cannot save initial GPAC Config file", "Fatal Error");\r
+ return Quit(KErrGeneral);\r
+ }\r
+\r
+\r
+ MessageBox("Osmo4", "Thank you for Installing");\r
+ }\r
+\r
+ /*load modules*/\r
+ opt = gf_cfg_get_key(m_user.config, "General", "ModulesDirectory");\r
+ m_user.modules = gf_modules_new(opt, m_user.config);\r
+ if (!m_user.modules || !gf_modules_get_count(m_user.modules)) {\r
+ MessageBox(m_user.modules ? "No modules available" : "Cannot create module manager", "Fatal Error");\r
+ if (m_user.modules) gf_modules_del(m_user.modules);\r
+ gf_cfg_del(m_user.config);\r
+ return Quit(KErrGeneral);\r
+ }\r
+\r
+ if (first_launch) {\r
+ /*first launch, register all files ext*/\r
+ for (u32 i=0; i<gf_modules_get_count(m_user.modules); i++) {\r
+ GF_InputService *ifce = (GF_InputService *) gf_modules_load_interface(m_user.modules, i, GF_NET_CLIENT_INTERFACE);\r
+ if (!ifce) continue;\r
+ if (ifce) {\r
+ ifce->CanHandleURL(ifce, "test.test");\r
+ gf_modules_close_interface((GF_BaseInterface *)ifce);\r
+ }\r
+ }\r
+ }\r
+\r
+ /*we don't thread the terminal, ie appart from the audio renderer, media decoding and visual rendering is \r
+ handled by the app process*/\r
+ m_user.init_flags = GF_TERM_NO_THREAD | GF_TERM_NO_REGULATION;\r
+ m_user.init_flags |= GF_TERM_NO_AUDIO;\r
+ m_user.EventProc = GPAC_EventProc;\r
+ m_user.opaque = this;\r
+ m_user.os_window_handler = m_window;\r
+ m_user.os_display = m_session;\r
+\r
+ m_term = gf_term_new(&m_user);\r
+ if (!m_term) {\r
+ MessageBox("Cannot load GPAC terminal", "Fatal Error");\r
+ gf_modules_del(m_user.modules);\r
+ gf_cfg_del(m_user.config);\r
+ return Quit(KErrGeneral);\r
+ }\r
+ MessageBox("GPAC terminal loaded", "Success !");\r
+\r
+ gf_term_set_size(m_term, m_Width, m_Height);\r
+\r
+ m_pTimer = new CPeriodic();\r
+ m_pTimer->Start();\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "StartupFile");\r
+ //if (opt) gf_term_connect(m_term, opt);\r
+\r
+ //initGL();\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::connect(const char *url){\r
+ /*debug_log("Starting to connect ..."); \r
+\r
+ gf_term_connect_from_time(m_term, url, 0, false);\r
+ //gf_term_connect(m_term, url);\r
+\r
+ debug_log("connected ...");*/\r
+\r
+ char pl_path[GF_MAX_PATH];\r
+ \r
+ strcpy(pl_path, url);\r
+\r
+ debug_log("Connecting to ...");\r
+ debug_log(pl_path);\r
+\r
+ //gf_term_connect_with_path(m_term, url, pl_path);\r
+ gf_term_connect(m_term, url);\r
+ debug_log("connected ...");\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::disconnect(){\r
+ \r
+ gf_term_disconnect(m_term);\r
+ debug_log("disconnected ...");\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::step(JNIEnv * env, jobject * bitmap){\r
+ m_window = env;\r
+ m_session = bitmap;\r
+ debug_log("Step ...");\r
+ if (!m_term)\r
+ debug_log("m_term ...");\r
+ else\r
+ if (!m_term->compositor)\r
+ debug_log("compositor ...");\r
+ else\r
+ if (!m_term->compositor->video_out)\r
+ debug_log("video_out ...");\r
+ else\r
+ if (!m_term->compositor->video_out->Setup)\r
+ debug_log("Setup ...");\r
+ else\r
+ {\r
+ debug_log("Video Setup ...");\r
+ m_term->compositor->video_out->Setup(m_term->compositor->video_out, m_window, m_session, -1);\r
+ }\r
+ gf_term_process_step(m_term);\r
+ //drawGLScene();\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::resize(int w, int h){\r
+ gf_term_set_size(m_term, w, h);\r
+ //resizeWindow(w,h);\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onMouseDown(float x, float y){\r
+ char msg[100]; \r
+ sprintf(msg, "onMousedown x=%f, y=%f", x, y );\r
+ debug_log(msg);\r
+\r
+ GF_Event evt;\r
+ evt.type = GF_EVENT_MOUSEDOWN;\r
+ evt.mouse.button = GF_MOUSE_LEFT;\r
+ evt.mouse.x = x;\r
+ evt.mouse.y = y;\r
+ \r
+ int ret = gf_term_user_event(m_term, &evt);\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onMouseUp(float x, float y){\r
+ char msg[100]; \r
+ sprintf(msg, "onMouseUp x=%f, y=%f", x, y );\r
+ debug_log(msg);\r
+\r
+ GF_Event evt;\r
+ evt.type = GF_EVENT_MOUSEUP;\r
+ evt.mouse.button = GF_MOUSE_LEFT;\r
+ evt.mouse.x = x;\r
+ evt.mouse.y = y;\r
+ \r
+ int ret = gf_term_user_event(m_term, &evt);\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onKeyPress(int keycode, int rawkeycode, int up, int flag){\r
+ GF_Event evt;\r
+ if (up == 0) evt.type = GF_EVENT_KEYUP;\r
+ else evt.type = GF_EVENT_KEYDOWN;\r
+\r
+ evt.key.flags = 0;\r
+ evt.key.hw_code = rawkeycode;\r
+ \r
+ char msg[100]; \r
+ sprintf(msg, "onKeyPress keycode=%d", keycode);\r
+ debug_log(msg); \r
+\r
+ //translate_key(keycode, &evt.key);\r
+ evt.key.key_code = GF_KEY_A;\r
+ int ret = gf_term_user_event(m_term, &evt);\r
+ /*generate a key up*/\r
+ \r
+ sprintf(msg, "onKeyPress gpac keycode=%d, GF_KEY_A=%d, ret=%d", evt.key.key_code, GF_KEY_A, ret);\r
+ debug_log(msg); \r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::translate_key(ANDROID_KEYCODE keycode, GF_EventKey *evt){\r
+ evt->flags = 0;\r
+ \r
+ char msg[100]; \r
+ sprintf(msg, "translate_key keycode=%d", keycode);\r
+ debug_log(msg);\r
+\r
+ switch (keycode) {\r
+ case ANDROID_KEYCODE_BACK: evt->key_code = GF_KEY_BACKSPACE; break;\r
+ case ANDROID_KEYCODE_TAB: evt->key_code = GF_KEY_TAB; break;\r
+ case ANDROID_KEYCODE_CLEAR: evt->key_code = GF_KEY_CLEAR; break;\r
+ case ANDROID_KEYCODE_ENTER: evt->key_code = GF_KEY_ENTER; break;\r
+ case ANDROID_KEYCODE_SHIFT_LEFT: evt->key_code = GF_KEY_SHIFT; break;\r
+ case ANDROID_KEYCODE_SHIFT_RIGHT: evt->key_code = GF_KEY_SHIFT; break;\r
+ //case VK_CONTROL: evt->key_code = GF_KEY_CONTROL; break;\r
+ case ANDROID_KEYCODE_ALT_LEFT: evt->key_code = GF_KEY_ALT; break;\r
+ case ANDROID_KEYCODE_ALT_RIGHT: evt->key_code = GF_KEY_ALT; break;\r
+ //case VK_PAUSE: evt->key_code = GF_KEY_PAUSE; break;\r
+ //case VK_CAPITAL: evt->key_code = GF_KEY_CAPSLOCK; break;\r
+ //case VK_KANA: evt->key_code = GF_KEY_KANAMODE; break;\r
+ //case VK_JUNJA: evt->key_code = GF_KEY_JUNJAMODE; break;\r
+ //case VK_FINAL: evt->key_code = GF_KEY_FINALMODE; break;\r
+ //case VK_KANJI: evt->key_code = GF_KEY_KANJIMODE; break;\r
+ //case VK_ESCAPE: evt->key_code = GF_KEY_ESCAPE; break;\r
+ //case VK_CONVERT: evt->key_code = GF_KEY_CONVERT; break;\r
+ case ANDROID_KEYCODE_SPACE: evt->key_code = GF_KEY_SPACE; break;\r
+ //case VK_PRIOR: evt->key_code = GF_KEY_PAGEUP; break;\r
+ //case VK_NEXT: evt->key_code = GF_KEY_PAGEDOWN; break;\r
+ //case VK_END: evt->key_code = GF_KEY_END; break;\r
+ case ANDROID_KEYCODE_HOME: evt->key_code = GF_KEY_HOME; break;\r
+ case ANDROID_KEYCODE_DPAD_LEFT: evt->key_code = GF_KEY_LEFT; break;\r
+ case ANDROID_KEYCODE_DPAD_UP: evt->key_code = GF_KEY_UP; break;\r
+ case ANDROID_KEYCODE_DPAD_RIGHT: evt->key_code = GF_KEY_RIGHT; break;\r
+ case ANDROID_KEYCODE_DPAD_DOWN: evt->key_code = GF_KEY_DOWN; break;\r
+ //case VK_SELECT: evt->key_code = GF_KEY_SELECT; break;\r
+ //case VK_PRINT: \r
+ //case VK_SNAPSHOT:\r
+ // evt->key_code = GF_KEY_PRINTSCREEN; break;\r
+ //case VK_EXECUTE: evt->key_code = GF_KEY_EXECUTE; break;\r
+ //case VK_INSERT: evt->key_code = GF_KEY_INSERT; break;\r
+ case ANDROID_KEYCODE_DEL: evt->key_code = GF_KEY_DEL; break;\r
+ //case VK_HELP: evt->key_code = GF_KEY_HELP; break;\r
+\r
+\r
+/* case '!': evt->key_code = GF_KEY_EXCLAMATION; break;\r
+ case '"': evt->key_code = GF_KEY_QUOTATION; break;\r
+ case '#': evt->key_code = GF_KEY_NUMBER; break;\r
+ case '$': evt->key_code = GF_KEY_DOLLAR; break;\r
+ case '&': evt->key_code = GF_KEY_AMPERSAND; break;\r
+ case '\'': evt->key_code = GF_KEY_APOSTROPHE; break;\r
+ case '(': evt->key_code = GF_KEY_LEFTPARENTHESIS; break;\r
+ case ')': evt->key_code = GF_KEY_RIGHTPARENTHESIS; break;\r
+ case ',': evt->key_code = GF_KEY_COMMA; break;\r
+ case ':': evt->key_code = GF_KEY_COLON; break;\r
+ case ';': evt->key_code = GF_KEY_SEMICOLON; break;\r
+ case '<': evt->key_code = GF_KEY_LESSTHAN; break;\r
+ case '>': evt->key_code = GF_KEY_GREATERTHAN; break;\r
+ case '?': evt->key_code = GF_KEY_QUESTION; break;\r
+ case '@': evt->key_code = GF_KEY_AT; break;\r
+ case '[': evt->key_code = GF_KEY_LEFTSQUAREBRACKET; break;\r
+ case ']': evt->key_code = GF_KEY_RIGHTSQUAREBRACKET; break;\r
+ case '\\': evt->key_code = GF_KEY_BACKSLASH; break;\r
+ case '_': evt->key_code = GF_KEY_UNDERSCORE; break;\r
+ case '`': evt->key_code = GF_KEY_GRAVEACCENT; break;\r
+ case ' ': evt->key_code = GF_KEY_SPACE; break;\r
+ case '/': evt->key_code = GF_KEY_SLASH; break;\r
+ case '*': evt->key_code = GF_KEY_STAR; break;\r
+ case '-': evt->key_code = GF_KEY_HIPHEN; break;\r
+ case '+': evt->key_code = GF_KEY_PLUS; break;\r
+ case '=': evt->key_code = GF_KEY_EQUALS; break;\r
+ case '^': evt->key_code = GF_KEY_CIRCUM; break;\r
+ case '{': evt->key_code = GF_KEY_LEFTCURLYBRACKET; break;\r
+ case '}': evt->key_code = GF_KEY_RIGHTCURLYBRACKET; break;\r
+ case '|': evt->key_code = GF_KEY_PIPE; break;\r
+*/ \r
+\r
+\r
+/* case VK_LWIN: return ;\r
+ case VK_RWIN: return ;\r
+ case VK_APPS: return ;\r
+*/\r
+ case ANDROID_KEYCODE_0: \r
+ evt->key_code = GF_KEY_0;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_1:\r
+ evt->key_code = GF_KEY_1;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_2:\r
+ evt->key_code = GF_KEY_2;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_3:\r
+ evt->key_code = GF_KEY_3;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_4:\r
+ evt->key_code = GF_KEY_4;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_5:\r
+ evt->key_code = GF_KEY_5;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_6:\r
+ evt->key_code = GF_KEY_6;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_7:\r
+ evt->key_code = GF_KEY_7;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_8:\r
+ evt->key_code = GF_KEY_8;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_9:\r
+ evt->key_code = GF_KEY_9;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_A:\r
+ evt->key_code = GF_KEY_9;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ /*\r
+ case VK_MULTIPLY: \r
+ evt->key_code = GF_KEY_STAR;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case VK_ADD: \r
+ evt->key_code = GF_KEY_PLUS;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case VK_SEPARATOR:\r
+ evt->key_code = GF_KEY_FULLSTOP;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case VK_SUBTRACT:\r
+ evt->key_code = GF_KEY_HYPHEN;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case VK_DECIMAL:\r
+ evt->key_code = GF_KEY_COMMA;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case VK_DIVIDE:\r
+ evt->key_code = GF_KEY_SLASH;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ \r
+ case VK_F1: evt->key_code = GF_KEY_F1; break;\r
+ case VK_F2: evt->key_code = GF_KEY_F2; break;\r
+ case VK_F3: evt->key_code = GF_KEY_F3; break;\r
+ case VK_F4: evt->key_code = GF_KEY_F4; break;\r
+ case VK_F5: evt->key_code = GF_KEY_F5; break;\r
+ case VK_F6: evt->key_code = GF_KEY_F6; break;\r
+ case VK_F7: evt->key_code = GF_KEY_F7; break;\r
+ case VK_F8: evt->key_code = GF_KEY_F8; break;\r
+ case VK_F9: evt->key_code = GF_KEY_F9; break;\r
+ case VK_F10: evt->key_code = GF_KEY_F10; break;\r
+ case VK_F11: evt->key_code = GF_KEY_F11; break;\r
+ case VK_F12: evt->key_code = GF_KEY_F12; break;\r
+ case VK_F13: evt->key_code = GF_KEY_F13; break;\r
+ case VK_F14: evt->key_code = GF_KEY_F14; break;\r
+ case VK_F15: evt->key_code = GF_KEY_F15; break;\r
+ case VK_F16: evt->key_code = GF_KEY_F16; break;\r
+ case VK_F17: evt->key_code = GF_KEY_F17; break;\r
+ case VK_F18: evt->key_code = GF_KEY_F18; break;\r
+ case VK_F19: evt->key_code = GF_KEY_F19; break;\r
+ case VK_F20: evt->key_code = GF_KEY_F20; break;\r
+ case VK_F21: evt->key_code = GF_KEY_F21; break;\r
+ case VK_F22: evt->key_code = GF_KEY_F22; break;\r
+ case VK_F23: evt->key_code = GF_KEY_F23; break;\r
+ case VK_F24: evt->key_code = GF_KEY_F24; break;\r
+\r
+ case VK_NUMLOCK: evt->key_code = GF_KEY_NUMLOCK; break;\r
+ case VK_SCROLL: evt->key_code = GF_KEY_SCROLL; break;\r
+ */\r
+\r
+/*\r
+ * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.\r
+ * Used only as parameters to GetAsyncKeyState() and GetKeyState().\r
+ * No other API or message will distinguish left and right keys in this way.\r
+ */\r
+ /*\r
+ case ANDROID_KEYCODE_SHIFT_LEFT: \r
+ evt->key_code = GF_KEY_SHIFT;\r
+ evt->flags = GF_KEY_EXT_LEFT;\r
+ break;\r
+ case ANDROID_KEYCODE_SHIFT_RIGHT:\r
+ evt->key_code = GF_KEY_SHIFT;\r
+ evt->flags = GF_KEY_EXT_RIGHT;\r
+ break;\r
+ case VK_LCONTROL:\r
+ evt->key_code = GF_KEY_CONTROL;\r
+ evt->flags = GF_KEY_EXT_LEFT;\r
+ break;\r
+ case VK_RCONTROL:\r
+ evt->key_code = GF_KEY_CONTROL;\r
+ evt->flags = GF_KEY_EXT_RIGHT;\r
+ break;\r
+ case VK_LMENU:\r
+ evt->key_code = GF_KEY_ALT;\r
+ evt->flags = GF_KEY_EXT_LEFT;\r
+ break;\r
+ case VK_RMENU:\r
+ evt->key_code = GF_KEY_ALT;\r
+ evt->flags = GF_KEY_EXT_RIGHT;\r
+ break;\r
+ */\r
+\r
+ /*thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */\r
+ /* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */\r
+ default: \r
+ if ((keycode>=ANDROID_KEYCODE_A) && (keycode<=ANDROID_KEYCODE_Z)) { evt->key_code = GF_KEY_A + keycode - ANDROID_KEYCODE_A; debug_log("default keycode"); }\r
+ else\r
+ evt->key_code = GF_KEY_UNIDENTIFIED;\r
+ break;\r
+ }\r
+\r
+ //evt->hw_code = keycode;\r
+ evt->hw_code = evt->key_code;\r
+}\r
+//-----------------------------------------------------\r
+GF_Config *CNativeWrapper::create_default_config(char *file_path, char *file_name){\r
+ GF_Config *cfg;\r
+ char szPath[GF_MAX_PATH];\r
+ FILE *f;\r
+ sprintf(szPath, "%s%c%s", file_path, GF_PATH_SEPARATOR, file_name);\r
+ f = fopen(szPath, "wt");\r
+ fprintf(stdout, "create %s: %s\n", szPath, (f==NULL) ? "Error" : "OK");\r
+ if (!f) return NULL;\r
+ fclose(f);\r
+\r
+ cfg = gf_cfg_new(file_path, file_name);\r
+ if (!cfg) return NULL;\r
+\r
+#ifdef GPAC_MODULES_PATH\r
+ fprintf(stdout, "Using module directory %s \n", GPAC_MODULES_PATH);\r
+ strcpy(szPath, GPAC_MODULES_PATH);\r
+#elif defined(WIN32)\r
+ strcpy(szPath, file_path); \r
+#else \r
+ fprintf(stdout, "Please enter full path to GPAC modules directory:\n");\r
+ scanf("%s", szPath);\r
+#endif\r
+ gf_cfg_set_key(cfg, "General", "ModulesDirectory", szPath);\r
+ gf_cfg_set_key(cfg, "Audio", "ForceConfig", "yes");\r
+ gf_cfg_set_key(cfg, "Audio", "NumBuffers", "2");\r
+ gf_cfg_set_key(cfg, "Audio", "TotalDuration", "120");\r
+ gf_cfg_set_key(cfg, "Audio", "DisableNotification", "no");\r
+ gf_cfg_set_key(cfg, "FontEngine", "FontReader", "ft_font");\r
+\r
+ /*these fonts seems installed by default on many systems...*/\r
+ //gf_cfg_set_key(cfg, "FontEngine", "FontSerif", "Bitstream Vera Serif");\r
+ //gf_cfg_set_key(cfg, "FontEngine", "FontSans", "Bitstream Vera Sans");\r
+ //gf_cfg_set_key(cfg, "FontEngine", "FontFixed", "Bitstream Vera Monospace");\r
+ strcpy(szPath, "/system/fonts/");\r
+\r
+ fprintf(stdout, "Using default font directory %s\n", szPath);\r
+ gf_cfg_set_key(cfg, "FontEngine", "FontDirectory", szPath);\r
+\r
+ fprintf(stdout, "Using /tmp as a cache directory for HTTP downloads:\n");\r
+ gf_cfg_set_key(cfg, "General", "CacheDirectory", "/data/osmo/tmp");\r
+\r
+ gf_cfg_set_key(cfg, "Downloader", "CleanCache", "yes");\r
+ gf_cfg_set_key(cfg, "Compositor", "AntiAlias", "All");\r
+ gf_cfg_set_key(cfg, "Compositor", "FrameRate", "30");\r
+ /*use power-of-2 emulation*/\r
+ gf_cfg_set_key(cfg, "Compositor", "EmulatePOW2", "yes");\r
+\r
+ gf_cfg_set_key(cfg, "Video", "DriverName", "Android Video Output");\r
+ /*x11 only supports scalable zoom*/\r
+ gf_cfg_set_key(cfg, "Compositor", "ScalableZoom", "yes");\r
+ gf_cfg_set_key(cfg, "Audio", "DriverName", "SDL Audio Output");\r
+\r
+ gf_cfg_set_key(cfg, "Video", "SwitchResolution", "no");\r
+ gf_cfg_set_key(cfg, "Network", "AutoReconfigUDP", "yes");\r
+ gf_cfg_set_key(cfg, "Network", "UDPTimeout", "10000");\r
+ gf_cfg_set_key(cfg, "Network", "BufferLength", "3000");\r
+\r
+ /*store and reload*/\r
+ gf_cfg_del(cfg);\r
+ return gf_cfg_new(file_path, file_name);\r
+}\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+// this function will be called by Java to init gpac\r
+\r
+void gpac_init(JNIEnv * env, jobject * bitmap){\r
+\r
+ gpac_obj = new CNativeWrapper();\r
+ if (gpac_obj) gpac_obj->init(env, bitmap);\r
+ //if (gpac_obj) gpac_obj->connect("/data/osmo/tidycity.mp4");\r
+}\r
+\r
+void gpac_render(JNIEnv * env, jobject * bitmap){\r
+ if (gpac_obj) gpac_obj->step(env, bitmap);\r
+}\r
+\r
+void gpac_connect(const char *url){\r
+ //gpac_obj->connect("/data/osmo/tidycity.mp4");\r
+ gpac_obj->connect(url);\r
+}\r
+\r
+void gpac_resize(int w, int h){\r
+ if (gpac_obj) gpac_obj->resize(w, h);\r
+}\r
+\r
+void gpac_disconnect(){\r
+ if (gpac_obj) gpac_obj->disconnect();\r
+}\r
+\r
+void gpac_free(){\r
+ if (gpac_obj) delete gpac_obj;\r
+}\r
+\r
+void gpac_onmousedown(float x, float y){\r
+ if (gpac_obj) gpac_obj->onMouseDown(x, y);\r
+}\r
+\r
+void gpac_onmouseup(float x, float y){\r
+ if (gpac_obj) gpac_obj->onMouseUp(x, y);\r
+}\r
+void gpac_onkeypress(int keycode, int rawkeycode, int up, int flag){\r
+ if (gpac_obj) gpac_obj->onKeyPress(keycode, rawkeycode, up, flag);\r
+}\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacinit(JNIEnv * env, jobject obj, jobject bitmap, jint width, jint height)\r
+{\r
+ int x = width;\r
+ int y = height;\r
+ gpac_init(env, &bitmap);\r
+ //initGL();\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacconnect(JNIEnv * env, jobject obj, jstring url)\r
+{\r
+ const char *the_url = env->GetStringUTFChars(url, NULL);\r
+ //(*env)->ReleaseStringUTFChars(env, prompt, str);\r
+ gpac_connect(the_url); \r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacdisconnect(JNIEnv * env, jobject obj){\r
+ gpac_disconnect();\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacfree(JNIEnv * env, jobject obj)\r
+{\r
+ gpac_free();\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacrender (JNIEnv * env, jobject obj, jobject bitmap)\r
+{\r
+ gpac_render(env, &bitmap);\r
+ //drawGLScene();\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacresize (JNIEnv * env, jobject obj, jint width, jint height)\r
+{\r
+ int w = width;\r
+ int h = height;\r
+ gpac_resize(w,h);\r
+ //resizeWindow(w,h);\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpaceventmousedown(JNIEnv * env, jobject obj, jfloat x, jfloat y){\r
+ gpac_onmousedown(x, y);\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpaceventmouseup(JNIEnv * env, jobject obj, jfloat x, jfloat y){\r
+ gpac_onmouseup(x, y);\r
+}\r
+//-----------------------------------\r
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpaceventkeypress(JNIEnv * env, jobject obj, jint keycode, jint rawkeycode, jint up, jint flag){\r
+ gpac_onkeypress(keycode, rawkeycode, up, flag);\r
+}\r
+//-----------------------------------\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen, Ivica ARSOV / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#include <jni.h>\r
+\r
+#include <gpac/terminal.h>\r
+#include <gpac/thread.h>\r
+#include <gpac/options.h>\r
+#include <gpac/modules/service.h>\r
+\r
+#include <android/bitmap.h>\r
+\r
+#define KErrGeneral 1\r
+#define GPAC_CFG_DIR "/data/osmo/"\r
+#define GPAC_MODULES_DIR "/data/osmo/modules/"\r
+#define GPAC_MODULES_PATH "/data/osmo/modules/"\r
+#define GPAC_CACHE_DIR "/data/osmo/cache/"\r
+#define GPAC_LOG_FILE "/data/osmo/gpac_logs.txt"\r
+#define GPAC_FONT_DIR "/system/fonts/"\r
+\r
+#define DEBUG_MODE 1\r
+#define DEBUG_FILE "/data/osmo/osmo_debug.txt"\r
+\r
+// keyboard code\r
+#define ANDROID_KEYCODE int\r
+#define ANDROID_KEYCODE_0 7\r
+#define ANDROID_KEYCODE_1 8\r
+#define ANDROID_KEYCODE_2 9\r
+#define ANDROID_KEYCODE_3 10\r
+#define ANDROID_KEYCODE_4 11\r
+#define ANDROID_KEYCODE_5 12\r
+#define ANDROID_KEYCODE_6 13\r
+#define ANDROID_KEYCODE_7 14\r
+#define ANDROID_KEYCODE_8 15\r
+#define ANDROID_KEYCODE_9 16\r
+#define ANDROID_KEYCODE_A 29\r
+#define ANDROID_KEYCODE_B 30\r
+#define ANDROID_KEYCODE_C 31\r
+#define ANDROID_KEYCODE_D 32\r
+#define ANDROID_KEYCODE_E 33\r
+#define ANDROID_KEYCODE_F 34\r
+#define ANDROID_KEYCODE_G 35\r
+#define ANDROID_KEYCODE_H 36\r
+#define ANDROID_KEYCODE_I 37\r
+#define ANDROID_KEYCODE_J 38\r
+#define ANDROID_KEYCODE_K 39\r
+#define ANDROID_KEYCODE_L 40\r
+#define ANDROID_KEYCODE_M 41\r
+#define ANDROID_KEYCODE_N 42\r
+#define ANDROID_KEYCODE_O 43\r
+#define ANDROID_KEYCODE_P 44\r
+#define ANDROID_KEYCODE_Q 45\r
+#define ANDROID_KEYCODE_R 46\r
+#define ANDROID_KEYCODE_S 47\r
+#define ANDROID_KEYCODE_T 48\r
+#define ANDROID_KEYCODE_U 49\r
+#define ANDROID_KEYCODE_V 50\r
+#define ANDROID_KEYCODE_W 51\r
+#define ANDROID_KEYCODE_X 52\r
+#define ANDROID_KEYCODE_Y 53\r
+#define ANDROID_KEYCODE_Z 54\r
+#define ANDROID_KEYCODE_ALT_LEFT 57\r
+#define ANDROID_KEYCODE_ALT_RIGHT 58\r
+#define ANDROID_KEYCODE_AT 77\r
+#define ANDROID_KEYCODE_BACK 4\r
+#define ANDROID_KEYCODE_BACKSLASH 73\r
+#define ANDROID_KEYCODE_CALL 5\r
+#define ANDROID_KEYCODE_CAMERA 27\r
+#define ANDROID_KEYCODE_CLEAR 28\r
+#define ANDROID_KEYCODE_COMMA 55\r
+#define ANDROID_KEYCODE_DEL 67\r
+#define ANDROID_KEYCODE_DPAD_CENTER 23\r
+#define ANDROID_KEYCODE_DPAD_DOWN 20\r
+#define ANDROID_KEYCODE_DPAD_LEFT 21\r
+#define ANDROID_KEYCODE_DPAD_RIGHT 22\r
+#define ANDROID_KEYCODE_DPAD_UP 19\r
+#define ANDROID_KEYCODE_ENDCALL 6\r
+#define ANDROID_KEYCODE_ENTER 66\r
+#define ANDROID_KEYCODE_ENVELOPE 65\r
+#define ANDROID_KEYCODE_EQUALS 70\r
+#define ANDROID_KEYCODE_EXPLORER 64\r
+#define ANDROID_KEYCODE_FOCUS 80\r
+#define ANDROID_KEYCODE_GRAVE 68\r
+#define ANDROID_KEYCODE_HEADSETHOOK 79\r
+#define ANDROID_KEYCODE_HOME 3\r
+#define ANDROID_KEYCODE_LEFT_BRACKET 71\r
+#define ANDROID_KEYCODE_MEDIA_FAST_FORWARD 90\r
+#define ANDROID_KEYCODE_MEDIA_NEXT 87\r
+#define ANDROID_KEYCODE_MEDIA_PLAY_PAUSE 85\r
+#define ANDROID_KEYCODE_MEDIA_PREVIOUS 88\r
+#define ANDROID_KEYCODE_MEDIA_REWIND 89\r
+#define ANDROID_KEYCODE_MEDIA_STOP 86\r
+#define ANDROID_KEYCODE_MENU 82\r
+#define ANDROID_KEYCODE_MINUS 69\r
+#define ANDROID_KEYCODE_MUTE 91\r
+#define ANDROID_KEYCODE_NUM 78\r
+#define ANDROID_KEYCODE_PLUS 81\r
+#define ANDROID_KEYCODE_POWER 26\r
+#define ANDROID_KEYCODE_RIGHT_BRACKET 72\r
+#define ANDROID_KEYCODE_SEARCH 84\r
+#define ANDROID_KEYCODE_SEMICOLON 74\r
+#define ANDROID_KEYCODE_SHIFT_LEFT 59\r
+#define ANDROID_KEYCODE_SHIFT_RIGHT 60\r
+#define ANDROID_KEYCODE_SLASH 76\r
+#define ANDROID_KEYCODE_SOFT_LEFT 1\r
+#define ANDROID_KEYCODE_SOFT_RIGHT 2\r
+#define ANDROID_KEYCODE_SPACE 62\r
+#define ANDROID_KEYCODE_STAR 17\r
+#define ANDROID_KEYCODE_SYM 63\r
+#define ANDROID_KEYCODE_TAB 61\r
+\r
+#define ANDROID_KEYCODE_UNKWON -1\r
+\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+class CPeriodic{\r
+ public:\r
+ CPeriodic();\r
+ ~CPeriodic();\r
+\r
+ void Start();\r
+ void Cancel();\r
+\r
+};\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+class CNativeWrapper{\r
+\r
+ private:\r
+ void* m_window;\r
+ void* m_session;\r
+\r
+ GF_User *GetUser() { return &m_user; }\r
+ GF_Terminal *m_term;\r
+\r
+ CPeriodic *m_pTimer;\r
+ GF_Mutex *m_mx;\r
+ GF_User m_user;\r
+ GF_SystemRTInfo m_rti;\r
+\r
+ int do_log;\r
+ FILE *logfile;\r
+ private:\r
+ void SetupLogs();\r
+ void Shutdown();\r
+ void DisplayRTI();\r
+ public:\r
+ CNativeWrapper();\r
+ ~CNativeWrapper();\r
+ int init(JNIEnv * env, jobject * bitmap);\r
+ int OnTick();\r
+ \r
+ int connect(const char *url);\r
+ void disconnect();\r
+ void step(JNIEnv * env, jobject * bitmap);\r
+ void resize(int w, int h);\r
+\r
+ void onMouseDown(float x, float y);\r
+ void onMouseUp(float x, float y);\r
+ void onKeyPress(int keycode, int rawkeycode, int up, int flag);\r
+ void translate_key(ANDROID_KEYCODE keycode, GF_EventKey *evt);\r
+ public: \r
+ int MessageBox(const char* msg, const char* title);\r
+ int Quit(int code);\r
+ GF_Config *create_default_config(char *file_path, char *file_name);\r
+\r
+ static void on_gpac_log(void *cbk, u32 ll, u32 lm, const char *fmt, va_list list);\r
+ static Bool GPAC_EventProc(void *ptr, GF_Event *evt);\r
+ static void Osmo4_progress_cbk(void *usr, char *title, u32 done, u32 total);\r
+\r
+ private:\r
+#ifdef DEBUG_MODE\r
+ FILE *debug_f;\r
+#endif \r
+ void debug_log(const char* msg);\r
+ \r
+};\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+// this function will be called by Java to init gpac\r
+CNativeWrapper* gpac_obj = NULL;\r
+\r
+/*\r
+void gpac_init();\r
+void gpac_connect(const char *url);\r
+void gpac_disconnect();\r
+void gpac_render();\r
+void gpac_free();\r
+*/\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+extern "C" {\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacinit(JNIEnv * env, jobject obj, jobject bitmap, jint width, jint height);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacconnect(JNIEnv * env, jobject obj, jstring url);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacdisconnect(JNIEnv * env, jobject obj);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacrender(JNIEnv * env, jobject obj, jobject bitmap);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacresize (JNIEnv * env, jobject obj, jint width, jint height);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpacfree(JNIEnv * env, jobject obj);\r
+\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpaceventmousedown(JNIEnv * env, jobject obj, jfloat x, jfloat y);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpaceventmouseup(JNIEnv * env, jobject obj, jfloat x, jfloat y);\r
+ JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GpacObject_gpaceventkeypress(JNIEnv * env, jobject obj, jint keycode, jint rawkeycode, jint up, jint flag);\r
+};\r
+\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen, Ivica ARSOV / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ */\r
+\r
+#include <jni.h>\r
+\r
+#include <gpac/terminal.h>\r
+#include <gpac/thread.h>\r
+#include <gpac/options.h>\r
+#include <gpac/modules/service.h>\r
+#include <gpac/internal/terminal_dev.h>\r
+#include <gpac/internal/compositor_dev.h>\r
+\r
+#include "wrapper.h"\r
+#include "wrapper_jni.c"\r
+\r
+#include <math.h>\r
+#include <android/log.h>\r
+\r
+#define TAG "GPAC_WRAPPER"\r
+\r
+#define LOGV(X, Y) __android_log_print(ANDROID_LOG_VERBOSE, TAG, X, Y)\r
+#define LOGD(X, Y) __android_log_print(ANDROID_LOG_DEBUG, TAG, X, Y)\r
+#define LOGE(X, Y) __android_log_print(ANDROID_LOG_ERROR, TAG, X, Y)\r
+#define LOGW(X, Y) __android_log_print(ANDROID_LOG_WARN, TAG, X, Y)\r
+#define LOGI(X, Y) __android_log_print(ANDROID_LOG_INFO, TAG, X, Y)\r
+#include <pthread.h>\r
+\r
+static JavaVM* javaVM = NULL;\r
+\r
+static pthread_key_t jni_thread_env_key = 0;\r
+\r
+/**\r
+ * This method is called when a pthread is destroyed, so we can delete the JNI env\r
+ */\r
+static void jni_destroy_env_func(void * env) {\r
+ LOGI("Destroying a thread with attached data, env=%p.\n", env);\r
+ JavaEnvTh * jniEnv = (JavaEnvTh *) env;\r
+ if (jniEnv){\r
+ /*jniEnv->env->DeleteLocalRef(&jniEnv->cbk_displayMessage);\r
+ jniEnv->env->DeleteLocalRef(&jniEnv->cbk_onProgress);\r
+ jniEnv->env->DeleteLocalRef(&jniEnv->cbk_showKeyboard);\r
+ jniEnv->env->DeleteLocalRef(&jniEnv->cbk_setCaption);\r
+ jniEnv->env->DeleteLocalRef(&jniEnv->cbk_onLog);*/\r
+ memset(jniEnv, 0, sizeof(JavaEnvTh));\r
+ gf_free(jniEnv);\r
+ }\r
+ pthread_setspecific(jni_thread_env_key, NULL);\r
+ if (javaVM)\r
+ javaVM->DetachCurrentThread();\r
+}\r
+\r
+static int jniRegisterNativeMethods(JNIEnv* env, const char* className,\r
+ const JNINativeMethod* gMethods, int numMethods)\r
+{\r
+ jclass clazz;\r
+ clazz = env->FindClass(className);\r
+ if (clazz == NULL) {\r
+ LOGE("Native registration unable to find class '%s'\n", className);\r
+ return -1;\r
+ }\r
+ if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {\r
+ LOGE("RegisterNatives failed for '%s'\n", className);\r
+ return -1;\r
+ }\r
+ return 0;\r
+}\r
+\r
+static JNINativeMethod sMethods[] = {\r
+ /* name, signature, funcPtr */\r
+\r
+ {"createInstance",\r
+ "(Lcom/artemis/Osmo4/GpacCallback;IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J",\r
+ (void*)&Java_com_artemis_Osmo4_GPACInstance_createInstance},\r
+ {"gpacdisconnect",\r
+ "()V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpacdisconnect},\r
+ {"gpacrender",\r
+ "()V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpacrender},\r
+ {"gpacresize",\r
+ "(II)V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpacresize},\r
+ {"gpacfree",\r
+ "()V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpacfree},\r
+ {"gpaceventkeypress",\r
+ "(IIIII)V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpaceventkeypress},\r
+ {"gpaceventmousedown",\r
+ "(FF)V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpaceventmousedown},\r
+ {"gpaceventmouseup",\r
+ "(FF)V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpaceventmouseup},\r
+ {"gpaceventmousemove",\r
+ "(FF)V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_gpaceventmousemove},\r
+ {"setGpacPreference",\r
+ "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",\r
+ (void*)Java_com_artemis_Osmo4_GPACInstance_setGpacPreference},\r
+ NULL\r
+};\r
+\r
+\r
+jint JNI_OnUnLoad(JavaVM* vm, void* reserved){\r
+ LOGI("Deleting library, vm=%p...\n", vm);\r
+ if (pthread_key_delete(jni_thread_env_key)){\r
+ LOGW("Failed to delete key jni_thread_env_key jni_thread_env_key=%p\n", jni_thread_env_key);\r
+ }\r
+ javaVM = NULL;\r
+ jni_thread_env_key = NULL;\r
+}\r
+\r
+//---------------------------------------------------------------------------------------------------\r
+jint JNI_OnLoad(JavaVM* vm, void* reserved){\r
+ const char * className = "com/artemis/Osmo4/GPACInstance";\r
+ JNIEnv * env;\r
+ if (!vm)\r
+ return -1;\r
+ if (vm->GetEnv((void**)(&env), JNI_VERSION_1_2) != JNI_OK)\r
+ return -1;\r
+ javaVM = vm;\r
+ LOGI("Registering %s natives\n", className);\r
+ if (jniRegisterNativeMethods(env, className, sMethods, 9) < 0){\r
+ LOGE("Failed to register native methods for %s !\n", className);\r
+ return -1;\r
+ }\r
+ LOGI("Registering natives DONE, now registering pthread_keys with destructor=%p\n", &jni_destroy_env_func);\r
+ int ret = pthread_key_create(&jni_thread_env_key, &jni_destroy_env_func);\r
+ if (ret){\r
+ LOGE("Failed to register jni_thread_env_key jni_thread_env_key=%p\n", jni_thread_env_key);\r
+ }\r
+ return JNI_VERSION_1_2;\r
+}\r
+\r
+//---------------------------------------------------------------------------------------------------\r
+//CNativeWrapper\r
+//-------------------------------\r
+\r
+CNativeWrapper::CNativeWrapper(){\r
+ do_log = 1;\r
+ m_term = NULL;\r
+ m_mx = NULL;\r
+#ifndef GPAC_GUI_ONLY\r
+ memset(&m_user, 0, sizeof(GF_User));\r
+ memset(&m_rti, 0, sizeof(GF_SystemRTInfo));\r
+#endif\r
+}\r
+//-------------------------------\r
+CNativeWrapper::~CNativeWrapper(){\r
+ debug_log("~CNativeWrapper()");\r
+ JavaEnvTh * env = getEnv();\r
+ if (env && env->cbk_obj)\r
+ env->env->DeleteGlobalRef(env->cbk_obj);\r
+ Shutdown();\r
+ debug_log("~CNativeWrapper() : DONE\n");\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::debug_log(const char* msg){\r
+ LOGV("%s", msg);\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::Shutdown()\r
+{\r
+ debug_log("shutdown");\r
+ if (m_term)\r
+ gf_term_disconnect(m_term);\r
+ if (m_mx)\r
+ gf_mx_del(m_mx);\r
+ m_mx = NULL;\r
+#ifndef GPAC_GUI_ONLY\r
+ if (m_term) {\r
+ GF_Terminal *t = m_term;\r
+ m_term = NULL;\r
+ gf_term_del(t);\r
+ }\r
+ if (m_user.config) {\r
+ gf_cfg_del(m_user.config);\r
+ m_user.config = NULL;\r
+ }\r
+ if (m_user.modules) {\r
+ gf_modules_del(m_user.modules);\r
+ m_user.modules = NULL;\r
+ }\r
+#endif\r
+ m_term = NULL;\r
+ debug_log("shutdown end");\r
+}\r
+\r
+void CNativeWrapper::setJavaEnv(JavaEnvTh * envToSet, JNIEnv *env, jobject callback){\r
+ assert( envToSet );\r
+ jclass localRef = env->GetObjectClass(callback);\r
+ envToSet->env = env;\r
+ envToSet->javaThreadId = gf_th_id();\r
+ envToSet->cbk_obj = callback;\r
+ envToSet->cbk_displayMessage =\r
+ env->GetMethodID(localRef, "displayMessage", "(Ljava/lang/String;Ljava/lang/String;I)V");\r
+ envToSet->cbk_onProgress =\r
+ env->GetMethodID(localRef, "onProgress", "(Ljava/lang/String;II)V");\r
+ envToSet->cbk_onLog =\r
+ env->GetMethodID(localRef, "onLog", "(IILjava/lang/String;)V");\r
+ envToSet->cbk_setCaption =\r
+ env->GetMethodID(localRef, "setCaption", "(Ljava/lang/String;)V");\r
+ envToSet->cbk_showKeyboard =\r
+ env->GetMethodID(localRef, "showKeyboard", "(Z)V");\r
+ env->DeleteLocalRef(localRef);\r
+}\r
+\r
+static u32 beforeThreadExits(void * param){\r
+ LOGI("Before Thread exist, detach the JavaVM from Thread for thread %p...\n", gf_th_current());\r
+ if (javaVM)\r
+ javaVM->DetachCurrentThread();\r
+}\r
+\r
+JavaEnvTh * CNativeWrapper::getEnv(){\r
+ JNIEnv *env;\r
+ JavaEnvTh * javaEnv;\r
+ if (!javaVM){\r
+ debug_log("************* No JVM Found ************");\r
+ return NULL;\r
+ }\r
+ javaEnv = (JavaEnvTh*) pthread_getspecific( jni_thread_env_key );\r
+ if (javaEnv)\r
+ return javaEnv;\r
+ javaEnv = (JavaEnvTh *) gf_malloc(sizeof(JavaEnvTh));\r
+ if (!javaEnv)\r
+ return NULL;\r
+ memset(javaEnv, 0, sizeof(JavaEnvTh));\r
+ javaVM->AttachCurrentThread(&env, NULL);\r
+ if (!env){\r
+ LOGE("Attaching to thread did faild for thread id=%d", gf_th_id());\r
+ gf_free(javaEnv);\r
+ return NULL;\r
+ }\r
+ LOGI("Rebuilding methods for thread %d", gf_th_id());\r
+ setJavaEnv(javaEnv, env, mainJavaEnv.cbk_obj);\r
+ if (pthread_setspecific(jni_thread_env_key, javaEnv)){\r
+ LOGE("Failed to set specific thread data to jni_thread_env_key for thread=%d. No ENV available !", gf_th_id());\r
+ gf_free(javaEnv);\r
+ return NULL;\r
+ }\r
+ GF_Thread * t;\r
+ LOGI("Getting current Thread %d...", gf_th_id());\r
+ t = gf_th_current();\r
+ LOGI("Getting current Thread DONE = %p, now registering before exit...", t);\r
+\r
+ if (GF_OK != gf_register_before_exit_function(gf_th_current(), &beforeThreadExits)){\r
+ LOGE("Failed to register exit function for thread %p, no javaEnv for current thread.", gf_th_current());\r
+ //javaVM->DetachCurrentThread();\r
+ gf_free(javaEnv);\r
+ javaEnv = NULL;\r
+ }\r
+ LOGI("Registering DONE for %d", gf_th_id());\r
+ return javaEnv;\r
+}\r
+\r
+\r
+//-------------------------------\r
+int CNativeWrapper::MessageBox(const char* msg, const char* title, GF_Err status){\r
+ LOGV("MessageBox start %s", msg);\r
+ JavaEnvTh * env = getEnv();\r
+ if (!env || !env->cbk_displayMessage)\r
+ return 0;\r
+ env->env->PushLocalFrame(2);\r
+ jstring tit = env->env->NewStringUTF(title?title:"null");\r
+ jstring mes = env->env->NewStringUTF(msg?msg:"null");\r
+ env->env->CallVoidMethod(env->cbk_obj, env->cbk_displayMessage, mes, tit, status);\r
+ env->env->PopLocalFrame(NULL);\r
+ LOGV("MessageBox done %s", msg);\r
+ return 1;\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::DisplayRTI(){\r
+#ifndef GPAC_GUI_ONLY\r
+ // display some system informations ?\r
+#endif\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::Quit(int code){\r
+\r
+ Shutdown();\r
+ // send shutdown request to java\r
+ return code;\r
+}\r
+\r
+#include <stdio.h>\r
+\r
+//-------------------------------\r
+void CNativeWrapper::on_gpac_log(void *cbk, u32 ll, u32 lm, const char *fmt, va_list list){\r
+ char szMsg[4096];\r
+ const char * tag;\r
+ char unknTag[32];\r
+ int debug;\r
+ // We do not want to be flood by mutexes\r
+ if (ll == GF_LOG_DEBUG && lm == GF_LOG_MUTEX)\r
+ return;\r
+ switch (ll){\r
+ case GF_LOG_DEBUG:\r
+ debug = ANDROID_LOG_DEBUG;\r
+ break;\r
+ case GF_LOG_INFO:\r
+ debug = ANDROID_LOG_INFO;\r
+ break;\r
+ case GF_LOG_WARNING:\r
+ debug = ANDROID_LOG_WARN;\r
+ break;\r
+ case GF_LOG_ERROR:\r
+ debug = ANDROID_LOG_ERROR;\r
+ break;\r
+ default:\r
+ debug = ANDROID_LOG_INFO;\r
+ }\r
+ vsnprintf(szMsg, 4096, fmt, list);\r
+ CNativeWrapper * self = (CNativeWrapper *) cbk;\r
+ if (!self)\r
+ goto displayInAndroidlogs;\r
+\r
+ {\r
+ JavaEnvTh *env = self->getEnv();\r
+ jstring msg;\r
+ if (!env || !env->cbk_onLog)\r
+ goto displayInAndroidlogs;\r
+ env->env->PushLocalFrame(1);\r
+ msg = env->env->NewStringUTF(szMsg);\r
+ env->env->CallVoidMethod(env->cbk_obj, env->cbk_onLog, debug, lm, msg);\r
+ env->env->PopLocalFrame(NULL);\r
+ return;\r
+ }\r
+displayInAndroidlogs:\r
+ {\r
+ /* When no callback is properly set, we use direct logging */\r
+ switch( lm){\r
+ case GF_LOG_CORE:\r
+ tag="GF_LOG_CORE";\r
+ break;\r
+ case GF_LOG_CODING:\r
+ tag="GF_LOG_CODING";\r
+ break;\r
+ case GF_LOG_CONTAINER:\r
+ tag="GF_LOG_CONTAINER";\r
+ break;\r
+ case GF_LOG_NETWORK:\r
+ tag="GF_LOG_NETWORK";\r
+ break;\r
+ case GF_LOG_RTP:\r
+ tag="GF_LOG_RTP";\r
+ break;\r
+ case GF_LOG_AUTHOR:\r
+ tag="GF_LOG_AUTHOR";\r
+ break;\r
+ case GF_LOG_SYNC:\r
+ tag="GF_LOG_SYNC";\r
+ break;\r
+ case GF_LOG_CODEC:\r
+ tag="GF_LOG_CODEC";\r
+ break;\r
+ case GF_LOG_PARSER:\r
+ tag="GF_LOG_PARSER";\r
+ break;\r
+ case GF_LOG_MEDIA:\r
+ tag="GF_LOG_MEDIA";\r
+ break;\r
+ case GF_LOG_SCENE:\r
+ tag="GF_LOG_SCENE";\r
+ break;\r
+ case GF_LOG_SCRIPT:\r
+ tag="GF_LOG_SCRIPT";\r
+ break;\r
+ case GF_LOG_INTERACT:\r
+ tag="GF_LOG_INTERACT";\r
+ break;\r
+ case GF_LOG_COMPOSE:\r
+ tag="GF_LOG_COMPOSE";\r
+ break;\r
+ case GF_LOG_CACHE:\r
+ tag="GF_LOG_CACHE";\r
+ break;\r
+ case GF_LOG_MMIO:\r
+ tag="GF_LOG_MMIO";\r
+ break;\r
+ case GF_LOG_RTI:\r
+ tag="GF_LOG_RTI";\r
+ break;\r
+ case GF_LOG_SMIL:\r
+ tag="GF_LOG_SMIL";\r
+ break;\r
+ case GF_LOG_MEMORY:\r
+ tag="GF_LOG_MEMORY";\r
+ break;\r
+ case GF_LOG_AUDIO:\r
+ tag="GF_LOG_AUDIO";\r
+ break;\r
+ case GF_LOG_MODULE:\r
+ tag="GF_LOG_MODULE";\r
+ break;\r
+ case GF_LOG_MUTEX:\r
+ tag="GF_LOG_MUTEX";\r
+ break;\r
+ default:\r
+ snprintf(unknTag, 32, "GPAC_UNKNOWN[%d]", lm);\r
+ tag = unknTag;\r
+ }\r
+ __android_log_print(debug, tag, szMsg);\r
+ }\r
+}\r
+//-------------------------------\r
+Bool CNativeWrapper::GPAC_EventProc(void *cbk, GF_Event *evt){\r
+ if (cbk)\r
+ {\r
+ CNativeWrapper* ptr = (CNativeWrapper*)cbk;\r
+ char msg[4096];\r
+ msg[0] = 0;\r
+ LOGD("GPAC_EventProc() Message=%d", evt->type);\r
+ switch (evt->type){\r
+ case GF_EVENT_CLICK:\r
+ case GF_EVENT_MOUSEUP:\r
+ case GF_EVENT_MOUSEDOWN:\r
+ case GF_EVENT_MOUSEOVER:\r
+ case GF_EVENT_MOUSEOUT:\r
+ case GF_EVENT_MOUSEMOVE:\r
+ case GF_EVENT_MOUSEWHEEL:\r
+ case GF_EVENT_KEYUP:\r
+ case GF_EVENT_KEYDOWN:\r
+ case GF_EVENT_LONGKEYPRESS:\r
+ case GF_EVENT_TEXTINPUT:\r
+ /* We ignore all these events */\r
+ break;\r
+ case GF_EVENT_MEDIA_BEGIN_SESSION_SETUP:\r
+ case GF_EVENT_MEDIA_END_SESSION_SETUP:\r
+ case GF_EVENT_MEDIA_DATA_REQUEST:\r
+ case GF_EVENT_MEDIA_PLAYABLE:\r
+ case GF_EVENT_MEDIA_NOT_PLAYABLE:\r
+ case GF_EVENT_MEDIA_DATA_PROGRESS:\r
+ case GF_EVENT_MEDIA_END_OF_DATA:\r
+ case GF_EVENT_MEDIA_STOP:\r
+ case GF_EVENT_MEDIA_ERROR:\r
+ LOGD("GPAC_EventProc() Media Event detected = [index=%d]", evt->type - GF_EVENT_MEDIA_BEGIN_SESSION_SETUP);\r
+ break;\r
+ case GF_EVENT_MESSAGE:\r
+ {\r
+ ptr->debug_log("GPAC_EventProc start");\r
+ if ( evt->message.message )\r
+ {\r
+ strcat(msg, evt->message.message);\r
+ strcat(msg, ": ");\r
+ }\r
+ strcat(msg, gf_error_to_string(evt->message.error));\r
+\r
+ ptr->debug_log(msg);\r
+ ptr->MessageBox(msg, evt->message.service ? evt->message.service : "GF_EVENT_MESSAGE", evt->message.error);\r
+ ptr->debug_log("GPAC_EventProc end");\r
+ };\r
+ break;\r
+ case GF_EVENT_CONNECT:\r
+ if (evt->connect.is_connected)\r
+ ptr->MessageBox("Connected", "Connected to scene", GF_OK);\r
+ else\r
+ ptr->MessageBox("Disconnected", "Disconnected from scene.", GF_OK);\r
+ break;\r
+ case GF_EVENT_PROGRESS:\r
+ {\r
+ const char * szTitle;;\r
+ if (evt->progress.progress_type==0)\r
+ szTitle = "Buffering";\r
+ else if (evt->progress.progress_type==1)\r
+ szTitle = "Downloading...";\r
+ else if (evt->progress.progress_type==2)\r
+ szTitle = "Import ";\r
+ else\r
+ szTitle = "Unknown Progress Event";\r
+ ptr->Osmo4_progress_cbk(ptr, szTitle, evt->progress.done, evt->progress.total);\r
+ gf_set_progress(szTitle, evt->progress.done, evt->progress.total);\r
+ }\r
+ break;\r
+ case GF_EVENT_TEXT_EDITING_START:\r
+ case GF_EVENT_TEXT_EDITING_END:\r
+ {\r
+ JavaEnvTh * env = ptr->getEnv();\r
+ if (!env || !env->cbk_showKeyboard)\r
+ return 0;\r
+ LOGI("Needs to display/hide the Virtual Keyboard (%d)", evt->type);\r
+ env->env->CallVoidMethod(env->cbk_obj, env->cbk_showKeyboard, GF_EVENT_TEXT_EDITING_START == evt->type);\r
+ LOGV("Done showing virtual keyboard (%d)", evt->type);\r
+ }\r
+ break;\r
+ case GF_EVENT_EOS:\r
+ LOGI("EOS Reached (%d)", evt->type);\r
+ break;\r
+ case GF_EVENT_DISCONNECT:\r
+ /* FIXME : not sure about this behaviour */\r
+ if (ptr)\r
+ ptr->disconnect();\r
+ break;\r
+ default:\r
+ LOGI("Unknown Message %d", evt->type);\r
+ }\r
+ }\r
+ return 0;\r
+}\r
+\r
+\r
+void CNativeWrapper::progress_cbk(const char *title, u64 done, u64 total){\r
+ JavaEnvTh *env = getEnv();\r
+ if (!env || !env->cbk_onProgress)\r
+ return;\r
+ debug_log("Osmo4_progress_cbk start");\r
+ env->env->PushLocalFrame(1);\r
+ jstring js = env->env->NewStringUTF(title);\r
+ env->env->CallVoidMethod(env->cbk_obj, env->cbk_onProgress, js, done, total);\r
+ env->env->PopLocalFrame(NULL);\r
+ debug_log("Osmo4_progress_cbk end");\r
+}\r
+\r
+\r
+//-------------------------------\r
+void CNativeWrapper::Osmo4_progress_cbk(const void *usr, const char *title, u64 done, u64 total){\r
+ if (!usr)\r
+ return;\r
+ CNativeWrapper * self = (CNativeWrapper *) usr;\r
+ self->progress_cbk(title, done, total);\r
+}\r
+//-------------------------------\r
+void CNativeWrapper::SetupLogs(){\r
+ const char *opt;\r
+ debug_log("SetupLogs()");\r
+\r
+ gf_mx_p(m_mx);\r
+\r
+ /*setup GPAC logs: log all errors*/\r
+ gf_log_set_level(GF_LOG_DEBUG);\r
+ gf_log_set_tools(0xFFFFFFFF);\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "LogLevel");\r
+ /* FIXME : set the loglevel according to config file */\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "LogTools");\r
+ if (opt) gf_log_set_tools(gf_log_parse_tools(opt));\r
+\r
+ gf_log_set_callback(this, on_gpac_log);\r
+ gf_mx_v(m_mx);\r
+\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Osmo4 logs initialized\n"));\r
+ /* Test for JNI invocations, should work properly\r
+ int k;\r
+ for (k = 0 ; k < 512; k++){\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Message %d\n", k));\r
+ }*/\r
+}\r
+//-------------------------------\r
+// dir should end with /\r
+int CNativeWrapper::init(JNIEnv * env, void * bitmap, jobject * callback, int width, int height, const char * cfg_dir, const char * modules_dir, const char * cache_dir, const char * font_dir, const char * urlToLoad){\r
+ LOGI("Initializing GPAC with URL=%s...", urlToLoad);\r
+ strcpy(m_cfg_dir, cfg_dir);\r
+ strcpy(m_modules_dir, modules_dir);\r
+ strcpy(m_cache_dir, cache_dir);\r
+ strcpy(m_font_dir, font_dir);\r
+\r
+ char m_cfg_filename[GF_MAX_PATH];\r
+ strcpy(m_cfg_filename, m_cfg_dir);\r
+ strcat(m_cfg_filename, "GPAC.cfg");\r
+\r
+ int m_Width = width;\r
+ int m_Height = height;\r
+\r
+ int first_launch = 0;\r
+ const char *opt;\r
+\r
+ m_window = env;\r
+ m_session = bitmap;\r
+ setJavaEnv(&mainJavaEnv, env, env->NewGlobalRef(*callback));\r
+ if (pthread_setspecific( jni_thread_env_key, &mainJavaEnv)){\r
+ LOGE("Failed to set specific thread data to jni_thread_env_key=%p for main thread !", jni_thread_env_key);\r
+ }\r
+\r
+ m_mx = gf_mx_new("Osmo4");\r
+\r
+ //load config file\r
+ LOGI("Loading User Config %s...", "GPAC.cfg");\r
+ m_user.config = gf_cfg_force_new(cfg_dir, "GPAC.cfg");\r
+ SetupLogs();\r
+ gf_set_progress_callback(this, Osmo4_progress_cbk);\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "ModulesDirectory");\r
+ if (!opt) {\r
+ FILE * fstart;\r
+ char msg[256];\r
+ LOGI("First launch, initializing new Config %s...", "GPAC.cfg");\r
+ /*hardcode module directory*/\r
+ gf_cfg_set_key(m_user.config, "Downloader", "CleanCache", "yes");\r
+ /*startup file*/\r
+ snprintf(msg, 256, "%sgui/gui.bt", cfg_dir);\r
+ fstart = fopen(msg, "r");\r
+ if (fstart){\r
+ fclose(fstart);\r
+ gf_cfg_set_key(m_user.config, "General", "StartupFile", msg);\r
+ } else {\r
+ gf_cfg_set_key(m_user.config, "General", "#StartupFile", msg);\r
+ }\r
+ gf_cfg_set_key(m_user.config, "GUI", "UnhideControlPlayer", "1");\r
+ /*setup UDP traffic autodetect*/\r
+ gf_cfg_set_key(m_user.config, "Network", "AutoReconfigUDP", "yes");\r
+ gf_cfg_set_key(m_user.config, "Network", "UDPTimeout", "10000");\r
+ gf_cfg_set_key(m_user.config, "Network", "BufferLength", "3000");\r
+ gf_cfg_set_key(m_user.config, "Compositor", "TextureTextMode", "Default");\r
+ //gf_cfg_set_key(m_user.config, "Compositor", "FrameRate", "30");\r
+ gf_cfg_set_key(m_user.config, "Audio", "ForceConfig", "no");\r
+ gf_cfg_set_key(m_user.config, "Audio", "NumBuffers", "1");\r
+ gf_cfg_set_key(m_user.config, "FontEngine", "FontReader", "ft_font");\r
+ }\r
+ /* All of this has to be done for every instance */\r
+ gf_cfg_set_key(m_user.config, "General", "ModulesDirectory", modules_dir ? modules_dir : GPAC_MODULES_DIR);\r
+ gf_cfg_set_key(m_user.config, "General", "CacheDirectory", cache_dir ? cache_dir : GPAC_CACHE_DIR);\r
+ gf_cfg_set_key(m_user.config, "General", "LastWorkingDir", cfg_dir);\r
+ gf_cfg_set_key(m_user.config, "FontEngine", "FontDirectory", GPAC_FONT_DIR);\r
+ gf_cfg_set_key(m_user.config, "Video", "DriverName", "Android Video Output");\r
+ gf_cfg_set_key(m_user.config, "Audio", "DriverName", "Android Audio Output");\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "ModulesDirectory");\r
+ LOGI("loading modules in directory %s...", opt);\r
+ m_user.modules = gf_modules_new(opt, m_user.config);\r
+ if (!m_user.modules || !gf_modules_get_count(m_user.modules)) {\r
+ LOGE("No modules found in directory %s !", opt);\r
+ if (m_user.modules)\r
+ gf_modules_del(m_user.modules);\r
+ gf_cfg_del(m_user.config);\r
+ m_user.config = NULL;\r
+ return Quit(KErrGeneral);\r
+ }\r
+\r
+ /*we don't thread the visual compositor to be able to minimize the app and still have audio running*/\r
+ m_user.init_flags = GF_TERM_NO_COMPOSITOR_THREAD | GF_TERM_NO_REGULATION;\r
+ //m_user.init_flags |= GF_TERM_NO_AUDIO;\r
+ m_user.opaque = this;\r
+\r
+ m_user.os_window_handler = m_window;\r
+ m_user.os_display = m_session;\r
+ m_user.EventProc = GPAC_EventProc;\r
+ if (!javaVM){\r
+ LOGE("NO JAVA VM FOUND, m_user=%p !!!!\n", &m_user);\r
+ return Quit(KErrGeneral);\r
+ }\r
+\r
+ LOGD("Loading GPAC terminal, m_user=%p...", &m_user);\r
+ m_term = gf_term_new(&m_user);\r
+ if (!m_term) {\r
+ LOGE("Cannot load GPAC Terminal with m_user=%p", m_user);\r
+ MessageBox("Cannot load GPAC terminal", "Fatal Error", GF_SERVICE_ERROR);\r
+ gf_modules_del(m_user.modules);\r
+ m_user.modules = NULL;\r
+ gf_cfg_del(m_user.config);\r
+ m_user.config = NULL;\r
+ return Quit(KErrGeneral);\r
+ }\r
+\r
+ //setAudioEnvironment(javaVM);\r
+\r
+ LOGD("Setting term size m_user=%p...", &m_user);\r
+ gf_term_set_size(m_term, m_Width, m_Height);\r
+\r
+ opt = gf_cfg_get_key(m_user.config, "General", "StartupFile");\r
+ LOGD("File loaded at startup=%s.", opt);\r
+\r
+ if (!urlToLoad)\r
+ urlToLoad = opt;\r
+ if (urlToLoad){\r
+ LOGI("Connecting to %s...", urlToLoad);\r
+ gf_term_connect(m_term, urlToLoad);\r
+ }\r
+ debug_log("init end");\r
+ LOGD("Saving config file %s...\n", m_cfg_filename);\r
+ gf_cfg_save(m_user.config);\r
+ LOGI("Initialization complete, config file saved as %s.\n", m_cfg_filename);\r
+ return 0;\r
+}\r
+//-------------------------------\r
+int CNativeWrapper::connect(const char *url){\r
+ if (m_term){\r
+ debug_log("Starting to connect ...");\r
+ gf_term_connect_from_time(m_term, url, 0, false);\r
+ debug_log("connected ...");\r
+ }\r
+}\r
+\r
+void CNativeWrapper::setGpacPreference( const char * category, const char * name, const char * value)\r
+{\r
+ if (m_user.config){\r
+ gf_cfg_set_key(m_user.config, category, name, value);\r
+ gf_cfg_save(m_user.config);\r
+ }\r
+}\r
+\r
+//-----------------------------------------------------\r
+void CNativeWrapper::disconnect(){\r
+ if (m_term){\r
+ debug_log("disconnecting");\r
+ gf_term_disconnect(m_term);\r
+ debug_log("disconnected ...");\r
+ }\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::step(void * env, void * bitmap){\r
+ m_window = env;\r
+ m_session = bitmap;\r
+ //debug_log("Step ...");\r
+ if (!m_term){\r
+ debug_log("step(): No m_term found.");\r
+ return;\r
+ } else\r
+ if (!m_term->compositor)\r
+ debug_log("step(): No compositor found.");\r
+ else if (!m_term->compositor->video_out)\r
+ debug_log("step(): No video_out found");\r
+ else if (!m_term->compositor->video_out->Setup)\r
+ debug_log("step(): No video_out->Setup found");\r
+ else {\r
+ //debug_log("step(): gf_term_process_step : start()");\r
+ m_term->compositor->frame_draw_type = GF_SC_DRAW_FRAME;\r
+ gf_term_process_step(m_term);\r
+ //debug_log("step(): gf_term_process_step : end()");\r
+ }\r
+}\r
+\r
+//-----------------------------------------------------\r
+void CNativeWrapper::setAudioEnvironment(JavaVM* javaVM){\r
+ if (!m_term){\r
+ debug_log("setAudioEnvironment(): no m_term found.");\r
+ return;\r
+ }\r
+ debug_log("setAudioEnvironment start");\r
+ m_term->compositor->audio_renderer->audio_out->Setup(m_term->compositor->audio_renderer->audio_out, javaVM, 0, 0);\r
+ debug_log("setAudioEnvironment end");\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::resize(int w, int h){\r
+ if (!m_term)\r
+ return;\r
+ debug_log("resize start");\r
+ gf_term_set_size(m_term, w, h);\r
+ debug_log("resize end");\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onMouseDown(float x, float y){\r
+ if (!m_term)\r
+ return;\r
+ debug_log("onMouseDown start");\r
+ //char msg[100];\r
+ //sprintf(msg, "onMousedown x=%f, y=%f", x, y );\r
+ //debug_log(msg);\r
+\r
+ GF_Event evt;\r
+ evt.type = GF_EVENT_MOUSEDOWN;\r
+ evt.mouse.button = GF_MOUSE_LEFT;\r
+ evt.mouse.x = x;\r
+ evt.mouse.y = y;\r
+\r
+ int ret = gf_term_user_event(m_term, &evt);\r
+ debug_log("onMouseDown end");\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onMouseUp(float x, float y){\r
+ if (!m_term)\r
+ return;\r
+ debug_log("onMouseUp start");\r
+ //char msg[100];\r
+ //sprintf(msg, "onMouseUp x=%f, y=%f", x, y );\r
+ //debug_log(msg);\r
+\r
+ GF_Event evt;\r
+ evt.type = GF_EVENT_MOUSEUP;\r
+ evt.mouse.button = GF_MOUSE_LEFT;\r
+ evt.mouse.x = x;\r
+ evt.mouse.y = y;\r
+\r
+ int ret = gf_term_user_event(m_term, &evt);\r
+ debug_log("onMouseUp end");\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onMouseMove(float x, float y){\r
+ if (!m_term)\r
+ return;\r
+ GF_Event evt;\r
+ evt.type = GF_EVENT_MOUSEMOVE;\r
+ evt.mouse.button = GF_MOUSE_LEFT;\r
+ evt.mouse.x = x;\r
+ evt.mouse.y = y;\r
+\r
+ int ret = gf_term_user_event(m_term, &evt);\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::onKeyPress(int keycode, int rawkeycode, int up, int flag, int unicode){\r
+ if (!m_term)\r
+ return;\r
+ debug_log("onKeyPress start");\r
+ GF_Event evt;\r
+ memset(&evt, 0, sizeof(GF_Event));\r
+ if (up == 0) evt.type = GF_EVENT_KEYUP;\r
+ else evt.type = GF_EVENT_KEYDOWN;\r
+\r
+ evt.key.flags = 0;\r
+ evt.key.hw_code = rawkeycode;\r
+\r
+ translate_key(keycode, &evt.key);\r
+ //evt.key.key_code = GF_KEY_A;\r
+ int ret = gf_term_user_event(m_term, &evt);\r
+\r
+ if (evt.type == GF_EVENT_KEYUP && unicode){\r
+ memset(&evt, 0, sizeof(GF_Event));\r
+ evt.type = GF_EVENT_TEXTINPUT;\r
+ evt.character.unicode_char = unicode;\r
+ ret = gf_term_user_event(m_term, &evt);\r
+ }\r
+}\r
+//-----------------------------------------------------\r
+void CNativeWrapper::translate_key(ANDROID_KEYCODE keycode, GF_EventKey *evt){\r
+ evt->flags = 0;\r
+ switch (keycode) {\r
+ case ANDROID_KEYCODE_BACK: evt->key_code = GF_KEY_BACKSPACE; break;\r
+ case ANDROID_KEYCODE_TAB: evt->key_code = GF_KEY_TAB; break;\r
+ case ANDROID_KEYCODE_CLEAR: evt->key_code = GF_KEY_CLEAR; break;\r
+ case ANDROID_KEYCODE_ENTER: evt->key_code = GF_KEY_ENTER; break;\r
+ case ANDROID_KEYCODE_SHIFT_LEFT: evt->key_code = GF_KEY_SHIFT; break;\r
+ case ANDROID_KEYCODE_SHIFT_RIGHT: evt->key_code = GF_KEY_SHIFT; break;\r
+ case ANDROID_KEYCODE_ALT_LEFT: evt->key_code = GF_KEY_ALT; break;\r
+ case ANDROID_KEYCODE_ALT_RIGHT: evt->key_code = GF_KEY_ALT; break;\r
+ case ANDROID_KEYCODE_SPACE: evt->key_code = GF_KEY_SPACE; break;\r
+ case ANDROID_KEYCODE_HOME: evt->key_code = GF_KEY_HOME; break;\r
+ case ANDROID_KEYCODE_DPAD_LEFT: evt->key_code = GF_KEY_LEFT; break;\r
+ case ANDROID_KEYCODE_DPAD_UP: evt->key_code = GF_KEY_UP; break;\r
+ case ANDROID_KEYCODE_DPAD_RIGHT: evt->key_code = GF_KEY_RIGHT; break;\r
+ case ANDROID_KEYCODE_DPAD_DOWN: evt->key_code = GF_KEY_DOWN; break;\r
+ case ANDROID_KEYCODE_DEL: evt->key_code = GF_KEY_DEL; break;\r
+ case ANDROID_KEYCODE_0:\r
+ evt->key_code = GF_KEY_0;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_1:\r
+ evt->key_code = GF_KEY_1;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_2:\r
+ evt->key_code = GF_KEY_2;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_3:\r
+ evt->key_code = GF_KEY_3;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_4:\r
+ evt->key_code = GF_KEY_4;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_5:\r
+ evt->key_code = GF_KEY_5;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_6:\r
+ evt->key_code = GF_KEY_6;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_7:\r
+ evt->key_code = GF_KEY_7;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_8:\r
+ evt->key_code = GF_KEY_8;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ case ANDROID_KEYCODE_9:\r
+ evt->key_code = GF_KEY_9;\r
+ evt->flags = GF_KEY_EXT_NUMPAD;\r
+ break;\r
+ /*thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */\r
+ /* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */\r
+ default:\r
+ if ((keycode>=ANDROID_KEYCODE_A) && (keycode<=ANDROID_KEYCODE_Z)){\r
+ evt->key_code = GF_KEY_A + keycode - ANDROID_KEYCODE_A;\r
+ } else {\r
+ evt->key_code = GF_KEY_UNIDENTIFIED;\r
+ }\r
+ break;\r
+ }\r
+ evt->hw_code = evt->key_code;\r
+}\r
+\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen, Ivica ARSOV / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ */\r
+\r
+#include <jni.h>\r
+\r
+#include <gpac/terminal.h>\r
+#include <gpac/thread.h>\r
+#include <gpac/options.h>\r
+#include <gpac/modules/service.h>\r
+\r
+//#define MAX_PATH 255\r
+\r
+#define KErrGeneral 1\r
+//#define GPAC_CFG_DIR "/data/osmo/"\r
+#define GPAC_CFG_DIR m_cfg_dir\r
+//#define GPAC_MODULES_DIR "/data/osmo/modules/"\r
+#define GPAC_MODULES_DIR m_modules_dir\r
+//#define GPAC_MODULES_PATH "/data/osmo/modules/"\r
+#define GPAC_MODULES_PATH m_modules_dir\r
+//#define GPAC_CACHE_DIR "/data/osmo/cache/"\r
+#define GPAC_CACHE_DIR m_cache_dir\r
+//#define GPAC_LOG_FILE "/data/osmo/gpac_logs.txt"\r
+#define GPAC_LOG_FILE m_log_filename\r
+//#define GPAC_FONT_DIR "/system/fonts/"\r
+#define GPAC_FONT_DIR m_font_dir\r
+\r
+#define DEBUG_MODE 1\r
+//#define DEBUG_FILE "/data/osmo/osmo_debug.txt"\r
+#define DEBUG_FILE m_debug_filename\r
+\r
+// keyboard code\r
+#define ANDROID_KEYCODE int\r
+#define ANDROID_KEYCODE_0 7\r
+#define ANDROID_KEYCODE_1 8\r
+#define ANDROID_KEYCODE_2 9\r
+#define ANDROID_KEYCODE_3 10\r
+#define ANDROID_KEYCODE_4 11\r
+#define ANDROID_KEYCODE_5 12\r
+#define ANDROID_KEYCODE_6 13\r
+#define ANDROID_KEYCODE_7 14\r
+#define ANDROID_KEYCODE_8 15\r
+#define ANDROID_KEYCODE_9 16\r
+#define ANDROID_KEYCODE_A 29\r
+#define ANDROID_KEYCODE_B 30\r
+#define ANDROID_KEYCODE_C 31\r
+#define ANDROID_KEYCODE_D 32\r
+#define ANDROID_KEYCODE_E 33\r
+#define ANDROID_KEYCODE_F 34\r
+#define ANDROID_KEYCODE_G 35\r
+#define ANDROID_KEYCODE_H 36\r
+#define ANDROID_KEYCODE_I 37\r
+#define ANDROID_KEYCODE_J 38\r
+#define ANDROID_KEYCODE_K 39\r
+#define ANDROID_KEYCODE_L 40\r
+#define ANDROID_KEYCODE_M 41\r
+#define ANDROID_KEYCODE_N 42\r
+#define ANDROID_KEYCODE_O 43\r
+#define ANDROID_KEYCODE_P 44\r
+#define ANDROID_KEYCODE_Q 45\r
+#define ANDROID_KEYCODE_R 46\r
+#define ANDROID_KEYCODE_S 47\r
+#define ANDROID_KEYCODE_T 48\r
+#define ANDROID_KEYCODE_U 49\r
+#define ANDROID_KEYCODE_V 50\r
+#define ANDROID_KEYCODE_W 51\r
+#define ANDROID_KEYCODE_X 52\r
+#define ANDROID_KEYCODE_Y 53\r
+#define ANDROID_KEYCODE_Z 54\r
+#define ANDROID_KEYCODE_ALT_LEFT 57\r
+#define ANDROID_KEYCODE_ALT_RIGHT 58\r
+#define ANDROID_KEYCODE_AT 77\r
+#define ANDROID_KEYCODE_BACK 4\r
+#define ANDROID_KEYCODE_BACKSLASH 73\r
+#define ANDROID_KEYCODE_CALL 5\r
+#define ANDROID_KEYCODE_CAMERA 27\r
+#define ANDROID_KEYCODE_CLEAR 28\r
+#define ANDROID_KEYCODE_COMMA 55\r
+#define ANDROID_KEYCODE_DEL 67\r
+#define ANDROID_KEYCODE_DPAD_CENTER 23\r
+#define ANDROID_KEYCODE_DPAD_DOWN 20\r
+#define ANDROID_KEYCODE_DPAD_LEFT 21\r
+#define ANDROID_KEYCODE_DPAD_RIGHT 22\r
+#define ANDROID_KEYCODE_DPAD_UP 19\r
+#define ANDROID_KEYCODE_ENDCALL 6\r
+#define ANDROID_KEYCODE_ENTER 66\r
+#define ANDROID_KEYCODE_ENVELOPE 65\r
+#define ANDROID_KEYCODE_EQUALS 70\r
+#define ANDROID_KEYCODE_EXPLORER 64\r
+#define ANDROID_KEYCODE_FOCUS 80\r
+#define ANDROID_KEYCODE_GRAVE 68\r
+#define ANDROID_KEYCODE_HEADSETHOOK 79\r
+#define ANDROID_KEYCODE_HOME 3\r
+#define ANDROID_KEYCODE_LEFT_BRACKET 71\r
+#define ANDROID_KEYCODE_MEDIA_FAST_FORWARD 90\r
+#define ANDROID_KEYCODE_MEDIA_NEXT 87\r
+#define ANDROID_KEYCODE_MEDIA_PLAY_PAUSE 85\r
+#define ANDROID_KEYCODE_MEDIA_PREVIOUS 88\r
+#define ANDROID_KEYCODE_MEDIA_REWIND 89\r
+#define ANDROID_KEYCODE_MEDIA_STOP 86\r
+#define ANDROID_KEYCODE_MENU 82\r
+#define ANDROID_KEYCODE_MINUS 69\r
+#define ANDROID_KEYCODE_MUTE 91\r
+#define ANDROID_KEYCODE_NUM 78\r
+#define ANDROID_KEYCODE_PLUS 81\r
+#define ANDROID_KEYCODE_POWER 26\r
+#define ANDROID_KEYCODE_RIGHT_BRACKET 72\r
+#define ANDROID_KEYCODE_SEARCH 84\r
+#define ANDROID_KEYCODE_SEMICOLON 74\r
+#define ANDROID_KEYCODE_SHIFT_LEFT 59\r
+#define ANDROID_KEYCODE_SHIFT_RIGHT 60\r
+#define ANDROID_KEYCODE_SLASH 76\r
+#define ANDROID_KEYCODE_SOFT_LEFT 1\r
+#define ANDROID_KEYCODE_SOFT_RIGHT 2\r
+#define ANDROID_KEYCODE_SPACE 62\r
+#define ANDROID_KEYCODE_STAR 17\r
+#define ANDROID_KEYCODE_SYM 63\r
+#define ANDROID_KEYCODE_TAB 61\r
+\r
+#define ANDROID_KEYCODE_UNKWON -1\r
+\r
+#include <jni.h>\r
+\r
+typedef struct _JavaEnvTh {\r
+ JNIEnv * env;\r
+ u32 javaThreadId;\r
+ jobject cbk_obj;\r
+ jmethodID cbk_displayMessage;\r
+ jmethodID cbk_onProgress;\r
+ jmethodID cbk_showKeyboard;\r
+ jmethodID cbk_setCaption;\r
+ jmethodID cbk_onLog;\r
+} JavaEnvTh;\r
+\r
+\r
+//---------------------------------------------------------------------------------------------------\r
+//---------------------------------------------------------------------------------------------------\r
+class CNativeWrapper{\r
+\r
+ private:\r
+ void* m_window;\r
+ void* m_session;\r
+\r
+ GF_User *GetUser() { return &m_user; }\r
+ GF_Terminal *m_term;\r
+\r
+ /*\r
+ * Callback management\r
+ */\r
+ JavaEnvTh mainJavaEnv;\r
+\r
+ GF_Mutex *m_mx;\r
+ GF_User m_user;\r
+ GF_SystemRTInfo m_rti;\r
+\r
+ int do_log;\r
+ private:\r
+ char m_cfg_dir[GF_MAX_PATH];\r
+ char m_modules_dir[GF_MAX_PATH];\r
+ char m_cache_dir[GF_MAX_PATH];\r
+ char m_font_dir[GF_MAX_PATH];\r
+ void setJavaEnv(JavaEnvTh * envToSet, JNIEnv *env, jobject callback);\r
+ private:\r
+ void SetupLogs();\r
+ void Shutdown();\r
+ void DisplayRTI();\r
+ protected:\r
+ JavaEnvTh * getEnv();\r
+\r
+ public:\r
+ CNativeWrapper();\r
+ ~CNativeWrapper();\r
+ int init(JNIEnv * env, void * bitmap, jobject * callback, int width, int height, const char * cfg_dir, const char * modules_dir, const char * cache_dir, const char * font_dir, const char * urlToLoad);\r
+\r
+ int connect(const char *url);\r
+ void disconnect();\r
+ void step(void * env, void * bitmap);\r
+ void resize(int w, int h);\r
+ void setAudioEnvironment(JavaVM* javaVM);\r
+\r
+ void onMouseDown(float x, float y);\r
+ void onMouseUp(float x, float y);\r
+ void onMouseMove(float x, float y);\r
+ void onKeyPress(int keycode, int rawkeycode, int up, int flag, int unicode);\r
+ void translate_key(ANDROID_KEYCODE keycode, GF_EventKey *evt);\r
+ void setGpacPreference( const char * category, const char * name, const char * value);\r
+ public:\r
+ int MessageBox(const char* msg, const char* title, GF_Err status);\r
+ int Quit(int code);\r
+ GF_Config *create_default_config(char *file_path, char *file_name);\r
+\r
+ static void on_gpac_log(void *cbk, u32 ll, u32 lm, const char *fmt, va_list list);\r
+ static Bool GPAC_EventProc(void *cbk, GF_Event *evt);\r
+ void progress_cbk(const char *title, u64 done, u64 total);\r
+ static void Osmo4_progress_cbk(const void *usr, const char *title, u64 done, u64 total);\r
+\r
+ private:\r
+#ifdef DEBUG_MODE\r
+ FILE *debug_f;\r
+#endif\r
+ void debug_log(const char* msg);\r
+\r
+};\r
+\r
--- /dev/null
+//#include "wrapper_jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <android/log.h>
+
+#define jniTAG "WRAPPER_JNI"
+
+#define jniLOGV(X) __android_log_print(ANDROID_LOG_VERBOSE, jniTAG, X)
+#define jniLOGI(X) __android_log_print(ANDROID_LOG_INFO, jniTAG, X)
+#define jniLOGE(X) __android_log_print(ANDROID_LOG_ERROR, jniTAG, X)
+
+#define CAST_HANDLE(wr) jclass c = env->GetObjectClass(obj);\
+ if (!c) return;\
+ jfieldID fid = env->GetFieldID(c, "handle", "J");\
+ if (!fid){\
+ __android_log_print(ANDROID_LOG_ERROR, jniTAG, "No Field ID, ERROR");\
+ return;\
+ }\
+ jlong h = env->GetLongField(obj, fid);\
+ CNativeWrapper* wr = (CNativeWrapper*) h;
+// __android_log_print(ANDROID_LOG_VERBOSE, jniTAG, "Handle = %p", wr);
+
+/*
+ * Class: com_artemis_Osmo4_GPACInstance
+ * Method: createInstance
+ * Signature: (Lcom/artemis/Osmo4/GpacCallback;IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
+ */
+JNIEXPORT jlong JNICALL Java_com_artemis_Osmo4_GPACInstance_createInstance(JNIEnv * env, jclass obj, jobject callback, jint width, jint height, jstring cfg_dir, jstring modules_dir, jstring cache_dir, jstring font_dir, jstring url_to_open)
+{
+ jboolean isCopy;
+ const char * s1 = env->GetStringUTFChars(cfg_dir, &isCopy);
+ const char * s2 = env->GetStringUTFChars(modules_dir, &isCopy);
+ const char * s3 = env->GetStringUTFChars(cache_dir, &isCopy);
+ const char * s4 = env->GetStringUTFChars(font_dir, &isCopy);
+ const char * s5 = NULL;
+ if (url_to_open)
+ s5 = env->GetStringUTFChars(url_to_open, &isCopy);
+ else
+ s5 = NULL;
+ CNativeWrapper * gpac_obj = new CNativeWrapper();
+ if (gpac_obj){
+ int w = width;
+ int h = height;
+ jniLOGI("Calling gpac_obj->init()...");
+ if (gpac_obj->init(env, NULL, &callback,
+ w, h,
+ s1, s2, s3, s4, s5)){
+ jniLOGE("FAILED to init(), return code not 0");
+ delete gpac_obj;
+ gpac_obj = NULL;
+ }
+ } else {
+ jniLOGE("FAILED to create new CNativeWrapper() : not enough memory ?");
+ }
+
+ env->ReleaseStringUTFChars(cfg_dir, s1);
+ env->ReleaseStringUTFChars(modules_dir, s2);
+ env->ReleaseStringUTFChars(cache_dir, s3);
+ env->ReleaseStringUTFChars(font_dir, s4);
+ if (s5)
+ env->ReleaseStringUTFChars(font_dir, s5);
+ __android_log_print(ANDROID_LOG_VERBOSE, jniTAG, "Returned Handle = %p", gpac_obj);
+ return (jlong) gpac_obj;
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpacconnect(JNIEnv * env, jobject obj, jstring fileName)
+{
+ CAST_HANDLE(wr);
+ jniLOGV("connect::start");
+ if (!wr){
+ jniLOGV("connect::end : aborted");
+ return;
+ }
+ jboolean isCopy;
+ const char * cFileName = env->GetStringUTFChars(fileName, &isCopy);
+
+ wr->connect(cFileName);
+
+ env->ReleaseStringUTFChars(fileName, cFileName);
+ jniLOGV("connect::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpacdisconnect(JNIEnv * env, jobject obj){
+ CAST_HANDLE(wr);
+ jniLOGV("disconnect::start");
+ if (wr)
+ wr->disconnect();
+ jniLOGV("disconnect::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpacfree(JNIEnv * env, jobject obj)
+{
+ CAST_HANDLE(wr);
+ jniLOGV("free::start");
+ if (wr)
+ delete wr;
+ jniLOGV("free::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpacrender (JNIEnv * env, jobject obj)
+{
+ CAST_HANDLE(wr);
+ //jniLOGV("render::start");
+ if (wr)
+ wr->step(env, NULL);
+ //jniLOGV("render::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpacresize (JNIEnv * env, jobject obj, jint width, jint height)
+{
+ CAST_HANDLE(wr);
+ jniLOGV("resize::start");
+ if (wr)
+ wr->resize(width, height);
+ jniLOGV("resize::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpaceventmousedown(JNIEnv * env, jobject obj, jfloat x, jfloat y){
+ CAST_HANDLE(wr);
+ jniLOGV("mouseDown::start");
+ if (wr)
+ wr->onMouseDown(x, y);
+ jniLOGV("mouseDown::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpaceventmouseup(JNIEnv * env, jobject obj, jfloat x, jfloat y){
+ CAST_HANDLE(wr);
+ jniLOGV("mouseUp::start");
+ if (wr)
+ wr->onMouseUp(x, y);
+ jniLOGV("mouseUp::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpaceventmousemove(JNIEnv * env, jobject obj, jfloat x, jfloat y){
+ CAST_HANDLE(wr);
+ jniLOGV("mouseMouv::start");
+ if (wr)
+ wr->onMouseMove(x, y);
+ jniLOGV("mouseMouv::end");
+}
+//-----------------------------------
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_gpaceventkeypress(JNIEnv * env, jobject obj, jint keycode, jint rawkeycode, jint up, jint flag, jint unicode){
+ CAST_HANDLE(wr);
+ jniLOGV("keypress::start");
+ if (wr)
+ wr->onKeyPress(keycode, rawkeycode, up, flag, unicode);
+ jniLOGV("keypress::end");
+}
+
+
+/*
+ * Class: com_artemis_Osmo4_GPACInstance
+ * Method: setGpacPreference
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_com_artemis_Osmo4_GPACInstance_setGpacPreference
+ (JNIEnv * env, jobject obj, jstring category, jstring name, jstring value){
+ CAST_HANDLE(wr);
+ jboolean isCopy;
+ const char * scat = env->GetStringUTFChars(category, &isCopy);
+ const char * sname = env->GetStringUTFChars(name, &isCopy);
+ const char * svalue;
+ if (value)
+ svalue = env->GetStringUTFChars(value, &isCopy);
+ else
+ svalue = NULL;
+ if (wr)
+ wr->setGpacPreference(scat, sname, svalue);
+ env->ReleaseStringUTFChars(category, scat);
+ env->ReleaseStringUTFChars(name, sname);
+ if (value)
+ env->ReleaseStringUTFChars(value, svalue);
+ }
+//-----------------------------------
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked in Version Control Systems,
+# as it contains information specific to your local configuration.
+
+# location of the SDK. This is only used by Ant
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=/opt/android-sdk
--- /dev/null
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembernames class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembernames class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
+ android:layout_height="fill_parent" android:orientation="vertical">
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal"
+ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="2dip" android:gravity="center_vertical"
+ android:layout_gravity="top|center_horizontal">
+ <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon"
+ android:padding="2dip" android:id="@+id/about_img1"/>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:orientation="vertical">
+ <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/aboutCopyright1"
+ android:text="@string/aboutCopyright1" android:layout_gravity="right"/>
+ <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/aboutCopyright1"
+ android:text="@string/aboutCopyright2" android:layout_gravity="right"/>
+ <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/aboutLicence"
+ android:text="@string/aboutLicence" android:layout_gravity="right"/>
+ <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/aboutAuthors"
+ android:text="@string/aboutAuthors"/>
+ </LinearLayout>
+ </LinearLayout>
+ <ListView android:id="@+id/aboutAuthors_listView" android:layout_width="fill_parent"
+ android:isScrollContainer="true" android:entries="@array/allAuthors_array" android:layout_height="fill_parent"
+ style="@android:style/Widget.TextView"/>
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <LinearLayout android:id="@+id/verticalLayout" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:orientation="vertical">
+ <TableLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:id="@+id/usernameAndPasswordLayout">
+ <TableRow android:id="@+id/tableRow1" android:layout_height="wrap_content" android:layout_gravity="fill_horizontal"
+ android:layout_width="fill_parent" android:baselineAligned="true">
+ <TextView android:id="@+id/userNameLabel" android:layout_width="wrap_content"
+ android:layout_gravity="right" android:text="@string/usernameLabel" android:layout_height="fill_parent"/>
+ <EditText android:inputType="textUri" android:id="@+id/userNamePrompt" android:layout_height="wrap_content"
+ android:text="" android:hint="@string/usernameHint" android:layout_width="fill_parent"
+ android:gravity="fill_horizontal|right" android:layout_weight="2"/>
+ </TableRow>
+ <TableRow android:id="@+id/tableRow2" android:layout_height="wrap_content" android:gravity="fill_horizontal"
+ android:layout_gravity="fill_horizontal">
+ <TextView android:id="@+id/passwordLabel" android:layout_width="fill_parent"
+ android:baselineAligned="true" android:layout_height="wrap_content" android:layout_gravity="right"
+ android:text="@string/passwordLabel" android:layout_weight="0"/>
+ <EditText android:inputType="textPassword" android:hint="@string/passwordHint" android:id="@+id/passwordPrompt"
+ android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_gravity="fill_horizontal"
+ android:text="" android:gravity="fill_horizontal|right" android:layout_weight="2"/>
+ </TableRow>
+ </TableLayout>
+ <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+
+ </LinearLayout>
+ </LinearLayout>
+
+
+</FrameLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content"
+ android:orientation="vertical" android:layout_width="fill_parent">
+ <TextView android:text="@+id/TextView01" android:id="@+id/TextView01" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:singleLine="true" android:textStyle="bold"
+ android:layout_marginTop="5dip" android:layout_marginLeft="5dip"></TextView>
+ <TextView android:text="@+id/TextView02" android:id="@+id/TextView02" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:layout_marginLeft="10dip"></TextView>
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:visible="true" android:enabled="true" android:title="@string/open_file" android:id="@+id/open_file"
+ android:checkable="false"/>
+ <item android:visible="true" android:enabled="true" android:title="@string/open_url" android:id="@+id/open_url"
+ android:checkable="false"/>
+ <item android:visible="true" android:id="@+id/quit" android:title="@string/quit" android:enabled="true"
+ android:checkable="false"/>
+ <group android:id="@+id/options" android:enabled="true" android:visible="true" android:checkableBehavior="none"
+ android:menuCategory="secondary">
+ <item android:visible="true" android:enabled="true" android:title="@string/showVirtualKeyboard" android:id="@+id/showVirtualKeyboard"
+ android:checkable="false"/>
+ <item android:checkable="false" android:visible="true" android:title="@string/about" android:id="@+id/about"
+ android:enabled="true"/>
+ <item android:id="@+id/cleanCache" android:enabled="true" android:title="@string/cleanCache"
+ android:checkable="false" android:visible="true"/>
+ <item android:enabled="true" android:checkable="false" android:id="@+id/setAsStartupFile" android:visible="true"
+ android:title="@string/setAsStartupFile"/>
+ <item android:enabled="true" android:checkable="false" android:id="@+id/resetGpacConfig" android:visible="true"
+ android:title="@string/resetGpacConfig"/>
+ </group>
+
+</menu>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="ok_button">OK</string>
+ <string name="cancel_button">Cancel</string>
+ <string name="resetGpacConfigMessage">This will remove all GPAC settings. You have to quit the applications to apply changes. Do you
+ want to continue ?</string>
+ <string name="open_file">Open file...</string>
+ <string name="open_url">Open URL...</string>
+ <string name="about">About...</string>
+ <string name="quit">Exit</string>
+ <string name="app_name">Osmo4</string>
+ <string name="titleWithURL">Osmo4 [%s]</string>
+ <string name="copying_native_libs">Copying module %1$s to %2$s...</string>
+ <string name="displayPopupFormat">%1$s\n%2$s</string>
+ <string name="gpacNotInitialized">GPAC is not initialized</string>
+ <string name="cleanCache">Clean Cache</string>
+ <string name="cleaningCache">Cleaning Cache...</string>
+ <string name="cleaningCacheDirectory">Cleaning Cache directory %s...</string>
+ <string name="showVirtualKeyboard">Keyboard</string>
+ <string name="gpacNotInitializedLongMessages">Sorry, GPAC is not initialized, operation cannot be performed</string>
+ <string name="usernameLabel">Username:</string>
+ <string name="usernameHint">Username</string>
+ <string name="passwordLabel">Password:</string>
+ <string name="passwordHint">Password</string>
+ <string name="pleaseSelectAFile">Select a file to open</string>
+ <string name="parentDirectory">Parent Directory</string>
+ <string name="directory">Directory</string>
+ <string name="fileSize">File [%d bytes]</string>
+ <string name="selectFileTitlePattern">%1$s [%2$s]</string>
+ <string name="selectFileDefaultTitle">Select a file</string>
+ <string name="options">Options</string>
+ <string name="aboutTitle">Osmo4 : GPAC for Android</string>
+ <string name="aboutCopyright1">© Jean Le Feuvre, 2000-2011</string>
+ <string name="aboutCopyright2">© Telecom-Paris-Tech</string>
+ <string name="aboutLicence">published under LGPL</string>
+ <string name="aboutAuthors">Authors:</string>
+ <string name="osmoLoading">Osmo4 is loading...</string>
+ <string name="gpacLoading">Gpac is loading...</string>
+ <string name="resetGpacConfig">Reset GPAC Config</string>
+ <string name="setAsStartupFile">Set as startup file...</string>
+ <string name="setAsStartupFileMessage">Use %s as startup file ?</string>
+ <string name="setAsStartupFileTitle">Startup file</string>
+ <string name="setAsStartupFileYes">Use current</string>
+ <string name="setAsStartupFileNo">Cancel</string>
+ <string name="setAsStartupFileNull">No startup file</string>
+ <string name="setAsStartupFileMessageNoURL">You are not connected to any URL. You may use this entry to set an URL as a startup file when
+ connected to a given URL or file.
+ </string>
+ <!-- All authors in alphabetical order -->
+ <string-array name="allAuthors_array">
+ <item>Romain Bouqueau</item>
+ <item>Cyril Concolato</item>
+ <item>Jean Lefeuvre</item>
+ <item>Jonathan Sillan</item>
+ <item>Pierre Souchay (VizionR)</item>
+ <item>NGO Van Luyen</item>
+ </string-array>
+</resources>
--- /dev/null
+///**
+// * Osmo on Android
+// * Aug/2010
+// * NGO Van Luyen
+// *
+// *
+// */
+//package com.artemis.Osmo4;
+//
+//import android.content.Context;
+//import android.graphics.Bitmap;
+//import android.graphics.Canvas;
+//import android.util.Log;
+//import android.view.View;
+//
+///**
+// *
+// * @version $Revision: 2822 $
+// *
+// */
+//@Deprecated
+//public class BitmapView extends View {
+//
+// private Bitmap m_Bitmap = null;
+//
+// private int m_width = 100, m_height = 100;
+//
+// private final static String LOG_BITMAP = BitmapView.class.getSimpleName();
+//
+// /**
+// * Constructor
+// *
+// * @param context The current view's context
+// */
+// public BitmapView(Context context) {
+// super(context);
+// }
+//
+// @Override
+// protected void onDraw(Canvas canvas) {
+// // canvas.drawColor(0xFFCCCCCC);
+// m_width = canvas.getWidth();
+// m_height = canvas.getHeight();
+// if (m_Bitmap == null) {
+// if (m_width < 1)
+// m_width = 100;
+// if (m_height < 1)
+// m_height = 100;
+// m_Bitmap = Bitmap.createBitmap(m_width, m_height, Bitmap.Config.ARGB_8888);
+// gpacinit();
+// }
+//
+// GpacObject.gpacrender(m_Bitmap);
+// canvas.drawBitmap(m_Bitmap, 0, 0, null);
+// // force a redraw, with a different time-based pattern.
+// invalidate();
+//
+// }
+//
+// /**
+// * Called to init all GPAC resources
+// */
+// private void gpacinit() {
+// Log.i(LOG_BITMAP, "Going to gpacinit"); //$NON-NLS-1$
+// if (m_Bitmap != null) {
+// Log.e(LOG_BITMAP, "m_Bitmap != null"); //$NON-NLS-1$
+// if (m_width < 1)
+// m_width = 100;
+// if (m_height < 1)
+// m_height = 100;
+// GpacObject.gpacinit(m_Bitmap,
+// null,
+// m_width,
+// m_height,
+// Osmo4Renderer.GPAC_CFG_DIR,
+// Osmo4Renderer.GPAC_MODULES_DIR,
+// Osmo4Renderer.GPAC_CACHE_DIR,
+// Osmo4Renderer.GPAC_FONT_DIR,
+// null);
+// // GpacObject.gpacconnect("/data/osmo/bifs-2D-interactivity-stringsensor.mp4");
+// GpacObject.gpacresize(m_width, m_height);
+// }
+// }
+//
+// /**
+// * Called to free all GPAC resources
+// */
+// public void gpacfree() {
+// Log.e(LOG_BITMAP, "gpacfree()"); //$NON-NLS-1$
+// GpacObject.gpacdisconnect();
+// GpacObject.gpacfree();
+// }
+// }
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/GPACInstance.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-20 12:31:24 -0400 (Wed, 20 Apr 2011) $
+ */
+package com.artemis.Osmo4;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+/**
+ * @version $Revision: 2972 $
+ *
+ */
+public class GPACInstance implements GPACInstanceInterface {
+
+ private final static String LOG_LIB = "LibrariesLoader"; //$NON-NLS-1$
+
+ private final Thread uniqueThread;
+
+ private static void listing(StringBuilder sb, File root, int inc) {
+ StringBuilder increment = new StringBuilder();
+ for (int i = 0; i < inc; i++)
+ increment.append(' ');
+ String incr = increment.toString();
+ for (File f : root.listFiles()) {
+ sb.append(incr).append(f.getName());
+ if (f.isDirectory()) {
+ sb.append(" [Directory]\n"); //$NON-NLS-1$
+ listing(sb, f, inc + 2);
+ } else {
+ sb.append(" [").append(f.length() + " bytes]\n"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+ }
+
+ /**
+ * Loads all libraries
+ *
+ * @param config
+ *
+ * @return a map of exceptions containing the library as key and the exception as value. If map is empty, no error
+ *
+ */
+ synchronized static Map<String, Throwable> loadAllLibraries(GpacConfig config) {
+ if (errors != null)
+ return errors;
+ StringBuilder sb = new StringBuilder();
+ final String[] toLoad = { "GLESv1_CM", "dl", "log",//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
+ "jpeg", "javaenv", //$NON-NLS-1$ //$NON-NLS-2$
+ "mad", "editline", "ft2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "js_osmo", "openjpeg", "png", "z", //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
+ "ffmpeg", "faad", "gpac", //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ "stdc++", "gpacWrapper" }; // //$NON-NLS-1$ //$NON-NLS-2$
+ HashMap<String, Throwable> exceptions = new HashMap<String, Throwable>();
+ for (String s : toLoad) {
+ try {
+ String msg = "Loading library " + s + "...";//$NON-NLS-1$//$NON-NLS-2$
+ sb.append(msg);
+ Log.i(LOG_LIB, msg);
+ System.loadLibrary(s);
+ } catch (UnsatisfiedLinkError e) {
+ sb.append("Failed to load " + s + ", error=" + e.getLocalizedMessage() + " :: " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ + e.getClass().getSimpleName() + "\n"); //$NON-NLS-1$
+ exceptions.put(s, e);
+ Log.e(LOG_LIB, "Failed to load library : " + s + " due to link error " + e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (SecurityException e) {
+ exceptions.put(s, e);
+ Log.e(LOG_LIB, "Failed to load library : " + s + " due to security error " + e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (Throwable e) {
+ exceptions.put(s, e);
+ Log.e(LOG_LIB, "Failed to load library : " + s + " due to Runtime error " + e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ if (!exceptions.isEmpty()) {
+ try {
+ PrintStream out = new PrintStream(config.getGpacConfigDirectory() + "debug_libs.txt", "UTF-8"); //$NON-NLS-1$//$NON-NLS-2$
+ out.println("$Revision: 2972 $"); //$NON-NLS-1$
+ out.println(new Date());
+ out.println("\n*** Configuration\n"); //$NON-NLS-1$
+ out.println(config.getConfigAsText());
+ sb.append("*** Libs listing: "); //$NON-NLS-1$
+ sb.append(config.getGpacLibsDirectory());
+ sb.append('\n');
+ listing(sb, new File(config.getGpacLibsDirectory()), 2);
+ sb.append("*** Modules listing: "); //$NON-NLS-1$
+ sb.append(config.getGpacModulesDirectory());
+ sb.append('\n');
+ listing(sb, new File(config.getGpacModulesDirectory()), 2);
+ sb.append("*** Fonts listing: \n"); //$NON-NLS-1$
+ sb.append(config.getGpacFontDirectory());
+ sb.append('\n');
+ listing(sb, new File(config.getGpacFontDirectory()), 2);
+ sb.append("*** Exceptions:\n"); //$NON-NLS-1$
+ for (Map.Entry<String, Throwable> ex : exceptions.entrySet()) {
+ sb.append(ex.getKey()).append(": ") //$NON-NLS-1$
+ .append(ex.getValue().getLocalizedMessage())
+ .append('(')
+ .append(ex.getValue().getClass())
+ .append(")\n"); //$NON-NLS-1$
+ }
+ out.println(sb.toString());
+ out.flush();
+ out.close();
+ } catch (Exception e) {
+ Log.e(LOG_LIB, "Failed to output debug info to debug file", e); //$NON-NLS-1$
+ }
+ }
+ errors = Collections.unmodifiableMap(exceptions);
+ return errors;
+ }
+
+ private static Map<String, Throwable> errors = null;
+
+ private boolean hasToBeFreed = true;
+
+ /**
+ * Constructor
+ *
+ * @param callback
+ * @param width
+ * @param height
+ * @param config The configuration to use for GPAC
+ * @param urlToOpen
+ * @throws GpacInstanceException
+ */
+ public GPACInstance(GpacCallback callback, int width, int height, GpacConfig config, String urlToOpen)
+ throws GpacInstanceException {
+ StringBuilder sb = new StringBuilder();
+ Map<String, Throwable> errors = loadAllLibraries(config);
+ if (!errors.isEmpty()) {
+ sb.append("Exceptions while loading libraries:"); //$NON-NLS-1$
+ for (Map.Entry<String, Throwable> x : errors.entrySet()) {
+ sb.append('\n')
+ .append(x.getKey())
+ .append('[')
+ .append(x.getValue().getClass().getSimpleName())
+ .append("]: ") //$NON-NLS-1$
+ .append(x.getValue().getLocalizedMessage());
+ }
+ Log.e(LOG_LIB, sb.toString());
+ }
+ try {
+ handle = createInstance(callback,
+ width,
+ height,
+ config.getGpacConfigDirectory(),
+ config.getGpacModulesDirectory(),
+ config.getGpacCacheDirectory(),
+ config.getGpacFontDirectory(),
+ urlToOpen);
+ } catch (Throwable e) {
+ throw new GpacInstanceException("Error while creating instance\n" + sb.toString()); //$NON-NLS-1$
+ }
+ if (handle == 0) {
+ throw new GpacInstanceException("Error while creating instance, no handle created!\n" + sb.toString()); //$NON-NLS-1$
+ }
+ synchronized (this) {
+ hasToBeFreed = true;
+ }
+ uniqueThread = Thread.currentThread();
+ }
+
+ /**
+ * This one handles the pointer to the real C object
+ */
+ private final long handle;
+
+ /**
+ * @return the handle
+ */
+ public synchronized long getHandle() {
+ return handle;
+ }
+
+ private void checkCurrentThread() throws RuntimeException {
+ if (Thread.currentThread() != uniqueThread)
+ throw new RuntimeException("Method called outside allowed Thread scope !"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void disconnect() {
+ checkCurrentThread();
+ gpacdisconnect();
+ }
+
+ @Override
+ public void connect(String url) {
+ Log.i(LOG_LIB, "connect(" + url + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ checkCurrentThread();
+ gpacconnect(url);
+ }
+
+ /**
+ * Call this method when a key has been pressed
+ *
+ * @param keyCode
+ * @param event
+ * @param pressed true if key is pressed, false if key is released
+ * @param unicode
+ */
+ public void eventKey(int keyCode, KeyEvent event, boolean pressed, int unicode) {
+ checkCurrentThread();
+ gpaceventkeypress(keyCode, event.getScanCode(), pressed ? 1 : 0, event.getFlags(), unicode);
+ }
+
+ /**
+ * Renders the current frame
+ */
+ public void render() {
+ checkCurrentThread();
+ gpacrender();
+ }
+
+ /**
+ * Resizes the object to new dimensions
+ *
+ * @param width
+ * @param height
+ */
+ public void resize(int width, int height) {
+ Log.i(LOG_LIB, "Resizing to " + width + "x" + height); //$NON-NLS-1$ //$NON-NLS-2$
+ gpacresize(width, height);
+ }
+
+ /**
+ * Call this when a motion event occurs
+ *
+ * @param event
+ */
+ public void motionEvent(MotionEvent event) {
+ checkCurrentThread();
+ final float x = event.getX();
+ final float y = event.getY();
+ switch (event.getAction()) {
+ // not in 1.6 case MotionEvent.ACTION_POINTER_1_DOWN:
+ case MotionEvent.ACTION_DOWN:
+ gpaceventmousemove(x, y);
+ gpaceventmousedown(x, y);
+ break;
+ // not in 1.6 case MotionEvent.ACTION_POINTER_1_UP:
+ case MotionEvent.ACTION_UP:
+ gpaceventmouseup(x, y);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ gpaceventmousemove(x, y);
+ }
+ }
+
+ @Override
+ public void finalize() throws Throwable {
+ // Not sure how to do this..., destroy is supposed to be called already
+ // destroy();
+ super.finalize();
+ }
+
+ /**
+ * All Native functions, those functions are binded using the handle
+ */
+
+ /**
+ * Opens an URL
+ *
+ * @param url The URL to open
+ */
+ private native void gpacconnect(String url);
+
+ /**
+ * Used to create the GPAC instance
+ *
+ * @param callback
+ * @param width
+ * @param height
+ * @param cfg_dir
+ * @param modules_dir
+ * @param cache_dir
+ * @param font_dir
+ * @return
+ */
+ private native long createInstance(GpacCallback callback, int width, int height, String cfg_dir,
+ String modules_dir, String cache_dir, String font_dir, String url_to_open);
+
+ /**
+ * Disconnects the currently loaded URL
+ */
+ private native void gpacdisconnect();
+
+ /**
+ * Renders
+ *
+ * @param handle
+ */
+ private native void gpacrender();
+
+ /**
+ * Resizes the current view
+ *
+ * @param width The new width to set
+ * @param height The new height to set
+ */
+ private native void gpacresize(int width, int height);
+
+ /**
+ * Free all GPAC resources
+ */
+ private native void gpacfree();
+
+ /**
+ * To call when a key has been pressed
+ *
+ * @param keycode
+ * @param rawkeycode
+ * @param up
+ * @param flag
+ */
+ private native void gpaceventkeypress(int keycode, int rawkeycode, int up, int flag, int unicode);
+
+ /**
+ * To call when a mouse is down
+ *
+ * @param x Position in pixels
+ * @param y Position in pixels
+ */
+ private native void gpaceventmousedown(float x, float y);
+
+ /**
+ * To call when a mouse is up (released)
+ *
+ * @param x Position in pixels
+ * @param y Position in pixels
+ */
+ private native void gpaceventmouseup(float x, float y);
+
+ /**
+ * To call when a mouse is moving
+ *
+ * @param x Position in pixels
+ * @param y Position in pixels
+ */
+ private native void gpaceventmousemove(float x, float y);
+
+ @Override
+ public void destroy() {
+ boolean freeIt;
+ synchronized (this) {
+ freeIt = hasToBeFreed;
+ hasToBeFreed = false;
+ }
+ if (freeIt) {
+ disconnect();
+ gpacfree();
+ }
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GPACInstanceInterface#setGpacPreference(String, String, String)
+ */
+ @Override
+ public native void setGpacPreference(String category, String name, String value);
+}
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/GPACInstanceInterface.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-18 09:33:58 -0400 (Mon, 18 Apr 2011) $
+ */
+package com.artemis.Osmo4;
+
+/**
+ * @copyright RTL Group 2008
+ * @author RTL Group DTIT software development team (last changed by $LastChangedBy: bad_sheep $)
+ * @version $Revision: 2935 $
+ *
+ */
+public interface GPACInstanceInterface {
+
+ /**
+ * @version $Revision: 2935 $
+ *
+ */
+ public static class GpacInstanceException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3207851655866335152L;
+
+ /**
+ * Constructor
+ *
+ * @param msg
+ */
+ public GpacInstanceException(String msg) {
+ super(msg);
+ }
+
+ };
+
+ /**
+ * Call this method to disconnect
+ */
+ public void disconnect();
+
+ /**
+ * Call this method to connect to a given URL
+ *
+ * @param url The URL to connect to
+ */
+ public void connect(String url);
+
+ /**
+ * Destroys the current instance, you won't be able to use it anymore...
+ */
+ public void destroy();
+
+ /**
+ * Set a GPAC preference to given value
+ *
+ * @param category
+ * @param name The name of preference as defined in GPAC.cfg
+ * @param value The value to set, if null, value will be deleted
+ */
+ public void setGpacPreference(String category, String name, String value);
+
+}
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/GpacCallback.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-11 02:42:42 -0400 (Mon, 11 Apr 2011) $
+ */
+package com.artemis.Osmo4;
+
+/**
+ * Interface to implement by Java Objects to listen for callbacks from GPAC native code
+ *
+ * @version $Revision: 2888 $
+ *
+ */
+public interface GpacCallback {
+
+ /**
+ * GPAC Error codes
+ *
+ * @version $Revision: 2888 $
+ *
+ */
+ public enum GF_Err {
+
+ /** Message from any scripting engine used in the presentation (ECMAScript, MPEG-J, ...) (Info). */
+ GF_SCRIPT_INFO(3),
+ /**
+ * Indicates an data frame has several AU packed (not MPEG-4 compliant). This is used by decoders to force
+ * multiple decoding of the same data frame (Info).
+ */
+ GF_PACKED_FRAMES(2),
+ /** Indicates the end of a stream or of a file (Info). */
+ GF_EOS(1),
+ /*
+ * ! \n\n
+ */
+ /** Operation success (no error). */
+ GF_OK(0),
+ /** \n */
+ /** One of the input parameter is not correct or cannot be used in the current operating mode of the framework. */
+ GF_BAD_PARAM(-1),
+ /** Memory allocation failure. */
+ GF_OUT_OF_MEM(-2),
+ /** Input/Output failure (disk access, system call failures) */
+ GF_IO_ERR(-3),
+ /** The desired feature or operation is not supported by the framework */
+ GF_NOT_SUPPORTED(-4),
+ /** Input data has been corrupted */
+ GF_CORRUPTED_DATA(-5),
+ /** A modification was attempted on a scene node which could not be found */
+ GF_SG_UNKNOWN_NODE(-6),
+ /** The PROTO node interface does not match the nodes using it */
+ GF_SG_INVALID_PROTO(-7),
+ /** An error occured in the scripting engine */
+ GF_SCRIPT_ERROR(-8),
+ /**
+ * Buffer is too small to contain decoded data. Decoders shall use this error whenever they need to resize their
+ * output memory buffers
+ */
+ GF_BUFFER_TOO_SMALL(-9),
+ /** Bitstream is not compliant to the specfication it refers to */
+ GF_NON_COMPLIANT_BITSTREAM(-10),
+ /** No decoders could be found to handle the desired media type */
+ GF_CODEC_NOT_FOUND(-11),
+ /** The URL is not properly formatted or cannot be found */
+ GF_URL_ERROR(-12),
+ /** An service error has occured at the local side */
+ GF_SERVICE_ERROR(-13),
+ /** A service error has occured at the remote (server) side */
+ GF_REMOTE_SERVICE_ERROR(-14),
+ /** The desired stream could not be found in the service */
+ GF_STREAM_NOT_FOUND(-15),
+ /** The IsoMedia file is not a valid one */
+ GF_ISOM_INVALID_FILE(-20),
+ /** The IsoMedia file is not complete. Either the file is being downloaded, or it has been truncated */
+ GF_ISOM_INCOMPLETE_FILE(-21),
+ /** The media in this IsoMedia track is not valid (usually due to a broken stream description) */
+ GF_ISOM_INVALID_MEDIA(-22),
+ /** The requested operation cannot happen in the current opening mode of the IsoMedia file */
+ GF_ISOM_INVALID_MODE(-23),
+ /** This IsoMedia track refers to media outside the file in an unknown way */
+ GF_ISOM_UNKNOWN_DATA_REF(-24),
+
+ /** An invalid MPEG-4 Object Descriptor was found */
+ GF_ODF_INVALID_DESCRIPTOR(-30),
+ /** An MPEG-4 Object Descriptor was found or added to a forbidden descriptor */
+ GF_ODF_FORBIDDEN_DESCRIPTOR(-31),
+ /** An invalid MPEG-4 BIFS command was detected */
+ GF_ODF_INVALID_COMMAND(-32),
+ /** The scene has been encoded using an unknown BIFS version */
+ GF_BIFS_UNKNOWN_VERSION(-33),
+
+ /** The remote IP address could not be solved */
+ GF_IP_ADDRESS_NOT_FOUND(-40),
+ /** The connection to the remote peer has failed */
+ GF_IP_CONNECTION_FAILURE(-41),
+ /** The network operation has failed */
+ GF_IP_NETWORK_FAILURE(-42),
+ /** The network connection has been closed */
+ GF_IP_CONNECTION_CLOSED(-43),
+ /** The network operation has failed because no data is available */
+ GF_IP_NETWORK_EMPTY(-44),
+ /** The network operation has been discarded because it would be a blocking one */
+ GF_IP_SOCK_WOULD_BLOCK(-45),
+ /**
+ * UDP connection did not receive any data at all. Signaled by client services to reconfigure network if
+ * possible
+ */
+ GF_IP_UDP_TIMEOUT(-46),
+
+ /** Authentication with the remote host has failed */
+ GF_AUTHENTICATION_FAILURE(-50),
+ /** Script not ready for playback */
+ GF_SCRIPT_NOT_READY(-51),
+
+ /**
+ * Unknown GPAC Error code
+ */
+ JAVA_UNKNOWN_ERROR(-100);
+
+ int value;
+
+ GF_Err(int x) {
+ this.value = x;
+ };
+
+ /**
+ * Get a GPAC Error code from its value
+ *
+ * @param status The int status corresponding to the error
+ * @return A {@link GF_Err} object
+ */
+ public static GF_Err getError(int status) {
+ for (GF_Err x : values()) {
+ if (x.value == status)
+ return x;
+ }
+ return JAVA_UNKNOWN_ERROR;
+ }
+ }
+
+ /**
+ * Mapping between GPAC Log Modules and Java symbols
+ *
+ * @version $Revision: 2888 $
+ *
+ */
+ public enum GF_Log_Module implements Comparable<GF_Log_Module> {
+ /** Log message from the core library (init, threads, network calls, etc) */
+ GF_LOG_CORE(1),
+ /** Log message from a raw media parser (BIFS, LASeR, A/V formats) */
+ GF_LOG_CODING(1 << 1),
+ /** Log message from a bitstream parser (IsoMedia, MPEG-2 TS, OGG, ...) */
+ GF_LOG_CONTAINER(1 << 2),
+ /** Log message from the network/service stack (messages & co) */
+ GF_LOG_NETWORK(1 << 3),
+ /** Log message from the RTP/RTCP stack (TS info) and packet structure & hinting (debug) */
+ GF_LOG_RTP(1 << 4),
+ /** Log message from authoring subsystem (file manip, import/export) */
+ GF_LOG_AUTHOR(1 << 5),
+ /** Log message from the sync layer of the terminal */
+ GF_LOG_SYNC(1 << 6),
+ /** Log message from a codec */
+ GF_LOG_CODEC(1 << 7),
+ /** Log message from any XML parser (context loading, etc) */
+ GF_LOG_PARSER(1 << 8),
+ /** Log message from the terminal/compositor, indicating media object state */
+ GF_LOG_MEDIA(1 << 9),
+ /** Log message from the scene graph/scene manager (handling of nodes and attribute modif, DOM core) */
+ GF_LOG_SCENE(1 << 10),
+ /** Log message from the scripting engine */
+ GF_LOG_SCRIPT(1 << 11),
+ /** Log message from event handling */
+ GF_LOG_INTERACT(1 << 12),
+ /** Log message from compositor */
+ GF_LOG_COMPOSE(1 << 13),
+ /** Log for video object cache */
+ GF_LOG_CACHE(1 << 14),
+ /** Log message from multimedia I/O devices (audio/video input/output, ...) */
+ GF_LOG_MMIO(1 << 15),
+ /** Log for runtime info (times, memory, CPU usage) */
+ GF_LOG_RTI(1 << 16),
+ /** Log for SMIL timing and animation */
+ GF_LOG_SMIL(1 << 17),
+ /** Log for memory tracker */
+ GF_LOG_MEMORY(1 << 18),
+ /** Log for audio compositor */
+ GF_LOG_AUDIO(1 << 19),
+ /** generic Log for modules */
+ GF_LOG_MODULE(1 << 20),
+ /**
+ * Log for GPAC mutexes and threads (Very verbose at DEBUG)
+ *
+ */
+ GF_LOG_MUTEX(1 << 21),
+ /**
+ * Unknown Log subsystem
+ */
+ GF_LOG_UNKNOWN(1 << 30);
+
+ int value;
+
+ /**
+ * Private Constructor
+ */
+ private GF_Log_Module(int x) {
+ this.value = x;
+ };
+
+ /**
+ * Finds a module from its module_code
+ *
+ * @param module_code
+ * @return The Module found (never null)
+ */
+ public static GF_Log_Module getModule(int module_code) {
+ for (GF_Log_Module x : values()) {
+ if (x.value == module_code)
+ return x;
+ }
+ return GF_LOG_UNKNOWN;
+ }
+ }
+
+ /**
+ * Display a message
+ *
+ * @param message
+ * @param title
+ * @param errorCode
+ */
+ public void displayMessage(String message, String title, int errorCode);
+
+ /**
+ * Called when logging
+ *
+ * @param level
+ * @param module
+ * @param message
+ */
+ public void onLog(int level, int module, String message);
+
+ /**
+ * Called when progress is set
+ *
+ * @param msg
+ * @param done
+ * @param total
+ */
+ public void onProgress(String msg, int done, int total);
+
+ /**
+ * Called when GPAC is ready
+ */
+ public void onGPACReady();
+
+ /**
+ * Called when GPAC initialization fails
+ *
+ * @param e
+ */
+ public void onGPACError(Throwable e);
+
+ // /**
+ // * Returns UserName:Password for given site
+ // *
+ // * @param siteURL The URL of site requiring authorization
+ // * @param userName The User Name (may be null if never set)
+ // * @param password The password (may be null if never set)
+ // * @return A String formated as username:password
+ // */
+ // public String onGPACAuthorization(String siteURL, String userName, String password);
+
+ /**
+ * Set the new caption for the application
+ *
+ * @param newCaption The new caption to set for application
+ */
+ public void setCaption(String newCaption);
+
+ /**
+ * Show the virtual keyboard
+ *
+ * @param showKeyboard
+ */
+ public void showKeyboard(boolean showKeyboard);
+}
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/GpacConfig.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-20 08:42:10 -0400 (Wed, 20 Apr 2011) $
+ */
+package com.artemis.Osmo4;
+
+import java.io.File;
+import android.content.Context;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Environment;
+import android.util.Log;
+
+/**
+ * This class handles all GPAC configuration directories
+ *
+ * @author Pierre Souchay (VizionR SAS) (last changed by $LastChangedBy: bad_sheep $)
+ * @version $Revision: 2964 $
+ *
+ */
+public class GpacConfig {
+
+ private final static String LOG_GPAC_CONFIG = GpacConfig.class.getSimpleName();
+
+ /**
+ * Default Constructor
+ *
+ * @param context
+ */
+ public GpacConfig(Context context) {
+ File rootCfg = Environment.getExternalStorageDirectory();
+ File osmo = new File(rootCfg, "osmo"); //$NON-NLS-1$
+ gpacConfigDirectory = osmo.getAbsolutePath() + '/';
+ Log.v(LOG_GPAC_CONFIG, "Using directory " + gpacConfigDirectory + " for osmo"); //$NON-NLS-1$ //$NON-NLS-2$
+ gpacCacheDirectory = new File(osmo, "cache").getAbsolutePath() + '/'; //$NON-NLS-1$
+ Log.v(LOG_GPAC_CONFIG, "Using directory " + gpacCacheDirectory + " for cache"); //$NON-NLS-1$ //$NON-NLS-2$
+ //gpacModulesDirectory = (new File(Environment.getDataDirectory() + "/data", "com.artemis.Osmo4")).getAbsolutePath() + '/'; //$NON-NLS-1$ //$NON-NLS-2$
+ //Log.v(LOG_GPAC_CONFIG, "Using directory " + gpacModulesDirectory + " for modules"); //$NON-NLS-1$ //$NON-NLS-2$
+ String dataDir;
+ try {
+ if (context == null || context.getPackageManager() == null) {
+ dataDir = Environment.getDataDirectory() + "/data/com.artemis.Osmo4/"; //$NON-NLS-1$
+ Log.e(LOG_GPAC_CONFIG, "Cannot get context or PackageManager, using default directory=" + dataDir); //$NON-NLS-1$
+ } else
+ dataDir = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0).dataDir;
+ } catch (NameNotFoundException e) {
+ Log.e(LOG_GPAC_CONFIG, "This is bad, we cannot find ourself : " + context.getPackageName(), e); //$NON-NLS-1$
+ throw new RuntimeException("Cannot find package " + context.getPackageName(), e); //$NON-NLS-1$
+ }
+ gpacLibsDirectory = dataDir + "/lib/"; //$NON-NLS-1$
+ Log.v(LOG_GPAC_CONFIG, "Using directory " + gpacLibsDirectory + " for libraries"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ /**
+ * Ensures all directories are created
+ *
+ * @return The {@link GpacConfig} instance itself
+ */
+ public GpacConfig ensureAllDirectoriesExist() {
+ for (String s : new String[] { gpacConfigDirectory, gpacCacheDirectory }) {
+ createDirIfNotExist(s);
+ }
+ return this;
+ }
+
+ private final String gpacConfigDirectory;
+
+ /**
+ * Default directory for GPAC configuration directory, ends with /
+ *
+ * @return the gpacConfigDirectory
+ */
+ public String getGpacConfigDirectory() {
+ return gpacConfigDirectory;
+ }
+
+ /**
+ * Directory of Android containing all fonts
+ *
+ * @return the gpacFontDirectory
+ */
+ public String getGpacFontDirectory() {
+ return gpacFontDirectory;
+ }
+
+ /**
+ * Default directory for GPAC modules directory, ends with /
+ *
+ * @return the gpacModulesDirectory
+ */
+ public String getGpacModulesDirectory() {
+ // return gpacModulesDirectory;
+ return gpacLibsDirectory;
+ }
+
+ /**
+ * @return the gpacLibsDirectory
+ */
+ public String getGpacLibsDirectory() {
+ return gpacLibsDirectory;
+ }
+
+ /**
+ * Default directory for cached files
+ *
+ * @return the gpacCacheDirectory
+ */
+ public String getGpacCacheDirectory() {
+ return gpacCacheDirectory;
+ }
+
+ private final String gpacFontDirectory = "/system/fonts/"; //$NON-NLS-1$
+
+ // private final String gpacModulesDirectory;
+
+ private final String gpacLibsDirectory;
+
+ private final String gpacCacheDirectory;
+
+ /**
+ * Creates a given directory if it does not exist
+ *
+ * @param path
+ */
+ private static boolean createDirIfNotExist(String path) {
+ File f = new File(path);
+ if (!f.exists()) {
+ if (!f.mkdirs()) {
+ Log.e(LOG_GPAC_CONFIG, "Failed to create directory " + path); //$NON-NLS-1$
+ return false;
+ } else {
+ Log.i(LOG_GPAC_CONFIG, "Created directory " + path); //$NON-NLS-1$
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Get the GPAC.cfg file
+ *
+ * @return the file
+ */
+ public File getGpacConfigFile() {
+ return new File(getGpacConfigDirectory(), "GPAC.cfg"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the GPAC.cfg file
+ *
+ * @return the file
+ */
+ public File getGpacLastRevFile() {
+ return new File(getGpacCacheDirectory(), "lastRev.txt"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the configuration as text
+ *
+ * @return a String with newlines representing all the configuration
+ */
+ public String getConfigAsText() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("GpacConfigDirectory=").append(getGpacConfigDirectory()).append('\n'); //$NON-NLS-1$
+ sb.append("GpacModulesDirectory=").append(getGpacModulesDirectory()).append('\n'); //$NON-NLS-1$
+ sb.append("GpacFontDirectory=").append(getGpacFontDirectory()).append('\n'); //$NON-NLS-1$
+ sb.append("GpacCacheDirectory=").append(getGpacCacheDirectory()).append('\n'); //$NON-NLS-1$
+ return sb.toString();
+ }
+}
--- /dev/null
+/**
+ * Osmo on Android
+ * Aug/2010
+ * NGO Van Luyen
+ * $Id: Osmo4.java 2964 2011-04-20 12:42:10Z bad_sheep $
+ *
+ */
+package com.artemis.Osmo4;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.ActivityNotFoundException;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.DialogInterface.OnClickListener;
+import android.content.res.Configuration;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
+import android.text.InputType;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ArrayAdapter;
+import android.widget.AutoCompleteTextView;
+import android.widget.Toast;
+import com.artemis.Osmo4.extra.FileChooserActivity;
+import com.artemis.Osmo4.logs.GpacLogger;
+
+/**
+ * The main Osmo4 activity, used to launch everything
+ *
+ * @version $Revision: 2964 $
+ *
+ */
+public class Osmo4 extends Activity implements GpacCallback {
+
+ // private String[] m_modules_list;
+
+ private boolean shouldDeleteGpacConfig = false;
+
+ /**
+ * @return the shouldDeleteGpacConfig
+ */
+ public synchronized boolean isShouldDeleteGpacConfig() {
+ return shouldDeleteGpacConfig;
+ }
+
+ /**
+ * @param shouldDeleteGpacConfig the shouldDeleteGpacConfig to set
+ */
+ public synchronized void setShouldDeleteGpacConfig(boolean shouldDeleteGpacConfig) {
+ this.shouldDeleteGpacConfig = shouldDeleteGpacConfig;
+ }
+
+ private final static String CFG_STARTUP_CATEGORY = "General"; //$NON-NLS-1$
+
+ private final static String CFG_STARTUP_NAME = "StartupFile"; //$NON-NLS-1$
+
+ private boolean keyboardIsVisible = false;
+
+ private final static int DEFAULT_BUFFER_SIZE = 8192;
+
+ private GpacConfig gpacConfig;
+
+ /**
+ * Activity request ID for picking a file from local file system
+ */
+ public final static int PICK_FILE_REQUEST = 1;
+
+ private final static String LOG_OSMO_TAG = "Osmo4"; //$NON-NLS-1$
+
+ /**
+ * List of all extensions recognized by Osmo
+ */
+ public final static String OSMO_REGISTERED_FILE_EXTENSIONS = "*.mp4,*.bt,*.xmt,*.xml,*.ts,*.svg,*.mp3,*.m3u8,*.mpg,*.aac,*.m4a,*.jpg,*.png"; //$NON-NLS-1$
+
+ private PowerManager.WakeLock wl = null;
+
+ private Osmo4GLSurfaceView mGLView;
+
+ private GpacLogger logger;
+
+ private ProgressDialog startupProgress;
+
+ // ---------------------------------------
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_PROGRESS);
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+
+ final String toOpen;
+ if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
+ Uri uri = getIntent().getData();
+ if (uri != null) {
+ synchronized (this) {
+ toOpen = uri.toString();
+ }
+ } else
+ toOpen = null;
+ } else
+ toOpen = null;
+ if (gpacConfig == null) {
+ gpacConfig = new GpacConfig(this);
+ if (gpacConfig == null)
+ Log.e(LOG_OSMO_TAG, "Failed to load GPAC config"); //$NON-NLS-1$
+ else
+ gpacConfig.ensureAllDirectoriesExist();
+ }
+ if (logger == null)
+ logger = new GpacLogger(gpacConfig);
+ logger.onCreate();
+ if (startupProgress == null) {
+ startupProgress = new ProgressDialog(this);
+ startupProgress.setCancelable(false);
+ }
+ startupProgress.setMessage(getResources().getText(R.string.osmoLoading));
+ startupProgress.setTitle(R.string.osmoLoading);
+ startupProgress.show();
+ if (mGLView != null) {
+ setContentView(mGLView);
+ if (toOpen != null)
+ openURLasync(toOpen);
+ // OK, it means activity has already been started
+ return;
+ }
+ mGLView = new Osmo4GLSurfaceView(Osmo4.this);
+ service.submit(new Runnable() {
+
+ @Override
+ public void run() {
+ // loadAllModules();
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ startupProgress.setIndeterminate(true);
+ startupProgress.setMessage(getResources().getText(R.string.gpacLoading));
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, LOG_OSMO_TAG);
+ if (wl != null)
+ wl.acquire();
+ synchronized (Osmo4.this) {
+ Osmo4.this.wl = wl;
+ }
+
+ Osmo4Renderer renderer = new Osmo4Renderer(Osmo4.this, gpacConfig, toOpen);
+ mGLView.setRenderer(renderer);
+ setContentView(mGLView);
+ }
+ });
+
+ }
+ });
+
+ }
+
+ // ---------------------------------------
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ private String getRecentURLsFile() {
+ return gpacConfig.getGpacConfigDirectory() + "recentURLs.txt"; //$NON-NLS-1$
+ }
+
+ private boolean openURL() {
+ Future<String[]> res = service.submit(new Callable<String[]>() {
+
+ @Override
+ public String[] call() throws Exception {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(new FileInputStream(getRecentURLsFile()),
+ DEFAULT_ENCODING), DEFAULT_BUFFER_SIZE);
+
+ String s = null;
+ Set<String> results = new HashSet<String>();
+ while (null != (s = reader.readLine())) {
+ results.add(s);
+ }
+ addAllRecentURLs(results);
+ return results.toArray(new String[0]);
+ } finally {
+ if (reader != null)
+ reader.close();
+ }
+ }
+ });
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final AutoCompleteTextView textView = new AutoCompleteTextView(this);
+ textView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
+
+ builder.setMessage("Please enter an URL to connect to...") //$NON-NLS-1$
+ .setCancelable(true)
+ .setPositiveButton("Open URL", new DialogInterface.OnClickListener() { //$NON-NLS-1$
+
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.cancel();
+ final String newURL = textView.getText().toString();
+ openURLasync(newURL);
+ service.execute(new Runnable() {
+
+ @Override
+ public void run() {
+ addAllRecentURLs(Collections.singleton(newURL));
+ File tmp = new File(getRecentURLsFile() + ".tmp"); //$NON-NLS-1$
+ BufferedWriter w = null;
+ try {
+ w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmp),
+ DEFAULT_ENCODING),
+ DEFAULT_BUFFER_SIZE);
+ Collection<String> toWrite = getAllRecentURLs();
+ for (String s : toWrite) {
+ w.write(s);
+ w.write("\n"); //$NON-NLS-1$
+ }
+ w.close();
+ w = null;
+ if (tmp.renameTo(new File(getRecentURLsFile())))
+ Log.e(LOG_OSMO_TAG,
+ "Failed to rename " + tmp + " to " + getRecentURLsFile()); //$NON-NLS-1$//$NON-NLS-2$
+
+ } catch (IOException e) {
+ Log.e(LOG_OSMO_TAG, "Failed to write recent URLs to " + tmp, e); //$NON-NLS-1$
+ try {
+ if (w != null)
+ w.close();
+ } catch (IOException ex) {
+ Log.e(LOG_OSMO_TAG, "Failed to close stream " + tmp, ex); //$NON-NLS-1$
+ }
+ }
+
+ }
+ });
+ }
+ })
+ .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { //$NON-NLS-1$
+
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.cancel();
+ }
+ });
+
+ textView.setText("http://"); //$NON-NLS-1$
+ builder.setView(textView);
+
+ builder.show();
+ ArrayAdapter<String> adapter;
+ try {
+ adapter = new ArrayAdapter<String>(this,
+ android.R.layout.simple_dropdown_item_1line,
+ res.get(1, TimeUnit.SECONDS));
+ textView.setAdapter(adapter);
+ } catch (ExecutionException e) {
+ // Ignored
+ Log.e(LOG_OSMO_TAG, "Error while parsing recent URLs", e); //$NON-NLS-1$
+ } catch (TimeoutException e) {
+ Log.e(LOG_OSMO_TAG, "It took too long to parse recent URLs", e); //$NON-NLS-1$
+ } catch (InterruptedException e) {
+ Log.e(LOG_OSMO_TAG, "Interrupted while parsing recent URLs", e); //$NON-NLS-1$
+ }
+
+ return true;
+ }
+
+ private final ExecutorService service = Executors.newSingleThreadExecutor();
+
+ private final Set<String> allRecentURLs = new HashSet<String>();
+
+ private synchronized void addAllRecentURLs(Collection<String> urlsToAdd) {
+ allRecentURLs.addAll(urlsToAdd);
+ }
+
+ private synchronized Collection<String> getAllRecentURLs() {
+ return new ArrayList<String>(allRecentURLs);
+ }
+
+ private final static Charset DEFAULT_ENCODING = Charset.forName("UTF-8"); //$NON-NLS-1$
+
+ /**
+ * Opens a new activity to select a file
+ *
+ * @return true if activity has been selected
+ */
+ private boolean openFileDialog() {
+ String title = getResources().getString(R.string.pleaseSelectAFile);
+ Uri uriDefaultDir = Uri.fromFile(new File(gpacConfig.getGpacConfigDirectory()));
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_PICK);
+ // Files and directories
+ intent.setDataAndType(uriDefaultDir, "vnd.android.cursor.dir/lysesoft.andexplorer.file"); //$NON-NLS-1$
+ // Optional filtering on file extension.
+ intent.putExtra("browser_filter_extension_whitelist", OSMO_REGISTERED_FILE_EXTENSIONS); //$NON-NLS-1$
+ // Title
+ intent.putExtra("explorer_title", title); //$NON-NLS-1$
+
+ try {
+ startActivityForResult(intent, PICK_FILE_REQUEST);
+ return true;
+ } catch (ActivityNotFoundException e) {
+ // OK, lets try with another one... (it includes out bundled one)
+ intent = new Intent("org.openintents.action.PICK_FILE"); //$NON-NLS-1$
+ intent.setData(uriDefaultDir);
+ intent.putExtra(FileChooserActivity.TITLE_PARAMETER, title);
+ intent.putExtra("browser_filter_extension_whitelist", OSMO_REGISTERED_FILE_EXTENSIONS); //$NON-NLS-1$
+ try {
+ startActivityForResult(intent, PICK_FILE_REQUEST);
+ return true;
+ } catch (ActivityNotFoundException ex) {
+ // Not found neither... We build our own dialog to display error
+ // Note that this should happen only if we did not embed out own intent
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setMessage("Impossible to find an Intent to choose a file... Cannot open file !") //$NON-NLS-1$
+ .setCancelable(true)
+ .setPositiveButton("Close", new DialogInterface.OnClickListener() { //$NON-NLS-1$
+
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.cancel();
+ }
+ });
+ AlertDialog alert = builder.create();
+ alert.show();
+ return false;
+ }
+ }
+ }
+
+ // ---------------------------------------
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ if (requestCode == PICK_FILE_REQUEST) {
+ if (resultCode == RESULT_OK) {
+ Uri uri = intent.getData();
+ if (uri != null) {
+ String url = uri.toString();
+ String file = "file://"; //$NON-NLS-1$
+ if (url.startsWith(file)) {
+ url = uri.getPath();
+ }
+ Log.i(LOG_OSMO_TAG, "Requesting opening local file " + url); //$NON-NLS-1$
+ openURLasync(url);
+ }
+ }
+ }
+ }
+
+ private String currentURL;
+
+ private void openURLasync(final String url) {
+ service.execute(new Runnable() {
+
+ @Override
+ public void run() {
+ mGLView.connect(url);
+ currentURL = url;
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ setTitle(getResources().getString(R.string.titleWithURL, url));
+ }
+ });
+ }
+ });
+ }
+
+ // ---------------------------------------
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ }
+
+ // ---------------------------------------
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle item selection
+ switch (item.getItemId()) {
+ case R.id.open_url:
+ return openURL();
+ case R.id.open_file:
+ // newGame();
+ return openFileDialog();
+ case R.id.cleanCache:
+ return cleanCache();
+ case R.id.showVirtualKeyboard:
+ showKeyboard(true);
+ return true;
+ case R.id.setAsStartupFile: {
+ AlertDialog.Builder b = new AlertDialog.Builder(this);
+ b.setTitle(R.string.setAsStartupFileTitle);
+ if (currentURL != null) {
+ b.setMessage(getResources().getString(R.string.setAsStartupFileMessage, currentURL));
+ b.setPositiveButton(R.string.setAsStartupFileYes, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ mGLView.setGpacPreference(CFG_STARTUP_CATEGORY, CFG_STARTUP_NAME, currentURL);
+ }
+ });
+ } else {
+ b.setMessage(getResources().getString(R.string.setAsStartupFileMessageNoURL));
+ }
+ b.setNegativeButton(R.string.setAsStartupFileNo, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ });
+ b.setNeutralButton(R.string.setAsStartupFileNull, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ mGLView.setGpacPreference(CFG_STARTUP_CATEGORY, CFG_STARTUP_NAME, null);
+ }
+ });
+ b.show();
+ return true;
+ }
+ case R.id.resetGpacConfig: {
+ AlertDialog.Builder b = new AlertDialog.Builder(this);
+ b.setCancelable(true);
+ b.setTitle(R.string.resetGpacConfig);
+ b.setMessage(R.string.resetGpacConfigMessage);
+ b.setNegativeButton(R.string.cancel_button, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ });
+ b.setPositiveButton(R.string.ok_button, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ setShouldDeleteGpacConfig(true);
+ deleteConfigIfNeeded();
+ }
+ });
+ b.show();
+ return true;
+ }
+ case R.id.about: {
+ Dialog d = new Dialog(this);
+ d.setTitle(R.string.aboutTitle);
+ d.setCancelable(true);
+ d.setContentView(R.layout.about_dialog);
+ d.show();
+ }
+ return true;
+ case R.id.quit:
+ this.finish();
+ mGLView.destroy();
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ protected boolean cleanCache() {
+ final CharSequence oldTitle = getTitle();
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ startupProgress.setTitle(R.string.cleaningCache);
+ startupProgress.setMessage(getResources().getString(R.string.cleaningCache,
+ gpacConfig.getGpacCacheDirectory()));
+ startupProgress.setProgress(0);
+ startupProgress.setIndeterminate(false);
+ startupProgress.show();
+ }
+ });
+ service.submit(new Runnable() {
+
+ @Override
+ public void run() {
+ File dir = new File(gpacConfig.getGpacCacheDirectory());
+ if (!dir.exists() || !dir.canRead() || !dir.canWrite() || !dir.isDirectory()) {
+ return;
+ }
+ File files[] = dir.listFiles();
+ int i = 0;
+ for (File f : files) {
+ if (f.isFile())
+ if (!f.delete()) {
+ Log.w(LOG_OSMO_TAG, "Failed to delete file " + f); //$NON-NLS-1$
+ } else {
+ Log.v(LOG_OSMO_TAG, f + " has been deleted"); //$NON-NLS-1$
+ }
+ final int percent = (++i) * 100 / files.length;
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ startupProgress.setProgress(percent);
+ }
+ });
+ }
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ startupProgress.setProgress(100);
+ startupProgress.setTitle(oldTitle);
+ startupProgress.dismiss();
+ }
+ });
+ }
+ });
+ return true;
+ }
+
+ private void deleteConfigIfNeeded() {
+ if (isShouldDeleteGpacConfig()) {
+ Log.i(LOG_OSMO_TAG, "Deleting GPAC config file..."); //$NON-NLS-1$
+ File f = gpacConfig.getGpacConfigFile();
+ if (f.exists() && !f.delete()) {
+ Log.e(LOG_OSMO_TAG, "Failed to delete " + f.getAbsolutePath()); //$NON-NLS-1$
+ }
+ f = gpacConfig.getGpacLastRevFile();
+ if (f.exists() && !f.delete()) {
+ Log.e(LOG_OSMO_TAG, "Failed to delete " + f.getAbsolutePath()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ // ---------------------------------------
+ @Override
+ protected void onDestroy() {
+ deleteConfigIfNeeded();
+ service.shutdown();
+ logger.onDestroy();
+ synchronized (this) {
+ if (wl != null)
+ wl.release();
+ }
+ Log.d(LOG_OSMO_TAG, "Disconnecting instance..."); //$NON-NLS-1$
+ mGLView.disconnect();
+ Log.d(LOG_OSMO_TAG, "Destroying GPAC instance..."); //$NON-NLS-1$
+ mGLView.destroy();
+ // Deleteing is done two times if GPAC fails to shutdown by crashing...
+ deleteConfigIfNeeded();
+ super.onDestroy();
+ }
+
+ // ---------------------------------------
+ // private void loadAllModules() {
+ // Log.i(LOG_OSMO_TAG, "Start loading all modules..."); //$NON-NLS-1$
+ // long start = System.currentTimeMillis();
+ // byte buffer[] = new byte[1024];
+ // int[] ids = getAllRawResources();
+ // String currentRevision = "$Revision: 2964 $"; //$NON-NLS-1$
+ // File revisionFile = gpacConfig.getGpacLastRevFile();
+ // boolean fastStartup = false;
+ // // We check if we already copied all the modules once without error...
+ // if (revisionFile.exists() && revisionFile.canRead()) {
+ // BufferedReader r = null;
+ // try {
+ // r = new BufferedReader(new InputStreamReader(new FileInputStream(revisionFile), DEFAULT_ENCODING),
+ // DEFAULT_BUFFER_SIZE);
+ // String rev = r.readLine();
+ // if (currentRevision.equals(rev)) {
+ // fastStartup = true;
+ // }
+ // } catch (IOException ignored) {
+ // } finally {
+ // // Exception or not, always close the stream...
+ // if (r != null)
+ // try {
+ // r.close();
+ // } catch (IOException ignored) {
+ // }
+ // }
+ // }
+ // boolean noErrors = true;
+ // final StringBuilder errorsMsg = new StringBuilder();
+ // for (int i = 0; i < ids.length; i++) {
+ // OutputStream fos = null;
+ // InputStream ins = null;
+ // String fn = gpacConfig.getGpacModulesDirectory() + m_modules_list[i] + ".so"; //$NON-NLS-1$
+ // File finalFile = new File(fn);
+ // // If file has already been copied, not need to do it again
+ // if (fastStartup && finalFile.exists() && finalFile.canRead()) {
+ // Log.i(LOG_OSMO_TAG, "Skipping " + finalFile); //$NON-NLS-1$
+ // continue;
+ // }
+ // try {
+ // final String msg = getResources().getString(R.string.copying_native_libs,
+ // finalFile.getName(),
+ // finalFile.getParent());
+ // runOnUiThread(new Runnable() {
+ //
+ // @Override
+ // public void run() {
+ // startupProgress.setIndeterminate(false);
+ // startupProgress.setMessage(msg);
+ // }
+ // });
+ // Log.i(LOG_OSMO_TAG, "Copying resource " + ids[i] + " to " //$NON-NLS-1$//$NON-NLS-2$
+ // + finalFile.getAbsolutePath());
+ // File tmpFile = new File(fn + ".tmp"); //$NON-NLS-1$
+ // int read;
+ // ins = new BufferedInputStream(getResources().openRawResource(ids[i]), DEFAULT_BUFFER_SIZE);
+ // fos = new BufferedOutputStream(new FileOutputStream(tmpFile), DEFAULT_BUFFER_SIZE);
+ // while (0 < (read = ins.read(buffer))) {
+ // fos.write(buffer, 0, read);
+ // }
+ // ins.close();
+ // ins = null;
+ // fos.close();
+ // fos = null;
+ // if (!tmpFile.renameTo(finalFile)) {
+ // if (finalFile.exists() && finalFile.delete() && !tmpFile.renameTo(finalFile))
+ // Log.e(LOG_OSMO_TAG, "Failed to rename " + tmpFile.getAbsolutePath() + " to " //$NON-NLS-1$//$NON-NLS-2$
+ // + finalFile.getAbsolutePath());
+ // }
+ // final int percent = i * 10000 / ids.length;
+ // runOnUiThread(new Runnable() {
+ //
+ // @Override
+ // public void run() {
+ // startupProgress.setProgress(percent);
+ // }
+ // });
+ // } catch (IOException e) {
+ // noErrors = false;
+ // String msg = "IOException for resource : " + ids[i]; //$NON-NLS-1$
+ // errorsMsg.append(msg).append('\n').append(finalFile.getAbsolutePath()).append('\n');
+ // errorsMsg.append(e.getLocalizedMessage());
+ // Log.e(LOG_OSMO_TAG, msg, e);
+ // } finally {
+ // if (ins != null) {
+ // try {
+ // ins.close();
+ // } catch (IOException e) {
+ // Log.e(LOG_OSMO_TAG, "Error while closing read stream", e); //$NON-NLS-1$
+ // }
+ // }
+ // if (fos != null) {
+ // try {
+ // fos.close();
+ // } catch (IOException e) {
+ // Log.e(LOG_OSMO_TAG, "Error while closing write stream", e); //$NON-NLS-1$
+ // }
+ // }
+ // }
+ // }
+ // // If no error during copy, fast startup will be enabled for next time
+ // if (noErrors && !fastStartup) {
+ // BufferedWriter w = null;
+ // try {
+ // w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(revisionFile), DEFAULT_ENCODING),
+ // DEFAULT_BUFFER_SIZE);
+ // w.write(currentRevision);
+ // w.write('\n');
+ // // We add the date as second line to ease debug in case of problem
+ // w.write(String.valueOf(new Date()));
+ // } catch (IOException ignored) {
+ // } finally {
+ // if (w != null)
+ // try {
+ // w.close();
+ // } catch (IOException ignored) {
+ // }
+ // }
+ // } else {
+ // if (!noErrors) {
+ // setShouldDeleteGpacConfig(true);
+ // displayMessage(errorsMsg.toString(), "Errors while copying modules !", GF_Err.GF_IO_ERR.value); //$NON-NLS-1$
+ // }
+ // }
+ // Log.i(LOG_OSMO_TAG, "Done loading all modules, took " + (System.currentTimeMillis() - start) + "ms."); //$NON-NLS-1$ //$NON-NLS-2$
+ // startupProgress.setProgress(100);
+ // startupProgress.setIndeterminate(true);
+ // runOnUiThread(new Runnable() {
+ //
+ // @Override
+ // public void run() {
+ // setTitle(LOG_OSMO_TAG);
+ // }
+ // });
+ // }
+
+ // private int[] getAllRawResources() throws RuntimeException {
+ // R.raw r = new R.raw();
+ //
+ // java.lang.reflect.Field fields[] = R.raw.class.getDeclaredFields();
+ // final int ids[] = new int[fields.length];
+ // m_modules_list = new String[fields.length];
+ //
+ // try {
+ // for (int i = 0; i < fields.length; i++) {
+ // java.lang.reflect.Field f = fields[i];
+ // ids[i] = f.getInt(r);
+ // m_modules_list[i] = f.getName();
+ // Log.i(LOG_OSMO_TAG, "R.raw." + f.getName() + " = 0x" + Integer.toHexString(ids[i])); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
+ // } catch (IllegalArgumentException e) {
+ // throw new RuntimeException(e);
+ // } catch (IllegalAccessException e) {
+ // throw new RuntimeException(e);
+ // }
+ //
+ // return ids;
+ // }
+
+ // ---------------------------------------
+
+ private String lastDisplayedMessage;
+
+ private void displayPopup(CharSequence message, CharSequence title) {
+ final String fullMsg = getResources().getString(R.string.displayPopupFormat, title, message);
+ synchronized (this) {
+ if (fullMsg.equals(lastDisplayedMessage))
+ return;
+ lastDisplayedMessage = fullMsg;
+ }
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ Toast toast = Toast.makeText(Osmo4.this, fullMsg, Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ });
+
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#displayMessage(String, String, int)
+ */
+ @Override
+ public void displayMessage(final String message, final String title, final int status) {
+ if (status == GF_Err.GF_OK.value)
+ displayPopup(message, title);
+ else {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(GF_Err.getError(status));
+ sb.append(' ');
+ sb.append(title);
+ AlertDialog.Builder builder = new AlertDialog.Builder(Osmo4.this);
+ builder.setTitle(sb.toString());
+ sb.append('\n');
+ sb.append(message);
+ builder.setMessage(sb.toString());
+ builder.setCancelable(true);
+ builder.setPositiveButton(R.string.ok_button, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
+ try {
+ builder.create().show();
+ } catch (WindowManager.BadTokenException e) {
+ // May happen when we close the window and there are still somes messages
+ Log.e(LOG_OSMO_TAG, "Failed to display Message " + sb.toString(), e); //$NON-NLS-1$
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#onLog(int, int, String)
+ */
+ @Override
+ public void onLog(int level, int module, String message) {
+ logger.onLog(level, module, message);
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#onProgress(java.lang.String, int, int)
+ */
+ @Override
+ public void onProgress(final String msg, final int done, final int total) {
+ if (Log.isLoggable(LOG_OSMO_TAG, Log.DEBUG))
+ Log.d(LOG_OSMO_TAG, "Setting progress to " + done + "/" + total + ", message=" + msg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ // GPAC sometimes return total = 0
+ if (total < 1) {
+ setProgressBarIndeterminate(true);
+ } else {
+ int progress = done * 10000 / (total < 1 ? 1 : total);
+ if (progress > 9900)
+ progress = 10000;
+ setProgressBarIndeterminate(false);
+ setProgress(progress);
+ }
+ }
+ });
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#onGPACReady()
+ */
+ @Override
+ public void onGPACReady() {
+ startupProgress.dismiss();
+ Log.i(LOG_OSMO_TAG, "GPAC is ready"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#onGPACError(java.lang.Throwable)
+ */
+ @Override
+ public void onGPACError(final Throwable e) {
+ startupProgress.dismiss();
+ Log.e(LOG_OSMO_TAG, "GPAC Error", e); //$NON-NLS-1$
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ // In such case, we force GPAC Configuration file deletion
+ setShouldDeleteGpacConfig(true);
+ StringBuilder sb = new StringBuilder();
+ sb.append("Failed to init GPAC due to "); //$NON-NLS-1$
+ sb.append(e.getClass().getSimpleName());
+ AlertDialog.Builder builder = new AlertDialog.Builder(Osmo4.this);
+ builder.setTitle(sb.toString());
+ sb.append('\n');
+ sb.append("Description: "); //$NON-NLS-1$
+ sb.append(e.getLocalizedMessage());
+ sb.append('\n');
+ sb.append("Revision: $Revision: 2964 $"); //$NON-NLS-1$
+ sb.append("\nConfiguration information :\n") //$NON-NLS-1$
+ .append(gpacConfig.getConfigAsText());
+ builder.setMessage(sb.toString());
+ builder.setCancelable(true);
+ builder.setPositiveButton(R.string.ok_button, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
+ builder.create().show();
+ }
+ });
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ if (mGLView != null)
+ mGLView.onPause();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (mGLView != null)
+ mGLView.onResume();
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#setCaption(java.lang.String)
+ */
+ @Override
+ public void setCaption(final String newCaption) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ setTitle(newCaption);
+ }
+ });
+ }
+
+ /**
+ * @see android.app.Activity#onStop()
+ */
+ @Override
+ protected void onStop() {
+ Log.i(LOG_OSMO_TAG, "onStop called on activity"); //$NON-NLS-1$
+ super.onStop();
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GpacCallback#showKeyboard(boolean)
+ */
+ @Override
+ public void showKeyboard(boolean showKeyboard) {
+ if (keyboardIsVisible == showKeyboard == true)
+ return;
+ InputMethodManager mgr = ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE));
+ this.keyboardIsVisible = showKeyboard;
+ if (showKeyboard)
+ mgr.showSoftInput(mGLView, 0);
+ else
+ mgr.hideSoftInputFromInputMethod(mGLView.getWindowToken(), 0);
+
+ }
+}
--- /dev/null
+package com.artemis.Osmo4;
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+/**
+ * The view represented the blitted contents by libgpac
+ *
+ * @version $Revision: 2942 $
+ *
+ */
+public class Osmo4GLSurfaceView extends GLSurfaceView implements GPACInstanceInterface {
+
+ private final static String LOG_GL_SURFACE = Osmo4GLSurfaceView.class.getSimpleName();
+
+ /**
+ * Constructor
+ *
+ * @param context
+ */
+ public Osmo4GLSurfaceView(Context context) {
+ super(context);
+ setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS);
+ setFocusable(true);
+ setFocusableInTouchMode(true);
+ }
+
+ private Osmo4Renderer gpacRenderer;
+
+ /**
+ * Set the renderer
+ *
+ * @param renderer
+ */
+ public void setRenderer(Osmo4Renderer renderer) {
+ synchronized (this) {
+ this.gpacRenderer = renderer;
+ }
+ super.setRenderer(renderer);
+ setRenderMode(RENDERMODE_CONTINUOUSLY);
+ }
+
+ private synchronized Osmo4Renderer getGpacRenderer() {
+ return gpacRenderer;
+ }
+
+ private GPACInstance getInstance() {
+ Osmo4Renderer r = getGpacRenderer();
+ if (r == null)
+ return null;
+ return r.getInstance();
+ }
+
+ // ------------------------------------
+ @Override
+ public boolean onTouchEvent(final MotionEvent event) {
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.motionEvent(event);
+ }
+ });
+ return true;
+ }
+
+ /**
+ * Should we handle this key in GPAC ?
+ *
+ * @param keyCode
+ * @param event
+ * @return
+ */
+ private static boolean handleInGPAC(int keyCode, KeyEvent event) {
+ if (event.isSystem())
+ return false;
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_MEDIA_STOP:
+ case KeyEvent.KEYCODE_MENU:
+ case KeyEvent.KEYCODE_BACK:
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(final int keyCode, final KeyEvent event) {
+ if (handleInGPAC(keyCode, event)) {
+ Log.d(LOG_GL_SURFACE, "onKeyDown = " + keyCode); //$NON-NLS-1$
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.eventKey(keyCode, event, true, event.getUnicodeChar());
+ }
+ });
+ return true;
+ }
+ return false;
+ }
+
+ // ------------------------------------
+ @Override
+ public boolean onKeyUp(final int keyCode, final KeyEvent event) {
+ if (handleInGPAC(keyCode, event)) {
+ Log.d(LOG_GL_SURFACE, "onKeyUp =" + keyCode); //$NON-NLS-1$
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.eventKey(keyCode, event, false, event.getUnicodeChar());
+ }
+ });
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onResume() {
+ if (getInstance() != null)
+ super.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ if (getInstance() != null)
+ super.onPause();
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GPACInstanceInterface#connect(java.lang.String)
+ */
+ @Override
+ public void connect(final String url) {
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.connect(url);
+ }
+ });
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GPACInstanceInterface#disconnect()
+ */
+ @Override
+ public void disconnect() {
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.disconnect();
+ }
+ });
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GPACInstanceInterface#destroy()
+ */
+ @Override
+ public void destroy() {
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.destroy();
+ }
+ });
+ }
+
+ /**
+ * @see com.artemis.Osmo4.GPACInstanceInterface#setGpacPreference(String, String, String)
+ */
+ @Override
+ public void setGpacPreference(final String category, final String name, final String value) {
+ queueEvent(new Runnable() {
+
+ @Override
+ public void run() {
+ GPACInstance instance = getInstance();
+ if (instance != null)
+ instance.setGpacPreference(category, name, value);
+ }
+ });
+ }
+}
--- /dev/null
+package com.artemis.Osmo4;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+import android.opengl.GLSurfaceView;
+import android.util.Log;
+
+/**
+ * The renderer
+ *
+ * @version $Revision: 2950 $
+ *
+ */
+public class Osmo4Renderer implements GLSurfaceView.Renderer {
+
+ private final GpacConfig gpacConfig;
+
+ private final static String LOG_RENDERER = Osmo4Renderer.class.getSimpleName();
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ if (instance == null) {
+ try {
+ Log.i(LOG_RENDERER, "Creating instance from thread " + Thread.currentThread()); //$NON-NLS-1$
+ instance = new GPACInstance(callback, 320, 430, gpacConfig, urlToLoad);
+ } catch (com.artemis.Osmo4.GPACInstanceInterface.GpacInstanceException e) {
+ Log.e(LOG_RENDERER, "Failed to create new GPAC instance !"); //$NON-NLS-1$
+ instance = null;
+ callback.onGPACError(e);
+ return;
+ }
+ if (callback != null)
+ callback.onGPACReady();
+ }
+ }
+
+ private GPACInstance instance = null;
+
+ private final String urlToLoad;
+
+ /**
+ * @return the urlToLoad
+ */
+ public synchronized String getUrlToLoad() {
+ return urlToLoad;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param callback
+ * @param gpacConfig
+ * @param urlToLoad The URL to load at startup, can be null
+ */
+ public Osmo4Renderer(GpacCallback callback, GpacConfig gpacConfig, String urlToLoad) {
+ this.callback = callback;
+ this.urlToLoad = urlToLoad;
+ this.gpacConfig = gpacConfig;
+ }
+
+ private final GpacCallback callback;
+
+ @Override
+ public void onSurfaceChanged(GL10 gl, int w, int h) {
+ // gl.glViewport(0, 0, w, h);
+ if (instance != null) {
+ Log.i(LOG_RENDERER, "Surface changed from thread " + Thread.currentThread()); //$NON-NLS-1$
+ instance.resize(w, h);
+ }
+ }
+
+ private int frames;
+
+ private long startFrame = System.currentTimeMillis();
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ if (instance != null) {
+ frames++;
+ if (frames % 1000 == 0) {
+ long now = System.currentTimeMillis();
+ Log.i(LOG_RENDERER, "Frames Per Second = " + ((now - startFrame) / 1000) + " fps"); //$NON-NLS-1$//$NON-NLS-2$
+ this.startFrame = now;
+ }
+ instance.render();
+ }
+ }
+
+ /**
+ * Get the current GPAC Instance
+ *
+ * @return the instance
+ */
+ synchronized GPACInstance getInstance() {
+ return instance;
+ }
+}
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/extra/FileArrayAdapter.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-06 10:23:04 -0400 (Wed, 06 Apr 2011) $
+ */
+package com.artemis.Osmo4.extra;
+
+import java.io.File;
+import java.util.List;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+import com.artemis.Osmo4.R;
+
+/**
+ * Class that contains the list of file for given directory
+ *
+ * @version $Revision: 2864 $
+ *
+ */
+public class FileArrayAdapter extends ArrayAdapter<FileEntry> {
+
+ private final Context context;
+
+ private final int id;
+
+ private final List<FileEntry> items;
+
+ /**
+ * Constructor
+ *
+ * @param context
+ * @param textViewResourceId
+ * @param objects
+ */
+ public FileArrayAdapter(Context context, int textViewResourceId, List<FileEntry> objects) {
+ super(context, textViewResourceId, objects);
+ this.context = context;
+ id = textViewResourceId;
+ items = objects;
+ }
+
+ @Override
+ public FileEntry getItem(int i) {
+ return items.get(i);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View v = convertView;
+ if (v == null) {
+ LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(id, null);
+ }
+ final FileEntry o = items.get(position);
+ if (o != null) {
+ TextView t1 = (TextView) v.findViewById(R.id.TextView01);
+ TextView t2 = (TextView) v.findViewById(R.id.TextView02);
+
+ if (t1 != null)
+ t1.setText(o.getName());
+ if (t2 != null) {
+ File f = o.getFile();
+ if (f.isDirectory())
+ t2.setText(context.getString(R.string.directory));
+ else
+ t2.setText(context.getString(R.string.fileSize, f.length()));
+ }
+ }
+ return v;
+ }
+
+}
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/extra/FileChooserActivity.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-06 10:23:04 -0400 (Wed, 06 Apr 2011) $
+ */
+package com.artemis.Osmo4.extra;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import android.app.ListActivity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ListView;
+import com.artemis.Osmo4.R;
+
+/**
+ * @version $Revision: 2864 $
+ *
+ */
+public class FileChooserActivity extends ListActivity {
+
+ private File currentDir;
+
+ private FileArrayAdapter adapter;
+
+ /**
+ * The parameter name to use to search for title
+ */
+ public final static String TITLE_PARAMETER = "org.openintents.extra.TITLE"; //$NON-NLS-1$
+
+ private String customTitle;
+
+ private void updateTitle(File currentPath) {
+ setTitle(getResources().getString(R.string.selectFileTitlePattern, customTitle, currentPath.getAbsolutePath()));
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent = getIntent();
+ currentDir = new File("/"); //$NON-NLS-1$
+ this.customTitle = getResources().getString(R.string.selectFileDefaultTitle);
+ if (intent != null) {
+ if (intent.getData() != null) {
+ File f = new File(intent.getData().getPath());
+ if (f.exists() && f.isDirectory() && f.canRead())
+ currentDir = f;
+ }
+ String title = intent.getExtras().getString(TITLE_PARAMETER);
+ if (title != null)
+ this.customTitle = title;
+ }
+ fillList(currentDir);
+ }
+
+ private void fillList(File f) {
+ File[] dirs = f.listFiles();
+ updateTitle(f);
+ List<FileEntry> dir = new ArrayList<FileEntry>();
+ List<FileEntry> fls = new ArrayList<FileEntry>();
+ if (dirs != null) {
+ for (File ff : dirs) {
+ dir.add(new FileEntry(ff.getAbsoluteFile()));
+ }
+ Collections.sort(dir);
+ Collections.sort(fls);
+ dir.addAll(fls);
+ }
+ if (f.getParentFile() != null)
+ dir.add(0, new FileEntry(f.getParentFile(), getResources().getString(R.string.parentDirectory)));
+ adapter = new FileArrayAdapter(this, R.layout.file_view, dir);
+ this.setListAdapter(adapter);
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ super.onListItemClick(l, v, position, id);
+ FileEntry o = adapter.getItem(position);
+ if (o.getFile().isDirectory()) {
+ fillList(o.getFile());
+ } else {
+ onFileClick(o);
+ }
+ }
+
+ private void onFileClick(FileEntry o) {
+ Intent data = new Intent();
+ data.setData(Uri.fromFile(o.getFile()));
+ setResult(RESULT_OK, data);
+ finish();
+ }
+
+}
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/extra/FileEntry.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-06 10:23:04 -0400 (Wed, 06 Apr 2011) $
+ */
+package com.artemis.Osmo4.extra;
+
+import java.io.File;
+
+/**
+ * @version $Revision: 2864 $
+ *
+ */
+public class FileEntry implements Comparable<FileEntry> {
+
+ private final File file;
+
+ private final String name;
+
+ /**
+ * Constructor
+ *
+ * @param f
+ */
+ public FileEntry(File f) {
+ this.file = f;
+ this.name = f.getName();
+ }
+
+ /**
+ * Constructor
+ *
+ * @param f
+ * @param name The name to use
+ */
+ public FileEntry(File f, String name) {
+ this.file = f.getAbsoluteFile();
+ this.name = name;
+ }
+
+ /**
+ * Get the name of option
+ *
+ * @return The name of option
+ */
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int compareTo(FileEntry o) {
+ return getName().toLowerCase().compareTo(o.getName());
+ }
+
+ /**
+ * @return the file
+ */
+ public File getFile() {
+ return file;
+ }
+}
\ No newline at end of file
--- /dev/null
+/**
+ * $URL: http://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac/applications/osmo4_android/src/com/artemis/Osmo4/logs/GpacLogger.java $
+ *
+ * $LastChangedBy: bad_sheep $ - $LastChangedDate: 2011-04-19 09:16:05 -0400 (Tue, 19 Apr 2011) $
+ */
+package com.artemis.Osmo4.logs;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.Date;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import android.util.Log;
+import com.artemis.Osmo4.GpacConfig;
+import com.artemis.Osmo4.GpacCallback.GF_Log_Module;
+
+/**
+ * This class handles logging.
+ *
+ * It will be extended soon to be configurable and enable saving files on disk
+ *
+ * @version $Revision: 2950 $
+ *
+ */
+public class GpacLogger {
+
+ /**
+ * Default Constructor
+ *
+ * @param gpacConfig
+ */
+ public GpacLogger(GpacConfig gpacConfig) {
+ loggedModules.add(GF_Log_Module.GF_LOG_AUDIO);
+ loggedModules.add(GF_Log_Module.GF_LOG_MEDIA);
+ loggedModules.add(GF_Log_Module.GF_LOG_MODULE);
+ loggedModules.add(GF_Log_Module.GF_LOG_CORE);
+ logger = new File(gpacConfig.getGpacCacheDirectory(), "gpac.log"); //$NON-NLS-1$
+ }
+
+ private boolean enableLogOnDisk = false;
+
+ /**
+ * @return the enableLogOnDisk
+ */
+ public synchronized boolean isEnableLogOnDisk() {
+ return enableLogOnDisk;
+ }
+
+ /**
+ * @param enableLogOnDisk the enableLogOnDisk to set
+ */
+ public synchronized void setEnableLogOnDisk(boolean enableLogOnDisk) {
+ this.enableLogOnDisk = enableLogOnDisk;
+ }
+
+ private final File logger;
+
+ /**
+ * Called when creating logger
+ */
+ public void onCreate() {
+ if (!enableLogOnDisk)
+ return;
+ if (writer == null) {
+ try {
+ writer = new PrintStream(new BufferedOutputStream(new FileOutputStream(logger), 128), true, "UTF-8"); //$NON-NLS-1$
+ } catch (Exception e) {
+ Log.e(GpacLogger.class.getSimpleName(), "Failed to create writer", e); //$NON-NLS-1$
+ }
+ }
+ if (writer != null)
+ writer.println("New log $Revision: 2950 $ at " + new Date()); //$NON-NLS-1$
+ }
+
+ /**
+ * Called when stopping logger
+ */
+ public void onDestroy() {
+ if (!enableLogOnDisk)
+ return;
+ PrintStream w = this.writer;
+ writer = null;
+ if (w != null) {
+ w.println("Closing log file at " + new Date()); //$NON-NLS-1$
+ w.close();
+ }
+ }
+
+ /**
+ * Logs from C-code
+ *
+ * @param level
+ * @param module
+ * @param message
+ */
+ public void onLog(int level, int module, String message) {
+ GF_Log_Module gModule = GF_Log_Module.getModule(module);
+ if (loggedModules.contains(gModule)) {
+ if (loggedLevel <= level)
+ doLog(gModule, level, message);
+ } else if (defaultLoggedLevel <= level) {
+ doLog(gModule, level, message);
+ }
+ }
+
+ private void doLog(GF_Log_Module module, int level, String message) {
+ Log.println(level, module.name(), message);
+ if (enableLogOnDisk) {
+ PrintStream s = writer;
+ if (s != null) {
+ s.println(module.name() + "\t" + message); //$NON-NLS-1$
+ s.flush();
+ }
+ }
+ }
+
+ private final SortedSet<GF_Log_Module> loggedModules = new TreeSet<GF_Log_Module>();
+
+ // The log level used by GPAC modules that are part of loggedModules collection
+ private int loggedLevel = Log.DEBUG;
+
+ // The log level used by GPAC modules not part of loggedModules collection
+ private int defaultLoggedLevel = Log.INFO;
+
+ /**
+ * @return the loggedLevel
+ */
+ public synchronized int getLoggedLevel() {
+ return loggedLevel;
+ }
+
+ /**
+ * @param loggedLevel the loggedLevel to set
+ */
+ public synchronized void setLoggedLevel(int loggedLevel) {
+ this.loggedLevel = loggedLevel;
+ }
+
+ /**
+ * @return the defaultLoggedLevel
+ */
+ public synchronized int getDefaultLoggedLevel() {
+ return defaultLoggedLevel;
+ }
+
+ /**
+ * @param defaultLoggedLevel the defaultLoggedLevel to set
+ */
+ public synchronized void setDefaultLoggedLevel(int defaultLoggedLevel) {
+ this.defaultLoggedLevel = defaultLoggedLevel;
+ }
+
+ private volatile PrintStream writer;
+
+};
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) 2005-200X ENST
+ * All rights reserved
+ *
+ * This file is part of GPAC / command-line client
+ *
+ * GPAC is gf_free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "libgpac_symbols.h"
+
+#ifdef WIN32
+#include <windows.h>
+#else
+typedef struct tagBITMAPFILEHEADER
+{
+ u16 bfType;
+ u32 bfSize;
+ u16 bfReserved1;
+ u16 bfReserved2;
+ u32 bfOffBits;
+} BITMAPFILEHEADER;
+
+typedef struct tagBITMAPINFOHEADER{
+ u32 biSize;
+ s32 biWidth;
+ s32 biHeight;
+ u16 biPlanes;
+ u16 biBitCount;
+ u32 biCompression;
+ u32 biSizeImage;
+ s32 biXPelsPerMeter;
+ s32 biYPelsPerMeter;
+ u32 biClrUsed;
+ u32 biClrImportant;
+} BITMAPINFOHEADER;
+
+#define BI_RGB 0L
+
+#endif
+
+
+#include <gpac/internal/avilib.h>
+#include <gpac/internal/terminal_dev.h>
+#include <gpac/internal/compositor_dev.h>
+
+extern Bool is_connected;
+extern GF_Terminal *term;
+extern u32 Duration;
+extern GF_Err last_error;
+
+static GFINLINE u8 colmask(s32 a, s32 n)
+{
+ s32 mask = (1 << n) - 1;
+ return (u8) (a & (0xff & ~mask)) | ((-((a >> n) & 1)) & mask);
+}
+
+static u32 put_pixel(FILE *fout, u32 type, u32 pf, char *ptr)
+{
+ u16 col;
+ switch (pf) {
+ case GF_PIXEL_RGB_32:
+ case GF_PIXEL_ARGB:
+ fputc(ptr[0], fout);
+ fputc(ptr[1], fout);
+ fputc(ptr[2], fout);
+ return 4;
+
+ case GF_PIXEL_BGR_32:
+ case GF_PIXEL_RGBA:
+ //probably due to tinygl bug - verify
+#ifndef GPAC_USE_TINYGL
+ fputc(ptr[3], fout);
+ fputc(ptr[2], fout);
+ fputc(ptr[1], fout);
+#else
+ fputc(ptr[2], fout);
+ fputc(ptr[1], fout);
+ fputc(ptr[0], fout);
+#endif
+ return 4;
+
+ case GF_PIXEL_RGB_24:
+ fputc(ptr[2], fout);
+ fputc(ptr[1], fout);
+ fputc(ptr[0], fout);
+ return 3;
+
+ case GF_PIXEL_BGR_24:
+ fputc(ptr[2], fout);
+ fputc(ptr[1], fout);
+ fputc(ptr[0], fout);
+ return 3;
+ case GF_PIXEL_RGB_565:
+ col = * (u16 *)ptr;
+ fputc(colmask(col << 3, 3), fout);
+ fputc(colmask(col >> (5 - 2), 2), fout);
+ fputc(colmask(col >> (11 - 3), 3), fout);
+ return 2;
+
+ case GF_PIXEL_RGB_555:
+ col = * (u16 *)ptr;
+ fputc(colmask(col << 3, 3), fout);
+ fputc(colmask(col >> (5 - 3), 3), fout);
+ fputc(colmask(col >> (10 - 3), 3), fout);
+ return 2;
+ /* this is used to write the byte depthbuffer in greyscale when dumping depth*/
+ case GF_PIXEL_GREYSCALE:
+ /* bmp always needs 3 pixels */
+ fputc(ptr[0], fout);
+ fputc(ptr[0], fout);
+ fputc(ptr[0], fout);
+ /* if printing the characters corresponding to the float depth buffer: */
+ /*
+ {
+ u32 i=0;
+ while (ptr[i]!='\0') {
+ fputc(ptr[i], fout);
+ i++;
+ }
+ fputc('\b', fout);
+ }
+ */
+ return 1;
+
+
+ case 0:
+ fputc(ptr[0], fout);
+ return 1;
+ }
+ return 0;
+}
+
+void write_bmp(GF_VideoSurface *fb, char *rad_name, u32 img_num)
+{
+ char str[GF_MAX_PATH];
+ BITMAPFILEHEADER fh;
+ BITMAPINFOHEADER fi;
+ FILE *fout;
+ u32 j, i;
+ char *ptr, *prev;
+
+ prev = strrchr(rad_name, '.');
+ //if (prev) prev[0] = '\0';
+
+ if (fb->pixel_format==GF_PIXEL_GREYSCALE) sprintf(str, "%s_%d_depth.bmp", rad_name, img_num);
+ else sprintf(str, "%s_%d.bmp", rad_name, img_num);
+
+ fout = gf_f64_open(str, "wb");
+ if (!fout) return;
+
+ memset(&fh, 0, sizeof(fh));
+ fh.bfType = 19778;
+ fh.bfOffBits = 14 + 40;
+
+ memset(&fi, 0, sizeof(char)*40);
+ fi.biSize = sizeof(char)*40;
+ fi.biWidth = fb->width;
+ fi.biHeight = fb->height;
+ fi.biPlanes = 1;
+ if (fb->pixel_format==GF_PIXEL_GREYSCALE) fi.biBitCount = 24;
+ else fi.biBitCount = 24;
+ fi.biCompression = BI_RGB;
+ fi.biSizeImage = fb->pitch_y * fb->height;
+
+ /*NOT ALIGNED!!*/
+ fwrite(&fh.bfType, 2, 1, fout);
+ fwrite(&fh.bfSize, 4, 1, fout);
+ fwrite(&fh.bfReserved1, 2, 1, fout);
+ fwrite(&fh.bfReserved2, 2, 1, fout);
+ fwrite(&fh.bfOffBits, 4, 1, fout);
+
+ fwrite(&fi, 1, 40, fout);
+//#ifndef GPAC_USE_TINYGL
+ for (j=fb->height; j>0; j--) {
+ ptr = fb->video_buffer + (j-1)*fb->pitch_y;
+ for (i=0;i<fb->width; i++) {
+ u32 res = put_pixel(fout, 0, fb->pixel_format, ptr);
+ assert(res);
+ ptr += res;
+ }
+ }
+//#else
+#if 0
+ for (j=0; j<fb->height; j++) {
+ ptr = fb->video_buffer + j*fb->pitch;
+ for (i=0;i<fb->width; i++) {
+ u32 res = put_pixel(fout, 0, fb->pixel_format, ptr);
+ assert(res);
+ ptr += res;
+ }
+ }
+#endif
+
+ fclose(fout);
+}
+
+/*writes onto a file the content of the framebuffer in *fb interpreted as the byte depthbuffer */
+/*it's also possible to write a float depthbuffer by passing the floats to strings and writing chars in putpixel - see comments*/
+void write_depthfile(GF_VideoSurface *fb, char *rad_name, u32 img_num)
+{
+ FILE *fout;
+ u32 i, j;
+ char val;
+ unsigned char *depth;
+
+ depth = (unsigned char *) fb->video_buffer;
+
+ fout = gf_f64_open("dump_depth", "wb");
+ if (!fout) return;
+ for (j=0; j<fb->height; j++) {
+ for (i=0;i<fb->width; i++) {
+
+#ifdef GPAC_USE_TINYGL
+ val = fputc(depth[2*i+j*fb->width*sizeof(unsigned short)], fout);
+ val = fputc(depth[2*i+j*fb->width*sizeof(unsigned short) + 1], fout);
+#else
+ val = fputc(depth[i+j*fb->width], fout);
+#endif
+ }
+ }
+ fclose(fout);
+}
+
+void write_texture_file(GF_VideoSurface *fb, char *rad_name, u32 img_num, u32 dump_mode)
+{
+
+ FILE *fout;
+ u32 i, j;
+ char val;
+ unsigned char *buf;
+
+ buf = (unsigned char *) fb->video_buffer;
+
+ if (dump_mode==6) fout = gf_f64_open("dump_rgbds", "wb");
+ else if (dump_mode==9) fout = gf_f64_open("dump_rgbd", "wb");
+ else return;
+
+ if (!fout) return;
+ for (j=0; j<fb->height; j++) {
+ for (i=0;i<fb->width*4; i++) {
+ val = fputc(buf[i+j*fb->pitch_y], fout);
+ }
+ }
+ fclose(fout);
+}
+
+
+void write_raw(GF_VideoSurface *fb, char *rad_name, u32 img_num)
+{
+ u32 j, i;
+ char *ptr, *prev;
+ char str[GF_MAX_PATH];
+ FILE *fout;
+ prev = strrchr(rad_name, '.');
+ if (prev) prev[0] = '\0';
+ if (img_num<10) {
+ sprintf(str, "%s_00%d.raw", rad_name, img_num);
+ } else if (img_num<100) {
+ sprintf(str, "%s_0%d.raw", rad_name, img_num);
+ } else {
+ sprintf(str, "%s_%d.raw", rad_name, img_num);
+ }
+
+ fout = gf_f64_open(str, "wb");
+ if (!fout) return;
+
+
+ for (j=0;j<fb->height; j++) {
+ ptr = fb->video_buffer + j*fb->pitch_y;
+ for (i=0;i<fb->width; i++) {
+ u32 res = put_pixel(fout, 0, fb->pixel_format, ptr);
+ assert(res);
+ ptr += res;
+ }
+ }
+ fclose(fout);
+}
+
+
+/* creates a .bmp format greyscale image of the byte depthbuffer and a binary with only the content of the depthbuffer */
+void dump_depth (GF_Terminal *term, char *rad_name, u32 dump_type, u32 frameNum, char *conv_buf, void *avi_out)
+{
+ GF_Err e;
+ u32 i, k;
+ GF_VideoSurface fb;
+
+ /*lock it*/
+ e = gf_sc_get_screen_buffer(term->compositor, &fb, 1);
+ if (e) fprintf(stdout, "Error grabbing depth buffer: %s\n", gf_error_to_string(e));
+ else fprintf(stdout, "OK\n");
+ /*export frame*/
+ switch (dump_type) {
+ case 1:
+ case 8:
+ /*reverse frame*/
+ for (k=0; k<fb.height; k++) {
+ char *dst, *src;
+ u16 src_16;
+ dst = conv_buf + k*fb.width*3;
+ src = fb.video_buffer + (fb.height-k-1) * fb.pitch_y;
+
+ for (i=0;i<fb.width; i++) {
+ switch (fb.pixel_format) {
+ case GF_PIXEL_RGB_32:
+ case GF_PIXEL_ARGB:
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ src+=4;
+ break;
+
+ case GF_PIXEL_BGR_32:
+ case GF_PIXEL_RGBA:
+ dst[0] = src[3];
+ dst[1] = src[2];
+ dst[2] = src[1];
+ src+=4;
+ break;
+ case GF_PIXEL_RGB_24:
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ src+=3;
+ break;
+ case GF_PIXEL_BGR_24:
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ src+=3;
+ break;
+ case GF_PIXEL_RGB_565:
+ src_16 = * ( (u16 *)src );
+ dst[2] = colmask(src_16 >> 8/*(11 - 3)*/, 3);
+ dst[1] = colmask(src_16 >> 3/*(5 - 2)*/, 2);
+ dst[0] = colmask(src_16 << 3, 3);
+ src+=2;
+ break;
+ case GF_PIXEL_RGB_555:
+ src_16 = * (u16 *)src;
+ dst[2] = colmask(src_16 >> 7/*(10 - 3)*/, 3);
+ dst[1] = colmask(src_16 >> 2/*(5 - 3)*/, 3);
+ dst[0] = colmask(src_16 << 3, 3);
+ src+=2;
+ break;
+ /*for depth .avi*/
+ case GF_PIXEL_GREYSCALE:
+ dst[0] = src[0];
+ dst[1] = src[0];
+ dst[2] = src[0];
+ src+=1;
+ break;
+ }
+ dst += 3;
+ }
+ }
+#ifndef GPAC_DISABLE_AVILIB
+ if (AVI_write_frame(avi_out, conv_buf, fb.height*fb.width*3, 1) <0)
+ printf("Error writing frame\n");
+#endif
+ break;
+ case 2:
+ write_bmp(&fb, rad_name, frameNum);
+ break;
+ case 3:
+ write_raw(&fb, rad_name, frameNum);
+ break;
+ case 4:
+ write_depthfile(&fb, rad_name, frameNum);
+ break;
+ case 7:
+ write_bmp(&fb, rad_name, frameNum);
+ break;
+
+ }
+ /*unlock it*/
+ /*in -depth -avi mode, do not release it yet*/
+ if (dump_type!=8) gf_sc_release_screen_buffer(term->compositor, &fb);
+}
+
+void dump_frame(GF_Terminal *term, char *rad_name, u32 dump_type, u32 frameNum, char *conv_buf, void *avi_out)
+{
+ GF_Err e = GF_OK;
+ u32 i, k, out_size;
+ GF_VideoSurface fb;
+
+ /*lock it*/
+ if (dump_type==5 || dump_type==6) e = gf_sc_get_screen_buffer(term->compositor, &fb, 2);
+ else if (dump_type== 9 || dump_type==10) e = gf_sc_get_screen_buffer(term->compositor, &fb, 3);
+ else e = gf_sc_get_screen_buffer(term->compositor, &fb, 0);
+ if (e) fprintf(stdout, "Error grabbing frame buffer: %s\n", gf_error_to_string(e));
+
+ if (dump_type!=5 && dump_type!= 10) {
+ out_size = fb.height*fb.width*3;
+ } else {
+ out_size = fb.height*fb.width*4;
+ }
+ /*export frame*/
+ switch (dump_type) {
+ case 1:
+ case 5:
+ case 10:
+ case 8:
+ /*reverse frame*/
+ for (k=0; k<fb.height; k++) {
+ char *dst, *src;
+ u16 src_16;
+ if (dump_type==5 || dump_type==10) dst = conv_buf + k*fb.width*4;
+ else dst = conv_buf + k*fb.width*3;
+ src = fb.video_buffer + (fb.height-k-1) * fb.pitch_y;
+
+ switch (fb.pixel_format) {
+ case GF_PIXEL_RGB_32:
+ case GF_PIXEL_ARGB:
+ for (i=0;i<fb.width; i++) {
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ src+=4;
+ dst += 3;
+ }
+ break;
+ case GF_PIXEL_RGBDS:
+ for (i=0;i<fb.width; i++) {
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ dst[3] = src[3];
+ dst +=4;
+ src+=4;
+ }
+ break;
+ case GF_PIXEL_RGBD:
+ for (i=0;i<fb.width; i++) {
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ dst[3] = src[3];
+ dst += 4;
+ src+=4;
+ }
+ break;
+ case GF_PIXEL_BGR_32:
+ case GF_PIXEL_RGBA:
+ for (i=0;i<fb.width; i++) {
+ dst[0] = src[3];
+ dst[1] = src[2];
+ dst[2] = src[1];
+ src+=4;
+ dst+=3;
+ }
+ break;
+ case GF_PIXEL_RGB_24:
+ for (i=0;i<fb.width; i++) {
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ src+=3;
+ dst+=3;
+ }
+ break;
+ case GF_PIXEL_BGR_24:
+ for (i=0;i<fb.width; i++) {
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ src+=3;
+ dst+=3;
+ }
+ break;
+ case GF_PIXEL_RGB_565:
+ for (i=0;i<fb.width; i++) {
+ src_16 = * ( (u16 *)src );
+ dst[2] = colmask(src_16 >> 8/*(11 - 3)*/, 3);
+ dst[1] = colmask(src_16 >> 3/*(5 - 2)*/, 2);
+ dst[0] = colmask(src_16 << 3, 3);
+ src+=2;
+ dst+=3;
+ }
+ break;
+ case GF_PIXEL_RGB_555:
+ for (i=0;i<fb.width; i++) {
+ src_16 = * (u16 *)src;
+ dst[2] = colmask(src_16 >> 7/*(10 - 3)*/, 3);
+ dst[1] = colmask(src_16 >> 2/*(5 - 3)*/, 3);
+ dst[0] = colmask(src_16 << 3, 3);
+ src+=2;
+ dst +=3;
+ }
+ break;
+ }
+ }
+#ifndef GPAC_DISABLE_AVILIB
+ if (dump_type!=5 && dump_type!= 10) {
+ if (AVI_write_frame(avi_out, conv_buf, out_size, 1) <0)
+ printf("Error writing frame\n");
+ } else {
+ if (AVI_write_frame(avi_out, conv_buf, out_size, 1) <0)
+ printf("Error writing frame\n");
+ }
+#endif
+ break;
+ case 2:
+ write_bmp(&fb, rad_name, frameNum);
+ break;
+ case 6:
+ case 9:
+ write_texture_file(&fb, rad_name, frameNum, dump_type);
+ break;
+
+ case 3:
+ write_raw(&fb, rad_name, frameNum);
+ break;
+ }
+ /*unlock it*/
+ gf_sc_release_screen_buffer(term->compositor, &fb);
+}
+
+Bool dump_file(char *url, u32 dump_mode, Double fps, u32 width, u32 height, Float scale, u32 *times, u32 nb_times)
+{
+ GF_Err e;
+ u32 i = 0;
+ GF_VideoSurface fb;
+ char szPath[GF_MAX_PATH];
+ char *prev=NULL;
+
+ prev = strstr(url, "://");
+ if (prev) {
+ prev = strrchr(url, '/');
+ if (prev) prev++;
+ }
+
+ if (!prev) prev = url;
+ strcpy(szPath, prev);
+ prev = strrchr(szPath, '.');
+ if (prev) prev[0] = 0;
+
+ fprintf(stdout, "Opening URL %s\n", url);
+ /*connect in pause mode*/
+ gf_term_connect_from_time(term, url, 0, 1);
+
+ while (!term->compositor->scene
+ || term->compositor->msg_type
+ || (gf_term_get_option(term, GF_OPT_PLAY_STATE) == GF_STATE_STEP_PAUSE)
+ ) {
+ if (last_error) return 1;
+ gf_term_process_flush(term);
+ gf_sleep(10);
+ }
+
+ if (width && height) {
+ gf_term_set_size(term, width, height);
+ gf_term_process_flush(term);
+ }
+#ifndef GPAC_USE_TINYGL
+ printf("not tinygl\n");
+ e = gf_sc_get_screen_buffer(term->compositor, &fb, 0);
+#else
+ printf("tinygl\n");
+ e = gf_sc_get_screen_buffer(term->compositor, &fb, 1);
+#endif
+ if (e != GF_OK) {
+ fprintf(stdout, "Error grabbing screen buffer: %s\n", gf_error_to_string(e));
+ return 0;
+ }
+ width = fb.width;
+ height = fb.height;
+ gf_sc_release_screen_buffer(term->compositor, &fb);
+
+ if (scale != 1) {
+ width = (u32)(width * scale);
+ height = (u32)(height * scale);
+ gf_term_set_size(term, width, height);
+ gf_term_process_flush(term);
+ }
+
+ /*we work in RGB24, and we must make sure the pitch is %4*/
+ if ((width*3)%4) {
+ fprintf(stdout, "Adjusting width (%d) to have a stride multiple of 4\n", width);
+ while ((width*3)%4) width--;
+
+ gf_term_set_size(term, width, height);
+ gf_term_process_flush(term);
+
+ gf_sc_get_screen_buffer(term->compositor, &fb, 0);
+ width = fb.width;
+ height = fb.height;
+ gf_sc_release_screen_buffer(term->compositor, &fb);
+ }
+
+ if (dump_mode==1 || dump_mode==5 || dump_mode==8 || dump_mode==10) {
+#ifdef GPAC_DISABLE_AVILIB
+ fprintf(stdout, "AVILib is disabled in this build of GPAC\n");
+ return 0;
+#else
+ u32 time, prev_time, nb_frames, dump_dur;
+ char *conv_buf;
+ avi_t *avi_out = NULL;
+ avi_t *depth_avi_out = NULL;
+ char szPath_depth[GF_MAX_PATH];
+ char comp[5];
+ strcpy(szPath_depth, szPath);
+ strcat(szPath, ".avi");
+ avi_out = AVI_open_output_file(szPath);
+ if (!avi_out) {
+ fprintf(stdout, "Error creating AVI file %s\n", szPath);
+ return 1;
+ }
+ if (dump_mode==8) {
+ strcat(szPath_depth, "_depth.avi");
+ depth_avi_out = AVI_open_output_file(szPath_depth);
+ if (!depth_avi_out) {
+ fprintf(stdout, "Error creating AVI file %s\n", szPath);
+ return 1;
+ }
+ }
+
+ if (!fps) fps = 25.0;
+ time = prev_time = 0;
+ nb_frames = 0;
+
+ if (nb_times==2) {
+ prev_time = times[0];
+ dump_dur = times[1] - times[0];
+ } else {
+ dump_dur = times[0] ? times[0] : Duration;
+ }
+ if (!dump_dur) {
+ fprintf(stdout, "Warning: file has no duration, defaulting to 1 sec\n");
+ dump_dur = 1000;
+ }
+
+ comp[0] = comp[1] = comp[2] = comp[3] = comp[4] = 0;
+ AVI_set_video(avi_out, width, height, fps, comp);
+ if (dump_mode==8) AVI_set_video(depth_avi_out, width, height, fps, comp);
+ if (dump_mode != 5 && dump_mode!=10) conv_buf = gf_malloc(sizeof(char) * width * height * 3);
+ else conv_buf = gf_malloc(sizeof(char) * width * height * 4);
+ /*step to first frame*/
+ if (prev_time) gf_term_step_clocks(term, prev_time);
+
+ while (time < dump_dur) {
+ while ((gf_term_get_option(term, GF_OPT_PLAY_STATE) == GF_STATE_STEP_PAUSE)) {
+ gf_term_process_flush(term);
+ }
+ fprintf(stdout, "Dumping %02d/100\r", (u32) ((100.0*prev_time)/dump_dur) );
+
+ if (dump_mode==8) {
+ /*we'll dump both buffers at once*/
+ gf_mx_p(term->compositor->mx);
+ dump_depth(term, szPath_depth, dump_mode, i+1, conv_buf, depth_avi_out);
+ dump_frame(term, szPath, dump_mode, i+1, conv_buf, avi_out);
+ gf_mx_v(term->compositor->mx);
+
+ }
+ else dump_frame(term, szPath, dump_mode, i+1, conv_buf, avi_out);
+
+ nb_frames++;
+ time = (u32) (nb_frames*1000/fps);
+ gf_term_step_clocks(term, time - prev_time);
+ prev_time = time;
+ }
+ AVI_close(avi_out);
+ if (dump_mode==8) AVI_close(depth_avi_out);
+ gf_free(conv_buf);
+ fprintf(stdout, "AVI Extraction 100/100\n");
+#endif /*GPAC_DISABLE_AVILIB*/
+ } else {
+ if (times[0]) gf_term_step_clocks(term, times[0]);
+
+ for (i=0; i<nb_times; i++) {
+ while ((gf_term_get_option(term, GF_OPT_PLAY_STATE) == GF_STATE_STEP_PAUSE)) {
+ gf_term_process_flush(term);
+ }
+
+ if (dump_mode==4 || dump_mode==7) {
+ dump_depth(term, szPath, dump_mode, i+1, NULL, NULL);
+ } else {
+ dump_frame(term, url, dump_mode, i+1, NULL, NULL);
+ }
+
+ if (i+1<nb_times) gf_term_step_clocks(term, times[i+1] - times[i]);
+ }
+ }
+ return 0;
+}
+
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / command-line client
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include "libgpac_symbols.h"
+
+void (*gf_log_lt)(u32 ll, u32 lt);
+int (*AVI_close)(avi_t *AVI);
+GF_Err (*gf_term_del)(GF_Terminal *term);
+void (*gf_sleep)(u32 ms);
+GF_Err (*gf_sc_release_screen_buffer)(GF_Compositor *sr, GF_VideoSurface *framebuffer);
+char (*gf_prompt_get_char)();
+void (*gf_set_progress)(char *title, u32 done, u32 total);
+GF_Terminal *(*gf_term_new)(GF_User *user);
+GF_Err (*gf_term_process_step)(GF_Terminal *term);
+GF_Err (*gf_sc_get_screen_buffer)(GF_Compositor *sr, GF_VideoSurface *framebuffer, Bool depth_buffer);
+void (*gf_iphone_set_sdl_audio_module)(void* (*SDL_Module) (void));
+GF_Err (*gf_term_step_clocks)(GF_Terminal * term, u32 ms_diff);
+void (*gf_prompt_set_echo_off)(Bool echo_off);
+u32 (*gf_log_get_tools)();
+u32 (*gf_log_get_level)();
+GF_Err (*gf_cfg_set_key)(GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue);
+u32 (*gf_cfg_get_section_count)(GF_Config *cfgFile);
+GF_Err (*gf_term_get_service_info)(GF_Terminal *term, GF_ObjectManager *odm, NetInfoCommand *netcom);
+GF_Err (*gf_term_set_size)(GF_Terminal *term, u32 NewWidth, u32 NewHeight);
+Bool (*gf_sys_get_rti)(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags);
+void (*gf_log_set_tools)(u32 tools);
+u32 (*gf_term_play_from_time)(GF_Terminal *term, u64 from_time, u32 pause_at_first_frame);
+void *(*gf_malloc)(size_t size);
+void (*gf_log_set_level)(u32 level);
+void (*gf_iphone_set_sdl_video_module)(void* (*SDL_Module) (void));
+u32 (*gf_term_get_option)(GF_Terminal *term, u32 opt_type);
+Bool (*gf_term_user_event)(GF_Terminal *term, GF_Event *event);
+const char *(*gf_modules_get_file_name)(GF_ModuleManager *pm, u32 index);
+GF_Mutex *(*gf_mx_new)(const char *name);
+u32 (*gf_list_count)(GF_List *ptr);
+void (*gf_free)(void *ptr);
+const char *(*gf_term_get_world_info)(GF_Terminal *term, GF_ObjectManager *scene_od, GF_List *descriptions);
+const char *(*gf_cfg_get_section_name)(GF_Config *cfgFile, u32 secIndex);
+void (*gf_term_navigate_to)(GF_Terminal *term, const char *toURL);
+void (*gf_modules_del)(GF_ModuleManager *pm);
+GF_ModuleManager *(*gf_modules_new)(const char *directory, GF_Config *cfgFile);
+void (*gf_sys_init)(Bool enable_memory_tracker);
+void (*gf_log)(const char *fmt, ...);
+GF_Err (*gf_term_get_object_info)(GF_Terminal *term, GF_ObjectManager *odm, GF_MediaInfo *info);
+u32 (*gf_mx_p)(GF_Mutex *mx);
+u32 (*gf_mx_v)(GF_Mutex *mx);
+void (*gf_mx_del)(GF_Mutex *mx);
+GF_Err (*gf_term_process_flush)(GF_Terminal *term);
+const char *(*gf_cfg_get_key_name)(GF_Config *cfgFile, const char *secName, u32 keyIndex);
+int (*AVI_write_frame)(avi_t *AVI, char *data, long bytes, int keyframe);
+void (*gf_cfg_del)(GF_Config *iniFile);
+Bool (*gf_term_get_channel_net_info)(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_enum, u32 *chid, NetStatCommand *netcom, GF_Err *ret_code);
+void (*gf_term_process_shortcut)(GF_Terminal *term, GF_Event *ev);
+GF_Config *(*gf_cfg_new)(const char *filePath, const char *fileName);
+Bool (*gf_term_get_download_info)(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_enum, const char **server, const char **path, u32 *bytes_done, u32 *total_bytes, u32 *bytes_per_sec);
+u32 (*gf_sys_clock)();
+GF_ObjectManager *(*gf_term_get_object)(GF_Terminal *term, GF_ObjectManager *scene_od, u32 index);
+GF_Err (*gf_term_set_option)(GF_Terminal *term, u32 opt_type, u32 opt_value);
+void (*gf_sys_close)();
+void (*gf_term_connect_from_time)(GF_Terminal *term, const char *URL, u64 time_in_ms, Bool pause_at_first_frame);
+avi_t* (*AVI_open_output_file)(char * filename);
+const char *(*gf_cfg_get_key)(GF_Config *cfgFile, const char *secName, const char *keyName);
+void (*AVI_set_video)(avi_t *AVI, int width, int height, double fps, char *compressor);
+void (*gf_term_set_speed)(GF_Terminal *term, Fixed speed);
+u32 (*gf_cfg_get_key_count)(GF_Config *cfgFile, const char *secName);
+u32 (*gf_term_object_subscene_type)(GF_Terminal *term, GF_ObjectManager *odm);
+Double (*gf_term_get_framerate)(GF_Terminal *term, Bool absoluteFPS);
+const char *(*gf_error_to_string)(GF_Err e);
+GF_Err (*gf_stretch_bits)(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *dst_wnd, GF_Window *src_wnd, u8 alpha, Bool flip, GF_ColorKey *colorKey, GF_ColorMatrix * cmat);
+void (*gf_list_del)(GF_List *ptr);
+void *(*gf_list_get)(GF_List *ptr, u32 itemNumber);
+void (*gf_term_disconnect)(GF_Terminal *term);
+Bool (*gf_term_is_supported_url)(GF_Terminal *term, const char *fileName, Bool use_parent_url, Bool no_mime_check);
+GF_List *(*gf_list_new)(void);
+const char *(*gf_modules_get_option)(GF_BaseInterface *interface_obj, const char *secName, const char *keyName);
+GF_Err (*gf_term_dump_scene)(GF_Terminal *term, char *rad_name, char **filename, Bool xml_dump, Bool skip_proto, GF_ObjectManager *odm);
+Bool (*gf_prompt_has_input)();
+GF_Err (*gf_term_scene_update)(GF_Terminal *term, char *type, char *com);
+void (*gf_term_connect)(GF_Terminal *term, const char *URL);
+u32 (*gf_term_get_object_count)(GF_Terminal *term, GF_ObjectManager *scene_od);
+u32 (*gf_modules_get_count)(GF_ModuleManager *pm);
+GF_ObjectManager *(*gf_term_get_root_object)(GF_Terminal *term);
+u32 (*gf_term_get_time_in_ms)(GF_Terminal *term);
+void (*gf_term_connect_with_path)(GF_Terminal *term, const char *URL, const char *parent_URL);
+gf_log_cbk (*gf_log_set_callback)(void *usr_cbk, gf_log_cbk cbk);
+u32 (*gf_log_parse_tools)(const char *val);
+u32 (*gf_log_parse_level)(const char *val);
+void (*gf_term_switch_quality)(GF_Terminal *term, Bool up);
+GF_Err (*gf_term_release_screen_buffer)(GF_Terminal *term, GF_VideoSurface *framebuffer);
+GF_Err (*gf_term_get_screen_buffer)(GF_Terminal *term, GF_VideoSurface *framebuffer);
+FILE *(*gf_f64_open)(const char *file_name, const char *mode);
+GF_Err (*gf_img_png_enc)(char *data, u32 width, u32 height, s32 stride, u32 pixel_format, char *dst, u32 *dst_size);
+u32 (*utf8_to_ucs4)(u32 *ucs4_buf, u32 utf8_len, unsigned char *utf8_buf);
+
+#ifndef WIN32
+#include <pwd.h>
+#include <unistd.h>
+
+#else
+#include <windows.h> /*for GetModuleFileName*/
+#include <direct.h> /*for _mkdir*/
+#include <shlobj.h> /*for getting user-dir*/
+#ifndef SHGFP_TYPE_CURRENT
+#define SHGFP_TYPE_CURRENT 0 /*needed for MinGW*/
+#endif
+
+#ifdef _MSC_VER
+/*get rid of console*/
+#if 0
+#pragma comment(linker,"/SUBSYSTEM:WINDOWS")
+#pragma comment(linker,"/ENTRY:main")
+#else
+#pragma comment(linker,"/SUBSYSTEM:CONSOLE")
+#endif
+
+#endif // _MSC_VER
+
+#endif //WIN32
+
+
+/*local prototypes*/
+void PrintWorldInfo(GF_Terminal *term);
+void ViewOD(GF_Terminal *term, u32 OD_ID, u32 number);
+void PrintODList(GF_Terminal *term, GF_ObjectManager *root_odm, u32 num, u32 indent, char *root_name);
+
+void ViewODs(GF_Terminal *term, Bool show_timing);
+void PrintGPACConfig();
+
+static Bool restart = 0;
+#if defined(__DARWIN__) || defined(__APPLE__)
+static Bool not_threaded = 1;
+#else
+static Bool not_threaded = 0;
+#endif
+static Bool no_audio = 0;
+static Bool no_regulation = 0;
+static Bool bench_mode = 0;
+Bool is_connected = 0;
+Bool startup_file = 0;
+GF_User user;
+GF_Terminal *term;
+u64 Duration;
+GF_Err last_error = GF_OK;
+
+static Fixed bench_speed = FLT2FIX(20);
+
+static Bool request_next_playlist_item = 0;
+
+static GF_Config *cfg_file;
+static Bool display_rti = 0;
+static Bool Run;
+static Bool CanSeek = 0;
+static u32 Volume=100;
+static char the_url[GF_MAX_PATH];
+static char pl_path[GF_MAX_PATH];
+static Bool no_mime_check = 1;
+static Bool be_quiet = 0;
+static u32 log_time_start = 0;
+
+static u32 forced_width=0;
+static u32 forced_height=0;
+
+/*windowless options*/
+u32 align_mode = 0;
+u32 init_w = 0;
+u32 init_h = 0;
+u32 last_x, last_y;
+Bool right_down = 0;
+
+void dump_frame(GF_Terminal *term, char *rad_path, u32 dump_type, u32 frameNum);
+Bool dump_file(char *the_url, u32 dump_mode, Double fps, u32 width, u32 height, Float scale, u32 *times, u32 nb_times);
+
+void PrintUsage()
+{
+ fprintf(stdout, "Usage Osmo4iOS [options] [filename]\n"
+ "\t-c fileName: user-defined configuration file\n"
+ "\t-rti fileName: logs run-time info (FPS, CPU, Mem usage) to file\n"
+ "\t-rtix fileName: same as -rti but driven by GPAC logs\n"
+ "\t-quiet: removes script message, buffering and downloading status\n"
+ "\t-opt option: Overrides an option in the configuration file. String format is section:key=value\n"
+ "\t-log-file file: sets output log file.\n"
+ "\t-log-level lev: sets log level. Possible values are:\n"
+ "\t \"error\" : logs only error messages\n"
+ "\t \"warning\" : logs error+warning messages\n"
+ "\t \"info\" : logs error+warning+info messages\n"
+ "\t \"debug\" : logs all messages\n"
+ "\n"
+ "\t-log-tools lt: sets tool(s) to log. List of \':\'-separated values:\n"
+ "\t \"core\" : libgpac core\n"
+ "\t \"coding\" : bitstream formats (audio, video, scene)\n"
+ "\t \"container\" : container formats (ISO File, MPEG-2 TS, AVI, ...)\n"
+ "\t \"network\" : network data exept RTP trafic\n"
+ "\t \"rtp\" : rtp trafic\n"
+ "\t \"author\" : authoring tools (hint, import, export)\n"
+ "\t \"sync\" : terminal sync layer\n"
+ "\t \"codec\" : terminal codec messages\n"
+ "\t \"parser\" : scene parsers (svg, xmt, bt) and other\n"
+ "\t \"media\" : terminal media object management\n"
+ "\t \"scene\" : scene graph and scene manager\n"
+ "\t \"script\" : scripting engine messages\n"
+ "\t \"interact\" : interaction engine (events, scripts, etc)\n"
+ "\t \"compose\" : composition engine (2D, 3D, etc)\n"
+ "\t \"service\" : network service management\n"
+ "\t \"mmio\" : Audio/Video HW I/O management\n"
+ "\t \"none\" : no tool logged\n"
+ "\t \"all\" : all tools logged\n"
+ "\n"
+ "\t-size WxH: specifies visual size (default: scene size)\n"
+ "\t-scale s: scales the visual size (default: 1)\n"
+#if defined(__DARWIN__) || defined(__APPLE__)
+ "\t-thread: enables thread usage for terminal and compositor \n"
+#else
+ "\t-no-thread: disables thread usage (except for audio)\n"
+#endif
+ "\t-no-audio: disables audio \n"
+ "\t-no-wnd: uses windowless mode (Win32 only)\n"
+ "\t-align vh: specifies v and h alignment for windowless mode\n"
+ " possible v values: t(op), m(iddle), b(ottom)\n"
+ " possible h values: l(eft), m(iddle), r(ight)\n"
+ " default alignment is top-left\n"
+ " default alignment is top-left\n"
+ "\t-pause: pauses at first frame\n"
+ "\n"
+ "Dumper Options:\n"
+ "\t-bmp [times]: dumps given frames to bmp\n"
+ "\t-raw [times]: dumps given frames to bmp\n"
+ "\t-avi [times]: dumps given file to raw avi\n"
+ "\t-rgbds: dumps the RGBDS pixel format texture\n"
+ " with -avi [times]: dumps an rgbds-format .avi\n"
+ "\t-rgbd: dumps the RGBD pixel format texture\n"
+ " with -avi [times]: dumps an rgbd-format .avi\n"
+ "\t-depth: dumps depthmap (z-buffer) frames\n"
+ " with -avi [times]: dumps depthmap in grayscale .avi\n"
+ " with -bmp: dumps depthmap in grayscale .bmp\n"
+ "\t-fps FPS: specifies frame rate for AVI dumping (default: 25.0)\n"
+ "\t-2d: uses 2D compositor\n"
+ "\t-3d: uses 3D compositor\n"
+ "\t-fill: uses fill aspect ratio for dumping (default: none)\n"
+ "\t-show: show window while dumping (default: no)\n"
+ "MP4Client - GPAC command line player and dumper - version %s\n"
+ "GPAC Written by Jean Le Feuvre (c) 2001-2005 - ENST (c) 2005-200X\n",
+
+ GPAC_FULL_VERSION
+ );
+}
+
+void PrintHelp()
+{
+ fprintf(stdout, "MP4Client command keys:\n"
+ "\to: connect to the specified URL\n"
+ "\tO: connect to the specified URL in playlist mode\n"
+ "\tN: switch to the next URL in the playlist (works with return key as well)\n"
+ "\tr: restart current presentation\n"
+ "\tp: play/pause the presentation\n"
+ "\ts: step one frame ahead\n"
+ "\tz: seek into presentation\n"
+ "\tt: print current timing\n"
+ "\n"
+ "\tw: view world info\n"
+ "\tv: view Object Descriptor list\n"
+ "\ti: view Object Descriptor info (by ID)\n"
+ "\tj: view Object Descriptor info (by number)\n"
+ "\tb: view media objects timing and buffering info\n"
+ "\tm: view media objects buffering and memory info\n"
+ "\td: dumps scene graph\n"
+ "\n"
+ "\tC: Enable Streaming Cache\n"
+ "\tS: Stops Streaming Cache and save to file\n"
+ "\tA: Aborts Streaming Cache\n"
+ "\n"
+ "\tk: turns stress mode on/off\n"
+ "\tn: changes navigation mode\n"
+ "\tx: reset to last active viewpoint\n"
+ "\n"
+ "\t2: restart using 2D compositor\n"
+ "\t3: restart using 3D compositor\n"
+ "\n"
+ "\t4: forces 4/3 Aspect Ratio\n"
+ "\t5: forces 16/9 Aspect Ratio\n"
+ "\t6: forces no Aspect Ratio (always fill screen)\n"
+ "\t7: forces original Aspect Ratio (default)\n"
+ "\n"
+ "\tL: changes to new log level. CF MP4Client usage for possible values\n"
+ "\tT: select new tools to log. CF MP4Client usage for possible values\n"
+ "\n"
+ "\tl: list available modules\n"
+ "\tc: prints some GPAC configuration info\n"
+ "\tR: toggles run-time info display on/off\n"
+ "\tq: exit the application\n"
+ "\th: print this message\n"
+ "\n"
+ "MP4Client - GPAC command line player - version %s\n"
+ "GPAC Written by Jean Le Feuvre (c) 2001-2005 - ENST (c) 2005-200X\n",
+
+ GPAC_FULL_VERSION
+ );
+}
+
+GF_Config *create_default_config(char *file_path, char *file_name)
+{
+ GF_Config *cfg;
+ char szPath[GF_MAX_PATH];
+
+#ifdef WIN32
+ FILE *f;
+ Bool write_access = 0;
+
+ /*following code is highly inspired by Osmo4*/
+ /*do we have the write privileges on this dir ? if not, use user local data directory*/
+ strcpy(szPath, file_path);
+ strcat(szPath, "GPAC.cfg");
+ f = gf_f64_open(szPath, "wb");
+ if (f != NULL) {
+ fclose(f);
+ write_access = 1;
+ } else {
+ write_access = 0;
+ }
+ strcpy(szPath, file_path);
+
+ /*get GPAC.cfg path*/
+ if (!write_access) {
+ char szPath2[GF_MAX_PATH];
+ SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, file_path);
+ if (file_path[strlen((char *) file_path)-1] != '\\') strcat(file_path, "\\");
+ strcat(file_path, "GPAC\\");
+ /*create GPAC dir*/
+ _mkdir(file_path);
+ strcpy(szPath2, file_path);
+ strcat(szPath2, "GPAC.cfg");
+ f = gf_f64_open(szPath2, "wb");
+ assert(f);
+ if (!f) return NULL;
+ fclose(f);
+ }
+#else
+ FILE *f;
+ sprintf(szPath, "%s%c%s", file_path, GF_PATH_SEPARATOR, file_name);
+ f = gf_f64_open(szPath, "wt");
+ fprintf(stdout, "create %s: %s\n", szPath, (f==NULL) ? "Error" : "OK");
+ if (!f) return NULL;
+ fclose(f);
+#endif
+
+ cfg = gf_cfg_new(file_path, file_name);
+ if (!cfg) return NULL;
+
+#ifdef GPAC_MODULES_PATH
+ fprintf(stdout, "Using module directory %s \n", GPAC_MODULES_PATH);
+ strcpy(szPath, GPAC_MODULES_PATH);
+#elif defined(WIN32)
+ //szPath still contains the executable directory
+#else
+#if 0
+ fprintf(stdout, "Please enter full path to GPAC modules directory:\n");
+ scanf("%s", szPath);
+#endif
+ strcpy(szPath, "/Applications/osmo4ios.app/");
+#endif
+ gf_cfg_set_key(cfg, "General", "ModulesDirectory", szPath);
+ gf_cfg_set_key(cfg, "Audio", "ForceConfig", "yes");
+ gf_cfg_set_key(cfg, "Audio", "NumBuffers", "2");
+ gf_cfg_set_key(cfg, "Audio", "TotalDuration", "120");
+ gf_cfg_set_key(cfg, "Audio", "DisableNotification", "no");
+ gf_cfg_set_key(cfg, "FontEngine", "FontReader", "ft_font");
+
+#ifdef WIN32
+ GetWindowsDirectory((char*)szPath, MAX_PATH);
+ if (szPath[strlen((char*)szPath)-1] != '\\') strcat((char*)szPath, "\\");
+ strcat((char *)szPath, "Fonts");
+#elif defined(__DARWIN__) || defined(__APPLE__)
+ fprintf(stdout, "Please enter full path to a TrueType font directory (.ttf, .ttc) - enter to default:\n");
+ //scanf("%s", szPath);
+#else
+ strcpy(szPath, "/usr/share/fonts/truetype/");
+#endif
+ strcpy(szPath, "/System/Library/Fonts/Cache"), /*iOS*/
+ fprintf(stdout, "Using default font directory %s\n", szPath);
+ gf_cfg_set_key(cfg, "FontEngine", "FontDirectory", szPath);
+
+#ifdef WIN32
+/* fprintf(stdout, "Please enter full path to a cache directory for HTTP downloads:\n");
+ scanf("%s", szPath);
+*/
+ GetWindowsDirectory((char*)szPath, MAX_PATH);
+ if (szPath[strlen((char*)szPath)-1] != '\\') strcat((char*)szPath, "\\");
+ strcat((char *)szPath, "Temp");
+
+ gf_cfg_set_key(cfg, "General", "CacheDirectory", szPath);
+ fprintf(stdout, "Using default cache directory %s\n", szPath);
+#else
+ fprintf(stdout, "Using /tmp as a cache directory for HTTP downloads:\n");
+ gf_cfg_set_key(cfg, "General", "CacheDirectory", "/tmp");
+#endif
+
+ gf_cfg_set_key(cfg, "Downloader", "CleanCache", "yes");
+ gf_cfg_set_key(cfg, "Compositor", "AntiAlias", "All");
+ gf_cfg_set_key(cfg, "Compositor", "FrameRate", "30");
+ /*use power-of-2 emulation*/
+ gf_cfg_set_key(cfg, "Compositor", "EmulatePOW2", "yes");
+#ifdef WIN32
+ gf_cfg_set_key(cfg, "Compositor", "ScalableZoom", "yes");
+ gf_cfg_set_key(cfg, "Video", "DriverName", "DirectX Video Output");
+#elif defined(__DARWIN__)
+ gf_cfg_set_key(cfg, "Video", "DriverName", "SDL Video Output");
+ /*SDL not so fast with scalable zoom*/
+ gf_cfg_set_key(cfg, "Compositor", "ScalableZoom", "no");
+#else
+ gf_cfg_set_key(cfg, "Video", "DriverName", "X11 Video Output");
+ /*x11 only supports scalable zoom*/
+ gf_cfg_set_key(cfg, "Compositor", "ScalableZoom", "yes");
+ gf_cfg_set_key(cfg, "Audio", "DriverName", "SDL Audio Output");
+#endif
+
+ gf_cfg_set_key(cfg, "Video", "SwitchResolution", "no");
+ gf_cfg_set_key(cfg, "Network", "AutoReconfigUDP", "yes");
+ gf_cfg_set_key(cfg, "Network", "UDPTimeout", "10000");
+ gf_cfg_set_key(cfg, "Network", "BufferLength", "3000");
+
+ /*store and reload*/
+ gf_cfg_del(cfg);
+ return gf_cfg_new(file_path, file_name);
+}
+
+static void PrintTime(u64 time)
+{
+ u32 ms, h, m, s;
+ h = (u32) (time / 1000 / 3600);
+ m = (u32) (time / 1000 / 60 - h*60);
+ s = (u32) (time / 1000 - h*3600 - m*60);
+ ms = (u32) (time - (h*3600 + m*60 + s) * 1000);
+ fprintf(stdout, "%02d:%02d:%02d.%02d", h, m, s, ms);
+}
+
+
+static u32 rti_update_time_ms = 200;
+static FILE *rti_logs = NULL;
+static u64 memory_at_gpac_startup = 0;
+
+static void UpdateRTInfo(const char *legend)
+{
+ GF_SystemRTInfo rti;
+
+ /*refresh every second*/
+ if (!display_rti && !rti_logs) return;
+ if (!gf_sys_get_rti(rti_update_time_ms, &rti, 0) && !legend)
+ return;
+
+ if (display_rti) {
+ if (!rti.process_memory) rti.process_memory = (u32) (memory_at_gpac_startup-rti.physical_memory_avail);
+ if (!rti.gpac_memory) rti.gpac_memory = (u32) (memory_at_gpac_startup-rti.physical_memory_avail);
+
+ if (display_rti==2) {
+ fprintf(stdout, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB\r",
+ gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) );
+ } else {
+ char szMsg[1024];
+ GF_Event evt;
+
+ sprintf(szMsg, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB",
+ gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) );
+ evt.type = GF_EVENT_SET_CAPTION;
+ evt.caption.caption = szMsg;
+ gf_term_user_event(term, &evt);
+ }
+ }
+ if (rti_logs) {
+ fprintf(rti_logs, "% 8d\t% 8d\t% 8d\t% 4d\t% 8d\t%s",
+ gf_sys_clock(),
+ gf_term_get_time_in_ms(term),
+ rti.total_cpu_usage,
+ (u32) gf_term_get_framerate(term, 0),
+ (u32) (rti.gpac_memory / 1024),
+ legend ? legend : ""
+ );
+ if (!legend) fprintf(rti_logs, "\n");
+ }
+}
+
+static void ResetCaption()
+{
+ GF_Event event;
+ if (display_rti) return;
+ event.type = GF_EVENT_SET_CAPTION;
+ if (is_connected) {
+ char szName[1024];
+ NetInfoCommand com;
+
+ event.caption.caption = NULL;
+ /*get any service info*/
+ if (!startup_file && gf_term_get_service_info(term, gf_term_get_root_object(term), &com) == GF_OK) {
+ strcpy(szName, "");
+ if (com.track_info) {
+ char szBuf[10];
+ sprintf(szBuf, "%02d ", (u32) (com.track_info>>16) );
+ strcat(szName, szBuf);
+ }
+ if (com.artist) { strcat(szName, com.artist); strcat(szName, " "); }
+ if (com.name) { strcat(szName, com.name); strcat(szName, " "); }
+ if (com.album) { strcat(szName, "("); strcat(szName, com.album); strcat(szName, ")"); }
+
+ if (strlen(szName)) event.caption.caption = szName;
+ }
+ if (!event.caption.caption) {
+ char *str = strrchr(the_url, '\\');
+ if (!str) str = strrchr(the_url, '/');
+ event.caption.caption = str ? str+1 : the_url;
+ }
+ } else {
+ event.caption.caption = "GPAC MP4Client " GPAC_FULL_VERSION;
+ }
+ gf_term_user_event(term, &event);
+}
+
+#ifdef WIN32
+u32 get_sys_col(int idx)
+{
+ u32 res;
+ DWORD val = GetSysColor(idx);
+ res = (val)&0xFF; res<<=8;
+ res |= (val>>8)&0xFF; res<<=8;
+ res |= (val>>16)&0xFF;
+ return res;
+}
+#endif
+
+void switch_bench()
+{
+ if (is_connected) {
+ bench_mode = !bench_mode;
+ display_rti = !display_rti;
+ ResetCaption();
+ gf_term_set_speed(term, bench_mode ? bench_speed : FIX_ONE);
+ }
+}
+
+Bool GPAC_EventProc(void *ptr, GF_Event *evt)
+{
+ if (!term) return 0;
+
+ switch (evt->type) {
+ case GF_EVENT_DURATION:
+ Duration = 1000;
+ Duration = (u64) (((s64) Duration) * evt->duration.duration);
+ CanSeek = evt->duration.can_seek;
+ break;
+ case GF_EVENT_MESSAGE:
+ {
+ const char *servName;
+ if (!evt->message.service || !strcmp(evt->message.service, the_url)) {
+ servName = "main service";
+ } else if (!strnicmp(evt->message.service, "data:", 5)) {
+ servName = "";
+ } else {
+ servName = evt->message.service;
+ }
+ if (!evt->message.message) return 0;
+ if (evt->message.error==GF_SCRIPT_INFO) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_SCRIPT, ("[Script] %s\n", evt->message.message));
+ fprintf(stderr, "%s\n", evt->message.message);
+ } else if (evt->message.error) {
+ if (!is_connected) last_error = evt->message.error;
+ fprintf(stderr, "%s (%s): %s\n", evt->message.message, servName, gf_error_to_string(evt->message.error));
+ } else if (!be_quiet)
+ fprintf(stderr, "(%s) %s\r", servName, evt->message.message);
+ }
+ break;
+ case GF_EVENT_PROGRESS:
+ {
+ char *szTitle = "";
+ if (evt->progress.progress_type==0) szTitle = "Buffer ";
+ else if (evt->progress.progress_type==1) szTitle = "Download ";
+ else if (evt->progress.progress_type==2) szTitle = "Import ";
+ gf_set_progress(szTitle, evt->progress.done, evt->progress.total);
+ }
+ break;
+
+
+ case GF_EVENT_DBLCLICK:
+ gf_term_set_option(term, GF_OPT_FULLSCREEN, !gf_term_get_option(term, GF_OPT_FULLSCREEN));
+ return 0;
+
+ case GF_EVENT_MOUSEDOWN:
+ if (evt->mouse.button==GF_MOUSE_RIGHT) {
+ right_down = 1;
+ last_x = evt->mouse.x;
+ last_y = evt->mouse.y;
+ }
+ return 0;
+ case GF_EVENT_MOUSEUP:
+ if (evt->mouse.button==GF_MOUSE_RIGHT) {
+ right_down = 0;
+ last_x = evt->mouse.x;
+ last_y = evt->mouse.y;
+ }
+ return 0;
+ case GF_EVENT_MOUSEMOVE:
+ if (right_down && (user.init_flags & GF_TERM_WINDOWLESS) ) {
+ GF_Event move;
+ move.move.x = evt->mouse.x - last_x;
+ move.move.y = last_y-evt->mouse.y;
+ move.type = GF_EVENT_MOVE;
+ move.move.relative = 1;
+ gf_term_user_event(term, &move);
+ }
+ return 0;
+
+ case GF_EVENT_KEYUP:
+ switch (evt->key.key_code) {
+ case GF_KEY_SPACE:
+ if (evt->key.flags & GF_KEY_MOD_CTRL) switch_bench();
+ break;
+ }
+ break;
+ case GF_EVENT_KEYDOWN:
+ gf_term_process_shortcut(term, evt);
+ switch (evt->key.key_code) {
+ case GF_KEY_SPACE:
+ if (evt->key.flags & GF_KEY_MOD_CTRL) {
+ /*ignore key repeat*/
+ if (!bench_mode) switch_bench();
+ }
+ break;
+ case GF_KEY_PAGEDOWN:
+ case GF_KEY_MEDIANEXTTRACK:
+ request_next_playlist_item = 1;
+ break;
+ case GF_KEY_MEDIAPREVIOUSTRACK:
+ break;
+ case GF_KEY_ESCAPE:
+ gf_term_set_option(term, GF_OPT_FULLSCREEN, !gf_term_get_option(term, GF_OPT_FULLSCREEN));
+ break;
+ case GF_KEY_F:
+ if (evt->key.flags & GF_KEY_MOD_CTRL) fprintf(stderr, "Rendering rate: %f FPS\n", gf_term_get_framerate(term, 0));
+ break;
+ case GF_KEY_T:
+ if (evt->key.flags & GF_KEY_MOD_CTRL) fprintf(stderr, "Scene Time: %f \n", gf_term_get_time_in_ms(term)/1000.0);
+ break;
+ case GF_KEY_D:
+ if (evt->key.flags & GF_KEY_MOD_CTRL) gf_term_set_option(term, GF_OPT_DRAW_MODE, (gf_term_get_option(term, GF_OPT_DRAW_MODE)==GF_DRAW_MODE_DEFER) ? GF_DRAW_MODE_IMMEDIATE : GF_DRAW_MODE_DEFER );
+ break;
+ case GF_KEY_4:
+ if (evt->key.flags & GF_KEY_MOD_CTRL)
+ gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3);
+ break;
+ case GF_KEY_5:
+ if (evt->key.flags & GF_KEY_MOD_CTRL)
+ gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9);
+ break;
+ case GF_KEY_6:
+ if (evt->key.flags & GF_KEY_MOD_CTRL)
+ gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);
+ break;
+ case GF_KEY_7:
+ if (evt->key.flags & GF_KEY_MOD_CTRL)
+ gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP);
+ break;
+ case GF_KEY_P:
+ if (evt->key.flags & GF_KEY_MOD_CTRL && is_connected) {
+ Bool is_pause = gf_term_get_option(term, GF_OPT_PLAY_STATE);
+ fprintf(stderr, "[Status: %s]\n", is_pause ? "Playing" : "Paused");
+ gf_term_set_option(term, GF_OPT_PLAY_STATE, (gf_term_get_option(term, GF_OPT_PLAY_STATE)==GF_STATE_PAUSED) ? GF_STATE_PLAYING : GF_STATE_PAUSED);
+ }
+ break;
+ case GF_KEY_S:
+ if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected) {
+ gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE);
+ fprintf(stderr, "Step time: ");
+ PrintTime(gf_term_get_time_in_ms(term));
+ fprintf(stderr, "\n");
+ }
+ break;
+ case GF_KEY_B:
+ if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected)
+ ViewODs(term, 1);
+ break;
+ case GF_KEY_M:
+ if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected)
+ ViewODs(term, 0);
+ break;
+ case GF_KEY_H:
+ if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected)
+ gf_term_switch_quality(term, 1);
+ break;
+ case GF_KEY_L:
+ if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected)
+ gf_term_switch_quality(term, 0);
+ break;
+ }
+ break;
+
+ case GF_EVENT_CONNECT:
+ if (evt->connect.is_connected) {
+ is_connected = 1;
+ fprintf(stderr, "Service Connected\n");
+ } else if (is_connected) {
+ fprintf(stderr, "Service %s\n", is_connected ? "Disconnected" : "Connection Failed");
+ is_connected = 0;
+ Duration = 0;
+ }
+ if (init_w && init_h) {
+ gf_term_set_size(term, init_w, init_h);
+ }
+ ResetCaption();
+ break;
+ case GF_EVENT_EOS:
+ restart = 1;
+ break;
+ case GF_EVENT_SIZE:
+ if (user.init_flags & GF_TERM_WINDOWLESS) {
+ GF_Event move;
+ move.type = GF_EVENT_MOVE;
+ move.move.align_x = align_mode & 0xFF;
+ move.move.align_y = (align_mode>>8) & 0xFF;
+ move.move.relative = 2;
+ gf_term_user_event(term, &move);
+ }
+ break;
+ case GF_EVENT_SCENE_SIZE:
+ if (forced_width && forced_height) {
+ GF_Event size;
+ size.type = GF_EVENT_SIZE;
+ size.size.width = forced_width;
+ size.size.height = forced_height;
+ gf_term_user_event(term, &size);
+ }
+ break;
+
+ case GF_EVENT_METADATA:
+ ResetCaption();
+ break;
+
+ case GF_EVENT_QUIT:
+ Run = 0;
+ break;
+ case GF_EVENT_DISCONNECT:
+ gf_term_disconnect(term);
+ break;
+ case GF_EVENT_MIGRATE:
+ {
+ }
+ break;
+ case GF_EVENT_NAVIGATE_INFO:
+ if (evt->navigate.to_url) fprintf(stderr, "Go to URL: \"%s\"\r", evt->navigate.to_url);
+ break;
+ case GF_EVENT_NAVIGATE:
+ if (gf_term_is_supported_url(term, evt->navigate.to_url, 1, no_mime_check)) {
+ strcpy(the_url, evt->navigate.to_url);
+ fprintf(stderr, "Navigating to URL %s\n", the_url);
+ gf_term_navigate_to(term, evt->navigate.to_url);
+ return 1;
+ } else {
+ fprintf(stderr, "Navigation destination not supported\nGo to URL: %s\n", evt->navigate.to_url);
+ }
+ break;
+ case GF_EVENT_SET_CAPTION:
+ gf_term_user_event(term, evt);
+ break;
+ case GF_EVENT_AUTHORIZATION:
+ if (!strlen(evt->auth.user)) {
+ fprintf(stderr, "Authorization required for site %s\n", evt->auth.site_url);
+ fprintf(stderr, "login: ");
+ scanf("%s", evt->auth.user);
+ } else {
+ fprintf(stderr, "Authorization required for %s@%s\n", evt->auth.user, evt->auth.site_url);
+ }
+ fprintf(stderr, "password: ");
+ gf_prompt_set_echo_off(1);
+ scanf("%s", evt->auth.password);
+ gf_prompt_set_echo_off(0);
+ return 1;
+ case GF_EVENT_SYS_COLORS:
+#ifdef WIN32
+ evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
+ evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION);
+ evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE);
+ evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND);
+ evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE);
+ evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT);
+ evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW);
+ evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT);
+ evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT);
+ evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT);
+ evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT);
+ evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT);
+ evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER);
+ evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION);
+ evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT);
+ evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK);
+ evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT);
+ evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU);
+ evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT);
+ evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR);
+ evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW);
+ evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE);
+ evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT);
+ evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT);
+ evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW);
+ evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW);
+ evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME);
+ evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT);
+ return 1;
+#else
+ memset(evt->sys_cols.sys_colors, 0, sizeof(u32)*28);
+ return 1;
+#endif
+ break;
+ }
+ return 0;
+}
+
+GF_Config *loadconfigfile(char *filepath)
+{
+ GF_Config *cfg = NULL;
+ char *cfg_dir;
+ char szPath[GF_MAX_PATH];
+
+ if (filepath) {
+ strcpy(szPath, filepath);
+ cfg_dir = strrchr(szPath, '\\');
+ if (!cfg_dir) cfg_dir = strrchr(szPath, '/');
+ if (cfg_dir) {
+ char c = cfg_dir[0];
+ cfg_dir[0] = 0;
+ cfg = gf_cfg_new(cfg_dir, cfg_dir+1);
+ cfg_dir[0] = c;
+ if (cfg) goto success;
+ } else {
+ cfg = gf_cfg_new(".", filepath);
+ if (cfg) goto success;
+ }
+ }
+
+#ifdef WIN32
+ GetModuleFileNameA(NULL, szPath, GF_MAX_PATH);
+ cfg_dir = strrchr(szPath, '\\');
+ if (cfg_dir) cfg_dir[1] = 0;
+
+ cfg = gf_cfg_new(szPath, "GPAC.cfg");
+ if (cfg) goto success;
+ strcpy(szPath, ".");
+ cfg = gf_cfg_new(szPath, "GPAC.cfg");
+ if (cfg) goto success;
+ strcpy(szPath, ".");
+ cfg = gf_cfg_new(szPath, "GPAC.cfg");
+ if (cfg) goto success;
+
+ GetModuleFileNameA(NULL, szPath, GF_MAX_PATH);
+ cfg_dir = strrchr(szPath, '\\');
+ if (cfg_dir) cfg_dir[1] = 0;
+ cfg = create_default_config(szPath, "GPAC.cfg");
+#else
+ /*linux*/
+ cfg_dir = getenv("HOME");
+ fprintf(stderr, "WARNING: HOME env var not set - using current directory for config file\n");
+ strcpy(szPath, "/Applications/Documents");
+ cfg = gf_cfg_new(szPath, ".gpacrc");
+ if (cfg) goto success;
+ fprintf(stderr, "GPAC config file not found in %s - creating new file\n", szPath);
+ cfg = create_default_config(szPath, ".gpacrc");
+#endif
+ if (!cfg) {
+ fprintf(stderr, "cannot create config file in %s directory\n", szPath);
+ return NULL;
+ }
+ success:
+ fprintf(stderr, "Using config file in %s directory\n", szPath);
+ return cfg;
+}
+
+void list_modules(GF_ModuleManager *modules)
+{
+ u32 i;
+ fprintf(stderr, "\rAvailable modules:\n");
+ for (i=0; i<gf_modules_get_count(modules); i++) {
+ char *str = (char *) gf_modules_get_file_name(modules, i);
+ if (str) fprintf(stderr, "\t%s\n", str);
+ }
+ fprintf(stderr, "\n");
+}
+
+void set_navigation()
+{
+ GF_Err e;
+ char navstr[20], nav;
+ u32 type = gf_term_get_option(term, GF_OPT_NAVIGATION_TYPE);
+ e = GF_OK;
+ if (!type) {
+ fprintf(stdout, "Content/compositor doesn't allow user-selectable navigation\n");
+ } else if (type==1) {
+ fprintf(stdout, "Select Navigation (\'N\'one, \'E\'xamine, \'S\'lide): ");
+ scanf("%s", navstr);
+ nav = navstr[0];
+ if (nav=='N') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
+ else if (nav=='E') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE);
+ else if (nav=='S') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
+ else fprintf(stdout, "Unknown selector \'%c\' - only \'N\',\'E\',\'S\' allowed\n", nav);
+ } else if (type==2) {
+ fprintf(stdout, "Select Navigation (\'N\'one, \'W\'alk, \'F\'ly, \'E\'xamine, \'P\'an, \'S\'lide, \'G\'ame, \'V\'R, \'O\'rbit): ");
+ scanf("%s", navstr);
+ nav = navstr[0];
+ if (nav=='N') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
+ else if (nav=='W') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_WALK);
+ else if (nav=='F') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_FLY);
+ else if (nav=='E') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE);
+ else if (nav=='P') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_PAN);
+ else if (nav=='S') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
+ else if (nav=='G') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_GAME);
+ else if (nav=='O') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_ORBIT);
+ else if (nav=='V') e = gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_VR);
+ else fprintf(stdout, "Unknown selector %c - only \'N\',\'W\',\'F\',\'E\',\'P\',\'S\',\'G\', \'V\', \'O\' allowed\n", nav);
+ }
+ if (e) fprintf(stdout, "Error setting mode: %s\n", gf_error_to_string(e));
+}
+
+
+static Bool get_time_list(char *arg, u32 *times, u32 *nb_times)
+{
+ char *str;
+ Float var;
+ Double sec;
+ u32 h, m, s, ms, f, fps;
+ if (!arg || (arg[0]=='-') || !isdigit(arg[0])) return 0;
+
+ /*SMPTE time code*/
+ if (strchr(arg, ':') && strchr(arg, ';') && strchr(arg, '/')) {
+ if (sscanf(arg, "%02d:%02d:%02d;%02d/%02d", &h, &m, &s, &f, &fps)==5) {
+ sec = 0;
+ if (fps) sec = ((Double)f) / fps;
+ sec += 3600*h + 60*m + s;
+ times[*nb_times] = (u32) (1000*sec);
+ (*nb_times) ++;
+ return 1;
+ }
+ }
+ while (arg) {
+ str = strchr(arg, '-');
+ if (str) str[0] = 0;
+ /*HH:MM:SS:MS time code*/
+ if (strchr(arg, ':') && (sscanf(arg, "%02d:%02d:%02d:%02d", &h, &m, &s, &ms)==4)) {
+ sec = ms;
+ sec /= 1000;
+ sec += 3600*h + 60*m + s;
+ times[*nb_times] = (u32) (1000*sec);
+ (*nb_times) ++;
+ } else if (sscanf(arg, "%f", &var)==1) {
+ sec = atof(arg);
+ times[*nb_times] = (u32) (1000*sec);
+ (*nb_times) ++;
+ }
+ if (!str) break;
+ str[0] = '-';
+ arg = str+1;
+ }
+ return 1;
+}
+
+static void on_gpac_log(void *cbk, u32 ll, u32 lm, const char *fmt, va_list list)
+{
+ FILE *logs = cbk;
+
+ if (rti_logs && (lm & GF_LOG_RTI)) {
+ char szMsg[2048];
+ vsprintf(szMsg, fmt, list);
+ UpdateRTInfo(szMsg + 6 /*"[RTI] "*/);
+ } else {
+ if (log_time_start) fprintf(logs, "[At %d]", gf_sys_clock() - log_time_start);
+ vfprintf(logs, fmt, list);
+ fflush(logs);
+ }
+}
+
+static void init_rti_logs(char *rti_file, char *url, Bool use_rtix)
+{
+ if (rti_logs) fclose(rti_logs);
+ rti_logs = gf_f64_open(rti_file, "wt");
+ if (rti_logs) {
+ fprintf(rti_logs, "!! GPAC RunTime Info ");
+ if (url) fprintf(rti_logs, "for file %s", url);
+ fprintf(rti_logs, " !!\n");
+ fprintf(rti_logs, "SysTime(ms)\tSceneTime(ms)\tCPU\tFPS\tMemory(kB)\tObservation\n");
+
+ /*turn on RTI loging*/
+ if (use_rtix) {
+ gf_log_set_callback(NULL, on_gpac_log);
+ gf_log_set_level(GF_LOG_DEBUG);
+ gf_log_set_tools(GF_LOG_RTI);
+
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_RTI, ("[RTI] System state when enabling log\n"));
+ } else if (log_time_start) {
+ log_time_start = gf_sys_clock();
+ }
+ }
+}
+
+#ifdef GPAC_IPHONE
+int SDL_main (int argc, char *argv[])
+#else
+int main (int argc, char *argv[])
+#endif
+{
+ char c;
+ const char *str;
+ u32 i, times[100], nb_times, dump_mode;
+ u32 simulation_time = 0;
+ Bool auto_exit = 0;
+ Bool logs_set = 0;
+ Bool start_fs = 0;
+ Bool use_rtix = 0;
+ Bool rgbds_dump = 0;
+ Bool rgbd_dump = 0;
+ Bool depth_dump = 0;
+ Bool pause_at_first = 0;
+ Bool enable_mem_tracker = 0;
+ Double fps = 25.0;
+ Bool ret, fill_ar, visible;
+ char *url_arg, *the_cfg, *rti_file;
+ GF_SystemRTInfo rti;
+ FILE *playlist = NULL;
+ FILE *logfile = NULL;
+ Float scale = 1;
+ int *libgpac_so = NULL;
+
+ libgpac_so = dlopen("/Applications/osmo4ios.app/libgpac_dynamic.dylib", RTLD_LAZY);
+ fprintf(stderr, "dlopen libgpac_so: 0x%p\n", libgpac_so);
+ fprintf(stderr, "dlsym: %p gf_log_lt\n", gf_log_lt = dlsym(libgpac_so, "gf_log_lt"));
+ fprintf(stderr, "dlsym: %p AVI_close\n", AVI_close = dlsym(libgpac_so, "AVI_close"));
+ fprintf(stderr, "dlsym: %p gf_sleep\n", gf_sleep = dlsym(libgpac_so, "gf_sleep"));
+ fprintf(stderr, "dlsym: %p gf_term_del\n", gf_term_del = dlsym(libgpac_so, "gf_term_del"));
+ fprintf(stderr, "dlsym: %p gf_sc_release_screen_buffer\n", gf_sc_release_screen_buffer = dlsym(libgpac_so, "gf_sc_release_screen_buffer"));
+ fprintf(stderr, "dlsym: %p gf_prompt_get_char\n", gf_prompt_get_char = dlsym(libgpac_so, "gf_prompt_get_char"));
+ fprintf(stderr, "dlsym: %p gf_set_progress\n", gf_set_progress = dlsym(libgpac_so, "gf_set_progress"));
+ fprintf(stderr, "dlsym: %p gf_term_new\n", gf_term_new = dlsym(libgpac_so, "gf_term_new"));
+ fprintf(stderr, "dlsym: %p gf_term_process_step\n", gf_term_process_step = dlsym(libgpac_so, "gf_term_process_step"));
+ fprintf(stderr, "dlsym: %p gf_sc_get_screen_buffer\n", gf_sc_get_screen_buffer = dlsym(libgpac_so, "gf_sc_get_screen_buffer"));
+ fprintf(stderr, "dlsym: %p gf_iphone_set_sdl_audio_module\n", gf_iphone_set_sdl_audio_module = dlsym(libgpac_so, "gf_iphone_set_sdl_audio_module"));
+ fprintf(stderr, "dlsym: %p gf_term_step_clocks\n", gf_term_step_clocks = dlsym(libgpac_so, "gf_term_step_clocks"));
+ fprintf(stderr, "dlsym: %p gf_prompt_set_echo_off\n", gf_prompt_set_echo_off = dlsym(libgpac_so, "gf_prompt_set_echo_off"));
+ fprintf(stderr, "dlsym: %p gf_log_get_tools\n", gf_log_get_tools = dlsym(libgpac_so, "gf_log_get_tools"));
+ fprintf(stderr, "dlsym: %p gf_log_get_level\n", gf_log_get_level = dlsym(libgpac_so, "gf_log_get_level"));
+ fprintf(stderr, "dlsym: %p gf_cfg_set_key\n", gf_cfg_set_key = dlsym(libgpac_so, "gf_cfg_set_key"));
+ fprintf(stderr, "dlsym: %p gf_cfg_get_section_count\n", gf_cfg_get_section_count = dlsym(libgpac_so, "gf_cfg_get_section_count"));
+ fprintf(stderr, "dlsym: %p gf_term_get_service_info\n", gf_term_get_service_info = dlsym(libgpac_so, "gf_term_get_service_info"));
+ fprintf(stderr, "dlsym: %p gf_term_set_size\n", gf_term_set_size = dlsym(libgpac_so, "gf_term_set_size"));
+ fprintf(stderr, "dlsym: %p gf_sys_get_rti\n", gf_sys_get_rti = dlsym(libgpac_so, "gf_sys_get_rti"));
+ fprintf(stderr, "dlsym: %p gf_log_set_tools\n", gf_log_set_tools = dlsym(libgpac_so, "gf_log_set_tools"));
+ fprintf(stderr, "dlsym: %p gf_term_play_from_time\n", gf_term_play_from_time = dlsym(libgpac_so, "gf_term_play_from_time"));
+ fprintf(stderr, "dlsym: %p gf_malloc\n", gf_malloc = dlsym(libgpac_so, "gf_malloc"));
+ fprintf(stderr, "dlsym: %p gf_log_set_level\n", gf_log_set_level = dlsym(libgpac_so, "gf_log_set_level"));
+ fprintf(stderr, "dlsym: %p gf_iphone_set_sdl_video_module\n", gf_iphone_set_sdl_video_module = dlsym(libgpac_so, "gf_iphone_set_sdl_video_module"));
+ fprintf(stderr, "dlsym: %p gf_term_get_option\n", gf_term_get_option = dlsym(libgpac_so, "gf_term_get_option"));
+ fprintf(stderr, "dlsym: %p gf_term_user_event\n", gf_term_user_event = dlsym(libgpac_so, "gf_term_user_event"));
+ fprintf(stderr, "dlsym: %p gf_modules_get_file_name\n", gf_modules_get_file_name = dlsym(libgpac_so, "gf_modules_get_file_name"));
+ fprintf(stderr, "dlsym: %p gf_mx_new\n", gf_mx_new = dlsym(libgpac_so, "gf_mx_new"));
+ fprintf(stderr, "dlsym: %p gf_list_count\n", gf_list_count = dlsym(libgpac_so, "gf_list_count"));
+ fprintf(stderr, "dlsym: %p gf_free\n", gf_free = dlsym(libgpac_so, "gf_free"));
+ fprintf(stderr, "dlsym: %p gf_term_get_world_info\n", gf_term_get_world_info = dlsym(libgpac_so, "gf_term_get_world_info"));
+ fprintf(stderr, "dlsym: %p gf_cfg_get_section_name\n", gf_cfg_get_section_name = dlsym(libgpac_so, "gf_cfg_get_section_name"));
+ fprintf(stderr, "dlsym: %p gf_term_navigate_to\n", gf_term_navigate_to = dlsym(libgpac_so, "gf_term_navigate_to"));
+ fprintf(stderr, "dlsym: %p gf_modules_del\n", gf_modules_del = dlsym(libgpac_so, "gf_modules_del"));
+ fprintf(stderr, "dlsym: %p gf_modules_new\n", gf_modules_new = dlsym(libgpac_so, "gf_modules_new"));
+ fprintf(stderr, "dlsym: %p gf_sys_init\n", gf_sys_init = dlsym(libgpac_so, "gf_sys_init"));
+ fprintf(stderr, "dlsym: %p gf_log\n", gf_log = dlsym(libgpac_so, "gf_log"));
+ fprintf(stderr, "dlsym: %p gf_term_get_object_info\n", gf_term_get_object_info = dlsym(libgpac_so, "gf_term_get_object_info"));
+ fprintf(stderr, "dlsym: %p gf_mx_p\n", gf_mx_p = dlsym(libgpac_so, "gf_mx_p"));
+ fprintf(stderr, "dlsym: %p gf_mx_v\n", gf_mx_v = dlsym(libgpac_so, "gf_mx_v"));
+ fprintf(stderr, "dlsym: %p gf_mx_del\n", gf_mx_del = dlsym(libgpac_so, "gf_mx_del"));
+ fprintf(stderr, "dlsym: %p gf_term_process_flush\n", gf_term_process_flush = dlsym(libgpac_so, "gf_term_process_flush"));
+ fprintf(stderr, "dlsym: %p gf_cfg_get_key_name\n", gf_cfg_get_key_name = dlsym(libgpac_so, "gf_cfg_get_key_name"));
+ fprintf(stderr, "dlsym: %p AVI_write_frame\n", AVI_write_frame = dlsym(libgpac_so, "AVI_write_frame"));
+ fprintf(stderr, "dlsym: %p gf_cfg_del\n", gf_cfg_del = dlsym(libgpac_so, "gf_cfg_del"));
+ fprintf(stderr, "dlsym: %p gf_term_get_channel_net_info\n", gf_term_get_channel_net_info = dlsym(libgpac_so, "gf_term_get_channel_net_info"));
+ fprintf(stderr, "dlsym: %p gf_term_process_shortcut\n", gf_term_process_shortcut = dlsym(libgpac_so, "gf_term_process_shortcut"));
+ fprintf(stderr, "dlsym: %p gf_cfg_new\n", gf_cfg_new = dlsym(libgpac_so, "gf_cfg_new"));
+ fprintf(stderr, "dlsym: %p gf_term_get_download_info\n", gf_term_get_download_info = dlsym(libgpac_so, "gf_term_get_download_info"));
+ fprintf(stderr, "dlsym: %p gf_sys_clock\n", gf_sys_clock = dlsym(libgpac_so, "gf_sys_clock"));
+ fprintf(stderr, "dlsym: %p gf_term_get_object\n", gf_term_get_object = dlsym(libgpac_so, "gf_term_get_object"));
+ fprintf(stderr, "dlsym: %p gf_term_set_option\n", gf_term_set_option = dlsym(libgpac_so, "gf_term_set_option"));
+ fprintf(stderr, "dlsym: %p gf_sys_close\n", gf_sys_close = dlsym(libgpac_so, "gf_sys_close"));
+ fprintf(stderr, "dlsym: %p gf_term_connect_from_time\n", gf_term_connect_from_time = dlsym(libgpac_so, "gf_term_connect_from_time"));
+ fprintf(stderr, "dlsym: %p AVI_open_output_file\n", AVI_open_output_file = dlsym(libgpac_so, "AVI_open_output_file"));
+ fprintf(stderr, "dlsym: %p gf_cfg_get_key\n", gf_cfg_get_key = dlsym(libgpac_so, "gf_cfg_get_key"));
+ fprintf(stderr, "dlsym: %p AVI_set_video\n", AVI_set_video = dlsym(libgpac_so, "AVI_set_video"));
+ fprintf(stderr, "dlsym: %p gf_term_set_speed\n", gf_term_set_speed = dlsym(libgpac_so, "gf_term_set_speed"));
+ fprintf(stderr, "dlsym: %p gf_cfg_get_key_count\n", gf_cfg_get_key_count = dlsym(libgpac_so, "gf_cfg_get_key_count"));
+ fprintf(stderr, "dlsym: %p gf_term_object_subscene_type\n", gf_term_object_subscene_type = dlsym(libgpac_so, "gf_term_object_subscene_type"));
+ fprintf(stderr, "dlsym: %p gf_term_get_framerate\n", gf_term_get_framerate = dlsym(libgpac_so, "gf_term_get_framerate"));
+ fprintf(stderr, "dlsym: %p gf_error_to_string\n", gf_error_to_string = dlsym(libgpac_so, "gf_error_to_string"));
+ fprintf(stderr, "dlsym: %p gf_stretch_bits\n", gf_stretch_bits = dlsym(libgpac_so, "gf_stretch_bits"));
+ fprintf(stderr, "dlsym: %p gf_list_del\n", gf_list_del = dlsym(libgpac_so, "gf_list_del"));
+ fprintf(stderr, "dlsym: %p gf_list_get\n", gf_list_get = dlsym(libgpac_so, "gf_list_get"));
+ fprintf(stderr, "dlsym: %p gf_term_disconnect\n", gf_term_disconnect = dlsym(libgpac_so, "gf_term_disconnect"));
+ fprintf(stderr, "dlsym: %p gf_term_is_supported_url\n", gf_term_is_supported_url = dlsym(libgpac_so, "gf_term_is_supported_url"));
+ fprintf(stderr, "dlsym: %p gf_list_new\n", gf_list_new = dlsym(libgpac_so, "gf_list_new"));
+ fprintf(stderr, "dlsym: %p gf_modules_get_option\n", gf_modules_get_option = dlsym(libgpac_so, "gf_modules_get_option"));
+ fprintf(stderr, "dlsym: %p gf_term_dump_scene\n", gf_term_dump_scene = dlsym(libgpac_so, "gf_term_dump_scene"));
+ fprintf(stderr, "dlsym: %p gf_prompt_has_input\n", gf_prompt_has_input = dlsym(libgpac_so, "gf_prompt_has_input"));
+ fprintf(stderr, "dlsym: %p gf_term_scene_update\n", gf_term_scene_update = dlsym(libgpac_so, "gf_term_scene_update"));
+ fprintf(stderr, "dlsym: %p gf_term_connect\n", gf_term_connect = dlsym(libgpac_so, "gf_term_connect"));
+ fprintf(stderr, "dlsym: %p gf_term_get_object_count\n", gf_term_get_object_count = dlsym(libgpac_so, "gf_term_get_object_count"));
+ fprintf(stderr, "dlsym: %p gf_modules_get_count\n", gf_modules_get_count = dlsym(libgpac_so, "gf_modules_get_count"));
+ fprintf(stderr, "dlsym: %p gf_term_get_root_object\n", gf_term_get_root_object = dlsym(libgpac_so, "gf_term_get_root_object"));
+ fprintf(stderr, "dlsym: %p gf_term_get_time_in_ms\n", gf_term_get_time_in_ms = dlsym(libgpac_so, "gf_term_get_time_in_ms"));
+ fprintf(stderr, "dlsym: %p gf_term_connect_with_path\n", gf_term_connect_with_path = dlsym(libgpac_so, "gf_term_connect_with_path"));
+ fprintf(stderr, "dlsym: %p gf_log_set_callback\n", gf_log_set_callback = dlsym(libgpac_so, "gf_log_set_callback"));
+ fprintf(stderr, "dlsym: %p gf_log_parse_tools\n", gf_log_parse_tools = dlsym(libgpac_so, "gf_log_parse_tools"));
+ fprintf(stderr, "dlsym: %p gf_log_parse_level\n", gf_log_parse_level = dlsym(libgpac_so, "gf_log_parse_level"));
+ fprintf(stderr, "dlsym: %p gf_term_switch_quality\n", gf_term_switch_quality = dlsym(libgpac_so, "gf_term_switch_quality"));
+ fprintf(stderr, "dlsym: %p gf_term_release_screen_buffer\n", gf_term_release_screen_buffer = dlsym(libgpac_so, "gf_term_release_screen_buffer"));
+ fprintf(stderr, "dlsym: %p gf_term_get_screen_buffer\n", gf_term_get_screen_buffer = dlsym(libgpac_so, "gf_term_get_screen_buffer"));
+ fprintf(stderr, "dlsym: %p gf_f64_open\n", gf_f64_open = dlsym(libgpac_so, "gf_f64_open"));
+ fprintf(stderr, "dlsym: %p gf_img_png_enc\n", gf_img_png_enc = dlsym(libgpac_so, "gf_img_png_enc"));
+ fprintf(stderr, "dlsym: %p utf8_to_ucs4\n", utf8_to_ucs4 = dlsym(libgpac_so, "utf8_to_ucs4"));
+
+ /*by default use current dir*/
+ strcpy(the_url, ".");
+
+ memset(&user, 0, sizeof(GF_User));
+
+ dump_mode = 0;
+ fill_ar = visible = 0;
+ url_arg = the_cfg = rti_file = NULL;
+ nb_times = 0;
+ times[0] = 0;
+
+ /*first locate config file if specified*/
+ for (i=1; i<(u32) argc; i++) {
+ char *arg = argv[i];
+ if (!strcmp(arg, "-c") || !strcmp(arg, "-cfg")) {
+ the_cfg = argv[i+1];
+ i++;
+ }
+ else if (!strcmp(arg, "-mem-track")) enable_mem_tracker = 1;
+ }
+
+ gf_sys_init(enable_mem_tracker);
+ gf_iphone_set_sdl_video_module(SDL_NewVideo);
+ gf_iphone_set_sdl_audio_module(SDL_NewAudio);
+
+ cfg_file = loadconfigfile(the_cfg);
+ if (!cfg_file) {
+ fprintf(stdout, "Error: Configuration File \"GPAC.cfg\" not found\n");
+ if (logfile) fclose(logfile);
+ return 1;
+ }
+
+{
+ const char *str;
+ logs_set = 1;
+
+ str = gf_cfg_get_key(cfg_file, "General", "LogLevel");
+ if (str)
+ gf_log_set_level(gf_log_parse_level(str));
+ str = gf_cfg_get_key(cfg_file, "General", "LogTools");
+ if (str)
+ gf_log_set_tools(gf_log_parse_tools(str));
+}
+
+ for (i=1; i<(u32) argc; i++) {
+ char *arg = argv[i];
+// if (isalnum(arg[0]) || (arg[0]=='/') || (arg[0]=='.') || (arg[0]=='\\') ) {
+ if (arg[0] != '-') {
+ url_arg = arg;
+ } else if (!strcmp(arg, "-c") || !strcmp(arg, "-cfg")) {
+ the_cfg = argv[i+1];
+ i++;
+ } else if (!strcmp(arg, "-rti")) {
+ rti_file = argv[i+1];
+ i++;
+ } else if (!strcmp(arg, "-rtix")) {
+ rti_file = argv[i+1];
+ i++;
+ use_rtix = 1;
+ } else if (!strcmp(arg, "-fill")) {
+ fill_ar = 1;
+ } else if (!strcmp(arg, "-show")) {
+ visible = 1;
+ } else if (!strcmp(arg, "-avi")) {
+ if (rgbds_dump) dump_mode = 5;
+ else if (depth_dump) dump_mode = 8;
+ else if (rgbd_dump) dump_mode = 10;
+ else dump_mode=1;
+ if ((url_arg || (i+2<(u32)argc)) && get_time_list(argv[i+1], times, &nb_times)) i++;
+ } else if (!strcmp(arg, "-rgbds")) { /*get dump in rgbds pixel format*/
+ rgbds_dump = 1;
+ dump_mode=6; /* rgbds texture directly*/
+ if (dump_mode==1) dump_mode = 5; /* .avi rgbds dump*/
+ } else if (!strcmp(arg, "-rgbd")) { /*get dump in rgbd pixel format*/
+ rgbd_dump = 1;
+ dump_mode=9; /* rgbd texture directly*/
+ if (dump_mode==1) dump_mode = 10; /* .avi rgbds dump*/
+ } else if (!strcmp(arg, "-depth")) {
+ depth_dump = 1;
+ if (dump_mode==2) dump_mode=7; /* grayscale .bmp depth dump*/
+ else if (dump_mode==1) dump_mode=8; /* .avi depth dump*/
+ else dump_mode=4; /*depth dump*/
+ } else if (!strcmp(arg, "-bmp")) {
+ if(depth_dump) dump_mode=7; /*grayscale depth .bmp dump*/
+ else dump_mode=2;
+ if ((url_arg || (i+2<(u32)argc)) && get_time_list(argv[i+1], times, &nb_times)) i++;
+ } else if (!strcmp(arg, "-raw")) {
+ dump_mode = 3;
+ if ((url_arg || (i+2<(u32)argc)) && get_time_list(argv[i+1], times, &nb_times)) i++;
+
+ } else if (!stricmp(arg, "-size")) {
+ if (sscanf(argv[i+1], "%dx%d", &forced_width, &forced_height) != 2) {
+ forced_width = forced_height = 0;
+ }
+ i++;
+ } else if (!stricmp(arg, "-scale")) {
+ sscanf(argv[i+1], "%f", &scale);
+ i++;
+ } else if (!stricmp(arg, "-fps")) {
+ fps = atof(argv[i+1]);
+ i++;
+ } else if (!strcmp(arg, "-quiet")) {
+ be_quiet = 1;
+ } else if (!strcmp(arg, "-log-file") || !strcmp(arg, "-lf")) {
+ logfile = gf_f64_open(argv[i+1], "wt");
+ gf_log_set_callback(logfile, on_gpac_log);
+ i++;
+ } else if (!strcmp(arg, "-log-level") || !strcmp(arg, "-ll")) {
+ gf_log_set_level(gf_log_parse_level(argv[i+1]));
+ logs_set = 1;
+ i++;
+ } else if (!strcmp(arg, "-log-tools") || !strcmp(arg, "-lt")) {
+ gf_log_set_tools(gf_log_parse_tools(argv[i+1]));
+ logs_set = 1;
+ i++;
+ } else if (!strcmp(arg, "-log-clock") || !strcmp(arg, "-lc")) {
+ log_time_start = 1;
+ } else if (!strcmp(arg, "-align")) {
+ if (argv[i+1][0]=='m') align_mode = 1;
+ else if (argv[i+1][0]=='b') align_mode = 2;
+ align_mode <<= 8;
+ if (argv[i+1][1]=='m') align_mode |= 1;
+ else if (argv[i+1][1]=='r') align_mode |= 2;
+ i++;
+ }
+ else if (!strcmp(arg, "-no-wnd")) user.init_flags |= GF_TERM_WINDOWLESS;
+#if defined(__DARWIN__) || defined(__APPLE__)
+ else if (!strcmp(arg, "-thread")) not_threaded = 0;
+#else
+ else if (!strcmp(arg, "-no-thread")) not_threaded = 1;
+#endif
+ else if (!strcmp(arg, "-no-audio")) no_audio = 1;
+ else if (!strcmp(arg, "-no-regulation")) no_regulation = 1;
+ else if (!strcmp(arg, "-fs")) start_fs = 1;
+ else if (!strcmp(arg, "-pause")) pause_at_first = 1;
+ else if (!strcmp(arg, "-exit")) auto_exit = 1;
+ else if (!strcmp(arg, "-mem-track")) enable_mem_tracker = 1;
+ else if (!strcmp(arg, "-opt")) {
+ char *sep, *sep2, szSec[1024], szKey[1024], szVal[1024];
+ sep = strchr(argv[i+1], ':');
+ if (sep) {
+ sep[0] = 0;
+ strcpy(szSec, argv[i+1]);
+ sep[0] = ':'; sep ++;
+ sep2 = strchr(sep, '=');
+ if (sep2) {
+ sep2[0] = 0;
+ strcpy(szKey, sep);
+ strcpy(szVal, sep2+1);
+ sep2[0] = '=';
+ if (!stricmp(szVal, "null")) szVal[0]=0;
+ gf_cfg_set_key(cfg_file, szSec, szKey, szVal[0] ? szVal : NULL);
+ }
+ }
+ i++;
+ }
+ else if (!strncmp(arg, "-run-for=", 9)) simulation_time = atoi(arg+9);
+ else {
+ PrintUsage();
+ return 1;
+ }
+ }
+ if (dump_mode && !url_arg) {
+ fprintf(stdout, "Missing argument for dump\n");
+ PrintUsage();
+ if (logfile) fclose(logfile);
+ return 1;
+ }
+ if (dump_mode) rti_file = NULL;
+
+ if (!logs_set) {
+ gf_log_set_level(GF_LOG_ERROR);
+ gf_log_set_tools(0xFFFFFFFF);
+ }
+
+ gf_sys_get_rti(500, &rti, GF_RTI_SYSTEM_MEMORY_ONLY);
+ memory_at_gpac_startup = rti.physical_memory_avail;
+ if (rti_file) init_rti_logs(rti_file, url_arg, use_rtix);
+
+ /*setup dumping options*/
+ if (dump_mode) {
+ user.init_flags |= GF_TERM_NO_AUDIO | GF_TERM_NO_COMPOSITOR_THREAD | GF_TERM_NO_REGULATION /*| GF_TERM_INIT_HIDE*/;
+ if (visible || dump_mode==8) user.init_flags |= GF_TERM_INIT_HIDE;
+ } else {
+ init_w = forced_width;
+ init_h = forced_height;
+ }
+
+ fprintf(stderr, "Loading modules\n");
+ str = gf_cfg_get_key(cfg_file, "General", "ModulesDirectory");
+
+ user.modules = gf_modules_new((const unsigned char *) str, cfg_file);
+ if (user.modules) i = gf_modules_get_count(user.modules);
+ if (!i || !user.modules) {
+ fprintf(stdout, "Error: no modules found in %s - exiting\n", str);
+ if (user.modules) gf_modules_del(user.modules);
+ gf_cfg_del(cfg_file);
+ gf_sys_close();
+ if (logfile) fclose(logfile);
+ return 1;
+ }
+ fprintf(stderr, "Modules Loaded (%d found in %s)\n", i, str);
+
+ user.config = cfg_file;
+ user.EventProc = GPAC_EventProc;
+ /*dummy in this case (global vars) but MUST be non-NULL*/
+ user.opaque = user.modules;
+ if (not_threaded) user.init_flags |= GF_TERM_NO_COMPOSITOR_THREAD;
+ if (no_audio) user.init_flags |= GF_TERM_NO_AUDIO;
+ if (no_regulation) user.init_flags |= GF_TERM_NO_REGULATION;
+
+ fprintf(stderr, "Loading GPAC Terminal\n");
+ term = gf_term_new(&user);
+ if (!term) {
+ fprintf(stderr, "\nInit error - check you have at least one video out and one rasterizer...\nFound modules:\n");
+ list_modules(user.modules);
+ gf_modules_del(user.modules);
+ gf_cfg_del(cfg_file);
+ gf_sys_close();
+ if (logfile) fclose(logfile);
+ return 1;
+ }
+ fprintf(stderr, "Terminal Loaded\n");
+
+
+ if (dump_mode) {
+// gf_term_set_option(term, GF_OPT_VISIBLE, 0);
+ if (fill_ar) gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);
+ } else {
+ /*check video output*/
+ str = gf_cfg_get_key(cfg_file, "Video", "DriverName");
+ if (!strcmp(str, "Raw Video Output")) fprintf(stdout, "WARNING: using raw output video (memory only) - no display used\n");
+ /*check audio output*/
+ str = gf_cfg_get_key(cfg_file, "Audio", "DriverName");
+ if (!str || !strcmp(str, "No Audio Output Available")) fprintf(stdout, "WARNING: no audio output availble - make sure no other program is locking the sound card\n");
+
+ str = gf_cfg_get_key(cfg_file, "General", "NoMIMETypeFetch");
+ no_mime_check = (str && !stricmp(str, "yes")) ? 1 : 0;
+ }
+
+ str = gf_cfg_get_key(cfg_file, "HTTPProxy", "Enabled");
+ if (str && !strcmp(str, "yes")) {
+ str = gf_cfg_get_key(cfg_file, "HTTPProxy", "Name");
+ if (str) fprintf(stdout, "HTTP Proxy %s enabled\n", str);
+ }
+
+ if (rti_file) {
+ str = gf_cfg_get_key(cfg_file, "General", "RTIRefreshPeriod");
+ if (str) {
+ rti_update_time_ms = atoi(str);
+ } else {
+ gf_cfg_set_key(cfg_file, "General", "RTIRefreshPeriod", "200");
+ }
+ UpdateRTInfo("At GPAC load time\n");
+ }
+
+ Run = 1;
+ ret = 1;
+
+ if (dump_mode) {
+ if (!nb_times) {
+ times[0] = 0;
+ nb_times++;
+ }
+ ret = dump_file(url_arg, dump_mode, fps, forced_width, forced_height, scale, times, nb_times);
+ Run = 0;
+ } else
+
+ /*connect if requested*/
+ if (url_arg) {
+ char *ext;
+ strcpy(the_url, url_arg);
+ ext = strrchr(the_url, '.');
+ if (ext && (!stricmp(ext, ".m3u") || !stricmp(ext, ".pls"))) {
+ fprintf(stdout, "Opening Playlist %s\n", the_url);
+ playlist = gf_f64_open(the_url, "rt");
+ if (playlist) {
+ strcpy(pl_path, the_url);
+ fscanf(playlist, "%s", the_url);
+ fprintf(stdout, "Opening URL %s\n", the_url);
+ gf_term_connect_with_path(term, the_url, pl_path);
+ } else {
+ fprintf(stdout, "Hit 'h' for help\n\n");
+ }
+ } else {
+ fprintf(stdout, "Opening URL %s\n", the_url);
+ if (pause_at_first) fprintf(stdout, "[Status: Paused]\n");
+ gf_term_connect_from_time(term, the_url, 0, pause_at_first);
+ }
+ } else {
+ fprintf(stdout, "Hit 'h' for help\n\n");
+ str = gf_cfg_get_key(cfg_file, "General", "StartupFile");
+ if (str) {
+ strcpy(the_url, "MP4Client "GPAC_FULL_VERSION);
+ gf_term_connect(term, str);
+ startup_file = 1;
+ }
+ }
+ /*force fullscreen*/
+ if (start_fs)
+ gf_term_set_option(term, GF_OPT_FULLSCREEN, 1);
+
+ while (Run) {
+ /*we don't want getchar to block*/
+ if (1 || !gf_prompt_has_input()) {
+ if (restart) {
+ restart = 0;
+ gf_term_play_from_time(term, 0, 0);
+ }
+ if (request_next_playlist_item) {
+ c = '\n';
+ request_next_playlist_item = 0;
+ goto force_input;
+ }
+ if (!use_rtix || display_rti) UpdateRTInfo(NULL);
+ if (not_threaded) {
+ //printf("gf_term_process_step from run loop\n");
+ gf_term_process_step(term);
+ if (auto_exit && gf_term_get_option(term, GF_OPT_IS_OVER)) {
+ Run = 0;
+ }
+ } else {
+ gf_sleep(rti_update_time_ms);
+ }
+ /*sim time*/
+ if (simulation_time && (gf_term_get_time_in_ms(term)>simulation_time)) {
+ Run = 0;
+ }
+ continue;
+ }
+ c = gf_prompt_get_char();
+
+force_input:
+ switch (c) {
+ case 'q':
+ Run = 0;
+ break;
+ case 'X':
+ exit(0);
+ break;
+ case 'Q':
+ break;
+ case 'o':
+ startup_file = 0;
+ gf_term_disconnect(term);
+ fprintf(stdout, "Enter the absolute URL\n");
+ scanf("%s", the_url);
+ if (rti_file) init_rti_logs(rti_file, the_url, use_rtix);
+ gf_term_connect(term, the_url);
+ break;
+ case 'O':
+ gf_term_disconnect(term);
+ fprintf(stdout, "Enter the absolute URL to the playlist\n");
+ scanf("%s", the_url);
+ playlist = gf_f64_open(the_url, "rt");
+ if (playlist) {
+ fscanf(playlist, "%s", the_url);
+ fprintf(stdout, "Opening URL %s\n", the_url);
+ gf_term_connect(term, the_url);
+ }
+ break;
+ case '\n':
+ case 'N':
+ if (playlist) {
+ gf_term_disconnect(term);
+
+ if (fscanf(playlist, "%s", the_url) == EOF) {
+ fprintf(stdout, "No more items - exiting\n");
+ Run = 0;
+ } else {
+ fprintf(stdout, "Opening URL %s\n", the_url);
+ gf_term_connect_with_path(term, the_url, pl_path);
+ }
+ }
+ break;
+ case 'P':
+ if (playlist) {
+ u32 count;
+ gf_term_disconnect(term);
+ scanf("%d", &count);
+ while (count) {
+ fscanf(playlist, "%s", the_url);
+ count--;
+ }
+ fprintf(stdout, "Opening URL %s\n", the_url);
+ gf_term_connect(term, the_url);
+ }
+ break;
+ case 'r':
+ if (is_connected) {
+ gf_term_disconnect(term);
+ gf_term_connect(term, startup_file ? gf_cfg_get_key(cfg_file, "General", "StartupFile") : the_url);
+ }
+ break;
+
+ case 'D':
+ if (is_connected) gf_term_disconnect(term);
+ break;
+
+ case 'p':
+ if (is_connected) {
+ Bool is_pause = gf_term_get_option(term, GF_OPT_PLAY_STATE);
+ fprintf(stdout, "[Status: %s]\n", is_pause ? "Playing" : "Paused");
+ gf_term_set_option(term, GF_OPT_PLAY_STATE, is_pause ? GF_STATE_PLAYING : GF_STATE_PAUSED);
+ }
+ break;
+ case 's':
+ if (is_connected) {
+ gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE);
+ fprintf(stdout, "Step time: ");
+ PrintTime(gf_term_get_time_in_ms(term));
+ fprintf(stdout, "\n");
+ }
+ break;
+
+ case 'z':
+ if (!CanSeek || (Duration<=2000)) {
+ fprintf(stdout, "scene not seekable\n");
+ } else {
+ Double res;
+ s32 seekTo;
+ fprintf(stdout, "Duration: ");
+ PrintTime(Duration);
+ res = gf_term_get_time_in_ms(term);
+ res *= 100; res /= (s64)Duration;
+ fprintf(stdout, " (current %.2f %%)\nEnter Seek percentage:\n", res);
+ if (scanf("%d", &seekTo) == 1) {
+ if (seekTo > 100) seekTo = 100;
+ res = (Double)(s64)Duration; res /= 100; res *= seekTo;
+ gf_term_play_from_time(term, (u64) (s64) res, 0);
+ }
+ }
+ break;
+
+ case 't':
+ {
+ if (is_connected) {
+ fprintf(stdout, "Current Time: ");
+ PrintTime(gf_term_get_time_in_ms(term));
+ fprintf(stdout, " - Duration: ");
+ PrintTime(Duration);
+ fprintf(stdout, "\n");
+ }
+ }
+ break;
+ case 'w':
+ if (is_connected) PrintWorldInfo(term);
+ break;
+ case 'v':
+ if (is_connected) PrintODList(term, NULL, 0, 0, "Root");
+ break;
+ case 'i':
+ if (is_connected) {
+ u32 ID;
+ fprintf(stdout, "Enter OD ID (0 for main OD): ");
+ fflush(stdout);
+ scanf("%d", &ID);
+ ViewOD(term, ID, (u32)-1);
+ }
+ break;
+ case 'j':
+ if (is_connected) {
+ u32 num;
+ fprintf(stdout, "Enter OD number (0 for main OD): ");
+ fflush(stdout);
+ scanf("%d", &num);
+ ViewOD(term, (u32)-1, num);
+ }
+ break;
+ case 'b':
+ if (is_connected) ViewODs(term, 1);
+ break;
+
+ case 'm':
+ if (is_connected) ViewODs(term, 0);
+ break;
+
+ case 'l':
+ list_modules(user.modules);
+ break;
+
+ case 'n':
+ if (is_connected) set_navigation();
+ break;
+ case 'x':
+ if (is_connected) gf_term_set_option(term, GF_OPT_NAVIGATION_TYPE, 0);
+ break;
+
+ case 'd':
+ if (is_connected) {
+ GF_ObjectManager *odm = NULL;
+ char radname[GF_MAX_PATH], *sExt;
+ GF_Err e;
+ u32 i, count, odid;
+ Bool xml_dump, std_out;
+ fprintf(stdout, "Enter Inline OD ID if any or 0");
+ fflush(stdout);
+ radname[0] = 0;
+ scanf("%d", &odid);
+ if (odid) {
+ GF_ObjectManager *root_odm = gf_term_get_root_object(term);
+ if (!root_odm) break;
+ count = gf_term_get_object_count(term, root_odm);
+ for (i=0; i<count; i++) {
+ GF_MediaInfo info;
+ odm = gf_term_get_object(term, root_odm, i);
+ if (gf_term_get_object_info(term, odm, &info) == GF_OK) {
+ if (info.od->objectDescriptorID==odid) break;
+ }
+ odm = NULL;
+ }
+ }
+ fprintf(stdout, "Enter file radical name (+\'.x\' for XML dumping) - \"std\" for stdout: ");
+ fflush(stdout);
+ scanf("%s", radname);
+ sExt = strrchr(radname, '.');
+ xml_dump = 0;
+ if (sExt) {
+ if (!stricmp(sExt, ".x")) xml_dump = 1;
+ sExt[0] = 0;
+ }
+ std_out = strnicmp(radname, "std", 3) ? 0 : 1;
+ e = gf_term_dump_scene(term, std_out ? NULL : radname, NULL, xml_dump, 0, odm);
+ fprintf(stdout, "Dump done (%s)\n", gf_error_to_string(e));
+ }
+ break;
+
+ case 'c':
+ PrintGPACConfig();
+ break;
+ case '3':
+ {
+ Bool use_3d = !gf_term_get_option(term, GF_OPT_USE_OPENGL);
+ if (gf_term_set_option(term, GF_OPT_USE_OPENGL, use_3d)==GF_OK) {
+ fprintf(stdout, "Using %s for 2D drawing\n", use_3d ? "OpenGL" : "2D rasterizer");
+ }
+ }
+ break;
+ case 'k':
+ {
+ Bool opt = gf_term_get_option(term, GF_OPT_STRESS_MODE);
+ opt = !opt;
+ fprintf(stdout, "Turning stress mode %s\n", opt ? "on" : "off");
+ gf_term_set_option(term, GF_OPT_STRESS_MODE, opt);
+ }
+ break;
+ case '4': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3); break;
+ case '5': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9); break;
+ case '6': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN); break;
+ case '7': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP); break;
+
+ case 'C':
+ switch (gf_term_get_option(term, GF_OPT_MEDIA_CACHE)) {
+ case GF_MEDIA_CACHE_DISABLED: gf_term_set_option(term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_ENABLED); break;
+ case GF_MEDIA_CACHE_ENABLED: gf_term_set_option(term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_DISABLED); break;
+ case GF_MEDIA_CACHE_RUNNING: fprintf(stdout, "Streaming Cache is running - please stop it first\n"); continue;
+ }
+ switch (gf_term_get_option(term, GF_OPT_MEDIA_CACHE)) {
+ case GF_MEDIA_CACHE_ENABLED: fprintf(stdout, "Streaming Cache Enabled\n"); break;
+ case GF_MEDIA_CACHE_DISABLED: fprintf(stdout, "Streaming Cache Disabled\n"); break;
+ case GF_MEDIA_CACHE_RUNNING: fprintf(stdout, "Streaming Cache Running\n"); break;
+ }
+ break;
+ case 'S':
+ case 'A':
+ if (gf_term_get_option(term, GF_OPT_MEDIA_CACHE)==GF_MEDIA_CACHE_RUNNING) {
+ gf_term_set_option(term, GF_OPT_MEDIA_CACHE, (c=='S') ? GF_MEDIA_CACHE_DISABLED : GF_MEDIA_CACHE_DISCARD);
+ fprintf(stdout, "Streaming Cache stopped\n");
+ } else {
+ fprintf(stdout, "Streaming Cache not running\n");
+ }
+ break;
+ case 'R':
+ display_rti = !display_rti;
+ ResetCaption();
+ break;
+ case 'F':
+ if (display_rti) display_rti = 0;
+ else display_rti = 2;
+ ResetCaption();
+ break;
+
+ case 'u':
+ {
+ GF_Err e;
+ char szCom[8192];
+ fprintf(stdout, "Enter command to send:\n");
+ fflush(stdin);
+ szCom[0] = 0;
+ scanf("%[^\t\n]", szCom);
+ e = gf_term_scene_update(term, NULL, szCom);
+ if (e) fprintf(stdout, "Processing command failed: %s\n", gf_error_to_string(e));
+ }
+ break;
+
+ case 'L':
+ {
+ char szLog[1024];
+ fprintf(stdout, "Enter new log level:\n");
+ scanf("%s", szLog);
+ gf_log_set_level(gf_log_parse_level(szLog));
+ }
+ break;
+ case 'T':
+ {
+ char szLog[1024];
+ fprintf(stdout, "Enter new log tools:\n");
+ scanf("%s", szLog);
+ gf_log_set_tools(gf_log_parse_tools(szLog));
+ }
+ break;
+ case 'g':
+ {
+ GF_SystemRTInfo rti;
+ gf_sys_get_rti(rti_update_time_ms, &rti, 0);
+ fprintf(stdout, "GPAC allocated memory "LLD"\n", rti.gpac_memory);
+ }
+ break;
+ case 'M':
+ {
+ u32 size;
+ fprintf(stdout, "Enter new video cache memory in kBytes (current %d):\n", gf_term_get_option(term, GF_OPT_VIDEO_CACHE_SIZE));
+ scanf("%d", &size);
+ gf_term_set_option(term, GF_OPT_VIDEO_CACHE_SIZE, size);
+ }
+ break;
+
+ case 'E':
+ gf_term_set_option(term, GF_OPT_RELOAD_CONFIG, 1);
+ break;
+
+ case 'B':
+ switch_bench();
+ break;
+
+ /*extract to PNG*/
+ case 'Z':
+ {
+ GF_VideoSurface fb;
+ GF_Err e;
+ e = gf_term_get_screen_buffer(term, &fb);
+ if (e) {
+ fprintf(stdout, "Error dumping screen buffer %s\n", gf_error_to_string(e) );
+ } else {
+ u32 dst_size = fb.width*fb.height*3;
+ char *dst=malloc(sizeof(char)*dst_size);
+
+ e = gf_img_png_enc(fb.video_buffer, fb.width, fb.height, fb.pitch_y, fb.pixel_format, dst, &dst_size);
+ if (e) {
+ fprintf(stdout, "Error encoding PNG %s\n", gf_error_to_string(e) );
+ } else {
+ FILE *png = gf_f64_open("dump.png", "wb");
+ if (!png) {
+ fprintf(stdout, "Error writing file dump.png\n");
+ } else {
+ fwrite(dst, dst_size, 1, png);
+ fclose(png);
+ fprintf(stdout, "Writing file dump.png\n");
+ }
+ }
+ if (dst) free(dst);
+ gf_term_release_screen_buffer(term, &fb);
+ }
+ }
+ break;
+
+ case 'h':
+ PrintHelp();
+ break;
+ default:
+ break;
+ }
+ }
+
+ gf_term_disconnect(term);
+ if (rti_file) UpdateRTInfo("Disconnected\n");
+
+ fprintf(stdout, "Deleting terminal... ");
+ if (playlist) fclose(playlist);
+ gf_term_del(term);
+ fprintf(stdout, "OK\n");
+
+ fprintf(stdout, "GPAC cleanup ...\n");
+ gf_modules_del(user.modules);
+ gf_cfg_del(cfg_file);
+
+#ifdef GPAC_MEMORY_TRACKING
+ if (enable_mem_tracker) {
+ gf_memory_print();
+ fprintf(stdout, "print any key\n");
+ while (!gf_prompt_has_input()) {
+ gf_sleep(100);
+ }
+ }
+#endif
+
+ gf_sys_close();
+ if (rti_logs) fclose(rti_logs);
+ if (logfile) fclose(logfile);
+ fprintf(stdout, "Bye\n");
+ return 0;
+}
+
+void PrintWorldInfo(GF_Terminal *term)
+{
+ u32 i;
+ const char *title;
+ GF_List *descs;
+ descs = gf_list_new();
+ title = gf_term_get_world_info(term, NULL, descs);
+ if (!title && !gf_list_count(descs)) {
+ fprintf(stdout, "No World Info available\n");
+ } else {
+ fprintf(stdout, "\t%s\n", title ? title : "No title available");
+ for (i=0; i<gf_list_count(descs); i++) {
+ char *str = gf_list_get(descs, i);
+ fprintf(stdout, "%s\n", str);
+ }
+ }
+ gf_list_del(descs);
+}
+
+void PrintODList(GF_Terminal *term, GF_ObjectManager *root_odm, u32 num, u32 indent, char *root_name)
+{
+ GF_MediaInfo odi;
+ u32 i, count;
+ char szIndent[50];
+ GF_ObjectManager *odm;
+
+ if (!root_odm) {
+ fprintf(stdout, "Currently loaded objects:\n");
+ root_odm = gf_term_get_root_object(term);
+ }
+ if (!root_odm) return;
+ if (gf_term_get_object_info(term, root_odm, &odi) != GF_OK) return;
+ if (!odi.od) {
+ fprintf(stdout, "Service not attached\n");
+ return;
+ }
+
+ for (i=0;i<indent;i++) szIndent[i]=' ';
+ szIndent[indent]=0;
+
+ fprintf(stdout, "%s", szIndent);
+ fprintf(stdout, "#%d %s - ", num, root_name);
+ if (odi.media_url) {
+ fprintf(stdout, "%s\n", odi.media_url);
+ } else {
+ fprintf(stdout, "OD ID %d\n", odi.od->objectDescriptorID);
+ }
+
+ szIndent[indent]=' ';
+ szIndent[indent+1]=0;
+ indent++;
+
+ count = gf_term_get_object_count(term, root_odm);
+ for (i=0; i<count; i++) {
+ odm = gf_term_get_object(term, root_odm, i);
+ if (!odm) break;
+ num++;
+ if (gf_term_get_object_info(term, odm, &odi) == GF_OK) {
+ switch (gf_term_object_subscene_type(term, odm)) {
+ case 1:
+ PrintODList(term, odm, num, indent, "Root");
+ break;
+ case 2:
+ PrintODList(term, odm, num, indent, "Inline Scene");
+ break;
+ case 3:
+ PrintODList(term, odm, num, indent, "EXTERNPROTO Library");
+ break;
+ default:
+ fprintf(stdout, "%s", szIndent);
+ fprintf(stdout, "#%d - ", num);
+ if (odi.media_url) {
+ fprintf(stdout, "%s", odi.media_url);
+ } else {
+ fprintf(stdout, "ID %d", odi.od->objectDescriptorID);
+ }
+ fprintf(stdout, " - %s\n", (odi.od_type==GF_STREAM_VISUAL) ? "Video" : (odi.od_type==GF_STREAM_AUDIO) ? "Audio" : "Systems");
+ break;
+ }
+ }
+ }
+}
+
+void ViewOD(GF_Terminal *term, u32 OD_ID, u32 number)
+{
+ GF_MediaInfo odi;
+ u32 i, j, count, d_enum,id;
+ GF_Err e;
+ char code[5];
+ NetStatCommand com;
+ GF_ObjectManager *odm, *root_odm = gf_term_get_root_object(term);
+ if (!root_odm) return;
+
+ odm = NULL;
+ if ((!OD_ID && (number == (u32)(-1))) ||
+ ((OD_ID == (u32)(-1)) && !number)) {
+ odm = root_odm;
+ if ((gf_term_get_object_info(term, odm, &odi) != GF_OK)) odm=NULL;
+ } else {
+ count = gf_term_get_object_count(term, root_odm);
+ for (i=0; i<count; i++) {
+ odm = gf_term_get_object(term, root_odm, i);
+ if (!odm) break;
+ if (gf_term_get_object_info(term, odm, &odi) == GF_OK) {
+ if ((number == (u32)(-1)) && (odi.od->objectDescriptorID == OD_ID)) break;
+ else if (i == (u32)(number-1)) break;
+ }
+ odm = NULL;
+ }
+ }
+ if (!odm) {
+ if (number == (u32)-1) fprintf(stdout, "cannot find OD with ID %d\n", OD_ID);
+ else fprintf(stdout, "cannot find OD with number %d\n", number);
+ return;
+ }
+ if (!odi.od) {
+ if (number == (u32)-1) fprintf(stdout, "Object %d not attached yet\n", OD_ID);
+ else fprintf(stdout, "Object #%d not attached yet\n", number);
+ return;
+ }
+
+ if (!odi.od) {
+ fprintf(stdout, "Service not attached\n");
+ return;
+ }
+
+ if (odi.od->tag==GF_ODF_IOD_TAG) {
+ fprintf(stdout, "InitialObjectDescriptor %d\n", odi.od->objectDescriptorID);
+ fprintf(stdout, "Profiles and Levels: Scene %x - Graphics %x - Visual %x - Audio %x - OD %x\n",
+ odi.scene_pl, odi.graphics_pl, odi.visual_pl, odi.audio_pl, odi.OD_pl);
+ fprintf(stdout, "Inline Profile Flag %d\n", odi.inline_pl);
+ } else {
+ fprintf(stdout, "ObjectDescriptor %d\n", odi.od->objectDescriptorID);
+ }
+
+ fprintf(stdout, "Object Duration: ");
+ if (odi.duration) {
+ PrintTime((u32) (odi.duration*1000));
+ } else {
+ fprintf(stdout, "unknown");
+ }
+ fprintf(stdout, "\n");
+
+ if (odi.owns_service) {
+ fprintf(stdout, "Service Handler: %s\n", odi.service_handler);
+ fprintf(stdout, "Service URL: %s\n", odi.service_url);
+ }
+ if (odi.codec_name) {
+ Float avg_dec_time;
+ switch (odi.od_type) {
+ case GF_STREAM_VISUAL:
+ fprintf(stdout, "Video Object: Width %d - Height %d\r\n", odi.width, odi.height);
+ fprintf(stdout, "Media Codec: %s\n", odi.codec_name);
+ if (odi.par) fprintf(stdout, "Pixel Aspect Ratio: %d:%d\n", (odi.par>>16)&0xFF, (odi.par)&0xFF);
+ break;
+ case GF_STREAM_AUDIO:
+ fprintf(stdout, "Audio Object: Sample Rate %d - %d channels\r\n", odi.sample_rate, odi.num_channels);
+ fprintf(stdout, "Media Codec: %s\n", odi.codec_name);
+ break;
+ case GF_STREAM_SCENE:
+ case GF_STREAM_PRIVATE_SCENE:
+ if (odi.width && odi.height) {
+ fprintf(stdout, "Scene Description - Width %d - Height %d\n", odi.width, odi.height);
+ } else {
+ fprintf(stdout, "Scene Description - no size specified\n");
+ }
+ fprintf(stdout, "Scene Codec: %s\n", odi.codec_name);
+ break;
+ case GF_STREAM_TEXT:
+ if (odi.width && odi.height) {
+ fprintf(stdout, "Text Object: Width %d - Height %d\n", odi.width, odi.height);
+ } else {
+ fprintf(stdout, "Text Object: No size specified\n");
+ }
+ fprintf(stdout, "Text Codec %s\n", odi.codec_name);
+ break;
+ }
+
+ avg_dec_time = 0;
+ if (odi.nb_dec_frames) {
+ avg_dec_time = (Float) odi.total_dec_time;
+ avg_dec_time /= odi.nb_dec_frames;
+ }
+ fprintf(stdout, "\tBitrate over last second: %d kbps\n\tMax bitrate over one second: %d kbps\n\tAverage Decoding Time %.2f ms (%d max)\n\tTotal decoded frames %d\n",
+ (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time, odi.nb_dec_frames);
+ }
+ if (odi.protection) fprintf(stdout, "Encrypted Media%s\n", (odi.protection==2) ? " NOT UNLOCKED" : "");
+
+ count = gf_list_count(odi.od->ESDescriptors);
+ fprintf(stdout, "%d streams in OD\n", count);
+ for (i=0; i<count; i++) {
+ GF_ESD *esd = (GF_ESD *) gf_list_get(odi.od->ESDescriptors, i);
+
+ fprintf(stdout, "\nStream ID %d - Clock ID %d\n", esd->ESID, esd->OCRESID);
+ if (esd->dependsOnESID) fprintf(stdout, "\tDepends on Stream ID %d for decoding\n", esd->dependsOnESID);
+
+ switch (esd->decoderConfig->streamType) {
+ case GF_STREAM_OD: fprintf(stdout, "\tOD Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_OCR: fprintf(stdout, "\tOCR Stream\n"); break;
+ case GF_STREAM_SCENE: fprintf(stdout, "\tScene Description Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_VISUAL:
+ fprintf(stdout, "\tVisual Stream - media type: ");
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_VIDEO_MPEG4_PART2: fprintf(stdout, "MPEG-4\n"); break;
+ case GPAC_OTI_VIDEO_MPEG2_SIMPLE: fprintf(stdout, "MPEG-2 Simple Profile\n"); break;
+ case GPAC_OTI_VIDEO_MPEG2_MAIN: fprintf(stdout, "MPEG-2 Main Profile\n"); break;
+ case GPAC_OTI_VIDEO_MPEG2_SNR: fprintf(stdout, "MPEG-2 SNR Profile\n"); break;
+ case GPAC_OTI_VIDEO_MPEG2_SPATIAL: fprintf(stdout, "MPEG-2 Spatial Profile\n"); break;
+ case GPAC_OTI_VIDEO_MPEG2_HIGH: fprintf(stdout, "MPEG-2 High Profile\n"); break;
+ case GPAC_OTI_VIDEO_MPEG2_422: fprintf(stdout, "MPEG-2 422 Profile\n"); break;
+ case GPAC_OTI_VIDEO_MPEG1: fprintf(stdout, "MPEG-1\n"); break;
+ case GPAC_OTI_IMAGE_JPEG: fprintf(stdout, "JPEG\n"); break;
+ case GPAC_OTI_IMAGE_PNG: fprintf(stdout, "PNG\n"); break;
+ case GPAC_OTI_IMAGE_JPEG_2000: fprintf(stdout, "JPEG2000\n"); break;
+
+ case GPAC_OTI_MEDIA_GENERIC:
+ memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4);
+ code[4] = 0;
+ fprintf(stdout, "GPAC Intern (%s)\n", code);
+ break;
+ default:
+ fprintf(stdout, "Private Type (0x%x)\n", esd->decoderConfig->objectTypeIndication);
+ break;
+ }
+ break;
+
+ case GF_STREAM_AUDIO:
+ fprintf(stdout, "\tAudio Stream - media type: ");
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_AUDIO_AAC_MPEG4: fprintf(stdout, "MPEG-4\n"); break;
+ case GPAC_OTI_AUDIO_AAC_MPEG2_MP: fprintf(stdout, "MPEG-2 AAC Main Profile\n"); break;
+ case GPAC_OTI_AUDIO_AAC_MPEG2_LCP: fprintf(stdout, "MPEG-2 AAC LowComplexity Profile\n"); break;
+ case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP: fprintf(stdout, "MPEG-2 AAC Scalable Sampling Rate Profile\n"); break;
+ case GPAC_OTI_AUDIO_MPEG2_PART3: fprintf(stdout, "MPEG-2 Audio\n"); break;
+ case GPAC_OTI_AUDIO_MPEG1: fprintf(stdout, "MPEG-1 Audio\n"); break;
+ case GPAC_OTI_AUDIO_EVRC_VOICE: fprintf(stdout, "EVRC Audio\n"); break;
+ case GPAC_OTI_AUDIO_SMV_VOICE: fprintf(stdout, "SMV Audio\n"); break;
+ case GPAC_OTI_AUDIO_13K_VOICE: fprintf(stdout, "QCELP Audio\n"); break;
+ case GPAC_OTI_MEDIA_GENERIC:
+ memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4);
+ code[4] = 0;
+ fprintf(stdout, "GPAC Intern (%s)\n", code);
+ break;
+ default:
+ fprintf(stdout, "Private Type (0x%x)\n", esd->decoderConfig->objectTypeIndication);
+ break;
+ }
+ break;
+ case GF_STREAM_MPEG7: fprintf(stdout, "\tMPEG-7 Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_IPMP: fprintf(stdout, "\tIPMP Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_OCI: fprintf(stdout, "\tOCI Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_MPEGJ: fprintf(stdout, "\tMPEGJ Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_INTERACT: fprintf(stdout, "\tUser Interaction Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ case GF_STREAM_TEXT: fprintf(stdout, "\tStreaming Text Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break;
+ default: fprintf(stdout, "Unknown Stream\r\n"); break;
+ }
+
+ fprintf(stdout, "\tBuffer Size %d\n\tAverage Bitrate %d bps\n\tMaximum Bitrate %d bps\n", esd->decoderConfig->bufferSizeDB, esd->decoderConfig->avgBitrate, esd->decoderConfig->maxBitrate);
+ if (esd->slConfig->predefined==SLPredef_SkipSL) {
+ fprintf(stdout, "\tNot using MPEG-4 Synchronization Layer\n");
+ } else {
+ fprintf(stdout, "\tStream Clock Resolution %d\n", esd->slConfig->timestampResolution);
+ }
+ if (esd->URLString) fprintf(stdout, "\tStream Location: %s\n", esd->URLString);
+
+ /*check language*/
+ if (esd->langDesc) {
+ u32 i=0;
+ char lan[4], *szLang;
+ lan[0] = esd->langDesc->langCode>>16;
+ lan[1] = (esd->langDesc->langCode>>8)&0xFF;
+ lan[2] = (esd->langDesc->langCode)&0xFF;
+ lan[3] = 0;
+
+ if ((lan[0]=='u') && (lan[1]=='n') && (lan[2]=='d')) szLang = "Undetermined";
+ else {
+ szLang = lan;
+ while (GF_ISO639_Lang[i]) {
+ if (GF_ISO639_Lang[i+2][0] && strstr(GF_ISO639_Lang[i+1], lan)) {
+ szLang = (char*) GF_ISO639_Lang[i];
+ break;
+ }
+ i+=3;
+ }
+ }
+ fprintf(stdout, "\tStream Language: %s\n", szLang);
+ }
+ }
+ fprintf(stdout, "\n");
+ /*check OCI (not everything interests us) - FIXME: support for unicode*/
+ count = gf_list_count(odi.od->OCIDescriptors);
+ if (count) {
+ fprintf(stdout, "%d Object Content Information descriptors in OD\n", count);
+ for (i=0; i<count; i++) {
+ GF_Descriptor *desc = (GF_Descriptor *) gf_list_get(odi.od->OCIDescriptors, i);
+ switch (desc->tag) {
+ case GF_ODF_SEGMENT_TAG:
+ {
+ GF_Segment *sd = (GF_Segment *) desc;
+ fprintf(stdout, "Segment Descriptor: Name: %s - start time %g sec - duration %g sec\n", sd->SegmentName, sd->startTime, sd->Duration);
+ }
+ break;
+ case GF_ODF_CC_NAME_TAG:
+ {
+ GF_CC_Name *ccn = (GF_CC_Name *)desc;
+ fprintf(stdout, "Content Creators:\n");
+ for (j=0; j<gf_list_count(ccn->ContentCreators); j++) {
+ GF_ContentCreatorInfo *ci = (GF_ContentCreatorInfo *) gf_list_get(ccn->ContentCreators, j);
+ if (!ci->isUTF8) continue;
+ fprintf(stdout, "\t%s\n", ci->contentCreatorName);
+ }
+ }
+ break;
+
+ case GF_ODF_SHORT_TEXT_TAG:
+ {
+ GF_ShortTextual *std = (GF_ShortTextual *)desc;
+ fprintf(stdout, "Description:\n\tEvent: %s\n\t%s\n", std->eventName, std->eventText);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ fprintf(stdout, "\n");
+ }
+
+ switch (odi.status) {
+ case 0: fprintf(stdout, "Stopped - "); break;
+ case 1: fprintf(stdout, "Playing - "); break;
+ case 2: fprintf(stdout, "Paused - "); break;
+ case 3: fprintf(stdout, "Not setup yet\n"); return;
+ default: fprintf(stdout, "Setup Failed\n"); return;
+ }
+ if (odi.buffer>=0) fprintf(stdout, "Buffer: %d ms - ", odi.buffer);
+ else fprintf(stdout, "Not buffering - ");
+ fprintf(stdout, "Clock drift: %d ms\n", odi.clock_drift);
+ if (odi.db_unit_count) fprintf(stdout, "%d AU in DB\n", odi.db_unit_count);
+ if (odi.cb_max_count) fprintf(stdout, "Composition Buffer: %d CU (%d max)\n", odi.cb_unit_count, odi.cb_max_count);
+ fprintf(stdout, "\n");
+
+ if (odi.owns_service) {
+ const char *url;
+ u32 done, total, bps;
+ d_enum = 0;
+ while (gf_term_get_download_info(term, odm, &d_enum, &url, NULL, &done, &total, &bps)) {
+ if (d_enum==1) fprintf(stdout, "Current Downloads in service:\n");
+ if (done && total) {
+ fprintf(stdout, "%s: %d / %d bytes (%.2f %%) - %.2f kBps\n", url, done, total, (100.0f*done)/total, ((Float)bps)/1024.0f);
+ } else {
+ fprintf(stdout, "%s: %.2f kbps\n", url, ((Float)8*bps)/1024.0f);
+ }
+ }
+ if (!d_enum) fprintf(stdout, "No Downloads in service\n");
+ fprintf(stdout, "\n");
+ }
+ d_enum = 0;
+ while (gf_term_get_channel_net_info(term, odm, &d_enum, &id, &com, &e)) {
+ if (e) continue;
+ if (!com.bw_down && !com.bw_up) continue;
+
+ fprintf(stdout, "Stream ID %d statistics:\n", id);
+ if (com.multiplex_port) {
+ fprintf(stdout, "\tMultiplex Port %d - multiplex ID %d\n", com.multiplex_port, com.port);
+ } else {
+ fprintf(stdout, "\tPort %d\n", com.port);
+ }
+ fprintf(stdout, "\tPacket Loss Percentage: %.4f\n", com.pck_loss_percentage);
+ fprintf(stdout, "\tDown Bandwidth: %d bps\n", com.bw_down);
+ if (com.bw_up) fprintf(stdout, "\tUp Bandwidth: %d bps\n", com.bw_up);
+ if (com.ctrl_port) {
+ if (com.multiplex_port) {
+ fprintf(stdout, "\tControl Multiplex Port: %d - Control Multiplex ID %d\n", com.multiplex_port, com.ctrl_port);
+ } else {
+ fprintf(stdout, "\tControl Port: %d\n", com.ctrl_port);
+ }
+ fprintf(stdout, "\tDown Bandwidth: %d bps\n", com.ctrl_bw_down);
+ fprintf(stdout, "\tUp Bandwidth: %d bps\n", com.ctrl_bw_up);
+ }
+ fprintf(stdout, "\n");
+ }
+}
+
+void PrintODTiming(GF_Terminal *term, GF_ObjectManager *odm)
+{
+ GF_MediaInfo odi;
+ if (!odm) return;
+
+ if (gf_term_get_object_info(term, odm, &odi) != GF_OK) return;
+ if (!odi.od) {
+ fprintf(stdout, "Service not attached\n");
+ return;
+ }
+
+ fprintf(stdout, "OD %d: ", odi.od->objectDescriptorID);
+ switch (odi.status) {
+ case 1: fprintf(stdout, "Playing - "); break;
+ case 2: fprintf(stdout, "Paused - "); break;
+ default: fprintf(stdout, "Stopped - "); break;
+ }
+ if (odi.buffer>=0) fprintf(stdout, "Buffer: %d ms - ", odi.buffer);
+ else fprintf(stdout, "Not buffering - ");
+ fprintf(stdout, "Clock drift: %d ms", odi.clock_drift);
+ fprintf(stdout, " - time: ");
+ PrintTime((u32) (odi.current_time*1000));
+ fprintf(stdout, "\n");
+}
+
+void PrintODBuffer(GF_Terminal *term, GF_ObjectManager *odm)
+{
+ Float avg_dec_time;
+ GF_MediaInfo odi;
+ if (!odm) return;
+
+ if (gf_term_get_object_info(term, odm, &odi) != GF_OK) return;
+ if (!odi.od) {
+ fprintf(stdout, "Service not attached\n");
+ return;
+ }
+
+ fprintf(stdout, "OD %d: ", odi.od->objectDescriptorID);
+ switch (odi.status) {
+ case 1: fprintf(stdout, "Playing"); break;
+ case 2: fprintf(stdout, "Paused"); break;
+ default: fprintf(stdout, "Stopped"); break;
+ }
+ if (odi.buffer>=0) fprintf(stdout, " - Buffer: %d ms", odi.buffer);
+ if (odi.db_unit_count) fprintf(stdout, " - DB: %d AU", odi.db_unit_count);
+ if (odi.cb_max_count) fprintf(stdout, " - CB: %d/%d CUs", odi.cb_unit_count, odi.cb_max_count);
+
+ fprintf(stdout, "\n * %d decoded frames - %d dropped frames\n", odi.nb_dec_frames, odi.nb_droped);
+ avg_dec_time = 0;
+ if (odi.nb_dec_frames) { avg_dec_time = (Float) odi.total_dec_time; avg_dec_time /= odi.nb_dec_frames; }
+ fprintf(stdout, " * Avg Bitrate %d kbps (%d max) - Avg Decoding Time %.2f ms (%d max)\n",
+ (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time);
+}
+
+void ViewODs(GF_Terminal *term, Bool show_timing)
+{
+ u32 i, count;
+ GF_ObjectManager *odm, *root_odm = gf_term_get_root_object(term);
+ if (!root_odm) return;
+
+ if (show_timing) {
+ PrintODTiming(term, root_odm);
+ } else {
+ PrintODBuffer(term, root_odm);
+ }
+ count = gf_term_get_object_count(term, root_odm);
+ for (i=0; i<count; i++) {
+ odm = gf_term_get_object(term, root_odm, i);
+ if (show_timing) {
+ PrintODTiming(term, odm);
+ } else {
+ PrintODBuffer(term, odm);
+ }
+ }
+ fprintf(stdout, "\n");
+}
+
+
+void PrintGPACConfig()
+{
+ u32 i, j, cfg_count, key_count;
+ char szName[200];
+ char *secName = NULL;
+
+ fprintf(stdout, "Enter section name (\"*\" for complete dump):\n");
+ scanf("%s", szName);
+ if (strcmp(szName, "*")) secName = szName;
+
+ fprintf(stdout, "\n\n*** GPAC Configuration ***\n\n");
+
+ cfg_count = gf_cfg_get_section_count(cfg_file);
+ for (i=0; i<cfg_count; i++) {
+ const char *sec = gf_cfg_get_section_name(cfg_file, i);
+ if (secName) {
+ if (stricmp(sec, secName)) continue;
+ } else {
+ if (!stricmp(sec, "General")) continue;
+ if (!stricmp(sec, "MimeTypes")) continue;
+ if (!stricmp(sec, "RecentFiles")) continue;
+ }
+ fprintf(stdout, "[%s]\n", sec);
+ key_count = gf_cfg_get_key_count(cfg_file, sec);
+ for (j=0; j<key_count; j++) {
+ const char *key = gf_cfg_get_key_name(cfg_file, sec, j);
+ const char *val = gf_cfg_get_key(cfg_file, sec, key);
+ fprintf(stdout, "%s=%s\n", key, val);
+ }
+ fprintf(stdout, "\n");
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+</dict>
+</plist>
ifce = (GF_BaseDecoder *) gf_modules_load_interface(gpac->m_user.modules, i, GF_MEDIA_DECODER_INTERFACE);
if (!ifce) continue;
- if (ifce->CanHandleStream(ifce, GF_STREAM_AUDIO, 0, NULL, 0, 0)) {
+ if (ifce->CanHandleStream(ifce, GF_STREAM_AUDIO, NULL, 0)) {
if (sOpt && !stricmp(ifce->module_name, sOpt)) select = to_sel;
m_Audio.AddString(ifce->module_name);
to_sel++;
ifce = (GF_BaseDecoder *) gf_modules_load_interface(gpac->m_user.modules, i, GF_MEDIA_DECODER_INTERFACE);
if (!ifce) continue;
- if (ifce->CanHandleStream(ifce, GF_STREAM_VISUAL, 0, NULL, 0, 0)) {
+ if (ifce->CanHandleStream(ifce, GF_STREAM_VISUAL, NULL, 0)) {
if (sOpt && !stricmp(ifce->module_name, sOpt)) select = to_sel;
m_Video.AddString(ifce->module_name);
to_sel++;
sOpt = gf_cfg_get_key(gpac->m_user.config, "Video", "SwitchResolution");
m_SwitchRes.SetCheck(sOpt && !stricmp(sOpt, "yes") ? 1 : 0);
- sOpt = gf_cfg_get_key(gpac->m_user.config, "Video", "UseHardwareMemory");
- m_UseHWMemory.SetCheck(sOpt && !stricmp(sOpt, "yes") ? 1 : 0);
+ sOpt = gf_cfg_get_key(gpac->m_user.config, "Video", "HardwareMemory");
+ m_UseHWMemory.SetCheck(sOpt && !stricmp(sOpt, "Always") ? 1 : 0);
u32 count = gf_modules_get_count(gpac->m_user.modules);
char str[50];
gf_cfg_set_key(gpac->m_user.config, "Video", "SwitchResolution", m_SwitchRes.GetCheck() ? "yes" : "no");
- gf_cfg_set_key(gpac->m_user.config, "Video", "UseHardwareMemory", m_UseHWMemory.GetCheck() ? "yes" : "no");
+ gf_cfg_set_key(gpac->m_user.config, "Video", "HardwareMemory", m_UseHWMemory.GetCheck() ? "Always" : "Auto");
m_Videos.GetWindowText(str, 50);
gf_cfg_set_key(gpac->m_user.config, "Video", "DriverName", str);
}
}
-u32 get_sys_col(int idx)
-{
- u32 res;
- DWORD val = GetSysColor(idx);
- res = (val)&0xFF; res<<=8;
- res |= (val>>8)&0xFF; res<<=8;
- res |= (val>>16)&0xFF;
- return res;
-}
-
-static void Osmo4_progress_cbk(void *usr, char *title, u64 done, u64 total)
+static void Osmo4_progress_cbk(const void *usr, const char *title, u64 done, u64 total)
{
if (!total) return;
CMainFrame *pFrame = (CMainFrame *) ((Osmo4 *) usr)->m_pMainWnd;
return passdlg.GetPassword(evt->auth.site_url, evt->auth.user, evt->auth.password);
}
- case GF_EVENT_SYS_COLORS:
- evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
- evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION);
- evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE);
- evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND);
- evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE);
- evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT);
- evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW);
- evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT);
- evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT);
- evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT);
- evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT);
- evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT);
- evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER);
- evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION);
- evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT);
- evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK);
- evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT);
- evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU);
- evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT);
- evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR);
- evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW);
- evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE);
- evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT);
- evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT);
- evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW);
- evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW);
- evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME);
- evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT);
- return 1;
}
return 0;
}
for (i=0; i<count; i++) {
ifce = (GF_BaseDecoder *) gf_modules_load_interface(gpac->m_user.modules, i, GF_MEDIA_DECODER_INTERFACE);
if (!ifce) continue;
- if (ifce->CanHandleStream(ifce, GF_STREAM_AUDIO, 0, NULL, 0, 0)) {
+ if (ifce->CanHandleStream(ifce, GF_STREAM_AUDIO, NULL, 0)) {
if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel;
TCHAR wzTmp[500];
CE_CharToWide((char *) ifce->module_name, (u16 *)wzTmp);
for (i=0; i<count; i++) {
ifce = (GF_BaseDecoder *) gf_modules_load_interface(gpac->m_user.modules, i, GF_MEDIA_DECODER_INTERFACE);
if (!ifce) continue;
- if (ifce->CanHandleStream(ifce, GF_STREAM_VISUAL, 0, NULL, 0, 0)) {
+ if (ifce->CanHandleStream(ifce, GF_STREAM_VISUAL, NULL, 0)) {
if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel;
TCHAR wzTmp[500];
CE_CharToWide((char *) ifce->module_name, (u16 *)wzTmp);
strcpy((char *) config_path, "\\Windows");
gf_cfg_set_key(m_user.config, "FontEngine", "FontDirectory", (const char *) config_path);
}
- /*work with iPaq's default fonts ...*/
- str = gf_cfg_get_key(m_user.config, "FontEngine", "FontSerif");
- if (!str) gf_cfg_set_key(m_user.config, "FontEngine", "FontSerif", "Tahoma");
- str = gf_cfg_get_key(m_user.config, "FontEngine", "FontSans");
- if (!str) gf_cfg_set_key(m_user.config, "FontEngine", "FontSans", "Frutiger");
- str = gf_cfg_get_key(m_user.config, "FontEngine", "FontFixed");
- if (!str) gf_cfg_set_key(m_user.config, "FontEngine", "FontFixed", "Courier New");
/*check video driver, if none or raw_out use dx_hw by default*/
str = gf_cfg_get_key(m_user.config, "Video", "DriverName");
vpath %.cpp $(SRC_PATH)/applications/osmo4_wx
-CFLAGS= $(CPPFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(CPPFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
PROG=Osmo4
endif
+#3 - spidermonkey support
+ifeq ($(CONFIG_JS),no)
+else
+SCENEGRAPH_CFLAGS+=$(JS_FLAGS)
+ifeq ($(CONFIG_JS),local)
+NEED_LOCAL_LIB="yes"
+endif
+LDFLAGS+=$(JS_LIBS)
+endif
+
SRCS := $(OBJS:.o=.cpp)
for (i=0; i<count; i++) {
ifc_d = (GF_BaseDecoder *) gf_modules_load_interface(m_pApp->m_user.modules, i, GF_MEDIA_DECODER_INTERFACE);
if (!ifc_d) continue;
- if (ifc_d->CanHandleStream(ifc_d, GF_STREAM_AUDIO, 0, NULL, 0, 0)) {
+ if (ifc_d->CanHandleStream(ifc_d, GF_STREAM_AUDIO, NULL, 0)) {
if (sOpt && !stricmp(ifc_d->module_name, sOpt)) select = to_sel;
m_decaudio->Append(wxString(ifc_d->module_name, wxConvUTF8) );
to_sel++;
for (i=0; i<count; i++) {
ifc_d = (GF_BaseDecoder *) gf_modules_load_interface(m_pApp->m_user.modules, i, GF_MEDIA_DECODER_INTERFACE);
if (!ifc_d) continue;
- if (ifc_d->CanHandleStream(ifc_d, GF_STREAM_VISUAL, 0, NULL, 0, 0)) {
+ if (ifc_d->CanHandleStream(ifc_d, GF_STREAM_VISUAL, NULL, 0)) {
if (sOpt && !stricmp(ifc_d->module_name, sOpt)) select = to_sel;
m_decvideo->Append(wxString(ifc_d->module_name, wxConvUTF8) );
to_sel++;
#include "wxOsmo4.h"
#include "wxGPACControl.h"
#include "fileprops.h"
-#include "wx/image.h"
+#include <wx/image.h>
#include <gpac/modules/service.h>
#include <gpac/network.h>
#include <gpac/constants.h>
#include "osmo4.xpm"
#include <wx/dnd.h>
+
+
+
+
+
#include <wx/filename.h>
#include <wx/clipbrd.h>
{
const char *sOpt = gf_cfg_get_key(cfg, "General", "Browser");
if (sOpt) return wxString(sOpt, wxConvUTF8);
+ return wxEmptyString;
+/*
#ifdef __WXMAC__
return wxT("safari");
#else
#else
return wxT("mozilla");
#endif
-#endif
+#endif*/
}
return evt;
}
-
+#include <wx/wx.h>
/*open file dlg*/
BEGIN_EVENT_TABLE(OpenURLDlg, wxDialog)
}
#endif
-static void wxOsmo4_progress_cbk(void *usr, char *title, u64 done, u64 total)
+static void wxOsmo4_progress_cbk(const void *usr, const char *title, u64 done, u64 total)
{
if (!total) return;
wxOsmo4Frame *app = (wxOsmo4Frame *)usr;
break;
case GF_EVENT_PROGRESS:
{
- char *sTitle;
+ const char *sTitle;
if (evt->progress.progress_type==0) sTitle = (char *)"Buffer";
else if (evt->progress.progress_type==1) sTitle = (char *)"Download";
else if (evt->progress.progress_type==2) sTitle = (char *)"Import";
#endif
}
break;
+ case GF_EVENT_AUTHORIZATION:
+ {
+ wxGPACEvent wxevt(app);
+ wxTextEntryDialog user_d (0,
+ wxT("Please set the user name for connection"),
+ wxString(evt->auth.site_url, wxConvUTF8),
+ wxString(evt->auth.user, wxConvUTF8));
+ if (user_d.ShowModal() != wxID_OK)
+ return 0;
+ strncpy(evt->auth.user, user_d.GetValue().mb_str(wxConvUTF8), 50);
+ wxPasswordEntryDialog passwd_d(0,
+ wxT("Please enter password"),
+ wxString(evt->auth.site_url, wxConvUTF8),
+ wxString(evt->auth.password, wxConvUTF8));
+ if (passwd_d.ShowModal() != wxID_OK)
+ return 0;
+ strncpy(evt->auth.password, passwd_d.GetValue().mb_str(wxConvUTF8), 50);
+ return 1;
+ }
case GF_EVENT_SYS_COLORS:
#ifdef WIN32
evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
gf_cfg_set_key(m_user.config, "Compositor", "ScalableZoom", "no");
#else
gf_cfg_set_key(m_user.config, "FontEngine", "FontDirectory", "/usr/share/fonts/truetype/");
- /*these fonts seems installed by default on many systems...*/
- gf_cfg_set_key(m_user.config, "FontEngine", "FontSerif", "Bitstream Vera Serif");
- gf_cfg_set_key(m_user.config, "FontEngine", "FontSans", "Bitstream Vera Sans");
- gf_cfg_set_key(m_user.config, "FontEngine", "FontFixed", "Bitstream Vera Monospace");
-
gf_cfg_set_key(m_user.config, "General", "CacheDirectory", "/tmp");
gf_cfg_set_key(m_user.config, "Video", "DriverName", "X11 Video Output");
return;
}
cmd = get_pref_browser(m_user.config);
- cmd += wxT(" ");
- cmd += event.to_url;
- wxExecute(cmd);
+ if (cmd.IsEmpty()){
+ cmd += wxT(" ");
+ cmd += event.to_url;
+ wxExecute(cmd);
+ } else {
+ wxLaunchDefaultBrowser(event.to_url);
+ }
break;
case GF_EVENT_QUIT:
Close(TRUE);
wxMenu *popup = new wxMenu();
for (u32 i=0; i<10; i++) {
- if (start - i < 0) break;
+ if (i > start) break;
if (start - i >= count) break;
PLEntry *ple = (PLEntry *) gf_list_get(m_pPlayList->m_entries, start - i);
popup->Append(ID_NAV_PREV_0 + i, wxString(ple->m_disp_name, wxConvUTF8) );
switch (info.od_type) {
case GF_STREAM_AUDIO:
pMenu = sel_menu->FindItemByPosition(0)->GetSubMenu();
- if (!info.owns_service) sprintf(szLabel, "Audio #%ld", pMenu->GetMenuItemCount() + 1);
+ if (!info.owns_service) sprintf(szLabel, "Audio #"LLU, (u64)pMenu->GetMenuItemCount() + 1);
pMenu->AppendCheckItem(ID_SELSTREAM_0 +i, wxString(szLabel, wxConvUTF8));
break;
case GF_STREAM_VISUAL:
pMenu = sel_menu->FindItemByPosition(1)->GetSubMenu();
- if (!info.owns_service) sprintf(szLabel, "Video #%ld", pMenu->GetMenuItemCount() + 1);
+ if (!info.owns_service) sprintf(szLabel, "Video #"LLU, (u64)pMenu->GetMenuItemCount() + 1);
pMenu->AppendCheckItem(ID_SELSTREAM_0 +i, wxString(szLabel, wxConvUTF8));
break;
case GF_STREAM_TEXT:
nb_subs ++;
pMenu = sel_menu->FindItemByPosition(2)->GetSubMenu();
- if (!info.owns_service) sprintf(szLabel, "Subtitle #%ld", pMenu->GetMenuItemCount() + 1);
+ if (!info.owns_service) sprintf(szLabel, "Subtitle #"LLU, (u64)pMenu->GetMenuItemCount() + 1);
pMenu->AppendCheckItem(ID_SELSTREAM_0 +i, wxString(szLabel, wxConvUTF8));
break;
}
user.opaque = user.modules;
user.os_window_handler = g_hwnd_disp;
#ifdef TERM_NOT_THREADED
- user.init_flags = GF_TERM_NO_THREAD | GF_TERM_NO_REGULATION;
+ user.init_flags = GF_TERM_NO_DECODER_THREAD | GF_TERM_NO_COMPOSITOR_THREAD | GF_TERM_NO_REGULATION;
#endif
term = gf_term_new(&user);
endif
endif
-CFLAGS=$(CPPFLAGS) $(XUL_CFLAGS) -I$(SRC_PATH)/include
+CFLAGS=$(CPPFLAGS) $(XUL_CFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
ifeq ($(CONFIG_WIN32),yes)
windres osmozilla.rc osmoz.o
$(CXX) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) osmoz.o $(LINKLIBS)
- cp $(SRC_PATH)/applications/osmozilla/nsIOsmozilla.xpt_w32 ../../bin/gcc/nposmozilla.xpt
+ cp "$(SRC_PATH)/applications/osmozilla/nsIOsmozilla.xpt_w32" ../../bin/gcc/nposmozilla.xpt
chmod +w ../../bin/gcc/nposmozilla.xpt
else
$(CXX) $(SHFLAGS) $(LDFLAGS) $(OBJS) $(LINKLIBS) -o ../../bin/gcc/$@
- cp $(SRC_PATH)/applications/osmozilla/nsIOsmozilla.xpt_linux ../../bin/gcc/nposmozilla.xpt
+ cp "$(SRC_PATH)/applications/osmozilla/nsIOsmozilla.xpt_linux" ../../bin/gcc/nposmozilla.xpt
chmod +w ../../bin/gcc/nposmozilla.xpt
endif
@echo $(USER_ROOT)
NPError nsOsmozillaInstance::SetWindow(NPWindow* aWindow)
{
+ const char *gui;
if (mInitialized) {
m_width = aWindow->width;
m_height = aWindow->height;
m_user.os_window_handler = aWindow->window;
#endif
-// m_user.init_flags = GF_TERM_DRAW_FRAME;
m_prev_time = 0;
m_url_changed = 0;
if (!m_szURL || !m_bAutoStart) return TRUE;
/*connect from 0 and pause if not autoplay*/
- gf_term_connect(m_term, m_szURL);
+ gui = gf_cfg_get_key(m_user.config, "General", "StartupFile");
+ if (gui) {
+ gf_cfg_set_key(m_user.config, "Temp", "BrowserMode", "yes");
+ gf_cfg_set_key(m_user.config, "Temp", "GUIStartupFile", m_szURL);
+ gf_term_connect(m_term, gui);
+ } else {
+ gf_term_connect(m_term, m_szURL);
+ }
+
return TRUE;
}
m_szURL = gf_strdup((const char *)stream->url);
/*connect from 0 and pause if not autoplay*/
- if (m_bAutoStart)
- gf_term_connect(m_term, m_szURL);
+ if (m_bAutoStart) {
+ const char *gui = gf_cfg_get_key(m_user.config, "General", "StartupFile");
+ if (gui) {
+ gf_cfg_set_key(m_user.config, "Temp", "BrowserMode", "yes");
+ gf_cfg_set_key(m_user.config, "Temp", "GUIStartupFile", m_szURL);
+ gf_term_connect(m_term, gui);
+ } else {
+ gf_term_connect(m_term, m_szURL);
+ }
+ }
/*we handle data fetching ourselves*/
*stype = NP_SEEK;
vpath %.c $(SRC_PATH)/applications/testapps/broadcaster
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
SOURCES=
APPNAME=broadcaster
vpath %.c $(SRC_PATH)/applications/testapps/loadcompare
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
+++ /dev/null
-include ../../../config.mak
-
-vpath %.c $(SRC_PATH)/applications/testapps/mp42ts
-
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
-
-ifeq ($(DEBUGBUILD), yes)
-CFLAGS+=-g
-LDFLAGS+=-g
-endif
-
-ifeq ($(GPROFBUILD), yes)
-CFLAGS+=-pg
-LDFLAGS+=-pg
-endif
-
-#common obj
-OBJS= main.o
-
-LINKFLAGS=-L../../../bin/gcc
-ifeq ($(CONFIG_WIN32),yes)
-EXE=.exe
-PROG=mp42ts$(EXE)
-#LINKFLAGS+=-lgpac_static -lz $(EXTRALIBS)
-LINKFLAGS+=-lgpac
-else
-EXT=
-PROG=mp42ts
-#LINKFLAGS+=-lgpac_static $(EXTRALIBS) $(GPAC_SH_FLAGS) -lz $(OGL_LIBS)
-LINKFLAGS+=-lgpac $(OGL_LIBS)
-endif
-
-SRCS := $(OBJS:.o=.c)
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
- $(CC) $(LDFLAGS) -o ../../../bin/gcc/$@ $(OBJS) $(LINKFLAGS)
-
-
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-
-clean:
- rm -f $(OBJS) ../../../bin/gcc/$(PROG)
-
-dep: depend
-
-depend:
- rm -f .depend
- $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
-
-distclean: clean
- rm -f Makefile.bak .depend
-
-
-
-# include dependency files if they exist
-#
-ifneq ($(wildcard .depend),)
-include .depend
-endif
+++ /dev/null
-/*
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) ENST 2000-200X
- * All rights reserved
- *
- * This file is part of GPAC / mp4-to-ts (mp42ts) application
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <gpac/media_tools.h>
-#include <gpac/constants.h>
-#include <gpac/base_coding.h>
-#include <gpac/ietf.h>
-#include <gpac/scene_engine.h>
-#include <gpac/mpegts.h>
-
-
-#define MP42TS_PRINT_FREQ 634 /*refresh printed info every CLOCK_REFRESH ms*/
-
-
-static GFINLINE void usage()
-{
- fprintf(stderr, "usage: mp42ts {rate {prog}*} [mpeg4-carousel] [mpeg4] [time] [src] dst\n"
- "\n"
- "-rate=R specifies target rate in kbps of the multiplex\n"
- " If not set, transport stream will be of variable bitrate\n"
- "-prog=filename specifies an input file used for a TS service\n"
- " * currently only supports ISO files and SDP files\n"
- " * option can be used several times, once for each program\n"
- "-mpeg4-carousel=n carousel period in ms\n"
- "-mpeg4 forces usage of MPEG-4 signaling (use of IOD and SL Config)\n"
- "-time=n request the program to stop after n ms\n"
- "-src=filename update file: must be either an .sdp or a .bt file\n"
- "\n"
- "dst can be either a file, an RTP or a UDP destination (unicast/multicast)\n"
- );
-}
-
-
-
-
-#define MAX_MUX_SRC_PROG 100
-typedef struct
-{
- GF_ISOFile *mp4;
- u32 nb_streams, pcr_idx;
- GF_ESInterface streams[40];
- GF_Descriptor *iod;
- GF_SceneEngine *seng;
- GF_Thread *th;
- char *src_name;
- u32 rate;
- Bool repeat;
-} M2TSProgram;
-
-typedef struct
-{
- GF_ISOFile *mp4;
- u32 track, sample_number, sample_count;
- GF_ISOSample *sample;
- /*refresh rate for images*/
- u32 image_repeat_ms, nb_repeat_last;
- void *dsi;
- u32 dsi_size;
- u32 nalu_size;
- void *dsi_and_rap;
- Bool loop;
- u64 ts_offset;
-} GF_ESIMP4;
-
-typedef struct
-{
- u32 carousel_period, ts_delta;
- u16 aggregate_on_stream;
- Bool adjust_carousel_time;
- Bool discard;
- Bool rap;
- Bool critical;
- Bool vers_inc;
-} GF_ESIStream;
-
-/*output types*/
-enum
-{
- GF_MP42TS_FILE_OUTPUT, /*open mpeg2ts file*/
- GF_MP42TS_UDP_OUTPUT, /*open udp socket*/
- GF_MP42TS_RTP_OUTPUT, /*open rtp socket*/
-};
-
-static GF_Err mp4_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
-{
- GF_ESIMP4 *priv = (GF_ESIMP4 *)ifce->input_udta;
- if (!priv) return GF_BAD_PARAM;
-
- switch (act_type) {
- case GF_ESI_INPUT_DATA_FLUSH:
- {
- GF_ESIPacket pck;
- if (!priv->sample)
- priv->sample = gf_isom_get_sample(priv->mp4, priv->track, priv->sample_number+1, NULL);
-
- if (!priv->sample) return GF_IO_ERR;
-
- pck.flags = 0;
- pck.flags = GF_ESI_DATA_AU_START | GF_ESI_DATA_HAS_CTS;
- if (priv->sample->IsRAP) pck.flags |= GF_ESI_DATA_AU_RAP;
- pck.cts = priv->sample->DTS + priv->ts_offset;
-
- if (priv->nb_repeat_last) {
- pck.cts += priv->nb_repeat_last*ifce->timescale * priv->image_repeat_ms / 1000;
- }
-
- if (priv->sample->CTS_Offset) {
- pck.dts = pck.cts;
- pck.cts += priv->sample->CTS_Offset;
- pck.flags |= GF_ESI_DATA_HAS_DTS;
- }
-
- if (priv->sample->IsRAP && priv->dsi) {
- pck.data = priv->dsi;
- pck.data_len = priv->dsi_size;
- ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
- pck.flags = 0;
- }
- if (priv->nalu_size) {
- u32 remain = priv->sample->dataLength;
- char *ptr = priv->sample->data;
- u32 v, size;
- char sc[4];
- sc[0] = sc[1] = sc[2] = 0; sc[3] = 1;
-
- while (remain) {
- size = 0;
- v = priv->nalu_size;
- while (v) {
- size |= (u8) *ptr;
- ptr++;
- remain--;
- v-=1;
- if (v) size<<=8;
- }
- remain -= size;
-
- pck.data = sc;
- pck.data_len = 4;
- ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
- pck.flags &= ~GF_ESI_DATA_AU_START;
-
- if (!remain) pck.flags |= GF_ESI_DATA_AU_END;
-
- pck.data = ptr;
- pck.data_len = size;
- ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
- ptr += size;
- }
-
- } else {
- pck.flags |= GF_ESI_DATA_AU_END;
- pck.data = priv->sample->data;
- pck.data_len = priv->sample->dataLength;
- ifce->output_ctrl(ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
- }
-
- gf_isom_sample_del(&priv->sample);
- priv->sample_number++;
- if (priv->sample_number==priv->sample_count) {
- if (priv->loop) {
- Double scale;
- u64 duration;
- /*increment ts offset*/
- scale = gf_isom_get_media_timescale(priv->mp4, priv->track);
- scale /= gf_isom_get_timescale(priv->mp4);
- duration = (u64) (gf_isom_get_duration(priv->mp4) * scale);
- priv->ts_offset += duration;
- priv->sample_number = 0;
- }
- else if (priv->image_repeat_ms) {
- priv->nb_repeat_last++;
- priv->sample_number--;
- } else {
- ifce->caps |= GF_ESI_STREAM_IS_OVER;
- }
- }
- }
- return GF_OK;
-
- case GF_ESI_INPUT_DESTROY:
- if (priv->dsi) gf_free(priv->dsi);
- if (ifce->decoder_config) {
- gf_free(ifce->decoder_config);
- ifce->decoder_config = NULL;
- }
- gf_free(priv);
- ifce->input_udta = NULL;
- return GF_OK;
- default:
- return GF_BAD_PARAM;
- }
-}
-
-static void fill_isom_es_ifce(GF_ESInterface *ifce, GF_ISOFile *mp4, u32 track_num)
-{
- GF_ESIMP4 *priv;
- char _lan[4];
- GF_DecoderConfig *dcd;
- u64 avg_rate, duration;
-
- GF_SAFEALLOC(priv, GF_ESIMP4);
-
- priv->mp4 = mp4;
- priv->track = track_num;
- priv->loop = 1;
- priv->sample_count = gf_isom_get_sample_count(mp4, track_num);
-
- memset(ifce, 0, sizeof(GF_ESInterface));
- ifce->stream_id = gf_isom_get_track_id(mp4, track_num);
- dcd = gf_isom_get_decoder_config(mp4, track_num, 1);
- ifce->stream_type = dcd->streamType;
- ifce->object_type_indication = dcd->objectTypeIndication;
- if (dcd->decoderSpecificInfo && dcd->decoderSpecificInfo->dataLength) {
- switch (dcd->objectTypeIndication) {
- case GPAC_OTI_AUDIO_AAC_MPEG4:
- ifce->decoder_config = gf_malloc(sizeof(char)*dcd->decoderSpecificInfo->dataLength);
- ifce->decoder_config_size = dcd->decoderSpecificInfo->dataLength;
- memcpy(ifce->decoder_config, dcd->decoderSpecificInfo->data, dcd->decoderSpecificInfo->dataLength);
- break;
- case GPAC_OTI_VIDEO_MPEG4_PART2:
- priv->dsi = gf_malloc(sizeof(char)*dcd->decoderSpecificInfo->dataLength);
- priv->dsi_size = dcd->decoderSpecificInfo->dataLength;
- memcpy(priv->dsi, dcd->decoderSpecificInfo->data, dcd->decoderSpecificInfo->dataLength);
- break;
- case GPAC_OTI_VIDEO_AVC:
- {
-#ifndef GPAC_DISABLE_AV_PARSERS
- GF_AVCConfigSlot *slc;
- u32 i;
- GF_BitStream *bs;
- GF_AVCConfig *avccfg = gf_isom_avc_config_get(mp4, track_num, 1);
- priv->nalu_size = avccfg->nal_unit_size;
- bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
- for (i=0; i<gf_list_count(avccfg->sequenceParameterSets);i++) {
- slc = gf_list_get(avccfg->sequenceParameterSets, i);
- gf_bs_write_u32(bs, 1);
- gf_bs_write_data(bs, slc->data, slc->size);
- }
- for (i=0; i<gf_list_count(avccfg->pictureParameterSets);i++) {
- slc = gf_list_get(avccfg->pictureParameterSets, i);
- gf_bs_write_u32(bs, 1);
- gf_bs_write_data(bs, slc->data, slc->size);
- }
- gf_bs_get_content(bs, (char **) &priv->dsi, &priv->dsi_size);
- gf_bs_del(bs);
-#endif
- }
- break;
- }
- }
- gf_odf_desc_del((GF_Descriptor *)dcd);
- gf_isom_get_media_language(mp4, track_num, _lan);
- ifce->lang = GF_4CC(_lan[0],_lan[1],_lan[2],' ');
-
- ifce->timescale = gf_isom_get_media_timescale(mp4, track_num);
- ifce->duration = gf_isom_get_media_timescale(mp4, track_num);
- avg_rate = gf_isom_get_media_data_size(mp4, track_num);
- avg_rate *= ifce->timescale * 8;
- if (duration=gf_isom_get_media_duration(mp4, track_num))
- avg_rate /= duration;
-
- if (gf_isom_has_time_offset(mp4, track_num)) ifce->caps |= GF_ESI_SIGNAL_DTS;
-
- ifce->bit_rate = (u32) avg_rate;
- ifce->duration = (Double) (s64) gf_isom_get_media_duration(mp4, track_num);
- ifce->duration /= ifce->timescale;
-
- ifce->input_ctrl = mp4_input_ctrl;
- ifce->input_udta = priv;
-}
-
-
-static GF_Err seng_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
-{
- if (act_type==GF_ESI_INPUT_DESTROY) {
- //TODO: free my data
- ifce->input_udta = NULL;
- return GF_OK;
- }
-
- return GF_OK;
-}
-
-typedef struct
-{
- /*RTP channel*/
- GF_RTPChannel *rtp_ch;
-
- /*depacketizer*/
- GF_RTPDepacketizer *depacketizer;
-
- GF_ESIPacket pck;
-
- GF_ESInterface *ifce;
-
- Bool cat_dsi;
- void *dsi_and_rap;
-
- Bool use_carousel;
- u32 au_sn;
-} GF_ESIRTP;
-
-static GF_Err rtp_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
-{
- u32 size, PayloadStart;
- GF_Err e;
- GF_RTPHeader hdr;
- char buffer[8000];
- GF_ESIRTP *rtp = (GF_ESIRTP*)ifce->input_udta;
-
- if (!ifce->input_udta) return GF_BAD_PARAM;
-
- switch (act_type) {
- case GF_ESI_INPUT_DATA_FLUSH:
- /*flush rtp channel*/
- while (1) {
- size = gf_rtp_read_rtp(rtp->rtp_ch, buffer, 8000);
- if (!size) break;
- e = gf_rtp_decode_rtp(rtp->rtp_ch, buffer, size, &hdr, &PayloadStart);
- if (e) return e;
- gf_rtp_depacketizer_process(rtp->depacketizer, &hdr, buffer + PayloadStart, size - PayloadStart);
- }
- /*flush rtcp channel*/
- while (1) {
- size = gf_rtp_read_rtcp(rtp->rtp_ch, buffer, 8000);
- if (!size) break;
- e = gf_rtp_decode_rtcp(rtp->rtp_ch, buffer, size, NULL);
- if (e == GF_EOS) ifce->caps |= GF_ESI_STREAM_IS_OVER;
- }
- return GF_OK;
- case GF_ESI_INPUT_DESTROY:
- gf_rtp_depacketizer_del(rtp->depacketizer);
- if (rtp->dsi_and_rap) gf_free(rtp->dsi_and_rap);
- gf_rtp_del(rtp->rtp_ch);
- gf_free(rtp);
- ifce->input_udta = NULL;
- return GF_OK;
- }
- return GF_OK;
-}
-
-static GF_Err SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, u64 ts)
-{
- u32 i=0;
- //fprintf(stdout, "update: ESID=%d - size=%d - ts="LLD"\n", ESID, size, ts);
- if (calling_object) {
- M2TSProgram *prog = (M2TSProgram *)calling_object;
- while (i<prog->nb_streams){
- if (prog->streams[i].output_ctrl==NULL) {
- fprintf(stdout, "MULTIPLEX NOT YET CREATED\n");
- return GF_OK;
- }
- if (prog->streams[i].stream_id == ESID) {
- GF_ESIStream *priv = (GF_ESIStream *)prog->streams[i].input_udta;
- GF_ESIPacket pck;
- memset(&pck, 0, sizeof(GF_ESIPacket));
- pck.data = data;
- pck.data_len = size;
- pck.flags |= GF_ESI_DATA_HAS_CTS;
- pck.flags |= GF_ESI_DATA_AU_START;
- pck.flags |= GF_ESI_DATA_AU_END;
- if (priv->rap)
- pck.flags |= GF_ESI_DATA_AU_RAP;
- if (prog->repeat || !priv->vers_inc) {
- pck.flags |= GF_ESI_DATA_REPEAT;
- fprintf(stdout, "RAP carousel from scene engine sent: ESID=%d - size=%d - ts="LLD"\n", ESID, size, ts);
- } else {
- fprintf(stdout, "Update from scene engine sent: ESID=%d - size=%d - ts="LLD"\n", ESID, size, ts);
- }
- prog->streams[i].output_ctrl(&prog->streams[i], GF_ESI_OUTPUT_DATA_DISPATCH, &pck);
- return GF_OK;
- }
- i++;
- }
- }
- return GF_OK;
-}
-
-
-static volatile Bool run = 1;
-
-static void set_broadcast_params(M2TSProgram *prog, u16 esid, u32 period, u32 ts_delta, u16 aggregate_on_stream, Bool adjust_carousel_time, Bool force_rap, Bool aggregate_au, Bool discard_pending, Bool signal_rap, Bool signal_critical, Bool version_inc)
-{
- u32 i=0;
- GF_ESIStream *priv=NULL;
- GF_ESInterface *esi=NULL;
-
- /*locate our stream*/
- if (esid) {
- while (i<prog->nb_streams) {
- if (prog->streams[i].stream_id == esid){
- priv = (GF_ESIStream *)prog->streams[i].input_udta;
- esi = &prog->streams[i];
- break;
- }
- else{
- i++;
- }
- }
- /*TODO: stream not found*/
- }
-
- /*TODO - set/reset the ESID for the parsers*/
- if (!priv) return NULL;
-
- /*TODO - if discard is set, abort current carousel*/
- if (discard_pending) {
- }
-
- /*remember RAP flag*/
- priv->rap = signal_rap;
- priv->critical = signal_critical;
- priv->vers_inc = version_inc;
-
- priv->ts_delta = ts_delta;
- priv->adjust_carousel_time = adjust_carousel_time;
-
- /*change stream aggregation mode*/
- if ((aggregate_on_stream != (u16)-1) && (priv->aggregate_on_stream != aggregate_on_stream)) {
- gf_seng_enable_aggregation(prog->seng, esid, aggregate_on_stream);
- priv->aggregate_on_stream = aggregate_on_stream;
- }
- /*change stream aggregation mode*/
- if (priv->aggregate_on_stream==esi->stream_id) {
- if (priv->aggregate_on_stream && (period!=(u32)-1) && (esi->repeat_rate != period)) {
- esi->repeat_rate = period;
- }
- } else {
- esi->repeat_rate = 0;
- }
-
- return priv;
-}
-
-static Bool seng_output(void *param)
-{
- GF_Err e;
- u64 last_src_modif, mod_time;
- Bool has_carousel=0;
- M2TSProgram *prog = (M2TSProgram *)param;
- GF_SceneEngine *seng = prog->seng;
- Bool update_context=0;
- u32 i=0;
- Bool force_rap, adjust_carousel_time, discard_pending, signal_rap, signal_critical, version_inc, aggregate_au;
- u32 period, ts_delta;
- u16 es_id, aggregate_on_stream;
-
- if (prog->rate){
- has_carousel = 1;
- }
- gf_sleep(2000); /*TODO: events instead? What are we waiting for?*/
- gf_seng_encode_context(seng, SampleCallBack);
-
- last_src_modif = prog->src_name ? gf_file_modification_time(prog->src_name) : 0;
-
- while (run) {
- if (!gf_prompt_has_input()) {
- if (prog->src_name) {
- mod_time = gf_file_modification_time(prog->src_name);
- if (mod_time != last_src_modif) {
- FILE *srcf;
- char flag_buf[201], *flag;
- fprintf(stdout, "Update file modified - processing\n");
- last_src_modif = mod_time;
-
- srcf = fopen(prog->src_name, "rt");
- if (!srcf) continue;
-
- /*checks if we have a broadcast config*/
- fgets(flag_buf, 200, srcf);
- fclose(srcf);
-
- aggregate_au = force_rap = adjust_carousel_time = discard_pending = signal_rap = signal_critical = 0;
- version_inc = 1;
- period = -1;
- aggregate_on_stream = -1;
- ts_delta = 0;
- es_id = 0;
-
- /*find our keyword*/
- flag = strstr(flag_buf, "gpac_broadcast_config ");
- if (flag) {
- flag += strlen("gpac_broadcast_config ");
- /*move to next word*/
- while (flag && (flag[0]==' ')) flag++;
-
- while (1) {
- char *sep = strchr(flag, ' ');
- if (sep) sep[0] = 0;
- if (!strnicmp(flag, "esid=", 5)) {
- /*ESID on which the update is applied*/
- es_id = atoi(flag+5);
- } else if (!strnicmp(flag, "period=", 7)) {
- /*TODO: target period carousel for ESID ??? (ESID/carousel)*/
- period = atoi(flag+7);
- } else if (!strnicmp(flag, "ts=", 3)) {
- /*TODO: */
- ts_delta = atoi(flag+3);
- } else if (!strnicmp(flag, "carousel=", 9)) {
- /*TODO: why? => sends the update on carousel id specified by this argument*/
- aggregate_on_stream = atoi(flag+9);
- } else if (!strnicmp(flag, "restamp=", 8)) {
- /*CTS is updated when carouselled*/
- adjust_carousel_time = atoi(flag+8);
- } else if (!strnicmp(flag, "discard=", 8)) {
- /*when we receive several updates during a single carousel period, this attribute specifies whether the current update discard pending ones*/
- discard_pending = atoi(flag+8);
- } else if (!strnicmp(flag, "aggregate=", 10)) {
- /*Boolean*/
- aggregate_au = atoi(flag+10);
- } else if (!strnicmp(flag, "force_rap=", 10)) {
- /*TODO: */
- force_rap = atoi(flag+10);
- } else if (!strnicmp(flag, "rap=", 4)) {
- /*TODO: */
- signal_rap = atoi(flag+4);
- } else if (!strnicmp(flag, "critical=", 9)) {
- /*TODO: */
- signal_critical = atoi(flag+9);
- } else if (!strnicmp(flag, "vers_inc=", 9)) {
- /*Boolean to increment m2ts section version number*/
- version_inc = atoi(flag+9);
- }
- if (sep) {
- sep[0] = ' ';
- flag = sep+1;
- } else {
- break;
- }
- }
-
- set_broadcast_params(prog, es_id, period, ts_delta, aggregate_on_stream, adjust_carousel_time, force_rap, aggregate_au, discard_pending, signal_rap, signal_critical, version_inc);
- }
-
- e = gf_seng_encode_from_file(seng, es_id, aggregate_au ? 0 : 1, prog->src_name, SampleCallBack);
- if (e)
- fprintf(stdout, "Processing command failed: %s\n", gf_error_to_string(e));
- else
- gf_seng_aggregate_context(seng, 0);
-
- update_context=1;
-
-
-
- }
- }
- if (update_context) {
- prog->repeat = 1;
- e = gf_seng_encode_context(seng, SampleCallBack );
- prog->repeat = 0;
- }
-
- gf_sleep(10);
- } else { /*gf_prompt_has_input()*/
- char c = gf_prompt_get_char();
- switch (c) {
- case 'u':
- {
- GF_Err e;
- char szCom[8192];
- fprintf(stdout, "Enter command to send:\n");
- fflush(stdin);
- szCom[0] = 0;
- scanf("%[^\t\n]", szCom);
- prog->repeat = 0;
- e = gf_seng_encode_from_string(seng, 0, 0, szCom, SampleCallBack);
- prog->repeat = 1;
- if (e) fprintf(stdout, "Processing command failed: %s\n", gf_error_to_string(e));
- update_context=1;
- }
- break;
- case 'p':
- {
- char rad[GF_MAX_PATH];
- fprintf(stdout, "Enter output file name - \"std\" for stdout: ");
- scanf("%s", rad);
- e = gf_seng_save_context(seng, !strcmp(rad, "std") ? NULL : rad);
- fprintf(stdout, "Dump done (%s)\n", gf_error_to_string(e));
- }
- break;
- case 'q':
- {
- run = 0;
- }
- }
- e = GF_OK;
- }
- }
-
-
- return e ? 1 : 0;
-}
-
-
-static void rtp_sl_packet_cbk(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e)
-{
- GF_ESIRTP *rtp = (GF_ESIRTP*)udta;
- rtp->pck.data = payload;
- rtp->pck.data_len = size;
- rtp->pck.dts = hdr->decodingTimeStamp;
- rtp->pck.cts = hdr->compositionTimeStamp;
- rtp->pck.flags = 0;
- if (hdr->compositionTimeStampFlag) rtp->pck.flags |= GF_ESI_DATA_HAS_CTS;
- if (hdr->decodingTimeStampFlag) rtp->pck.flags |= GF_ESI_DATA_HAS_DTS;
- if (hdr->randomAccessPointFlag) rtp->pck.flags |= GF_ESI_DATA_AU_RAP;
- if (hdr->accessUnitStartFlag) rtp->pck.flags |= GF_ESI_DATA_AU_START;
- if (hdr->accessUnitEndFlag) rtp->pck.flags |= GF_ESI_DATA_AU_END;
-
- if (rtp->use_carousel) {
- if ((hdr->AU_sequenceNumber==rtp->au_sn) && hdr->randomAccessPointFlag) rtp->pck.flags |= GF_ESI_DATA_REPEAT;
- rtp->au_sn = hdr->AU_sequenceNumber;
- }
-
- if (rtp->cat_dsi && hdr->randomAccessPointFlag && hdr->accessUnitStartFlag) {
- if (rtp->dsi_and_rap) gf_free(rtp->dsi_and_rap);
- rtp->pck.data_len = size + rtp->depacketizer->sl_map.configSize;
- rtp->dsi_and_rap = gf_malloc(sizeof(char)*(rtp->pck.data_len));
- memcpy(rtp->dsi_and_rap, rtp->depacketizer->sl_map.config, rtp->depacketizer->sl_map.configSize);
- memcpy((char *) rtp->dsi_and_rap + rtp->depacketizer->sl_map.configSize, payload, size);
- rtp->pck.data = rtp->dsi_and_rap;
- }
-
-
- rtp->ifce->output_ctrl(rtp->ifce, GF_ESI_OUTPUT_DATA_DISPATCH, &rtp->pck);
-}
-
-static void fill_rtp_es_ifce(GF_ESInterface *ifce, GF_SDPMedia *media, GF_SDPInfo *sdp)
-{
- u32 i;
- GF_Err e;
- GF_X_Attribute*att;
- GF_ESIRTP *rtp;
- GF_RTPMap*map;
- GF_SDPConnection *conn;
- GF_RTSPTransport trans;
-
- /*check connection*/
- conn = sdp->c_connection;
- if (!conn) conn = (GF_SDPConnection*)gf_list_get(media->Connections, 0);
-
- /*check payload type*/
- map = (GF_RTPMap*)gf_list_get(media->RTPMaps, 0);
- GF_SAFEALLOC(rtp, GF_ESIRTP);
-
- memset(ifce, 0, sizeof(GF_ESInterface));
- rtp->rtp_ch = gf_rtp_new();
- i=0;
- while ((att = (GF_X_Attribute*)gf_list_enum(media->Attributes, &i))) {
- if (!stricmp(att->Name, "mpeg4-esid") && att->Value) ifce->stream_id = atoi(att->Value);
- }
-
- memset(&trans, 0, sizeof(GF_RTSPTransport));
- trans.Profile = media->Profile;
- trans.source = conn ? conn->host : sdp->o_address;
- trans.IsUnicast = gf_sk_is_multicast_address(trans.source) ? 0 : 1;
- if (!trans.IsUnicast) {
- trans.port_first = media->PortNumber;
- trans.port_last = media->PortNumber + 1;
- trans.TTL = conn ? conn->TTL : 0;
- } else {
- trans.client_port_first = media->PortNumber;
- trans.client_port_last = media->PortNumber + 1;
- }
-
- if (gf_rtp_setup_transport(rtp->rtp_ch, &trans, NULL) != GF_OK) {
- gf_rtp_del(rtp->rtp_ch);
- fprintf(stdout, "Cannot initialize RTP transport\n");
- return;
- }
- /*setup depacketizer*/
- rtp->depacketizer = gf_rtp_depacketizer_new(media, rtp_sl_packet_cbk, rtp);
- if (!rtp->depacketizer) {
- gf_rtp_del(rtp->rtp_ch);
- fprintf(stdout, "Cannot create RTP depacketizer\n");
- return;
- }
- /*setup channel*/
- gf_rtp_setup_payload(rtp->rtp_ch, map);
- ifce->input_udta = rtp;
- ifce->input_ctrl = rtp_input_ctrl;
- rtp->ifce = ifce;
-
- ifce->object_type_indication = rtp->depacketizer->sl_map.ObjectTypeIndication;
- ifce->stream_type = rtp->depacketizer->sl_map.StreamType;
- ifce->timescale = gf_rtp_get_clockrate(rtp->rtp_ch);
- if (rtp->depacketizer->sl_map.config) {
- switch (ifce->object_type_indication) {
- case GPAC_OTI_VIDEO_MPEG4_PART2:
- rtp->cat_dsi = 1;
- break;
- }
- }
- if (rtp->depacketizer->sl_map.StreamStateIndication) {
- rtp->use_carousel = 1;
- rtp->au_sn=0;
- }
-
- /*DTS signaling is only supported for MPEG-4 visual*/
- if (rtp->depacketizer->sl_map.DTSDeltaLength) ifce->caps |= GF_ESI_SIGNAL_DTS;
-
- gf_rtp_depacketizer_reset(rtp->depacketizer, 1);
- e = gf_rtp_initialize(rtp->rtp_ch, 0x100000ul, 0, 0, 10, 200, NULL);
- if (e!=GF_OK) {
- gf_rtp_del(rtp->rtp_ch);
- fprintf(stdout, "Cannot initialize RTP channel: %s\n", gf_error_to_string(e));
- return;
- }
- fprintf(stdout, "RTP interface initialized\n");
-}
-
-void fill_seng_es_ifce(GF_ESInterface *ifce, u32 i, GF_SceneEngine *seng, u32 period)
-{
- GF_Err e=GF_OK;
- char *config_buffer;
- u32 len;
- GF_ESIStream *stream;
-
- memset(ifce, 0, sizeof(GF_ESInterface));
- gf_seng_get_stream_config(seng, i, &ifce->stream_id, &config_buffer, &len, &ifce->stream_type, &ifce->object_type_indication, &ifce->timescale);
-
- ifce->repeat_rate = period;
- GF_SAFEALLOC(stream, GF_ESIStream);
- stream->rap = 1;
- ifce->input_udta = stream;
-
- //fprintf(stdout, "Caroussel period: %d\n", period);
-// e = gf_seng_set_carousel_time(seng, ifce->stream_id, period);
- if (e) {
- fprintf(stdout, "Cannot set carousel time on stream %d to %d: %s\n", ifce->stream_id, period, gf_error_to_string(e));
- }
- ifce->input_ctrl = seng_input_ctrl;
-
-}
-
-static Bool open_program(M2TSProgram *prog, const char *src, u32 carousel_rate, Bool *force_mpeg4, const char *update)
-{
- GF_SDPInfo *sdp;
- u32 i;
- GF_Err e;
-
- memset(prog, 0, sizeof(M2TSProgram));
-
- /*open ISO file*/
- if (gf_isom_probe_file(src)) {
- u32 nb_tracks;
- u32 first_audio = 0;
- prog->mp4 = gf_isom_open(src, GF_ISOM_OPEN_READ, 0);
- prog->nb_streams = 0;
- /*on MPEG-2 TS, carry 3GPP timed text as MPEG-4 Part17*/
- gf_isom_text_set_streaming_mode(prog->mp4, 1);
- nb_tracks = gf_isom_get_track_count(prog->mp4);
- for (i=0; i<nb_tracks; i++) {
- if (gf_isom_get_media_type(prog->mp4, i+1) == GF_ISOM_MEDIA_HINT)
- continue;
- fill_isom_es_ifce(&prog->streams[i], prog->mp4, i+1);
- switch(prog->streams[i].stream_type) {
- case GF_STREAM_OD:
- case GF_STREAM_SCENE:
- *force_mpeg4 = 1;
- prog->streams[i].repeat_rate = carousel_rate;
- break;
- case GF_STREAM_VISUAL:
- /*turn on image repeat*/
- switch (prog->streams[i].object_type_indication) {
- case GPAC_OTI_IMAGE_JPEG:
- case GPAC_OTI_IMAGE_PNG:
- ((GF_ESIMP4 *)prog->streams[i].input_udta)->image_repeat_ms = carousel_rate;
- break;
- }
- break;
- }
- prog->nb_streams++;
- /*get first visual stream as PCR*/
- if (!prog->pcr_idx &&
- (gf_isom_get_media_type(prog->mp4, i+1) == GF_ISOM_MEDIA_VISUAL) &&
- (gf_isom_get_sample_count(prog->mp4, i+1)>1) ) {
- prog->pcr_idx = i+1;
- }
- if (!first_audio && (gf_isom_get_media_type(prog->mp4, i+1) == GF_ISOM_MEDIA_AUDIO) ) {
- first_audio = i+1;
- }
- }
- /*if no visual PCR found, use first audio*/
- if (!prog->pcr_idx) prog->pcr_idx = first_audio;
- if (prog->pcr_idx) {
- GF_ESIMP4 *priv;
- prog->pcr_idx-=1;
- priv = prog->streams[prog->pcr_idx].input_udta;
- gf_isom_set_default_sync_track(prog->mp4, priv->track);
- }
- prog->iod = gf_isom_get_root_od(prog->mp4);
- return 1;
- }
-
- /*open SDP file*/
- if (strstr(src, ".sdp")) {
- GF_X_Attribute *att;
- char *sdp_buf;
- u32 sdp_size;
- FILE *_sdp = fopen(src, "rt");
- if (!_sdp) {
- fprintf(stderr, "Error opening %s - no such file\n", src);
- return 0;
- }
- fseek(_sdp, 0, SEEK_END);
- sdp_size = ftell(_sdp);
- fseek(_sdp, 0, SEEK_SET);
- sdp_buf = (char*)gf_malloc(sizeof(char)*sdp_size);
- memset(sdp_buf, 0, sizeof(char)*sdp_size);
- fread(sdp_buf, sdp_size, 1, _sdp);
- fclose(_sdp);
-
- sdp = gf_sdp_info_new();
- e = gf_sdp_info_parse(sdp, sdp_buf, sdp_size);
- gf_free(sdp_buf);
- if (e) {
- fprintf(stderr, "Error opening %s : %s\n", src, gf_error_to_string(e));
- gf_sdp_info_del(sdp);
- return 0;
- }
-
- i=0;
- while ((att = (GF_X_Attribute*)gf_list_enum(sdp->Attributes, &i))) {
- char buf[2000];
- u32 size;
- char *buf64;
- u32 size64;
- char *iod_str;
- if (strcmp(att->Name, "mpeg4-iod") ) continue;
- iod_str = att->Value + 1;
- if (strnicmp(iod_str, "data:application/mpeg4-iod;base64", strlen("data:application/mpeg4-iod;base64"))) continue;
-
- buf64 = strstr(iod_str, ",");
- if (!buf64) break;
- buf64 += 1;
- size64 = strlen(buf64) - 1;
- size = gf_base64_decode(buf64, size64, buf, 2000);
-
- gf_odf_desc_read(buf, size, &prog->iod);
- break;
- }
-
- prog->nb_streams = gf_list_count(sdp->media_desc);
- for (i=0; i<prog->nb_streams; i++) {
- GF_SDPMedia *media = gf_list_get(sdp->media_desc, i);
- fill_rtp_es_ifce(&prog->streams[i], media, sdp);
- switch(prog->streams[i].stream_type) {
- case GF_STREAM_OD:
- case GF_STREAM_SCENE:
- *force_mpeg4 = 1;
- prog->streams[i].repeat_rate = carousel_rate;
- break;
- }
- if (!prog->pcr_idx && (prog->streams[i].stream_type == GF_STREAM_VISUAL)) {
- prog->pcr_idx = i+1;
- }
- }
-
- if (prog->pcr_idx) prog->pcr_idx-=1;
- gf_sdp_info_del(sdp);
-
- return 2;
- }
- else if (strstr(src, ".bt")) //open .bt file
- {
- u32 load_type=0;
- prog->seng = gf_seng_init(prog, src, load_type, NULL, (load_type == GF_SM_LOAD_DIMS) ? 1 : 0);
-
- if (!prog->seng) {
- fprintf(stdout, "Cannot create scene engine\n");
- exit(0);
- }
- else{
- fprintf(stdout, "Scene engine created.\n");
- }
-
- prog->iod = gf_seng_get_iod(prog->seng);
-
- prog->nb_streams = gf_seng_get_stream_count(prog->seng);
- prog->rate = carousel_rate;
- *force_mpeg4 = 1;
-
- for (i=0; i<prog->nb_streams; i++) {
- fill_seng_es_ifce(&prog->streams[i], i, prog->seng, prog->rate);
- //fprintf(stdout, "Fill interface\n");
- if (!prog->pcr_idx && (prog->streams[i].stream_type == GF_STREAM_VISUAL)) {
- prog->pcr_idx = i+1;
- }
- }
- if (!prog->pcr_idx) prog->pcr_idx=1;
- prog->pcr_idx-=1;
- prog->th = gf_th_new("Carousel");
- prog->src_name = update;
- gf_th_run(prog->th, seng_output, prog);
- return 1;
- } else {
- fprintf(stderr, "Error opening %s - not a supported input media, skipping.\n", src);
- return 0;
- }
-}
-
-/*parse MP42TS arguments*/
-static GFINLINE GF_Err parse_args(int argc, char **argv, u32 *mux_rate, u32 *carrousel_rate, M2TSProgram *progs, u32 *nb_progs, Bool *mpeg4_signaling, char **src_name, Bool *real_time, u32 *run_time, u32 *output_type, char **ts_out, u16 *port)
-{
- Bool rate_found=0, mpeg4_carousel_found=0, prog_found=0, mpeg4_found=0, time_found=0, src_found=0, dst_found=0;
- char *prog_name;
- u32 res;
- s32 i;
- for (i=1; i<argc; i++) {
- char *arg = argv[i];
- if (arg[0]=='-') {
- if (!strnicmp(arg, "-rate=", 6)) {
- if (rate_found) {
- goto error;
- }
- rate_found = 1;
- *mux_rate = 1024*atoi(arg+6);
- } else if (!strnicmp(arg, "-mpeg4-carousel=", 16)) {
- if (mpeg4_carousel_found) {
- goto error;
- }
- mpeg4_carousel_found = 1;
- *carrousel_rate = atoi(arg+16);
- } else if (!strnicmp(arg, "-ll=", 4)) {
- gf_log_set_level(gf_log_parse_level(argv[i]+4));
- } else if (!strnicmp(arg, "-lt=", 4)) {
- gf_log_set_tools(gf_log_parse_tools(argv[i]+4));
- } else if (!strnicmp(arg, "-prog=", 6)) {
- prog_found = 1;
- prog_name = arg+6;
- if (prog_found && rate_found) {
- memset(&progs[*nb_progs], 0, sizeof(M2TSProgram));
- assert(prog_name);
- res = open_program(&progs[*nb_progs], prog_name, *carrousel_rate, mpeg4_signaling, *src_name);
- if (res) {
- (*nb_progs)++;
- if (res==2) *real_time=1;
- }
- }
- } else if (!strnicmp(arg, "-mpeg4", 6)) {
- if (mpeg4_found) {
- goto error;
- }
- mpeg4_found = 1;
- *mpeg4_signaling = 1;
- } else if (!strnicmp(arg, "-time=", 6)) {
- if (time_found) {
- goto error;
- }
- time_found = 1;
- *run_time = atoi(arg+6);
- }
- else if (!strnicmp(arg, "-src=", 5)){
- if (src_found) {
- goto error;
- }
- src_found = 1;
- *src_name = arg+5;
- }
- else {
- goto error;
- }
- } else { /*"dst" argument (output)*/
- if (dst_found) {
- goto error;
- }
- dst_found = 1;
- if (!strnicmp(arg, "rtp://", 6) || !strnicmp(arg, "udp://", 6)) {
- char *sep = strchr(arg+6, ':');
- *output_type = (arg[0]=='r') ? 2 : 1;
- *real_time=1;
- if (sep) {
- *port = atoi(sep+1);
- sep[0]=0;
- *ts_out = gf_strdup(arg+6);
- sep[0]=':';
- } else {
- *ts_out = gf_strdup(arg+6);
- }
- } else {
- *output_type = 0;
- *ts_out = gf_strdup(arg);
- }
- }
- }
-
- /*dst is the only mandatory argument*/
- if (dst_found && prog_found && rate_found)
- return GF_OK;
-
-error:
- return GF_BAD_PARAM;
-}
-
-int main(int argc, char **argv)
-{
- /********************/
- /* declarations */
- /********************/
- const char *ts_pck;
- GF_Err e;
- u32 res, run_time;
- Bool real_time, mpeg4_signaling;
- GF_M2TS_Mux *muxer=NULL;
- u32 i, j, mux_rate, nb_progs, cur_pid, carrousel_rate, last_print_time;
- char *ts_out = NULL;
- FILE *ts_file;
- GF_Socket *ts_udp;
- GF_RTPChannel *ts_rtp;
- GF_RTSPTransport tr;
- GF_RTPHeader hdr;
- u16 port;
- u32 output_type;
- char *src_name = NULL;
- M2TSProgram progs[MAX_MUX_SRC_PROG];
-
- /***********************/
- /* initialisations */
- /***********************/
- real_time=0;
- output_type = 0;
- ts_file = NULL;
- ts_udp = NULL;
- ts_rtp = NULL;
- ts_out = NULL;
- nb_progs = 0;
- mux_rate = 0;
- run_time = 0;
- mpeg4_signaling = 0;
- carrousel_rate = 500;
- port = 1234;
-
- /*****************/
- /* gpac init */
- /*****************/
- gf_sys_init(0);
- gf_log_set_level(GF_LOG_ERROR);
- gf_log_set_tools(0xFFFFFFFF);
- //gf_log_set_level(GF_LOG_DEBUG);
- //gf_log_set_tools(GF_LOG_CONTAINER);
-
- /***********************/
- /* parse arguments */
- /***********************/
- if (GF_OK != parse_args(argc, argv, &mux_rate, &carrousel_rate, progs, &nb_progs, &mpeg4_signaling, &src_name, &real_time, &run_time, &output_type, &ts_out, &port)) {
- usage();
- goto exit;
- }
-
- if (run_time && !mux_rate) {
- fprintf(stdout, "Cannot specify TS run time for VBR multiplex - disabling run time\n");
- run_time = 0;
- }
-
- /***************************/
- /* create mp42ts muxer */
- /***************************/
- muxer = gf_m2ts_mux_new(mux_rate, real_time);
- muxer->mpeg4_signaling = mpeg4_signaling;
- switch(output_type) {
- case GF_MP42TS_FILE_OUTPUT:
- ts_file = fopen(ts_out, "wb");
- if (!ts_file ) {
- fprintf(stderr, "Error opening %s\n", ts_out);
- goto exit;
- }
- break;
- case GF_MP42TS_UDP_OUTPUT:
- ts_udp = gf_sk_new(GF_SOCK_TYPE_UDP);
- if (gf_sk_is_multicast_address((char *)ts_out)) {
- e = gf_sk_setup_multicast(ts_udp, (char *)ts_out, port, 0, 0, NULL);
- } else {
- e = gf_sk_bind(ts_udp, NULL, port, (char *)ts_out, port, GF_SOCK_REUSE_PORT);
- }
- if (e) {
- fprintf(stdout, "Error initializing UDP socket: %s\n", gf_error_to_string(e));
- goto exit;
- }
- break;
- case GF_MP42TS_RTP_OUTPUT:
- ts_rtp = gf_rtp_new();
- gf_rtp_set_ports(ts_rtp, port);
- tr.IsUnicast = gf_sk_is_multicast_address((char *)ts_out) ? 0 : 1;
- tr.Profile="RTP/AVP";
- tr.destination = (char *)ts_out;
- tr.source = "0.0.0.0";
- tr.IsRecord = 0;
- tr.Append = 0;
- tr.SSRC = rand();
- tr.port_first = port;
- tr.port_last = port+1;
- if (tr.IsUnicast) {
- tr.client_port_first = port;
- tr.client_port_last = port+1;
- } else {
- tr.source = (char *)ts_out;
- }
- res = gf_rtp_setup_transport(ts_rtp, &tr, (char *)ts_out);
- if (res !=0) {
- fprintf(stdout, "Cannot setup RTP transport info\n");
- goto exit;
- }
- res = gf_rtp_initialize(ts_rtp, 0, 1, 1500, 0, 0, NULL);
- if (res !=0) {
- fprintf(stdout, "Cannot initialize RTP sockets\n");
- goto exit;
- }
- memset(&hdr, 0, sizeof(GF_RTPHeader));
- hdr.Version = 2;
- hdr.PayloadType = 33; /*MP2T*/
- hdr.SSRC = tr.SSRC;
- hdr.Marker = 0;
- break;
- }
-
-
- /****************************************/
- /* declare all streams to the muxer */
- /****************************************/
- cur_pid = 100; /*PIDs start from 100*/
- for (i=0; i<nb_progs; i++) {
- GF_M2TS_Mux_Program *program = gf_m2ts_mux_program_add(muxer, i+1, cur_pid);
- if (muxer->mpeg4_signaling) program->iod = progs[i].iod;
- for (j=0; j<progs[i].nb_streams; j++) {
- gf_m2ts_program_stream_add(program, &progs[i].streams[j], cur_pid+j+1, (progs[i].pcr_idx==j) ? 1 : 0);
- }
- cur_pid += progs[i].nb_streams;
- while (cur_pid % 10)
- cur_pid ++;
- }
-
- gf_m2ts_mux_update_config(muxer, 1);
-
- /*****************/
- /* main loop */
- /*****************/
- last_print_time=gf_sys_clock();
- while (run) {
- u32 ts, status;
- /*flush all packets*/
- switch (output_type) {
- case GF_MP42TS_FILE_OUTPUT:
- while ((ts_pck = gf_m2ts_mux_process(muxer, &status)) != NULL) {
- fwrite(ts_pck, 1, 188, ts_file);
- if (status>=GF_M2TS_STATE_PADDING) break;
- }
- break;
- case GF_MP42TS_UDP_OUTPUT:
- while ((ts_pck = gf_m2ts_mux_process(muxer, &status)) != NULL) {
- e = gf_sk_send(ts_udp, (char*)ts_pck, 188);
- if (e)
- fprintf(stdout, "Error %s sending UDP packet\n", gf_error_to_string(e));
- if (status>=GF_M2TS_STATE_PADDING) break;
- }
- break;
- case GF_MP42TS_RTP_OUTPUT:
- while ((ts_pck = gf_m2ts_mux_process(muxer, &status)) != NULL) {
- hdr.SequenceNumber++;
- /*muxer clock at 90k*/
- ts = muxer->time.sec*90000 + muxer->time.nanosec*9/100000;
- /*FIXME - better discontinuity check*/
- hdr.Marker = (ts < hdr.TimeStamp) ? 1 : 0;
- hdr.TimeStamp = ts;
- e = gf_rtp_send_packet(ts_rtp, &hdr, (char*)ts_pck, 188, 0);
- if (e)
- fprintf(stdout, "Error %s sending RTP packet\n", gf_error_to_string(e));
- if (status>=GF_M2TS_STATE_PADDING) break;
- }
- break;
- }
- if (real_time) {
- /*refresh every MP42TS_PRINT_FREQ ms*/
- u32 now=gf_sys_clock();
- if (now/MP42TS_PRINT_FREQ != last_print_time/MP42TS_PRINT_FREQ) {
- last_print_time = now;
- fprintf(stdout, "M2TS: time %d - TS time %d - avg bitrate %d\r", gf_m2ts_get_sys_clock(muxer), gf_m2ts_get_ts_clock(muxer), muxer->avg_br);
- }
- }
-
- /*cpu load regulation*/
- gf_sleep(1);
-
- if (run_time) {
- if (gf_m2ts_get_ts_clock(muxer) > run_time) {
- fprintf(stdout, "Stopping multiplex at %d ms (requested runtime %d ms)\n", gf_m2ts_get_ts_clock(muxer), run_time);
- break;
- }
- }
- if (status==GF_M2TS_STATE_EOS) {
- break;
- }
- }
-
-
-exit:
- run = 0;
- if (ts_file) fclose(ts_file);
- if (ts_udp) gf_sk_del(ts_udp);
- if (ts_rtp) gf_rtp_del(ts_rtp);
- if (ts_out) gf_free(ts_out);
- if (muxer) gf_m2ts_mux_del(muxer);
-
- for (i=0; i<nb_progs; i++) {
- for (j=0; j<progs[i].nb_streams; j++) {
- progs[i].streams[j].input_ctrl(&progs[i].streams[j], GF_ESI_INPUT_DESTROY, NULL);
- }
- if (progs[i].iod) gf_odf_desc_del((GF_Descriptor*)progs[i].iod);
- if (progs[i].mp4) gf_isom_close(progs[i].mp4);
- }
- gf_sys_close();
- return 1;
-}
+++ /dev/null
-# Microsoft Developer Studio Project File - Name="mp42ts" - Package Owner=<4>\r
-# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** DO NOT EDIT **\r
-\r
-# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
-\r
-CFG=mp42ts - Win32 Debug\r
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
-!MESSAGE use the Export Makefile command and run\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "mp42ts.mak".\r
-!MESSAGE \r
-!MESSAGE You can specify a configuration when running NMAKE\r
-!MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "mp42ts.mak" CFG="mp42ts - Win32 Debug"\r
-!MESSAGE \r
-!MESSAGE Possible choices for configuration are:\r
-!MESSAGE \r
-!MESSAGE "mp42ts - Win32 Release" (based on "Win32 (x86) Console Application")\r
-!MESSAGE "mp42ts - Win32 Debug" (based on "Win32 (x86) Console Application")\r
-!MESSAGE \r
-\r
-# Begin Project\r
-# PROP AllowPerConfigDependencies 0\r
-# PROP Scc_ProjName ""\r
-# PROP Scc_LocalPath ""\r
-CPP=cl.exe\r
-RSC=rc.exe\r
-\r
-!IF "$(CFG)" == "mp42ts - Win32 Release"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 0\r
-# PROP BASE Output_Dir "Release"\r
-# PROP BASE Intermediate_Dir "Release"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 0\r
-# PROP Output_Dir "Release"\r
-# PROP Intermediate_Dir "Release"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD BASE RSC /l 0x40c /d "NDEBUG"\r
-# ADD RSC /l 0x40c /d "NDEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"../../../bin/w32_rel/mp42ts.exe" /libpath:"../../../extra_lib/lib/w32_rel"\r
-\r
-!ELSEIF "$(CFG)" == "mp42ts - Win32 Debug"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 1\r
-# PROP BASE Output_Dir "Debug"\r
-# PROP BASE Intermediate_Dir "Debug"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 1\r
-# PROP Output_Dir "Debug"\r
-# PROP Intermediate_Dir "Debug"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c\r
-# ADD BASE RSC /l 0x40c /d "_DEBUG"\r
-# ADD RSC /l 0x40c /d "_DEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"../../../bin/w32_deb/mp42ts.exe" /pdbtype:sept /libpath:"../../../extra_lib/lib/w32_deb"\r
-# SUBTRACT LINK32 /nodefaultlib\r
-\r
-!ENDIF \r
-\r
-# Begin Target\r
-\r
-# Name "mp42ts - Win32 Release"\r
-# Name "mp42ts - Win32 Debug"\r
-# Begin Source File\r
-\r
-SOURCE=.\main.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\mp42ts.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\mp42ts.h\r
-# End Source File\r
-# End Target\r
-# End Project\r
+++ /dev/null
-/*
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) ENST 2000-200X
- * All rights reserved
- *
- * This file is part of GPAC / mp42ts application
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#include <gpac/isomedia.h>
-#include <gpac/bifs.h>
-#include <gpac/esi.h>
-#include <gpac/mpegts.h>
-#include <gpac/avparse.h>
-#include <gpac/thread.h>
-
-
-typedef struct __m2ts_mux_program M2TS_Mux_Program;
-typedef struct __m2ts_mux M2TS_Mux;
-
-enum {
- LOG_NO_LOG = 0,
- LOG_PES = 1,
- LOG_SECTION = 2,
- LOG_TS = 3
-};
-
-
-typedef struct __m2ts_section {
- struct __m2ts_section *next;
- u8 *data;
- u32 length;
-} M2TS_Mux_Section;
-
-typedef struct __m2ts_table {
- struct __m2ts_table *next;
- u8 table_id;
- u8 version_number;
- struct __m2ts_section *section;
-} M2TS_Mux_Table;
-
-typedef struct
-{
- u32 sec;
- u32 nanosec;
-} M2TS_Time;
-
-
-typedef struct __m2ts_mux_pck
-{
- struct __m2ts_mux_pck *next;
- char *data;
- u32 data_len;
- u32 flags;
- u64 cts, dts;
-} M2TS_Packet;
-
-
-typedef struct __m2ts_mux_stream {
- struct __m2ts_mux_stream *next;
-
- u32 pid;
- u8 continuity_counter;
- struct __m2ts_mux_program *program;
-
- /*average stream bit-rate in bit/sec*/
- u32 bit_rate;
-
- /*multiplexer time - NOT THE PCR*/
- M2TS_Time time;
-
-
- /* MPEG-4 SL Config */
- GF_SLConfig sl_config;
-
- /*table tools*/
- M2TS_Mux_Table *tables;
- /*total table sizes for bitrate estimation (PMT/PAT/...)*/
- u32 total_table_size;
- /* used for on-the-fly packetization of sections */
- M2TS_Mux_Table *current_table;
- M2TS_Mux_Section *current_section;
- u32 current_section_offset;
- u32 refresh_rate_ms;
- Bool table_needs_update;
-
- Bool (*process)(struct __m2ts_mux *muxer, struct __m2ts_mux_stream *stream);
-
- /*PES tools*/
- void *pes_packetizer;
- u32 mpeg2_stream_type;
- u32 mpeg2_stream_id;
-
- GF_ESIPacket pck;
- u32 pck_offset;
- Bool force_new;
-
- struct __elementary_stream_ifce *ifce;
- Double ts_scale;
- u64 initial_ts;
-
- /*packet fifo*/
- M2TS_Packet *pck_first, *pck_last;
- /*packet reassembler (PES packets are most of the time full frames)*/
- M2TS_Packet *pck_reassembler;
- GF_Mutex *mx;
- /*avg bitrate compute*/
- u64 last_br_time;
- u32 bytes_since_last_time;
-
- /*MPEG-4 over MPEG-2*/
- u8 table_id;
- GF_SLHeader sl_header;
- //GF_SLConfig sl_config;
-
- u32 last_aac_time;
-} M2TS_Mux_Stream;
-
-
-struct __m2ts_mux_program {
- struct __m2ts_mux_program *next;
-
- struct __m2ts_mux *mux;
- u16 number;
- /*all streams but PMT*/
- M2TS_Mux_Stream *streams;
- /*PMT*/
- M2TS_Mux_Stream *pmt;
- /*pointer to PCR stream*/
- M2TS_Mux_Stream *pcr;
-
- /*TS time at pcr init*/
- M2TS_Time ts_time_at_pcr_init;
- u64 pcr_init_time, num_pck_at_pcr_init;
- u64 last_pcr;
- u32 last_sys_clock;
-
- GF_Descriptor *iod;
-};
-
-struct __m2ts_mux {
- M2TS_Mux_Program *programs;
- M2TS_Mux_Stream *pat;
-
- u16 ts_id;
-
- Bool needs_reconfig;
-
- /* used to indicate that the input data is pushed to the muxer (i.e. not read from a file)
- or that the output data is sent on sockets (not written to a file) */
- Bool real_time;
-
- /* indicates if the multiplexer shall target a fix bit rate (monitoring timing and produce padding packets)
- or if the output stream will contain only input data*/
- Bool fixed_rate;
-
- /*output bit-rate in bit/sec*/
- u32 bit_rate;
-
- char dst_pck[188], null_pck[188];
-
- /*multiplexer time, incremented each time a packet is sent
- used to monitor the sending of muxer related data (PAT, ...) */
- M2TS_Time time;
-
- /* Time of the muxer when the first call to process is made (first packet sent?) */
- M2TS_Time init_ts_time;
-
- /* System time when the muxer is started */
- u32 init_sys_time;
-
- Bool eos_found;
- u32 pck_sent_over_br_window, last_br_time, avg_br;
- u64 tot_pck_sent, tot_pad_sent;
-
- Bool mpeg4_signaling;
-};
-
-
-enum
-{
- GF_M2TS_STATE_IDLE,
- GF_M2TS_STATE_DATA,
- GF_M2TS_STATE_PADDING,
- GF_M2TS_STATE_EOS,
-};
-
</References>\r
<Files>\r
<File\r
- RelativePath="main.c"\r
+ RelativePath="..\..\mp42ts\main.c"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\mp42ts\mp42ts.h"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
</Files>\r
<Globals>\r
vpath %.c $(SRC_PATH)/applications/test_apps/mpedemux
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
--- /dev/null
+include ../../config.mak\r
+\r
+vpath %.c $(SRC_PATH)/applications/udptsseg\r
+\r
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"\r
+\r
+ifeq ($(DEBUGBUILD), yes)\r
+CFLAGS+=-g\r
+LDFLAGS+=-g\r
+endif\r
+\r
+ifeq ($(GPROFBUILD), yes)\r
+CFLAGS+=-pg\r
+LDFLAGS+=-pg\r
+endif\r
+\r
+#common obj\r
+OBJS= main.o\r
+\r
+LINKFLAGS=-L../../bin/gcc -L../../extra_lib/lib/gcc\r
+\r
+ifeq ($(CONFIG_WIN32),yes)\r
+EXE=.exe\r
+PROG=udptsseg$(EXE)\r
+ifeq ($(MP4BOX_STATIC),yes)\r
+LINKFLAGS+=-lgpac_static -lz $(EXTRALIBS)\r
+else\r
+LINKFLAGS+=-lgpac\r
+endif\r
+else\r
+EXT=\r
+PROG=udptsseg\r
+ifeq ($(MP4BOX_STATIC),yes)\r
+LINKFLAGS+=-lgpac_static -lz $(EXTRALIBS)\r
+else\r
+LINKFLAGS+=-lgpac\r
+endif\r
+endif\r
+\r
+#3 - spidermonkey support\r
+ifeq ($(CONFIG_JS),no)\r
+else\r
+SCENEGRAPH_CFLAGS+=$(JS_FLAGS)\r
+ifeq ($(CONFIG_JS),local)\r
+NEED_LOCAL_LIB="yes"\r
+endif\r
+LINKFLAGS+=$(JS_LIBS)\r
+endif\r
+\r
+\r
+SRCS := $(OBJS:.o=.c) \r
+\r
+all: $(PROG)\r
+\r
+$(PROG): $(OBJS)\r
+ $(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(LINKFLAGS)\r
+\r
+\r
+%.o: %.c\r
+ $(CC) $(CFLAGS) -c -o $@ $< \r
+\r
+\r
+clean: \r
+ rm -f $(OBJS) ../../bin/gcc/$(PROG)\r
+\r
+dep: depend\r
+\r
+depend:\r
+ rm -f .depend \r
+ $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend\r
+\r
+distclean: clean\r
+ rm -f Makefile.bak .depend\r
+\r
+\r
+\r
+# include dependency files if they exist\r
+#\r
+ifneq ($(wildcard .depend),)\r
+include .depend\r
+endif\r
--- /dev/null
+/*\r
+* GPAC - Multimedia Framework C SDK\r
+*\r
+* Copyright (c) ENST 2000-200X\r
+* All rights reserved\r
+*\r
+* This file is part of GPAC / udp TS segmenter (udptsseg) application\r
+*\r
+* GPAC is free software; you can redistribute it and/or modify\r
+* it under the terms of the GNU Lesser General Public License as published by\r
+* the Free Software Foundation; either version 2, or (at your option)\r
+* any later version.\r
+* \r
+* GPAC is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU Lesser General Public License for more details.\r
+* \r
+* You should have received a copy of the GNU Lesser General Public\r
+* License along with this library; see the file COPYING. If not, write to\r
+* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+*\r
+*/\r
+#include <gpac/media_tools.h>\r
+#include <gpac/constants.h>\r
+#include <gpac/base_coding.h>\r
+#include <gpac/ietf.h>\r
+#include <gpac/mpegts.h>\r
+\r
+#define UDP_BUFFER_SIZE 64484\r
+\r
+/* adapted from http://svn.assembla.com/svn/legend/segmenter/segmenter.c */\r
+static GF_Err write_manifest(char *manifest, char *segment_dir, u32 segment_duration, char *segment_prefix, char *http_prefix, \r
+ u32 first_segment, u32 last_segment, Bool end) {\r
+ FILE *manifest_fp;\r
+ u32 i;\r
+ char manifest_tmp_name[GF_MAX_PATH];\r
+ char manifest_name[GF_MAX_PATH];\r
+ char *tmp_manifest = manifest_tmp_name;\r
+\r
+ if (segment_dir) {\r
+ sprintf(manifest_tmp_name, "%stmp.m3u8", segment_dir);\r
+ sprintf(manifest_name, "%s%s", segment_dir, manifest);\r
+ } else {\r
+ sprintf(manifest_tmp_name, "tmp.m3u8");\r
+ sprintf(manifest_name, "%s", manifest);\r
+ }\r
+\r
+ manifest_fp = fopen(tmp_manifest, "w");\r
+ if (!manifest_fp) {\r
+ fprintf(stderr, "Could not create m3u8 manifest file (%s)\n", tmp_manifest);\r
+ return GF_BAD_PARAM;\r
+ }\r
+\r
+ fprintf(manifest_fp, "#EXTM3U\n#EXT-X-TARGETDURATION:%u\n#EXT-X-MEDIA-SEQUENCE:%u\n", segment_duration, first_segment);\r
+\r
+ for (i = first_segment; i <= last_segment; i++) {\r
+ fprintf(manifest_fp, "#EXTINF:%u,\n%s%s_%u.ts\n", segment_duration, http_prefix, segment_prefix, i);\r
+ }\r
+\r
+ if (end) {\r
+ fprintf(manifest_fp, "#EXT-X-ENDLIST\n");\r
+ }\r
+ fclose(manifest_fp);\r
+\r
+ if (!rename(tmp_manifest, manifest_name)) {\r
+ return GF_OK;\r
+ } else {\r
+ if (remove(manifest_name)) {\r
+ fprintf(stdout, "Error removing file %s\n", manifest_name);\r
+ return GF_IO_ERR;\r
+ } else if (rename(tmp_manifest, manifest_name)) {\r
+ fprintf(stderr, "Could not rename temporary m3u8 manifest file (%s) into %s\n", tmp_manifest, manifest_name);\r
+ return GF_IO_ERR;\r
+ } else {\r
+ return GF_OK;\r
+ }\r
+ }\r
+}\r
+\r
+void usage() \r
+{\r
+ fprintf(stderr, "usage: udptsseg -src=UDP -dst-file=FILE -segment-duration=DUR -segment-dir=DIR -segment-manifest=M3U8 -segment-http-prefix=P -segment-number=N\n"\r
+ "-src=UDP udp://address:port providing the input transport stream\n"\r
+ "-dst-file=FILE e.g. out.ts, radical name of all segments\n"\r
+ "-segment-dir=DIR server local directory to store segments (with the trailing path separator)\n"\r
+ "-segment-duration=DUR segment duration in seconds\n"\r
+ "-segment-manifest=M3U8 m3u8 file basename\n"\r
+ "-segment-http-prefix=P client address for accessing server segments\n"\r
+ "-segment-number=N only n segments are used using a cyclic pattern\n"\r
+ "\n");\r
+}\r
+\r
+int main(int argc, char **argv)\r
+{\r
+ u32 i;\r
+ char *arg = NULL;\r
+ char *ts_in = NULL;\r
+ char *segment_dir = NULL;\r
+ char *segment_manifest = NULL;\r
+ char *segment_http_prefix = NULL;\r
+ u32 run_time = 0;\r
+ char *input_ip = NULL;\r
+ u32 input_port = 0;\r
+ GF_Socket *input_udp_sk = NULL;\r
+ char *input_buffer = NULL;\r
+ u32 input_buffer_size = UDP_BUFFER_SIZE;\r
+ GF_Err e = GF_OK;\r
+ FILE *ts_output_file = NULL;\r
+ char *ts_out = NULL;\r
+ char segment_prefix[GF_MAX_PATH];\r
+ char segment_name[GF_MAX_PATH];\r
+ u32 segment_duration = 0;\r
+ u32 segment_index = 0;\r
+ u32 segment_number = 0;\r
+ char segment_manifest_default[GF_MAX_PATH];\r
+ u32 run = 1;\r
+ u32 last_segment_time = 0;\r
+ u32 last_segment_size = 0;\r
+ u32 read = 0;\r
+ u32 towrite = 0;\r
+ u32 leftinbuffer = 0; \r
+\r
+ fprintf(stdout, "UDP Transport Stream Segmenter\n");\r
+\r
+ if (argc < 7) {\r
+ usage();\r
+ return 0;\r
+ }\r
+ /*****************/\r
+ /* gpac init */\r
+ /*****************/\r
+ gf_sys_init(0);\r
+ gf_log_set_level(GF_LOG_ERROR);\r
+ gf_log_set_tools(0xFFFFFFFF);\r
+\r
+ /*****************/\r
+ /* parsing of the arguments */\r
+ /*****************/\r
+ for (i = 1; i < (u32) argc ; i++) {\r
+ arg = argv[i];\r
+ if (!strnicmp(arg, "-src=udp://",11)) { \r
+ char *sep;\r
+ arg+=11;\r
+ sep = strchr(arg+6, ':');\r
+ if (sep) {\r
+ input_port = atoi(sep+1);\r
+ sep[0]=0;\r
+ input_ip = gf_strdup(arg);\r
+ sep[0]=':';\r
+ } else {\r
+ input_ip = gf_strdup(arg);\r
+ }\r
+\r
+ } else if (!strnicmp(arg, "-time=", 6)) {\r
+ run_time = atoi(arg+6);\r
+ } else if (!strnicmp(arg, "-dst-file=", 10)) {\r
+ ts_out = gf_strdup(arg+10);\r
+ } else if (!strnicmp(arg, "-segment-dir=", 13)) {\r
+ segment_dir = gf_strdup(arg+13);\r
+ } else if (!strnicmp(arg, "-segment-duration=", 18)) {\r
+ segment_duration = atoi(arg+18);\r
+ } else if (!strnicmp(arg, "-segment-manifest=", 18)) {\r
+ segment_manifest = gf_strdup(arg+18);\r
+ } else if (!strnicmp(arg, "-segment-http-prefix=", 21)) {\r
+ segment_http_prefix = gf_strdup(arg+21);\r
+ } else if (!strnicmp(arg, "-segment-number=", 16)) {\r
+ segment_number = atoi(arg+16);\r
+ } \r
+ }\r
+ fprintf(stdout, "Listening to TS input on %s:%d\n", input_ip, input_port);\r
+ fprintf(stdout, "Creating %d sec. segments in directory %s\n", segment_duration, segment_dir);\r
+ fprintf(stdout, "Creating %s manifest with %d segments\n", segment_manifest, segment_number);\r
+\r
+ /*****************/\r
+ /* creation of the input socket */\r
+ /*****************/\r
+ input_udp_sk = gf_sk_new(GF_SOCK_TYPE_UDP);\r
+ if (gf_sk_is_multicast_address((char *)input_ip)) {\r
+ e = gf_sk_setup_multicast(input_udp_sk, (char *)input_ip, input_port, 32, 0, NULL);\r
+ } else {\r
+ e = gf_sk_bind(input_udp_sk, NULL, input_port, (char *)input_ip, input_port, GF_SOCK_REUSE_PORT);\r
+ }\r
+ if (e) {\r
+ fprintf(stdout, "Error initializing UDP socket for %s:%d : %s\n", input_ip, input_port, gf_error_to_string(e));\r
+ goto exit;\r
+ }\r
+ gf_sk_set_buffer_size(input_udp_sk, 0, UDP_BUFFER_SIZE);\r
+ gf_sk_set_block_mode(input_udp_sk, 1);\r
+\r
+ /*****************/\r
+ /* Initialisation of the TS and Manifest files */\r
+ /*****************/\r
+\r
+ if (segment_duration) {\r
+ char *dot;\r
+ strcpy(segment_prefix, ts_out);\r
+ dot = strrchr(segment_prefix, '.');\r
+ dot[0] = 0;\r
+ if (segment_dir) {\r
+ if (strchr("\\/", segment_name[strlen(segment_name)-1])) {\r
+ sprintf(segment_name, "%s%s_%d.ts", segment_dir, segment_prefix, segment_index);\r
+ } else {\r
+ sprintf(segment_name, "%s%c%s_%d.ts", segment_dir, GF_PATH_SEPARATOR, segment_prefix, segment_index);\r
+ }\r
+ } else {\r
+ sprintf(segment_name, "%s_%d.ts", segment_prefix, segment_index);\r
+ }\r
+ fprintf(stderr, "Processing %s segment\r", segment_name);\r
+ ts_out = gf_strdup(segment_name);\r
+ if (!segment_manifest) { \r
+ sprintf(segment_manifest_default, "%s.m3u8", segment_prefix);\r
+ segment_manifest = segment_manifest_default;\r
+ }\r
+ //write_manifest(segment_manifest, segment_dir, segment_duration, segment_prefix, segment_http_prefix, segment_index, 0, 0);\r
+ } \r
+ ts_output_file = fopen(ts_out, "wb");\r
+ if (!ts_output_file) {\r
+ fprintf(stderr, "Error opening %s\n", ts_out);\r
+ goto exit;\r
+ }\r
+\r
+ /*allocate data buffer*/\r
+ input_buffer = (char*)gf_malloc(input_buffer_size);\r
+ assert(input_buffer);\r
+\r
+ /*****************/\r
+ /* main loop */\r
+ /*****************/\r
+ last_segment_time = gf_sys_clock();\r
+ last_segment_size = 0;\r
+ while (run) {\r
+ /*check for some input from the network*/\r
+ if (input_ip) {\r
+ gf_sk_receive(input_udp_sk, input_buffer+leftinbuffer, input_buffer_size-leftinbuffer, 0, &read);\r
+ leftinbuffer += read;\r
+ if (leftinbuffer) {\r
+ fprintf(stderr, "Processing %s segment ... received %d bytes (buffer: %d, segment: %d)\n", segment_name, read, leftinbuffer, last_segment_size);\r
+ if (input_buffer[0] != 0x47) {\r
+ u32 i = 0;\r
+ while (input_buffer[i] != 0x47 && i < leftinbuffer) i++;\r
+ fprintf(stderr, "Warning: data in buffer not starting with the MPEG-2 TS sync byte, skipping %d bytes of %d\n", i, leftinbuffer);\r
+ if (i < leftinbuffer) memmove(input_buffer, input_buffer+i, leftinbuffer-i);\r
+ leftinbuffer -=i; \r
+ }\r
+ if ((leftinbuffer % 188) != 0) {\r
+ fprintf(stderr, "Warning: data in buffer with a size (%d bytes) not multiple of 188 bytes\n", leftinbuffer);\r
+ towrite = leftinbuffer - (leftinbuffer % 188);\r
+ } else {\r
+ towrite = leftinbuffer;\r
+ }\r
+ } else {\r
+ towrite = 0;\r
+ }\r
+ /*write to current file */\r
+ if (ts_output_file != NULL) {\r
+ u32 now = gf_sys_clock();\r
+ if (towrite) {\r
+ fwrite(input_buffer, 1, towrite, ts_output_file); \r
+ if (towrite < leftinbuffer) {\r
+ fprintf(stderr, "Warning: wrote %d bytes, keeping %d bytes\n", towrite, (leftinbuffer-towrite));\r
+ memmove(input_buffer, input_buffer+towrite, leftinbuffer-towrite);\r
+ }\r
+ leftinbuffer -= towrite;\r
+ last_segment_size += towrite;\r
+ }\r
+ if ((now - last_segment_time) > segment_duration*1000) { \r
+ last_segment_time = now;\r
+ fclose(ts_output_file);\r
+ fprintf(stderr, "Closing segment %s (%d bytes)\n", segment_name, last_segment_size);\r
+ last_segment_size = 0;\r
+ segment_index++;\r
+ if (segment_dir) {\r
+ if (strchr("\\/", segment_name[strlen(segment_name)-1])) {\r
+ sprintf(segment_name, "%s%s_%d.ts", segment_dir, segment_prefix, segment_index);\r
+ } else {\r
+ sprintf(segment_name, "%s%c%s_%d.ts", segment_dir, GF_PATH_SEPARATOR, segment_prefix, segment_index);\r
+ }\r
+ } else {\r
+ sprintf(segment_name, "%s_%d.ts", segment_prefix, segment_index);\r
+ }\r
+ ts_output_file = fopen(segment_name, "wb");\r
+ if (!ts_output_file) {\r
+ fprintf(stderr, "Error opening segment %s\n", segment_name);\r
+ goto exit;\r
+ }\r
+ /* delete the oldest segment */\r
+ if (segment_number && ((s32) (segment_index - segment_number - 1) >= 0)){\r
+ char old_segment_name[GF_MAX_PATH];\r
+ if (segment_dir) {\r
+ if (strchr("\\/", segment_name[strlen(segment_name)-1])) {\r
+ sprintf(old_segment_name, "%s%s_%d.ts", segment_dir, segment_prefix, segment_index - segment_number - 1);\r
+ } else {\r
+ sprintf(old_segment_name, "%s/%s_%d.ts", segment_dir, segment_prefix, segment_index - segment_number - 1);\r
+ }\r
+ } else {\r
+ sprintf(old_segment_name, "%s_%d.ts", segment_prefix, segment_index - segment_number - 1);\r
+ }\r
+ gf_delete_file(old_segment_name);\r
+ fprintf(stderr, "Deleting segment %s\n", old_segment_name);\r
+ }\r
+ write_manifest(segment_manifest, segment_dir, segment_duration, segment_prefix, segment_http_prefix, \r
+ // (segment_index >= segment_number/2 ? segment_index - segment_number/2 : 0), segment_index >1 ? segment_index-1 : 0, 0);\r
+ ( (segment_index > segment_number ) ? segment_index - segment_number : 0), segment_index >1 ? segment_index-1 : 0, 0);\r
+ } \r
+ }\r
+\r
+ //}\r
+ }\r
+ /*cpu load regulation*/\r
+ gf_sleep(1);\r
+ }\r
+exit:\r
+ return 0;\r
+}\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="udptsseg" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=udptsseg - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "udptsseg.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "udptsseg.mak" CFG="udptsseg - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "udptsseg - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "udptsseg - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "udptsseg - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x40c /d "NDEBUG"\r
+# ADD RSC /l 0x40c /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"../../../bin/w32_rel/udptsseg.exe" /libpath:"../../../extra_lib/lib/w32_rel"\r
+\r
+!ELSEIF "$(CFG)" == "udptsseg - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x40c /d "_DEBUG"\r
+# ADD RSC /l 0x40c /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"../../../bin/w32_deb/udptsseg.exe" /pdbtype:sept /libpath:"../../../extra_lib/lib/w32_deb"\r
+# SUBTRACT LINK32 /nodefaultlib\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "udptsseg - Win32 Release"\r
+# Name "udptsseg - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=.\main.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+# End Source File\r
+# End Target\r
+# End Project\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8.00"\r
+ Name="udptsseg"\r
+ ProjectGUID="{540C6736-A386-4E04-ADC8-E28C6FC7DC91}"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory=".\Debug"\r
+ IntermediateDirectory=".\Debug"\r
+ ConfigurationType="1"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ TypeLibraryName=".\Debug/udptsseg.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="..\..\include"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile=".\Debug/udptsseg.pch"\r
+ AssemblerListingLocation=".\Debug/"\r
+ ObjectFile=".\Debug/"\r
+ ProgramDataBaseFileName=".\Debug/"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="odbc32.lib odbccp32.lib"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/udptsseg.exe"\r
+ LinkIncremental="2"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../../extra_lib/lib/w32_deb"\r
+ GenerateDebugInformation="true"\r
+ ProgramDatabaseFile=".\Debug/udptsseg.pdb"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile=".\Debug/udptsseg.bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory=".\Release"\r
+ IntermediateDirectory=".\Release"\r
+ ConfigurationType="1"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ TypeLibraryName=".\Release/udptsseg.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="2"\r
+ InlineFunctionExpansion="1"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ EnableFunctionLevelLinking="true"\r
+ PrecompiledHeaderFile=".\Release/udptsseg.pch"\r
+ AssemblerListingLocation=".\Release/"\r
+ ObjectFile=".\Release/"\r
+ ProgramDataBaseFileName=".\Release/"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="NDEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="odbc32.lib odbccp32.lib"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/udptsseg.exe"\r
+ LinkIncremental="1"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../../extra_lib/lib/w32_rel"\r
+ ProgramDatabaseFile=".\Release/udptsseg.pdb"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile=".\Release/udptsseg.bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <File\r
+ RelativePath=".\main.c"\r
+ >\r
+ </File>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
u32 ESID;
V4Service *v4serv = (V4Service *)plug->priv;
- sscanf(url, "ES_ID=%d", &ESID);
+ sscanf(url, "ES_ID=%ud", &ESID);
if (!ESID) {
gf_term_on_connect(v4serv->GetService(), channel, GF_STREAM_NOT_FOUND);
} else {
--- /dev/null
+for /f "delims=" %%a in ('svnversion') do set gpac_revision=%%a
+
+ECHO [Version] > gpaccab.inf
+ECHO Provider = "GPAC 0.4.6-r%gpac_revision%" >> gpaccab.inf
+type gpac.inf >> gpaccab.inf
+
+CabWiz gpaccab.inf
+
+ECHO off
+
+ECHO [CEAppManager]> gpac.ini
+ECHO Version = 0.4.6-r%gpac_revision%>> gpac.ini
+ECHO Component = GPAC for Windows Mobile>> gpac.ini
+ECHO [GPAC for Windows Mobile]>> gpac.ini
+ECHO Description = GPAC MPEG-4 Player>> gpac.ini
+ECHO Uninstall = GPAC Osmophone>> gpac.ini
+ECHO IconFile = ..\..\..\..\doc\osmo4.ico>> gpac.ini
+ECHO IconIndex = 0 >> gpac.ini
+ECHO CabFiles = gpaccab.cab >> gpac.ini
+
+ECHO on
+
+ezsetup -l english -i gpac.ini -r readme.txt -e ../../../../COPYING -o gpac.exe
+rename gpac.exe "GPAC_0.4.6-r%gpac_revision%_WindowsMobile.exe"
+DEL gpaccab.cab
+DEL gpaccab.inf
+DEL gpac.ini
--- /dev/null
+;[Version]
+;Provider = "GPAC 0.4.6"
+Signature = "$Windows NT$"
+CESignature = "$Windows CE$"
+
+[CEStrings]
+;Osmo4 for PocketPC install, Osmophone for Smartphone install
+AppName = Osmophone
+InstallDir = \Program Files\GPAC
+
+[Strings]
+;Osmo4.exe for PocketPC install, Osmophone.exe for Smartphone install
+ExeName = Osmophone.exe
+
+[DefaultInstall]
+CopyFiles = BinFiles , Exefiles
+AddReg = GPACReg
+CEShortcuts = Shortcut , ProgLink
+CESelfRegister=GPAX.dll
+
+
+[SourceDisksNames]
+
+1 =, "Common Files",, ..
+2 =, "Extra Files",, .
+3 =, "Doc Files",, ..\..\..\..\doc\
+
+[SourceDisksFiles]
+libgpac.dll = 1
+%ExeName% = 1
+;Osmo4.exe = 1
+GPAX.dll = 1
+gpac.mp4 = 3
+
+msvcr80.dll = 1
+
+;comment this one if not using OpenGL
+libGLES_CM.dll = 1
+
+;comment this one if not using SpiderMonkey
+js.dll = 1
+
+;uncomment if your device doesn't have GX installed (I think most do)
+;gx.dll = 2
+
+;all gpac modules - comment the ones you haven't compiled
+gm_aac_in.dll = 1
+gm_bifs_dec.dll = 1
+gm_ctx_load.dll = 1
+gm_dummy_in.dll = 1
+gm_ffmpeg_in.dll = 1
+avcodec-52.dll = 1
+avformat-52.dll = 1
+avutil-50.dll = 1
+swscale-0.dll = 1
+gm_ft_font.dll = 1
+gm_gapi.dll = 1
+gm_gpac_js.dll = 1
+gm_img_in.dll = 1
+gm_ismacryp.dll = 1
+gm_isom_in.dll = 1
+gm_laser_dec.dll = 1
+gm_mp3_in.dll = 1
+gm_mpegts_in.dll = 1
+gm_odf_dec.dll = 1
+gm_platinum.dll = 1
+gm_rtp_in.dll = 1
+gm_timedtext.dll = 1
+gm_soft_raster.dll = 1
+gm_svg_in.dll = 1
+gm_wav_out.dll = 1
+gm_widgetman.dll = 1
+gm_xvid_dec.dll = 1
+gm_ogg.dll = 1
+
+
+;==================================================
+
+
+
+; Ouput directories for files & shortcuts
+
+[DestinationDirs]
+BinFiles = 0, %CE2%
+Exefiles = 0, %InstallDir%
+Shortcut = 0, %CE17%
+ProgLink = 0, %CE11%
+DefaultDestDir = 0, %InstallDir%
+
+[BinFiles]
+;"gx.dll"
+"libgpac.dll"
+"GPAX.dll"
+"js.dll"
+"libGLES_CM.dll"
+"msvcr80.dll"
+
+[Exefiles]
+"%ExeName%"
+"gpac.mp4"
+"gm_aac_in.dll"
+"gm_bifs_dec.dll"
+"gm_ctx_load.dll"
+"gm_dummy_in.dll"
+"gm_ffmpeg_in.dll"
+"avcodec-52.dll"
+"avformat-52.dll"
+"avutil-50.dll"
+"swscale-0.dll"
+"gm_ft_font.dll"
+"gm_gapi.dll"
+"gm_gpac_js.dll"
+"gm_img_in.dll"
+"gm_ismacryp.dll"
+"gm_isom_in.dll"
+"gm_laser_dec.dll"
+"gm_mp3_in.dll"
+"gm_mpegts_in.dll"
+"gm_odf_dec.dll"
+"gm_platinum.dll"
+"gm_rtp_in.dll"
+"gm_timedtext.dll"
+"gm_soft_raster.dll"
+"gm_svg_in.dll"
+"gm_wav_out.dll"
+"gm_widgetman.dll"
+"gm_xvid_dec.dll"
+"gm_ogg.dll"
+
+[GPACReg]
+;GPAC cfg file location
+HKCR,GPAC,InstallDir,0x00000000,%InstallDir%
+
+;GPAC cfg file association
+HKCR,.cfg,,0x00000000,txtfile
+
+;MP4 file association
+HKCR,.mp4,,0x00000000,mp4file
+HKCR,mp4file\Shell\Open\Command,,0x00000000,"""%InstallDir%\%ExeName%""" """%%L"""
+
+;Icon number is bin ID of ressource in app
+HKCR,mp4file\DefaultIcon,,0x00000000,"%InstallDir%\%ExeName%,-128"
+
+[Shortcut]
+"%AppName%", 0, "%ExeName%"
+
+[ProgLink]
+"%AppName%", 0, "%ExeName%"
+
--- /dev/null
+This will install GPAC version 0.4.5 for ARM PocketPC/SmartPhones 2003 Platforms\r
+\r
+GPAC is an open source MPEG-4 framework developped by ENST and available at:\r
+ http://gpac.sourceforge.net\r
+\r
+WARNING: THIS RELEASE COMES WITH NO WARRANTY, AND MAY EVEN DAMAGE YOUR HANDHELD DEVICE. PLEASE READ CAREFULLY THE LICENSE HEREJOIN\r
--- /dev/null
+;--------------------------------
+;This default configuration file will generate an unversioned installer.\r
+;Please Check the readme.txt file.\r
+\r
+!define /date RELDATE "%Y%m%d_%H%M"\r
+Name "GPAC Framework ${GPAC_VERSION}"\r
+OutFile "GPAC.Framework.Setup-${GPAC_VERSION}-${RELDATE}_unversioned.exe"\r
--- /dev/null
+;--------------------------------
+;General
+!define GPAC_VERSION 0.4.6-DEV
+!include default.out
+
+!define GPAC_ROOT ..\..\..\..
+
+InstallDir "$PROGRAMFILES\GPAC"
+InstallDirRegKey HKCU "SOFTWARE\GPAC" "InstallDir"
+
+RequestExecutionLevel user
+
+
+;--------------------------------
+;Include Modern UI
+
+ !include "MUI2.nsh"
+
+WindowIcon on
+Icon "..\..\..\..\doc\osmo4.ico"
+UninstallIcon "..\..\..\..\doc\osmo4.ico"
+
+
+;--------------------------------
+;Interface Settings
+
+ !define MUI_ABORTWARNING
+
+Var DIALOG
+Var Label
+Var Confirm
+
+LangString PAGE_TITLE ${LANG_ENGLISH} "Title"
+LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Subtitle"
+
+Function EnableNext
+ Pop $R1
+ ${NSD_GetState} $Confirm $R1
+ GetDlgItem $0 $HWNDPARENT 1
+ ${If} $R1 == ${BST_CHECKED}
+ EnableWindow $0 1
+ ${Else}
+ EnableWindow $0 0
+ ${Endif}
+FunctionEnd
+
+Function customPage
+ !insertmacro MUI_HEADER_TEXT "Patents and Royalties" "Please read carefully the following clause."
+ GetDlgItem $0 $HWNDPARENT 1
+ EnableWindow $0 0
+ nsDialogs::Create 1018
+ Pop $DIALOG
+
+ ${NSD_CreateLabel} 0 0 100% 120u "Multimedia technologies are often covered by various patents which are most of the time hard to identify. These patents may or may not apply in your local jurisdiction. By installing this software, you acknowledge that you may have to pay royaltee fees in order to legally use this software. Do not proceed with this setup if you do not understand or do not agree with these terms. In any case, the authors and/or distributors bears no liability for any infringing usage of this software, which is provided for educational or research purposes."
+ Pop $Label
+
+ ${NSD_CreateCheckBox} 0 -30 100% 12u "I understand and accept the conditions"
+ Pop $Confirm
+ GetFunctionAddress $0 EnableNext
+ nsDialogs::OnClick $Confirm $0
+
+
+ nsDialogs::Show
+FunctionEnd
+
+;--------------------------------
+;Pages
+
+ !insertmacro MUI_PAGE_WELCOME
+ !insertmacro MUI_PAGE_LICENSE "${GPAC_ROOT}\COPYING"
+ Page custom customPage
+ !insertmacro MUI_PAGE_COMPONENTS
+ !insertmacro MUI_PAGE_DIRECTORY
+
+ !insertmacro MUI_PAGE_INSTFILES
+ !insertmacro MUI_PAGE_FINISH
+
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+
+ !insertmacro MUI_LANGUAGE "English"
+
+ComponentText "This will install the GPAC Framework on your computer. Select which optional things you want installed."
+DirText "This will install the GPAC Framework on your computer. Choose a directory"
+
+
+Function FctWriteRegStrAuth
+ ;local var
+ Push $0
+ Push $R0
+ Push $R1
+ Push $R2
+ Push $R3
+ ;pop function arguments
+ Exch 5
+ Pop $R3
+ Exch 5
+ Pop $R2
+ Exch 5
+ Pop $R1
+ Exch 5
+ Pop $R0
+
+ ;test if calling HKCR
+ StrCmp $R0 "HKCR" +1 +3
+ WriteRegStr HKCR $R1 $R2 $R3
+ goto lbl_end
+
+ #has current user admin privileges?
+ userInfo::getAccountType
+ Pop $0
+ StrCmp $0 "Admin" lbl_admin lbl_not_admin
+
+ lbl_admin:
+ WriteRegStr HKLM $R1 $R2 $R3
+ goto lbl_end
+
+ lbl_not_admin:
+ WriteRegStr HKCU $R1 $R2 $R3
+
+ lbl_end:
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+ Pop $0
+FunctionEnd
+
+!macro WriteRegStrAuth HKREG SUBREG ENTRY VALUESTR
+ Push "${HKREG}"
+ Push "${SUBREG}"
+ Push "${ENTRY}"
+ Push "${VALUESTR}"
+ Call FctWriteRegStrAuth
+!macroend
+
+!define WriteRegStrAuth "!insertmacro WriteRegStrAuth"
+
+
+Function un.FctDeleteRegKeyAuth
+ ;local var
+ Push $0
+ Push $R0
+ Push $R1
+ ;pop function arguments
+ Exch 3
+ Pop $R1
+ Exch 3
+ Pop $R0
+
+ ;test if calling HKCR
+ StrCmp $R0 "HKCR" +1 +3
+ DeleteRegKey HKCR $R1
+ goto lbl_end
+
+ #has current user admin privileges?
+ userInfo::getAccountType
+ Pop $0
+ StrCmp $0 "Admin" lbl_admin lbl_not_admin
+
+ lbl_admin:
+ DeleteRegKey HKLM $R1
+ goto lbl_end
+
+ lbl_not_admin:
+ DeleteRegKey HKCU $R1
+
+ lbl_end:
+ Pop $0
+ Pop $R1
+ Pop $R0
+FunctionEnd
+
+!macro DeleteRegKeyAuth HKREG SUBREG
+ Push "${HKREG}"
+ Push "${SUBREG}"
+ Call un.FctDeleteRegKeyAuth
+!macroend
+
+!define DeleteRegKeyAuth "!insertmacro DeleteRegKeyAuth"
+
+
+Function InsertGDIPLUS
+ Push $R0
+ Push $R1
+ ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $R0 "" 0 lbl_winnt
+
+ ;NOT NT
+ ReadRegStr $R0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion VersionNumber
+
+ StrCpy $R1 $R0 1
+ ; win95, NOT SUPPORTED
+ StrCmp $R1 '4' 0 lbl_err_95
+ StrCpy $R1 $R0 3
+ StrCmp $R1 '4.0' lbl_err_95
+ ;winME or 98 otherwise
+ StrCmp $R1 '4.9' lbl_add lbl_add
+
+lbl_err_nt:
+ MessageBox MB_OK "Microsoft GDI+ cannot be installed on NT 3 Systems"
+ Goto lbl_done
+
+lbl_err_95:
+ MessageBox MB_OK "Microsoft GDI+ cannot be installed on Windows 95 and older Systems"
+ Goto lbl_done
+
+lbl_winnt:
+ StrCpy $R1 $R0 1
+ StrCmp $R1 '3' lbl_err_nt
+ StrCmp $R1 '4' lbl_add
+ StrCpy $R1 $R0 3
+ StrCmp $R1 '5.0' lbl_add ;2000
+ StrCmp $R1 '5.1' lbl_xp ;XP
+ StrCmp $R1 '5.2' lbl_done ;.NET server
+
+lbl_add:
+ File ".\Gdiplus.dll"
+
+lbl_xp:
+ File "..\gm_gdip_raster.dll"
+
+lbl_done:
+FunctionEnd
+
+
+;osmo4 install
+Section "Osmo4/GPAC Player" SecOsmo4
+ SectionIn RO
+ SetOutPath $INSTDIR
+
+ File /oname=ReadMe.txt "${GPAC_ROOT}\README"
+ File /oname=License.txt "${GPAC_ROOT}\COPYING"
+ File /oname=Changelog.txt "${GPAC_ROOT}\Changelog"
+ File "${GPAC_ROOT}\doc\configuration.html"
+ File "${GPAC_ROOT}\doc\gpac.mp4"
+
+ File "..\Osmo4.exe"
+ File "..\..\..\..\doc\osmo4.ico"
+ File "..\libgpac.dll"
+ File "..\gm_dummy_in.dll"
+ File "..\gm_dx_hw.dll"
+ File "..\js32.dll"
+ File "..\gm_gpac_js.dll"
+
+ ;create default cache
+ SetOutPath $INSTDIR\cache
+
+
+ ;copy GUI
+ SetOutPath $INSTDIR\gui
+ File "..\..\..\..\gui\gui.bt"
+ File "..\..\..\..\gui\gui.js"
+ File "..\..\..\..\gui\gwlib.js"
+ File "..\..\..\..\gui\mpegu-core.js"
+ SetOutPath $INSTDIR\gui\icons
+ File /r /x .svn ..\..\..\..\gui\icons\*
+ SetOutPath $INSTDIR\gui\extensions
+ File /r /x .svn ..\..\..\..\gui\extensions\*
+
+ SetOutPath $INSTDIR
+
+ ${WriteRegStrAuth} HKCU "SOFTWARE\GPAC" "InstallDir" "$INSTDIR"
+ ${WriteRegStrAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" "DisplayName" "Osmo4/GPAC (remove only)"
+ ${WriteRegStrAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" "UninstallString" "$INSTDIR\uninstall.exe"
+ WriteUninstaller "uninstall.exe"
+
+SectionEnd
+
+SubSection "GPAC Plugins" SecPlugins
+
+
+;
+; 2 install modes, normal one and full one
+
+Section "MPEG-4 BIFS Decoder" SecBIFS
+ SectionIn 1
+ File "..\gm_bifs_dec.dll"
+SectionEnd
+
+Section "MPEG-4 ODF Decoder" SecODF
+ SectionIn 1
+ File "..\gm_odf_dec.dll"
+SectionEnd
+
+Section "MPEG-4 LASeR Decoder" SecLASeR
+ SectionIn 1
+ File "..\gm_laser_dec.dll"
+SectionEnd
+
+Section "MPEG-4 SAF Demultiplexer" SecSAF
+ SectionIn 1
+ File "..\gm_saf_in.dll"
+SectionEnd
+
+Section "Textual MPEG-4 Loader" SecTextLoad
+ SectionIn 1
+ File "..\gm_ctx_load.dll"
+SectionEnd
+
+Section "Image Package (PNG, JPEG, BMP)" SecIMG
+ SectionIn 1
+ File "..\gm_img_in.dll"
+SectionEnd
+
+Section "AAC Audio" SecAAC
+ SectionIn 1
+ File "..\gm_aac_in.dll"
+SectionEnd
+
+Section "MP3 Audio" SecMP3
+ SectionIn 1
+ File "..\gm_mp3_in.dll"
+SectionEnd
+
+Section "AC3 Audio" SecAC3
+ SectionIn 1
+ File "..\gm_ac3_in.dll"
+SectionEnd
+
+Section "FFMPEG" SecFFMPEG
+ SectionIn 1
+ File "..\gm_ffmpeg_in.dll"
+ File "..\avcodec-*.dll"
+ File "..\avformat-*.dll"
+ File "..\avutil-*.dll"
+ File "..\swscale-*.dll"
+SectionEnd
+
+Section "XviD Video Decoder" SecXVID
+ SectionIn 1
+ File "..\gm_xvid_dec.dll"
+SectionEnd
+
+;Section "AMR NB & WB" SecAMRFT
+; SectionIn 1
+; File "..\gm_amr_float_dec.dll"
+;SectionEnd
+
+Section "Subtitles" SecSUBS
+ SectionIn 1
+ File "..\gm_timedtext.dll"
+SectionEnd
+
+Section "ISO File Format" SecISOFF
+ SectionIn 1
+ File "..\gm_isom_in.dll"
+SectionEnd
+
+Section "MPEG-2 TS" SecM2TS
+ SectionIn 1
+ File "..\gm_mpegts_in.dll"
+SectionEnd
+
+Section "RTP/RTSP" SecRTP
+ SectionIn 1
+ File "..\gm_rtp_in.dll"
+SectionEnd
+
+Section "SVG" SecSVG
+ SectionIn 1
+ File "..\gm_svg_in.dll"
+SectionEnd
+
+
+Section "GDI+" SecGDIP
+ SectionIn 1
+ call InsertGDIPLUS
+SectionEnd
+
+Section "GPAC 2D Raster" SecG2DS
+ SectionIn 1
+ File "..\gm_soft_raster.dll"
+SectionEnd
+
+Section "FreeType" SecFT
+ SectionIn 1
+ File "..\gm_ft_font.dll"
+SectionEnd
+
+Section "Windows MME Audio" SecWAVE
+ SectionIn 1
+ File "..\gm_wav_out.dll"
+SectionEnd
+
+Section "Xiph" SecXIPH
+ SectionIn 1
+ File "..\gm_ogg.dll"
+SectionEnd
+
+Section "OpenSVC Decoder" SecOSVC
+ SectionIn 1
+ File "..\OpenSVCdecoder.plg"
+ File "..\gm_opensvc_dec.dll"
+SectionEnd
+
+Section "MPEG DASH Suppport" SecDASH
+ SectionIn 1
+ File "..\gm_mpd_in.dll"
+SectionEnd
+
+Section "UPnP Support" SecUPnP
+ SectionIn 1
+ File "..\gm_platinum.dll"
+SectionEnd
+
+Section "Widget Manager" SecMPEGU
+ SectionIn 1
+ File "..\gm_widgetman.dll"
+SectionEnd
+
+;Section "MobileIP Framework" SecMobIP
+; SectionIn 1
+; File "..\gm_mobile_ip.dll"
+; File "..\MobileSession.dll"
+;SectionEnd
+
+
+;Section "OFFIS Audio compressor" SecOffisComp
+; SectionIn 1
+; ;copy GUI
+; File "..\gm_offis_compressor.dll"
+; File "..\QtCore4.dll"
+; File "..\QtGui4.dll"
+; SetOutPath $INSTDIR\gui\extensions
+; File /r /x .svn ..\..\..\..\gui\extensions\offis*
+; SetOutPath $INSTDIR
+;SectionEnd
+
+SubSectionEnd
+
+
+Section "MP4Box" SecMP4B
+ SectionIn 1
+ SetOutPath $INSTDIR
+ File "..\MP4Box.exe"
+
+ Push $INSTDIR
+ Call AddToPath
+SectionEnd
+
+
+Section "GPAC SDK" SecSDK
+ SectionIn 1
+ SetOutPath $INSTDIR\sdk\include
+ File /r /x CVS ..\..\..\..\include\*.h
+ SetOutPath $INSTDIR\sdk\lib
+ File ..\libgpac.lib
+ File ..\..\..\..\extra_lib\lib\win32\release\js32.lib
+SectionEnd
+
+
+!define HK_MOZ "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0"
+
+Section "Osmozilla" SecZILLA
+ SectionIn 1
+ SetOutPath $INSTDIR
+ File "..\nposmozilla.dll"
+ File "..\nposmozilla.xpt"
+
+ ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Path" "$INSTDIR\nposmozilla.dll"
+ ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "XPTPath" "$INSTDIR\nposmozilla.xpt"
+ ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Version" "${GPAC_VERSION}"
+ ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Vendor" "GPAC"
+ ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Description" "GPAC plugin"
+ ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "ProductName" "Osmozilla"
+SectionEnd
+
+
+Section "GPAX" SecGPAX
+ SectionIn 1
+ SetOutPath $INSTDIR
+ File "..\GPAX.dll"
+ RegDLL "$INSTDIR\GPAX.dll"
+SectionEnd
+
+
+Section "MP4Client" SecMP4C
+ SectionIn 1
+ SetOutPath $INSTDIR
+ File "..\MP4Client.exe"
+SectionEnd
+
+
+
+Section "Windows Runtime Libraries" SecMSVCRT
+ SectionIn 1
+ File "..\Microsoft.VC90.CRT.manifest"
+ File "..\Microsoft.VC90.MFC.manifest"
+ File "..\msvcr90.dll"
+ File "..\mfc90.dll"
+SectionEnd
+
+
+
+
+SubSection "Osmo4 Shortcuts"
+
+Section "Add Start Menu Shortcuts"
+ SectionIn 1
+ #has current user admin privileges?
+ userInfo::getAccountType
+ Pop $0
+ StrCmp $0 "Admin" +1 +2
+ SetShellVarContext all
+ CreateDirectory "$SMPROGRAMS\Osmo4"
+ CreateShortCut "$SMPROGRAMS\Osmo4\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
+ CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0
+ CreateShortCut "$SMPROGRAMS\Osmo4\Readme.lnk" "$INSTDIR\ReadMe.txt"
+ CreateShortCut "$SMPROGRAMS\Osmo4\License.lnk" "$INSTDIR\License.txt"
+ CreateShortCut "$SMPROGRAMS\Osmo4\History.lnk" "$INSTDIR\changelog.txt"
+ CreateShortCut "$SMPROGRAMS\Osmo4\Configuration Info.lnk" "$INSTDIR\configuration.html"
+SectionEnd
+
+Section "Add shortcut to QuickLaunch"
+ SectionIn 1
+ CreateShortCut "$QUICKLAUNCH\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0
+SectionEnd
+
+Section "Add shortcut to Desktop"
+ SectionIn 1
+ CreateShortCut "$DESKTOP\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0
+SectionEnd
+
+!define SHCNE_ASSOCCHANGED 0x08000000
+!define SHCNF_IDLIST 0
+
+Section "Make Osmo4 the default MPEG-4 Player"
+ SectionIn 1
+ ;write file association
+ ${WriteRegStrAuth} HKCR GPAC\mp4\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0"
+ ${WriteRegStrAuth} HKCR GPAC\mp4\Shell\open\command "" "$INSTDIR\Osmo4.exe %L"
+ ${WriteRegStrAuth} HKCR .mp4 "" "GPAC\mp4"
+ !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
+
+SectionEnd
+
+Section "Associate 3GPP files (3GP) with Osmo4"
+ SectionIn 1
+ ;write file association
+ ${WriteRegStrAuth} HKCR GPAC\3gp\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0"
+ ${WriteRegStrAuth} HKCR GPAC\3gp\Shell\open\command "" "$INSTDIR\Osmo4.exe %L"
+ ${WriteRegStrAuth} HKCR .3gp "" "GPAC\3gp"
+ !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
+SectionEnd
+
+Section "Associate 3GPP2 files (3G2) with Osmo4"
+ SectionIn 1
+ ;write file association
+ ${WriteRegStrAuth} HKCR GPAC\3g2\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0"
+ ${WriteRegStrAuth} HKCR GPAC\3g2\Shell\open\command "" "$INSTDIR\Osmo4.exe %L"
+ ${WriteRegStrAuth} HKCR .3g2 "" "GPAC\3g2"
+ !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
+SectionEnd
+
+SubSectionEnd
+
+
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOsmo4} "Osmo4 player"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "GPAC Plugins"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecBIFS} "MPEG-4 BIFS Scene Decoder"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecODF} "MPEG-4 Object Descriptor Decoder"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecLASeR} "MPEG-4 LASeR Scene Decoder"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecTextLoad} "Support for uncompressed MPEG-4 (BT and XMT), VRML and X3D textual formats"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecSAF} "MPEG-4 SAF Demultiplexer"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecIMG} "Support for PNG, JPEG, BMP and JPEG2000 images"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecAAC} "Support for MPEG-4 Audio HE-AAC decoder and web radios"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecMP3} "Support for MPEG-1/2 Audio (inc. MP3) decoder and web radios"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecAC3} "Support for Dolby AC3 decoder and web radios"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMPEG} "Support for FFMPEG libraries for various format decoding and demultiplexing"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecXVID} "Support for XVID library for MPEG-4 Video Part 2 decoding"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecAMRFT} "Support for AMR and AMR WideBand decoder and web radios"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecSUBS} "Subtitle support include SRT, SUB, 3GPP and MPEG-4 Text formats"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecISOFF} "Support for ISO-based file formats (3GP, MP4, MJ2K)"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecM2TS} "Support for MPEG-2 Transport Stream"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecRTP} "Support for RTP and RTSP IP streaming"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecSVG} "Support for SVG including progressive loading"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecGDIP} "GDIPlus-based rasterizer"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecG2DS} "GPAC software rasterizer"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecFT} "FreeType font parsing"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecWAVE} "Windows MME Audio output support"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecXIPH} "Support for XIPP OGG, Vorbis and Theora media"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOSVC} "Support for SVC decoding through OpenSVC Decoder"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecDASH} "HTTP Streaming using MPEG DASH"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecUPnP} "Support for UPnP based on Platinum"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecMPEGU} "Support for W3C and MPEG-U Widgets"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecMobIP} "UNIGE Mobile IP Framework"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecOffisComp} "OFFIS Audio Compressor"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecMP4B} "MP4Box command-line tool for various multimedia operations"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecSDK} "GPAC SDK: headers and library files needed to develop modules for GPAC or appllication based on GPAC"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecZILLA} "GPAC playback support NPAPI-based browsers (FireFox/Gecko, Safari/WebKit)"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecGPAX} "GPAC playback support using ActiveX component (Internet Explorer)"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecMP4C} "GPAC command-line player and AVI dumper"
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+
+Function .onInstSuccess
+; MessageBox MB_YESNO "GPAC Framework installation complete. Do you want to launch the Osmo4 player?" IDNO NoLaunch
+; Exec $INSTDIR\Osmo4.exe
+; NoLaunch:
+FunctionEnd
+
+
+
+
+
+; uninstall stuff
+
+UninstallText "This will uninstall OSMO4/GPAC from your computer. Hit next to continue."
+
+; special uninstall section.
+Section "Uninstall"
+ ; remove registry keys
+ ${DeleteRegKeyAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4"
+ ${DeleteRegKeyAuth} HKCU "SOFTWARE\GPAC"
+ ${DeleteRegKeyAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0"
+ ${DeleteRegKeyAuth} HKCR GPAC\mp4\DefaultIcon
+ ${DeleteRegKeyAuth} HKCR GPAC\mp4\shell\open\command
+ ${DeleteRegKeyAuth} HKCR GPAC\mp4
+ ${DeleteRegKeyAuth} HKCR .mp4
+ ${DeleteRegKeyAuth} HKCR GPAC\3gp\DefaultIcon
+ ${DeleteRegKeyAuth} HKCR GPAC\3gp\shell\open\command
+ ${DeleteRegKeyAuth} HKCR GPAC\3gp
+ ${DeleteRegKeyAuth} HKCR .3gp
+ ${DeleteRegKeyAuth} HKCR GPAC\3g2\DefaultIcon
+ ${DeleteRegKeyAuth} HKCR GPAC\3g2\shell\open\command
+ ${DeleteRegKeyAuth} HKCR GPAC\3g2
+ ${DeleteRegKeyAuth} HKCR .3g2
+ ${DeleteRegKeyAuth} HKCR GPAC
+
+ UnRegDLL "$INSTDIR\GPAX.dll"
+ RMDir /r $INSTDIR
+ Push $INSTDIR
+ Call un.RemoveFromPath
+ #has current user admin privileges?
+ userInfo::getAccountType
+ Pop $0
+ StrCmp $0 "Admin" +1 +2
+ SetShellVarContext all
+ Delete "$SMPROGRAMS\Osmo4\*.*"
+ RMDir "$SMPROGRAMS\Osmo4"
+ Delete "$QUICKLAUNCH\Osmo4.lnk"
+ Delete "$DESKTOP\Osmo4.lnk"
+
+SectionEnd
+
+;path modif functions
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+; AddToPath - Adds the given dir to the search path.
+; Input - head of the stack
+; Note - Win9x systems requires reboot
+
+Function AddToPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ # don't add if the path doesn't exist
+ IfFileExists $0 "" AddToPath_done
+
+ ReadEnvStr $1 PATH
+ Push "$1;"
+ Push "$0;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$0\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ GetFullPathName /SHORT $3 $0
+ Push "$1;"
+ Push "$3;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$3\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+
+ Call IsNT
+ Pop $1
+ StrCmp $1 1 AddToPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" a
+ FileSeek $1 -1 END
+ FileReadByte $1 $2
+ IntCmp $2 26 0 +2 +2 # DOS EOF
+ FileSeek $1 -1 END # write over EOF
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+ FileClose $1
+ SetRebootFlag true
+ Goto AddToPath_done
+
+ AddToPath_NT:
+ ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+ StrCpy $2 $1 1 -1 # copy last char
+ StrCmp $2 ";" 0 +2 # if last char == ;
+ StrCpy $1 $1 -1 # remove last char
+ StrCmp $1 "" AddToPath_NTdoIt
+ StrCpy $0 "$1;$0"
+ AddToPath_NTdoIt:
+ WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
+
+ ReadRegStr $1 HKCU "Environment" "PATH"
+ StrCpy $2 $1 1 -1 # copy last char
+ StrCmp $2 ";" 0 +2 # if last char == ;
+ StrCpy $1 $1 -1 # remove last char
+ StrCmp $1 "" AddToPath_NTdoIt2
+ StrCpy $0 "$1;$0"
+ AddToPath_NTdoIt2:
+ WriteRegExpandStr HKCU "Environment" "PATH" $0
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ AddToPath_done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+; RemoveFromPath - Remove a given dir from the path
+; Input: head of the stack
+
+Function un.RemoveFromPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ IntFmt $6 "%c" 26 # DOS EOF
+
+ Call un.IsNT
+ Pop $1
+ StrCmp $1 1 unRemoveFromPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" r
+ GetTempFileName $4
+ FileOpen $2 $4 w
+ GetFullPathName /SHORT $0 $0
+ StrCpy $0 "SET PATH=%PATH%;$0"
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoop:
+ FileRead $1 $3
+ StrCpy $5 $3 1 -1 # read last char
+ StrCmp $5 $6 0 +2 # if DOS EOF
+ StrCpy $3 $3 -1 # remove DOS EOF so we can compare
+ StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+ FileWrite $2 $3
+ Goto unRemoveFromPath_dosLoop
+ unRemoveFromPath_dosLoopRemoveLine:
+ SetRebootFlag true
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoopEnd:
+ FileClose $2
+ FileClose $1
+ StrCpy $1 $WINDIR 2
+ Delete "$1\autoexec.bat"
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
+ Delete $4
+ Goto unRemoveFromPath_done
+
+ unRemoveFromPath_NT:
+ ReadRegStr $1 HKCU "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 ";" +2 # if last char != ;
+ StrCpy $1 "$1;" # append ;
+ Push $1
+ Push "$0;"
+ Call un.StrStr ; Find `$0;` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0;"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 ";" 0 +2 # if last char == ;
+ StrCpy $3 $3 -1 # remove last char
+
+ WriteRegExpandStr HKCU "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+###########################################
+# Utility Functions #
+###########################################
+
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+; Call IsNT
+; Pop $R0
+; ($R0 at this point is 1 or 0)
+
+!macro IsNT un
+Function ${un}IsNT
+ Push $0
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $0 "" 0 IsNT_yes
+ ; we are not NT.
+ Pop $0
+ Push 0
+ Return
+
+ IsNT_yes:
+ ; NT!!!
+ Pop $0
+ Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+
+; StrStr
+; input, top of stack = string to search for
+; top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+; Push "this is a long ass string"
+; Push "ass"
+; Call StrStr
+; Pop $R0
+; ($R0 at this point is "ass string")
+
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+ Exch ; st=old$R1,haystack
+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+ Push $R3
+ Push $R4
+ Push $R5
+ StrLen $R3 $R1
+ StrCpy $R4 0
+ ; $R1=needle
+ ; $R2=haystack
+ ; $R3=len(needle)
+ ; $R4=cnt
+ ; $R5=tmp
+ loop:
+ StrCpy $R5 $R2 $R3 $R4
+ StrCmp $R5 $R1 done
+ StrCmp $R5 "" done
+ IntOp $R4 $R4 + 1
+ Goto loop
+done:
+ StrCpy $R1 $R2 "" $R4
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
--- /dev/null
+GPAC: NSIS installer manual\r
+==========================\r
+\r
+Recommended\r
+-----------\r
+\r
+Please execute the "generate_installer.bat" file at the root GPAC directory. The revision and version will be retrieved.\r
+\r
+\r
+Alternative (developers only)\r
+-----------------------------\r
+\r
+Launching the NSIS installer the "bin\win32\release\nsis_install" will generate an unversion installer. The DATE/HOUR will be included in the installer file. Use it in case you're making some experimental developments.\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.artemis.gpac"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:name=".gpac"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+ <uses-sdk android:minSdkVersion="8" />
+
+</manifest>
\ No newline at end of file
--- /dev/null
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-8
--- /dev/null
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package com.artemis.gpac;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int icon=0x7f020000;
+ }
+ public static final class layout {
+ public static final int main=0x7f030000;
+ }
+ public static final class string {
+ public static final int app_name=0x7f040001;
+ public static final int hello=0x7f040000;
+ }
+}
--- /dev/null
+include $(call all-subdir-makefiles)
--- /dev/null
+APP_ABI := armeabi armeabi-v7a
+APP_OPTIM := release
+APP_MODULES := gpac gm_bifs_dec gm_ctx_load gm_dummy_in gm_ft_font gm_img_in gm_ismacryp gm_isom_in gm_laser_dec gm_odf_dec gm_rtp_in gm_saf_in gm_soft_raster gm_svg_in gm_timedtext libjavaenv gm_droidout gm_droidaudio gm_gpac_js gm_mp3_in gm_ffmpeg_in gm_mpegts_in gm_aac_in gm_mpd_in gm_widgetman gpacWrapper
+
--- /dev/null
+COMMON_PATH := $(call my-dir)
+
+#Settings common to all JNI Builds
+TARGET_PLATFORM := android-4
+
+# Common Flags for ligpac and modules
+LOCAL_CFLAGS += -DGPAC_ANDROID
+LOCAL_CFLAGS += -DGPAC_HAVE_CONFIG_H
+LOCAL_CFLAGS += -DXP_UNIX
+
--- /dev/null
+#!/bin/bash
+
+echo -e "\033[32m Note: You have to install Android NDK and setup the environment first!\033[0m"
+echo -e "\033[32m Note: You have to compile extra_libs first!\033[0m"
+
+if [ -z "$1" ]
+then
+ echo "Usage: $0 PATH_TO_ANDROID_NDK [ADDITIONAL_NDK-BUILD arguments] : You must give as first argument the directory path of the NDK"
+ exit 1
+fi
+
+export PATH="$1:$PATH"
+shift
+
+# Be sure to resolve if script not called from its directory
+export BUILDPATH=$(dirname "$0")
+cd $BUILDPATH || exit 1
+export BUILDPATH=$(pwd)
+echo "Current Dir = $BUILDPATH"
+version=$(svnversion)
+echo "*** Build path is $BUILDPATH, setting revision number $version"
+grep "$version" ../../../include/gpac/version.h 1>/dev/null && echo "Version $version already set" || echo "#define GPAC_SVN_REVISION \"$version\"" > ../../../include/gpac/version.h || exit 1
+echo "Building lib gpac ..."
+mkdir ../../../bin/android 2>/dev/null
+cd ../../../ || exit 1
+BASEPATH=$(pwd)
+
+rm -rf $BUILDPATH/../obj/local/armeabi/* || mkdir $BUILDPATH/../obj/local/armeabi
+rm -rf $BUILDPATH/../obj/local/armeabi-v7a/* || mkdir $BUILDPATH/../obj/local/armeabi-v7a
+
+
+cd $BUILDPATH || exit 1
+echo -n "Buiding all libs from $BUILDPATH..."
+ndk-build $* && echo "[OK] build successful." || echo "Build FAILED" || exit 1
+
+#echo "Copying modules to modules dir..."
+cd ../libs/ || exit 1
+#for i in $(find . -name 'gm*.so')
+#do
+# echo -n "$i..."
+# cp "$i" "$BASEPATH/applications/osmo4_android/res/raw/" || exit 1
+#done
+#echo
+#echo "[OK] success."
+
+LIBS_DIR="$BASEPATH/applications/osmo4_android/libs/"
+echo "Copying libs to libs dir $LIBS_DIR ..."
+for i in $(find . -name '*.so')
+do
+ echo -n "$i..."
+ cp "$i" "$LIBS_DIR/$i" || exit 1
+done
+echo
+echo "[OK] success."
+cd "$BASEPATH/extra_lib/lib/android" || exit 1
+echo "Copying all extra libs to $LIBS_DIR ..."
+for i in $(find . -name '*.so')
+do
+ echo -n "$i..."
+ cp "$i" "$LIBS_DIR/$i" || exit 1
+done
+echo "[OK] success."
--- /dev/null
+#you should run gpac config first
+#./configure --host=arm-eabi CC=arm-eabi-gcc CPPFLAGS="-I$NDK/build/platforms/android-3/arch-arm/usr/include/" CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=$NDK/build/platforms/android-4/arch-arm/usr/lib/ -L$NDK/build/platforms/android-3/arch-arm/usr/lib/" LIBS="-lc "
+#../../configure --host=arm-eabi CC=arm-eabi-gcc CPPFLAGS="-I$NDK/platforms/android-4/arch-arm/usr/include/" CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=$NDK/platforms/android-4/arch-arm/usr/lib/ -L$NDK/platforms/android-4/arch-arm/usr/lib/" LIBS="-lc "
+LOCAL_PATH:= $(call my-dir)
+APP_ABI := armeabi armeabi-v7a
+
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/../common.mk
+
+LOCAL_MODULE := gpac
+LOCAL_C_INCLUDES := $(LOCAL_PATH)
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/freetype
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/freetype/freetype
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/jpeg/android/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/png/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/faad
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/js/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../modules
+
+LOCAL_LDLIBS += -L$(COMMON_PATH)/../../../extra_lib/lib/android/$(TARGET_ARCH_ABI)
+LOCAL_LDLIBS += -lGLESv1_CM -ldl
+LOCAL_LDLIBS += -ljs_osmo -leditline -lft2 -ljpeg -lopenjpeg -lpng -lz
+#LOCAL_EXPORT_LDLIBS= -ljs_osmo -leditline -lft2 -ljpeg -lopenjpeg -lpng -lz
+
+
+LOCAL_CFLAGS += -DGPAC_HAVE_CONFIG_H
+LOCAL_CFLAGS += -DNO_MALLINFO
+LOCAL_CFLAGS += -DGPAC_ANDROID
+#LOCAL_CFLAGS += -DGPAC_FIXED_POINT
+
+LOCAL_SRC_FILES := \
+ ../../../../src/compositor/mpeg4_textures.c \
+ ../../../../src/compositor/navigate.c \
+ ../../../../src/compositor/texturing_gl.c \
+ ../../../../src/compositor/svg_paint_servers.c \
+ ../../../../src/compositor/audio_mixer.c \
+ ../../../../src/compositor/mpeg4_animstream.c \
+ ../../../../src/compositor/mpeg4_geometry_ifs2d.c \
+ ../../../../src/compositor/compositor.c \
+ ../../../../src/compositor/mesh_collide.c \
+ ../../../../src/compositor/svg_media.c \
+ ../../../../src/compositor/mesh_tesselate.c \
+ ../../../../src/compositor/mpeg4_bitmap.c \
+ ../../../../src/compositor/camera.c \
+ ../../../../src/compositor/svg_grouping.c \
+ ../../../../src/compositor/mpeg4_grouping.c \
+ ../../../../src/compositor/drawable.c \
+ ../../../../src/compositor/events.c \
+ ../../../../src/compositor/offscreen_cache.c \
+ ../../../../src/compositor/visual_manager.c \
+ ../../../../src/compositor/mpeg4_sound.c \
+ ../../../../src/compositor/mpeg4_grouping_3d.c \
+ ../../../../src/compositor/mpeg4_layer_3d.c \
+ ../../../../src/compositor/mpeg4_path_layout.c \
+ ../../../../src/compositor/mpeg4_geometry_2d.c \
+ ../../../../src/compositor/audio_input.c \
+ ../../../../src/compositor/compositor_node_init.c \
+ ../../../../src/compositor/mpeg4_geometry_3d.c \
+ ../../../../src/compositor/svg_base.c \
+ ../../../../src/compositor/mpeg4_geometry_ils2d.c \
+ ../../../../src/compositor/visual_manager_2d.c \
+ ../../../../src/compositor/mpeg4_sensors.c \
+ ../../../../src/compositor/mpeg4_form.c \
+ ../../../../src/compositor/x3d_geometry.c \
+ ../../../../src/compositor/texturing.c \
+ ../../../../src/compositor/mpeg4_audio.c \
+ ../../../../src/compositor/svg_font.c \
+ ../../../../src/compositor/mpeg4_background.c \
+ ../../../../src/compositor/audio_render.c \
+ ../../../../src/compositor/mpeg4_layout.c \
+ ../../../../src/compositor/mpeg4_grouping_2d.c \
+ ../../../../src/compositor/mesh.c \
+ ../../../../src/compositor/mpeg4_layer_2d.c \
+ ../../../../src/compositor/compositor_2d.c \
+ ../../../../src/compositor/svg_geometry.c \
+ ../../../../src/compositor/visual_manager_3d_gl.c \
+ ../../../../src/compositor/font_engine.c \
+ ../../../../src/compositor/mpeg4_viewport.c \
+ ../../../../src/compositor/bindable.c \
+ ../../../../src/compositor/mpeg4_text.c \
+ ../../../../src/compositor/mpeg4_timesensor.c \
+ ../../../../src/compositor/mpeg4_composite.c \
+ ../../../../src/compositor/visual_manager_2d_draw.c \
+ ../../../../src/compositor/mpeg4_background2d.c \
+ ../../../../src/compositor/visual_manager_3d.c \
+ ../../../../src/compositor/mpeg4_lighting.c \
+ ../../../../src/compositor/mpeg4_gradients.c \
+ ../../../../src/compositor/compositor_3d.c \
+ ../../../../src/compositor/hardcoded_protos.c \
+ ../../../../src/compositor/svg_text.c \
+ ../../../../src/compositor/hc_flash_shape.c \
+ ../../../../src/compositor/svg_filters.c \
+ ../../../../src/media_tools/avilib.c \
+ ../../../../src/media_tools/filestreamer.c \
+ ../../../../src/media_tools/isom_tools.c \
+ ../../../../src/media_tools/mpeg2_ps.c \
+ ../../../../src/media_tools/vobsub.c \
+ ../../../../src/media_tools/media_import.c \
+ ../../../../src/media_tools/text_import.c \
+ ../../../../src/media_tools/ismacryp.c \
+ ../../../../src/media_tools/img.c \
+ ../../../../src/media_tools/mpegts.c \
+ ../../../../src/media_tools/saf.c \
+ ../../../../src/media_tools/av_parsers.c \
+ ../../../../src/media_tools/isom_hinter.c \
+ ../../../../src/media_tools/gpac_ogg.c \
+ ../../../../src/media_tools/media_export.c \
+ ../../../../src/media_tools/dvb_mpe.c \
+ ../../../../src/media_tools/m2ts_mux.c \
+ ../../../../src/media_tools/reedsolomon.c \
+ ../../../../src/media_tools/mpd.c \
+ ../../../../src/media_tools/m3u8.c \
+ ../../../../src/laser/lsr_tables.c \
+ ../../../../src/laser/lsr_dec.c \
+ ../../../../src/laser/lsr_enc.c \
+ ../../../../src/scene_manager/scene_dump.c \
+ ../../../../src/scene_manager/loader_bt.c \
+ ../../../../src/scene_manager/loader_qt.c \
+ ../../../../src/scene_manager/encode_isom.c \
+ ../../../../src/scene_manager/swf_parse.c \
+ ../../../../src/scene_manager/scene_engine.c \
+ ../../../../src/scene_manager/scene_stats.c \
+ ../../../../src/scene_manager/scene_manager.c \
+ ../../../../src/scene_manager/text_to_bifs.c \
+ ../../../../src/scene_manager/loader_isom.c \
+ ../../../../src/scene_manager/swf_bifs.c \
+ ../../../../src/scene_manager/loader_xmt.c \
+ ../../../../src/scene_manager/loader_svg.c \
+ ../../../../src/utils/alloc.c \
+ ../../../../src/utils/os_net.c \
+ ../../../../src/utils/path2d_stroker.c \
+ ../../../../src/utils/zutil.c \
+ ../../../../src/utils/os_divers.c \
+ ../../../../src/utils/path2d.c \
+ ../../../../src/utils/base_encoding.c \
+ ../../../../src/utils/module.c \
+ ../../../../src/utils/uni_bidi.c \
+ ../../../../src/utils/dlmalloc.c \
+ ../../../../src/utils/math.c \
+ ../../../../src/utils/xml_parser.c \
+ ../../../../src/utils/os_module.c \
+ ../../../../src/utils/url.c \
+ ../../../../src/utils/downloader.c \
+ ../../../../src/utils/list.c \
+ ../../../../src/utils/error.c \
+ ../../../../src/utils/bitstream.c \
+ ../../../../src/utils/color.c \
+ ../../../../src/utils/token.c \
+ ../../../../src/utils/configfile.c \
+ ../../../../src/utils/utf.c \
+ ../../../../src/utils/os_thread.c \
+ ../../../../src/utils/cache.c \
+ ../../../../src/bifs/predictive_mffield.c \
+ ../../../../src/bifs/script_dec.c \
+ ../../../../src/bifs/memory_decoder.c \
+ ../../../../src/bifs/unquantize.c \
+ ../../../../src/bifs/script_enc.c \
+ ../../../../src/bifs/field_encode.c \
+ ../../../../src/bifs/conditional.c \
+ ../../../../src/bifs/bifs_node_tables.c \
+ ../../../../src/bifs/arith_decoder.c \
+ ../../../../src/bifs/field_decode.c \
+ ../../../../src/bifs/com_enc.c \
+ ../../../../src/bifs/quantize.c \
+ ../../../../src/bifs/bifs_codec.c \
+ ../../../../src/bifs/com_dec.c \
+ ../../../../src/ietf/rtsp_common.c \
+ ../../../../src/ietf/sdp.c \
+ ../../../../src/ietf/rtcp.c \
+ ../../../../src/ietf/rtsp_command.c \
+ ../../../../src/ietf/rtsp_session.c \
+ ../../../../src/ietf/rtp_pck_3gpp.c \
+ ../../../../src/ietf/rtp_pck_mpeg12.c \
+ ../../../../src/ietf/rtp_pck_mpeg4.c \
+ ../../../../src/ietf/rtsp_response.c \
+ ../../../../src/ietf/rtp_depacketizer.c \
+ ../../../../src/ietf/rtp_streamer.c \
+ ../../../../src/ietf/rtp.c \
+ ../../../../src/ietf/rtp_packetizer.c \
+ ../../../../src/isomedia/avc_ext.c \
+ ../../../../src/isomedia/box_dump.c \
+ ../../../../src/isomedia/box_code_isma.c \
+ ../../../../src/isomedia/track.c \
+ ../../../../src/isomedia/box_funcs.c \
+ ../../../../src/isomedia/isom_read.c \
+ ../../../../src/isomedia/box_code_meta.c \
+ ../../../../src/isomedia/box_code_base.c \
+ ../../../../src/isomedia/box_code_apple.c \
+ ../../../../src/isomedia/sample_descs.c \
+ ../../../../src/isomedia/meta.c \
+ ../../../../src/isomedia/stbl_read.c \
+ ../../../../src/isomedia/box_code_3gpp.c \
+ ../../../../src/isomedia/isom_intern.c \
+ ../../../../src/isomedia/isom_write.c \
+ ../../../../src/isomedia/isma_sample.c \
+ ../../../../src/isomedia/tx3g.c \
+ ../../../../src/isomedia/hint_track.c \
+ ../../../../src/isomedia/stbl_write.c \
+ ../../../../src/isomedia/data_map.c \
+ ../../../../src/isomedia/media.c \
+ ../../../../src/isomedia/hinting.c \
+ ../../../../src/isomedia/isom_store.c \
+ ../../../../src/isomedia/movie_fragments.c \
+ ../../../../src/isomedia/media_odf.c \
+ ../../../../src/mcrypt/ofb.c \
+ ../../../../src/mcrypt/tripledes.c \
+ ../../../../src/mcrypt/cfb.c \
+ ../../../../src/mcrypt/sha1.c \
+ ../../../../src/mcrypt/stream.c \
+ ../../../../src/mcrypt/rijndael-256.c \
+ ../../../../src/mcrypt/ncfb.c \
+ ../../../../src/mcrypt/rijndael-192.c \
+ ../../../../src/mcrypt/ctr.c \
+ ../../../../src/mcrypt/nofb.c \
+ ../../../../src/mcrypt/des.c \
+ ../../../../src/mcrypt/g_crypt.c \
+ ../../../../src/mcrypt/ecb.c \
+ ../../../../src/mcrypt/cbc.c \
+ ../../../../src/mcrypt/rijndael-128.c \
+ ../../../../src/terminal/scene.c \
+ ../../../../src/terminal/terminal.c \
+ ../../../../src/terminal/network_service.c \
+ ../../../../src/terminal/input_sensor.c \
+ ../../../../src/terminal/media_sensor.c \
+ ../../../../src/terminal/media_object.c \
+ ../../../../src/terminal/channel.c \
+ ../../../../src/terminal/term_node_init.c \
+ ../../../../src/terminal/object_browser.c \
+ ../../../../src/terminal/mpeg4_inline.c \
+ ../../../../src/terminal/decoder.c \
+ ../../../../src/terminal/media_manager.c \
+ ../../../../src/terminal/media_memory.c \
+ ../../../../src/terminal/clock.c \
+ ../../../../src/terminal/svg_external.c \
+ ../../../../src/terminal/media_control.c \
+ ../../../../src/terminal/object_manager.c \
+ ../../../../src/scenegraph/xml_ns.c \
+ ../../../../src/scenegraph/commands.c \
+ ../../../../src/scenegraph/vrml_tools.c \
+ ../../../../src/scenegraph/vrml_route.c \
+ ../../../../src/scenegraph/dom_events.c \
+ ../../../../src/scenegraph/smil_anim.c \
+ ../../../../src/scenegraph/mpeg4_valuator.c \
+ ../../../../src/scenegraph/svg_smjs.c \
+ ../../../../src/scenegraph/vrml_interpolators.c \
+ ../../../../src/scenegraph/svg_attributes.c \
+ ../../../../src/scenegraph/mpeg4_nodes.c \
+ ../../../../src/scenegraph/vrml_smjs.c \
+ ../../../../src/scenegraph/mpeg4_animators.c \
+ ../../../../src/scenegraph/dom_smjs.c \
+ ../../../../src/scenegraph/svg_properties.c \
+ ../../../../src/scenegraph/xbl_process.c \
+ ../../../../src/scenegraph/svg_types.c \
+ ../../../../src/scenegraph/x3d_nodes.c \
+ ../../../../src/scenegraph/base_scenegraph.c \
+ ../../../../src/scenegraph/smil_timing.c \
+ ../../../../src/scenegraph/vrml_script.c \
+ ../../../../src/scenegraph/vrml_proto.c \
+ ../../../../src/odf/ipmpx_dump.c \
+ ../../../../src/odf/odf_code.c \
+ ../../../../src/odf/desc_private.c \
+ ../../../../src/odf/slc.c \
+ ../../../../src/odf/odf_codec.c \
+ ../../../../src/odf/qos.c \
+ ../../../../src/odf/ipmpx_parse.c \
+ ../../../../src/odf/ipmpx_code.c \
+ ../../../../src/odf/odf_dump.c \
+ ../../../../src/odf/odf_parse.c \
+ ../../../../src/odf/odf_command.c \
+ ../../../../src/odf/oci_codec.c \
+ ../../../../src/odf/descriptors.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
+APP_ABI := armeabi armeabi-v7a
+APP_MODULES := gpac
\ No newline at end of file
--- /dev/null
+/* Automatically generated by configure */
+#ifndef GF_CONFIG_H
+#define GF_CONFIG_H
+#define GPAC_CONFIGURATION "--host=arm-eabi CC=arm-eabi-gcc CPPFLAGS=-I/mci/artemis/arsov/tools/android/android-ndk-r5/build/platforms/android-3/arch-arm/usr/include/ CFLAGS=-nostdlib LDFLAGS='-Wl,-rpath-link=/mci/artemis/arsov/tools/android/android-ndk-r5/build/platforms/android-3/arch-arm/usr/lib/ -L/mci/artemis/arsov/tools/android/android-ndk-r5/build/platforms/android-3/arch-arm/usr/lib/' LIBS='-lc '"
+
+#define GPAC_CONFIG_LINUX 1
+
+#define GPAC_HAS_SPIDERMONKEY 1
+
+//#define GPAC_STANDALONE_RENDER_2D 1
+
+#define GPAC_HAS_JPEG 1
+#define GPAC_HAS_JP2 1
+#define GPAC_HAS_PNG 1
+
+#define GPAC_USE_OGL_ES 1
+#define GPAC_FIXED_POINT 1
+#endif
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/gm_bifs_dec.mk
+include $(LOCAL_PATH)/gm_ctx_load.mk
+include $(LOCAL_PATH)/gm_dummy_in.mk
+include $(LOCAL_PATH)/gm_ft_font.mk
+include $(LOCAL_PATH)/gm_img_in.mk
+include $(LOCAL_PATH)/gm_ismacryp.mk
+include $(LOCAL_PATH)/gm_isom_in.mk
+include $(LOCAL_PATH)/gm_laser_dec.mk
+include $(LOCAL_PATH)/gm_odf_dec.mk
+include $(LOCAL_PATH)/gm_rtp_in.mk
+include $(LOCAL_PATH)/gm_saf_in.mk
+include $(LOCAL_PATH)/gm_soft_raster.mk
+include $(LOCAL_PATH)/gm_svg_in.mk
+include $(LOCAL_PATH)/gm_timedtext.mk
+include $(LOCAL_PATH)/gm_droid_out.mk
+include $(LOCAL_PATH)/gm_gpac_js.mk
+include $(LOCAL_PATH)/gm_droid_audio.mk
+include $(LOCAL_PATH)/gm_mp3_in.mk
+include $(LOCAL_PATH)/gm_ffmpeg_in.mk
+#---- module added by ENST -------
+include $(LOCAL_PATH)/gm_mpegts_in.mk
+include $(LOCAL_PATH)/gm_mpd_in.mk
+include $(LOCAL_PATH)/gm_aac_in.mk
+include $(LOCAL_PATH)/gm_widgetman.mk
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
+APP_ABI := armeabi-v7a armeabi
+APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/jni/modules/Android.mk
+APP_MODULES := gm_bifs_dec gm_ctx_load gm_dummy_in gm_ft_font gm_img_in gm_ismacryp gm_isom_in gm_laser_dec gm_odf_dec gm_rtp_in gm_saf_in gm_soft_raster gm_svg_in gm_timedtext libjavaenv gm_droidout gm_droidaudio gm_gpac_js gm_mp3_in gm_ffmpeg_in gm_mpegts_in gm_aac_in gm_mpd_in gm_widgetman
+
--- /dev/null
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/../common.mk
+LOCAL_C_INCLUDES := $(LOCAL_PATH)
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../libgpac/
+
+LOCAL_LDLIBS += -L$(LOCAL_PATH)/../../../../extra_lib/lib/android/$(TARGET_ARCH_ABI)/
+LOCAL_LDLIBS += -L../libs/$(TARGET_ARCH_ABI)
+LOCAL_LDLIBS += -lgpac -ljs_osmo -leditline -lft2 -ljpeg -lopenjpeg -lpng -lz
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_aac_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/faad
+LOCAL_LDLIBS += -lfaad
+
+#LOCAL_STATIC_LIBRARIES := libfaad
+LOCAL_CFLAGS += -DGPAC_HAS_FAAD
+
+LOCAL_SRC_FILES := ../../../../modules/aac_in/aac_in.c ../../../../modules/aac_in/faad_dec.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_bifs_dec
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/bifs_dec/bifs_dec.c
+
+
+include $(BUILD_SHARED_LIBRARY)
+
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_ctx_load
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/ctx_load/ctx_load.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libjavaenv
+
+LOCAL_SRC_FILES := ../../../../modules/droid_audio/javaenv.c
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_droidaudio
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_LDLIBS += -llog -ljavaenv -ldl
+
+LOCAL_SRC_FILES := ../../../../modules/droid_audio/droidaudio.c
+
+LOCAL_SHARED_LIBRARIES := javaenv
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_droidout
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_LDLIBS += -lGLESv1_CM -llog -ldl
+
+LOCAL_SRC_FILES := ../../../../modules/droid_out/droid_vout.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_dummy_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/dummy_in/dummy_in.c
+
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_ffmpeg_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/ffmpeg/jni/
+#LOCAL_C_INCLUDES += /home/gacon/workspace/ffmpeg/jni/
+
+LOCAL_LDLIBS += -lffmpeg
+#LOCAL_LDLIBS += -lavcodec -lavformat -lavutil
+#LOCAL_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc libswscale
+#LOCAL_STATIC_LIBRARIES += libavformat
+#LOCAL_STATIC_LIBRARIES += libavutil
+#LOCAL_STATIC_LIBRARIES += libswscale
+
+LOCAL_SRC_FILES := ../../../../modules/ffmpeg_in/ffmpeg_load.c ../../../../modules/ffmpeg_in/ffmpeg_demux.c ../../../../modules/ffmpeg_in/ffmpeg_decode.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_ft_font
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/freetypedroid/jni/include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../../extra_lib/android/freetypedroid/jni/include/freetype
+
+LOCAL_SRC_FILES := ../../../../modules/ft_font/ft_font.c
+
+LOCAL_LDLIBS += -lft2
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_gpac_js
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/js/jni
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/js/jni/Linux_All_DBG.OBJ
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/js/jni/editline
+#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/js/
+
+LOCAL_SRC_FILES := ../../../../modules/gpac_js/gpac_js.c
+
+LOCAL_LDLIBS += -ljs_osmo
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_img_in
+
+include $(LOCAL_PATH)/base.mk
+
+#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/libopenjpeg/jni/dist
+#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/libopenjpeg/jni/
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/openjpeg
+LOCAL_LDLIBS += -ljpeg -lopenjpeg -lpng
+
+LOCAL_SRC_FILES := ../../../../modules/img_in/img_dec.c ../../../../modules/img_in/img_in.c ../../../../modules/img_in/bmp_dec.c ../../../../modules/img_in/png_dec.c ../../../../modules/img_in/jpeg_dec.c ../../../../modules/img_in/jp2_dec.c
+
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_ismacryp
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/ismacryp/ismacryp.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_isom_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/isom_in/cache.c ../../../../modules/isom_in/load.c ../../../../modules/isom_in/read.c ../../../../modules/isom_in/read_ch.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_laser_dec
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/laser_dec/laser_dec.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_mp3_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/mad
+
+LOCAL_LDLIBS += -lmad
+
+LOCAL_SRC_FILES := ../../../../modules/mp3_in/mad_dec.c ../../../../modules/mp3_in/mp3_in.c
+
+LOCAL_CFLAGS += -DGPAC_HAS_MAD
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_mpd_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../include
+
+LOCAL_SRC_FILES := ../../../../modules/mpd_in/mpd_in.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_mpegts_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/
+
+LOCAL_SRC_FILES := ../../../../modules/mpegts_in/mpegts_in.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_odf_dec
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/odf_dec/odf_dec.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_rawout
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/raw_out/raw_video.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_rtp_in
+
+include $(LOCAL_PATH)/base.mk
+
+#LOCAL_CFLAGS += -DGPAC_DISABLE_STREAMING
+
+LOCAL_SRC_FILES := ../../../../modules/rtp_in/rtp_in.c ../../../../modules/rtp_in/rtp_session.c ../../../../modules/rtp_in/rtp_signaling.c ../../../../modules/rtp_in/rtp_stream.c ../../../../modules/rtp_in/sdp_fetch.c ../../../../modules/rtp_in/sdp_load.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_saf_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/saf_in/saf_in.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_soft_raster
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/../modules/soft_raster/ftgrays.c ../../../../modules/../modules/soft_raster/raster_load.c ../../../../modules/../modules/soft_raster/raster_565.c ../../../../modules/soft_raster/raster_argb.c ../../../../modules/soft_raster/raster_rgb.c ../../../../modules/soft_raster/stencil.c ../../../../modules/soft_raster/surface.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_svg_in
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/svg_in/svg_in.c
+
+LOCAL_LDLIBS += -ljs_osmo -lz
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_timedtext
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_SRC_FILES := ../../../../modules/timedtext/timedtext_in.c ../../../../modules/timedtext/timedtext_dec.c
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gm_widgetman
+
+include $(LOCAL_PATH)/base.mk
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/include/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/zlibdroid/jni/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/js/jni/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/js/jni/Linux_All_DBG.OBJ
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../extra_lib/android/js/jni/editline
+
+LOCAL_SRC_FILES := ../../../../modules/widgetman/widgetman.c ../../../../modules/widgetman/unzip.c ../../../../modules/widgetman/widget.c ../../../../modules/widgetman/wgt_load.c
+
+LOCAL_LDLIBS += -ljs_osmo -lz
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/../common.mk
+
+LOCAL_MODULE := gpacWrapper
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../libgpac/
+
+LOCAL_LDLIBS += -L../libs/$(TARGET_ARCH_ABI)
+LOCAL_LDLIBS += -llog -lgpac
+
+#LOCAL_CFLAGS += -DGPAC_GUI_ONLY
+LOCAL_CFLAGS += -DDEBUG_MODE
+
+LOCAL_SRC_FILES := ../../../../applications/osmo4_android/jni/wrapper.cpp
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
+APP_ABI := armeabi armeabi-v7a
+APP_MODULES := gpacWrapper
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+<TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/hello"
+ />
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World, gpac!</string>
+ <string name="app_name">gpac</string>
+</resources>
--- /dev/null
+package com.artemis.gpac;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class gpac extends Activity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+ }
+}
\ No newline at end of file
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
- CommandLine="if not exist "$(ProgramFiles)\GPAC" md "$(ProgramFiles)\GPAC"
copy ..\..\bin\w32_rel\GPAX.dll "$(ProgramFiles)\GPAC"
"\r
+ CommandLine=""\r
/>\r
</Configuration>\r
<Configuration\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib libfaad2.lib"\r
+ AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib libfaad.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ GenerateManifest="false"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib libfaad2.lib"\r
+ AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib libfaad.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile=".\obj\$(PlatformName)\$(ConfigurationName)\ac3_in/gm_ac3_in.pdb"\r
<Tool\r
Name="VCCLCompilerTool"\r
ExecutionBucket="7"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL;GPAC_HAS_LIBA52"\r
RuntimeLibrary="3"\r
PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ GenerateManifest="false"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
StackReserveSize="8388608"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile=".\obj/amr_dec_rel/gm_amr_dec.pdb"\r
SubSystem="9"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile=".\obj/amr_dec_deb/gm_amr_dec.pdb"\r
<References>\r
</References>\r
<Files>\r
- <Filter\r
- Name="amr_nb_dec"\r
- >\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\a_refl.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\a_refl.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\agc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\agc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\autocorr.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\autocorr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\az_lsp.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\az_lsp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\b_cn_cod.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\b_cn_cod.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\basic_op.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\basicop2.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\bgnscd.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\bgnscd.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\bits2prm.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\bits2prm.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c1035pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c1035pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c2_11pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c2_11pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c2_9pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c2_9pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c3_14pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c3_14pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c4_17pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c4_17pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c8_31pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c8_31pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c_g_aver.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\c_g_aver.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\calc_cor.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\calc_cor.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\calc_en.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\calc_en.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cbsearch.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cbsearch.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cl_ltp.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cl_ltp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cnst.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cnst_vad.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cod_amr.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cod_amr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\convolve.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\convolve.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\copy.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\copy.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cor_h.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\cor_h.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\count.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\count.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d1035pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d1035pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d2_11pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d2_11pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d2_9pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d2_9pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d3_14pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d3_14pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d4_17pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d4_17pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d8_31pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d8_31pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_gain_c.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_gain_c.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_gain_p.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_gain_p.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_homing.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_homing.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_plsf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_plsf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_plsf_3.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\d_plsf_5.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_amr.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_amr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_gain.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_gain.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_lag3.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_lag3.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_lag6.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dec_lag6.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dtx_dec.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dtx_dec.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dtx_enc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\dtx_enc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ec_gains.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\enc_lag6.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ex_ctrl.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ex_ctrl.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\frame.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\g_adapt.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\g_adapt.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\g_code.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\g_code.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\g_pitch.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\g_pitch.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\gain_q.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\gain_q.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\gc_pred.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\gc_pred.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\gmed_n.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\gmed_n.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\hp_max.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\hp_max.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\int_lpc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\int_lpc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\int_lsf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\int_lsf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\inter_36.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\inter_36.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\inv_sqrt.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\inv_sqrt.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lag_wind.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lag_wind.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\levinson.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\levinson.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lflg_upd.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\log2.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\log2.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lpc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lpc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsfwt.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsfwt.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp_avg.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp_avg.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp_az.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp_az.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp_lsf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\lsp_lsf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\mac_32.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\mac_32.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\mode.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\n_proc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\n_proc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ol_ltp.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ol_ltp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\oper_32b.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\oper_32b.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\p_ol_wgh.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\p_ol_wgh.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ph_disp.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ph_disp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pitch_fr.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pitch_fr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pitch_ol.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pitch_ol.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\post_pro.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\post_pro.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pow2.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pow2.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pre_big.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pre_big.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pre_proc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pre_proc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pred_lt.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pred_lt.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\preemph.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\preemph.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\prm2bits.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\prm2bits.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pstfilt.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\pstfilt.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_gain_c.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_gain_c.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_gain_p.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_gain_p.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_plsf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_plsf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_plsf_3.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\q_plsf_5.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\qgain475.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\qgain475.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\qgain795.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\qgain795.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\qua_gain.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\qua_gain.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\r_fft.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\reorder.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\reorder.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\residu.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\residu.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\s10_8pf.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\s10_8pf.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\set_sign.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\set_sign.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\set_zero.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\set_zero.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sid_sync.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sid_sync.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sp_dec.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sp_dec.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sp_enc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sp_enc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\spreproc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\spreproc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\spstproc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\spstproc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sqrt_l.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\sqrt_l.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\strfunc.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\strfunc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\syn_filt.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\syn_filt.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ton_stab.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\ton_stab.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\typedef.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\typedefs.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vad.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vad1.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vad1.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vad2.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vad2.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vadname.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\vadname.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\weight_a.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\weight_a.h"\r
- >\r
- </File>\r
- </Filter>\r
<File\r
RelativePath="..\..\modules\amr_dec\amr_dec.c"\r
>\r
/>\r
</FileConfiguration>\r
</File>\r
- <File\r
- RelativePath="..\..\modules\amr_dec\amr_nb\enc_lag3.c"\r
- >\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
<File\r
RelativePath="..\..\modules\modules_export.cpp"\r
>\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile=".\obj/amr_float_dec_deb/gm_amr_float_dec.pdb"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile=".\obj/amr_float_dec_rel/gm_amr_float_dec.pdb"\r
SubSystem="9"\r
<References>\r
</References>\r
<Files>\r
- <Filter\r
- Name="amr_nb_ft"\r
- >\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\interf_dec.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\interf_dec.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\interf_enc.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\interf_enc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\interf_rom.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\rom_dec.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\rom_enc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\sp_dec.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\sp_dec.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\sp_enc.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\sp_enc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_nb_ft\typedef.h"\r
- >\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="amr_wb_ft"\r
- >\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_acelp.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_acelp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_dtx.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_dtx.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_gain.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_gain.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_if.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_if.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_lpc.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_lpc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_main.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_main.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_rom.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_util.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\dec_util.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_acelp.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_acelp.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_dtx.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_dtx.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_gain.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_gain.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_if.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_if.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_lpc.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_lpc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_main.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_main.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_rom.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_util.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\enc_util.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\if_rom.c"\r
- >\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\if_rom.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\typedef.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\amr_float_dec\amr_wb_ft\typedefs.h"\r
- >\r
- </File>\r
- </Filter>\r
<File\r
RelativePath="..\..\modules\amr_float_dec\amr_float_dec.c"\r
>\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="libGLES_CM.lib"\r
+ AdditionalDependencies="libGLES_CM.lib ddraw.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../extra_lib/lib/w32_deb"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)/; C:\Program Files\Windows Mobile 6 SDK\PocketPC\Lib\Armv4i"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile=".\obj/dx_hw_deb/gm_dx_hw.pdb"\r
<Tool\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include,../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="avformat-52.lib avcodec-52.lib avutil-50.lib swscale-0.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
Name="VCCLCompilerTool"\r
ExecutionBucket="7"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include;../../include/wince;../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL;EMULATE_INTTYPES"\r
MinimalRebuild="true"\r
RuntimeLibrary="2"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib avformat-52.lib avcodec-52.lib avutil-50.lib swscale-0.lib"\r
+ AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib "\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
Name="VCCLCompilerTool"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include,../../extra_lib/include/"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/;../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="avformat-52.lib avcodec-52.lib avutil-50.lib swscale-0.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
ExecutionBucket="7"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include,../../extra_lib/include/"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include/;../../include/wince;../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL;EMULATE_INTTYPES"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="secchk.lib ccrtrtti.lib avformat-52.lib avcodec-52.lib avutil-50.lib swscale-0.lib"\r
+ AdditionalDependencies="secchk.lib ccrtrtti.lib "\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
-\r
+\r
Microsoft Visual Studio Solution File, Format Version 9.00\r
# Visual Studio 2005\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPAX", "GPAX.vcproj", "{72486240-A124-496E-A67A-E76FEC7E99BE}"\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4client", "mp4client.vcproj", "{A35D99BF-D72D-4F56-99A1-97249B22BCE2}"\r
ProjectSection(ProjectDependencies) = postProject\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Osmo4", "Osmo4.vcproj", "{C79C2D73-06E9-4622-92CE-F166B1B51792}"\r
ProjectSection(ProjectDependencies) = postProject\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE} = {71071F01-C813-4384-BE38-0F4020BCC0EE}\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974} = {042D3628-67F3-4B5C-8BC0-CD9AFA416974}\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165} = {B38E812D-9823-48E7-BE5F-BF09B0AD4165}\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013} = {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}\r
- {01183543-B182-4E32-9FD6-FC15C847316C} = {01183543-B182-4E32-9FD6-FC15C847316C}\r
- {CAA5A551-006A-4119-8115-FB14692E719F} = {CAA5A551-006A-4119-8115-FB14692E719F}\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E} = {E2DBD151-9523-4E1A-9478-F3F825668F6E}\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D} = {FC8F1F56-078E-470D-B252-68EDDE88AA9D}\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E} = {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7} = {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B} = {073E2381-4FDE-4C4D-A117-C489EB17C48B}\r
- {402A8794-B724-44A3-B608-84B600ECA387} = {402A8794-B724-44A3-B608-84B600ECA387}\r
- {879E26B2-48DB-47B3-B82F-893696286E6F} = {879E26B2-48DB-47B3-B82F-893696286E6F}\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45} = {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D} = {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B} = {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8} = {464697D2-BA44-446F-8223-1EB3969ED1A8}\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60} = {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088} = {A86E6EF8-3683-4AD0-8878-7A0D51326088}\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aac_in", "aac_in.vcproj", "{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}"\r
{233014D5-F6E5-419D-8757-FA9CE7337088} = {233014D5-F6E5-419D-8757-FA9CE7337088}\r
EndProjectSection\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4client", "mp4client.vcproj", "{A35D99BF-D72D-4F56-99A1-97249B22BCE2}"\r
- ProjectSection(ProjectDependencies) = postProject\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
- EndProjectSection\r
-EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpegts_in", "mpegts_in.vcproj", "{B38E812D-9823-48E7-BE5F-BF09B0AD4165}"\r
ProjectSection(ProjectDependencies) = postProject\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
EndProjectSection\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui_rec", "ui_rec.vcproj", "{073E2381-4FDE-4C4D-A117-C489DB17C48C}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opensvc_dec", "opensvc.vcproj", "{073E2381-4FDE-4C4D-B217-C489EB17C48B}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpd_in", "mpd_in.vcproj", "{B1AEFA90-318F-459C-96EE-B4DFF3318B7B}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amr_dec", "amr_dec.vcproj", "{5ED5A1C8-DB34-4089-8E53-EFB225754D02}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amr_float_dec", "amr_float_dec.vcproj", "{5D3983BF-143F-49C3-9284-89778282AEFE}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp42ts", "..\..\applications\mp42ts\mp42ts.vcproj", "{F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPAX", "GPAX.vcproj", "{72486240-A124-496E-A67A-E76FEC7E99BE}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Mixed Platforms = Debug|Mixed Platforms\r
- Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4)\r
Debug|Win32 = Debug|Win32\r
- Release|Mixed Platforms = Release|Mixed Platforms\r
- Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4)\r
Release|Win32 = Release|Win32\r
+ Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4)\r
+ Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4)\r
EndGlobalSection\r
GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Win32.Build.0 = Debug|Win32\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Win32.Build.0 = Release|Win32\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Win32.ActiveCfg = Release|Win32\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Win32.Build.0 = Debug|Win32\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Win32.ActiveCfg = Release|Win32\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Win32.Build.0 = Release|Win32\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Win32.ActiveCfg = Debug|Win32\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Win32.Build.0 = Debug|Win32\r
- {72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Win32.ActiveCfg = Release|Win32\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Win32.Build.0 = Release|Win32\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Win32.Build.0 = Debug|Win32\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Win32.ActiveCfg = Release|Win32\r
- {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Win32.Build.0 = Release|Win32\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Win32.ActiveCfg = Debug|Win32\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Win32.Build.0 = Debug|Win32\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Win32.ActiveCfg = Release|Win32\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Win32.Build.0 = Release|Win32\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Win32.ActiveCfg = Debug|Win32\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Win32.Build.0 = Debug|Win32\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Win32.ActiveCfg = Release|Win32\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Win32.Build.0 = Release|Win32\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Win32.ActiveCfg = Debug|Win32\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Win32.Build.0 = Debug|Win32\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Win32.ActiveCfg = Release|Win32\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Win32.Build.0 = Release|Win32\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Win32.ActiveCfg = Debug|Win32\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Win32.Build.0 = Debug|Win32\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Win32.ActiveCfg = Release|Win32\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Win32.Build.0 = Release|Win32\r
- {B64736BD-9245-4F40-961D-EB9822265764}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {B64736BD-9245-4F40-961D-EB9822265764}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {B64736BD-9245-4F40-961D-EB9822265764}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Debug|Win32.ActiveCfg = Debug|Win32\r
{B64736BD-9245-4F40-961D-EB9822265764}.Debug|Win32.Build.0 = Debug|Win32\r
- {B64736BD-9245-4F40-961D-EB9822265764}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {B64736BD-9245-4F40-961D-EB9822265764}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {B64736BD-9245-4F40-961D-EB9822265764}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Release|Win32.ActiveCfg = Release|Win32\r
{B64736BD-9245-4F40-961D-EB9822265764}.Release|Win32.Build.0 = Release|Win32\r
- {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Win32.ActiveCfg = Debug|Win32\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Win32.Build.0 = Debug|Win32\r
- {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Win32.ActiveCfg = Release|Win32\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Win32.Build.0 = Release|Win32\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Win32.ActiveCfg = Debug|Win32\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Win32.Build.0 = Debug|Win32\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Win32.ActiveCfg = Release|Win32\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Win32.Build.0 = Release|Win32\r
- {CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Win32.ActiveCfg = Debug|Win32\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Win32.Build.0 = Debug|Win32\r
- {CAA5A551-006A-4119-8115-FB14692E719F}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {CAA5A551-006A-4119-8115-FB14692E719F}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {CAA5A551-006A-4119-8115-FB14692E719F}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Release|Win32.ActiveCfg = Release|Win32\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Release|Win32.Build.0 = Release|Win32\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Win32.ActiveCfg = Debug|Win32\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Win32.Build.0 = Debug|Win32\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Win32.ActiveCfg = Release|Win32\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Win32.Build.0 = Release|Win32\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Win32.ActiveCfg = Debug|Win32\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Win32.Build.0 = Debug|Win32\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Win32.ActiveCfg = Release|Win32\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Win32.Build.0 = Release|Win32\r
- {879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Win32.ActiveCfg = Debug|Win32\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Win32.Build.0 = Debug|Win32\r
- {879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Win32.ActiveCfg = Release|Win32\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Win32.Build.0 = Release|Win32\r
- {233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Win32.ActiveCfg = Debug|Win32\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Win32.Build.0 = Debug|Win32\r
- {233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Win32.ActiveCfg = Release|Win32\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Win32.Build.0 = Release|Win32\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Win32.ActiveCfg = Debug|Win32\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Win32.Build.0 = Debug|Win32\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Win32.ActiveCfg = Release|Win32\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Win32.Build.0 = Release|Win32\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Win32.ActiveCfg = Debug|Win32\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Win32.Build.0 = Debug|Win32\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Win32.ActiveCfg = Release|Win32\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Win32.Build.0 = Release|Win32\r
- {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Win32.ActiveCfg = Debug|Win32\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Win32.Build.0 = Debug|Win32\r
- {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Win32.ActiveCfg = Release|Win32\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Win32.Build.0 = Release|Win32\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Win32.Build.0 = Debug|Win32\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Win32.ActiveCfg = Release|Win32\r
- {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Win32.Build.0 = Release|Win32\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Win32.ActiveCfg = Debug|Win32\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Win32.Build.0 = Debug|Win32\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Win32.ActiveCfg = Release|Win32\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Win32.Build.0 = Release|Win32\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Win32.ActiveCfg = Debug|Win32\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Win32.Build.0 = Debug|Win32\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Win32.ActiveCfg = Release|Win32\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Win32.Build.0 = Release|Win32\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Win32.ActiveCfg = Debug|Win32\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Win32.Build.0 = Debug|Win32\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Win32.ActiveCfg = Release|Win32\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Win32.Build.0 = Release|Win32\r
- {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Win32.ActiveCfg = Debug|Win32\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Win32.Build.0 = Debug|Win32\r
- {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Win32.ActiveCfg = Release|Win32\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Win32.Build.0 = Release|Win32\r
- {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Win32.ActiveCfg = Debug|Win32\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Win32.Build.0 = Debug|Win32\r
- {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Win32.ActiveCfg = Release|Win32\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Win32.Build.0 = Release|Win32\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Win32.ActiveCfg = Debug|Win32\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Win32.Build.0 = Debug|Win32\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Win32.ActiveCfg = Release|Win32\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Win32.Build.0 = Release|Win32\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Win32.ActiveCfg = Debug|Win32\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Win32.Build.0 = Debug|Win32\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Win32.ActiveCfg = Release|Win32\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Win32.Build.0 = Release|Win32\r
- {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Win32.ActiveCfg = Debug|Win32\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Win32.Build.0 = Debug|Win32\r
- {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Win32.ActiveCfg = Release|Win32\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Win32.Build.0 = Release|Win32\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Win32.ActiveCfg = Debug|Win32\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Win32.Build.0 = Debug|Win32\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Win32.ActiveCfg = Release|Win32\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Win32.Build.0 = Release|Win32\r
- {402A8794-B724-44A3-B608-84B600ECA387}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {402A8794-B724-44A3-B608-84B600ECA387}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {402A8794-B724-44A3-B608-84B600ECA387}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Win32.ActiveCfg = Debug|Win32\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Win32.Build.0 = Debug|Win32\r
- {402A8794-B724-44A3-B608-84B600ECA387}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {402A8794-B724-44A3-B608-84B600ECA387}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {402A8794-B724-44A3-B608-84B600ECA387}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Win32.ActiveCfg = Release|Win32\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Win32.Build.0 = Release|Win32\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Win32.ActiveCfg = Debug|Win32\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Win32.Build.0 = Debug|Win32\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Win32.ActiveCfg = Release|Win32\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Win32.Build.0 = Release|Win32\r
- {01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Win32.ActiveCfg = Debug|Win32\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Win32.Build.0 = Debug|Win32\r
- {01183543-B182-4E32-9FD6-FC15C847316C}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {01183543-B182-4E32-9FD6-FC15C847316C}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {01183543-B182-4E32-9FD6-FC15C847316C}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Win32.ActiveCfg = Release|Win32\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Win32.Build.0 = Release|Win32\r
- {4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Win32.ActiveCfg = Debug|Win32\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Win32.Build.0 = Debug|Win32\r
- {4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Win32.ActiveCfg = Release|Win32\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Win32.Build.0 = Release|Win32\r
- {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Win32.ActiveCfg = Debug|Win32\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Win32.Build.0 = Debug|Win32\r
- {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Win32.ActiveCfg = Release|Win32\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Win32.Build.0 = Release|Win32\r
- {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Win32.ActiveCfg = Debug|Win32\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Win32.Build.0 = Debug|Win32\r
- {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Win32.ActiveCfg = Release|Win32\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Win32.Build.0 = Release|Win32\r
- {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)\r
- {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Win32.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)\r
- {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)\r
- {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32\r
- {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Mixed Platforms.Build.0 = Debug|Win32\r
+ {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Win32.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Mixed Platforms.ActiveCfg = Release|Win32\r
- {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Mixed Platforms.Build.0 = Release|Win32\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Win32.ActiveCfg = Release|Win32\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Win32.Build.0 = Release|Win32\r
- {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Win32.ActiveCfg = Debug|Win32\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Win32.Build.0 = Debug|Win32\r
- {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Win32.ActiveCfg = Release|Win32\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Win32.Build.0 = Release|Win32\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Win32.ActiveCfg = Debug|Win32\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Win32.Build.0 = Debug|Win32\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Win32.ActiveCfg = Release|Win32\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Win32.Build.0 = Release|Win32\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Win32.ActiveCfg = Debug|Win32\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Win32.Build.0 = Debug|Win32\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Win32.ActiveCfg = Release|Win32\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Win32.Build.0 = Release|Win32\r
- {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Win32.ActiveCfg = Debug|Win32\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Win32.Build.0 = Debug|Win32\r
- {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Win32.ActiveCfg = Release|Win32\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Win32.Build.0 = Release|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Debug|Mixed Platforms.Build.0 = Debug|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Debug|Win32.Build.0 = Debug|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Release|Mixed Platforms.ActiveCfg = Release|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Release|Mixed Platforms.Build.0 = Release|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Release|Win32.ActiveCfg = Release|Win32\r
- {D08849E2-C077-4360-A70C-7B858A486EA4}.Release|Win32.Build.0 = Release|Win32\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Win32.ActiveCfg = Debug|Win32\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Win32.Build.0 = Debug|Win32\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
- {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Win32.ActiveCfg = Release|Win32\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Win32.Build.0 = Release|Win32\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Debug|Win32.Build.0 = Debug|Win32\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Release|Win32.ActiveCfg = Release|Win32\r
+ {073E2381-4FDE-4C4D-A117-C489DB17C48C}.Release|Win32.Build.0 = Release|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Win32.Build.0 = Debug|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Win32.ActiveCfg = Release|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Win32.Build.0 = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Win32.Build.0 = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Win32.ActiveCfg = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Win32.Build.0 = Release|Win32\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Debug|Win32.Build.0 = Debug|Win32\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Release|Win32.ActiveCfg = Release|Win32\r
+ {5ED5A1C8-DB34-4089-8E53-EFB225754D02}.Release|Win32.Build.0 = Release|Win32\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Debug|Win32.Build.0 = Debug|Win32\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Release|Win32.ActiveCfg = Release|Win32\r
+ {5D3983BF-143F-49C3-9284-89778282AEFE}.Release|Win32.Build.0 = Release|Win32\r
+ {F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Win32\r
+ {F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}.Debug|Win32.Build.0 = Debug|Win32\r
+ {F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Win32\r
+ {F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}.Release|Win32.ActiveCfg = Release|Win32\r
+ {F728CC74-A7D0-43D2-8A28-05CE9F2EF0D0}.Release|Win32.Build.0 = Release|Win32\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
>\r
<Tool\r
Name="VCPreBuildEventTool"\r
+ CommandLine=""$(InputDir)..\..\version.bat""\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
AdditionalOptions="/MP"\r
Optimization="0"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include,../../extra_lib/include/zlib,../../extra_lib/include/js,../../extra_lib/include/jpeg,../../extra_lib/include/png"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/zlib;../../extra_lib/include/js;../../extra_lib/include/jpeg;../../extra_lib/include/png;../../extra_lib/include"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_LIB"\r
MinimalRebuild="false"\r
BasicRuntimeChecks="3"\r
>\r
<Tool\r
Name="VCPreBuildEventTool"\r
+ CommandLine=""$(InputDir)..\..\version.bat""\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
>\r
<Tool\r
Name="VCPreBuildEventTool"\r
+ CommandLine=""$(InputDir)..\..\version.bat""\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
>\r
<Tool\r
Name="VCPreBuildEventTool"\r
+ CommandLine=""$(InputDir)..\..\version.bat""\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
<Filter\r
Name="utils"\r
>\r
+ <File\r
+ RelativePath="..\..\src\utils\alloc.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\utils\base_encoding.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\bitstream.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\utils\cache.c"\r
+ >\r
</File>\r
<File\r
RelativePath="..\..\src\utils\color.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\configfile.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\dlmalloc.c"\r
<File\r
RelativePath="..\..\src\utils\downloader.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\error.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- CompileAs="1"\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- CompileAs="1"\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- CompileAs="1"\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- CompileAs="1"\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\list.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\math.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\module.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\module_wrap.h"\r
<File\r
RelativePath="..\..\src\utils\os_divers.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\os_module.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\os_net.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\os_thread.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\path2d.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
- RelativePath="..\..\src\utils\path2d_stroker.c"\r
+ RelativePath="..\..\src\utils\path2d_stroker.c"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\src\utils\ringbuffer.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\token.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\uni_bidi.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\utils\unicode.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\utils\url.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\utf.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
<File\r
RelativePath="..\..\src\utils\xml_parser.c"\r
>\r
- <FileConfiguration\r
- Name="Debug|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
- >\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions=""\r
- />\r
- </FileConfiguration>\r
</File>\r
</Filter>\r
<Filter\r
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\gpac\internal\smjs_api.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\scenegraph\svg_attributes.c"\r
>\r
RelativePath="..\..\src\media_tools\m2ts_mux.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\media_tools\m3u8.c"\r
+ >\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)\$(InputName)1.obj"\r
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)/$(InputName)1.obj"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)\$(InputName)1.obj"\r
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Smartphone 2003 (ARMV4)"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)/$(InputName)1.obj"\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
<File\r
RelativePath="..\..\include\gpac\internal\media_dev.h"\r
>\r
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\media_tools\mpd.c"\r
+ >\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)\$(InputName)1.obj"\r
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)/$(InputName)1.obj"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)\$(InputName)1.obj"\r
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Smartphone 2003 (ARMV4)"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ObjectFile="$(IntDir)/$(InputName)1.obj"\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
<File\r
RelativePath="..\..\src\media_tools\mpeg2_ps.c"\r
>\r
RelativePath="..\..\include\gpac\list.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\gpac\internal\m3u8.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\gpac\math.h"\r
>\r
RelativePath="..\..\include\gpac\module.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\gpac\internal\mpd.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\gpac\mpeg4_odf.h"\r
>\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/libgpac.dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ AdditionalLibraryDirectories=""../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)""\r
GenerateManifest="false"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib js.lib zlib.lib libGLES_CM.lib"\r
+ AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib zlib.lib libGLES_CM.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/libgpac.dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
<?xml version="1.0" encoding="Windows-1252"?>\r
<VisualStudioProject\r
ProjectType="Visual C++"\r
- Version="8.00"\r
+ Version="8,00"\r
Name="m3u82mpd"\r
ProjectGUID="{19EFBA5D-372A-4451-B003-6AB3F448ECD4}"\r
RootNamespace="m3u82mpd"\r
</References>\r
<Files>\r
<File\r
- RelativePath="..\..\modules\m3u8_in\m3u8_parser.c"\r
+ RelativePath="..\..\modules\mpd_in\m3u8.c"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\modules\m3u8_in\m3u8_parser.h"\r
+ RelativePath="..\..\modules\mpd_in\m3u8.h"\r
>\r
</File>\r
<File\r
RelativePath="..\..\applications\m3u82mpd\main.c"\r
>\r
</File>\r
- <File\r
- RelativePath="..\..\modules\m3u8_in\playlist.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\m3u8_in\playlist.h"\r
- >\r
- </File>\r
</Files>\r
<Globals>\r
</Globals>\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ GenerateManifest="true"\r
ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"\r
SubSystem="1"\r
TargetMachine="1"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="User32.lib"\r
+ AdditionalDependencies="User32.lib kernel32.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/MP4Client.exe"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\applications\mp4client\mp4client.rc"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\applications\mp4client\resource.h"\r
+ >\r
+ </File>\r
</Files>\r
<Globals>\r
</Globals>\r
<?xml version="1.0" encoding="Windows-1252"?>\r
<VisualStudioProject\r
ProjectType="Visual C++"\r
- Version="8,00"\r
+ Version="8.00"\r
Name="mpd_in"\r
ProjectGUID="{B1AEFA90-318F-459C-96EE-B4DFF3318B7B}"\r
RootNamespace="dash"\r
<Platform\r
Name="Win32"\r
/>\r
+ <Platform\r
+ Name="Smartphone 2003 (ARMV4)"\r
+ />\r
</Platforms>\r
<ToolFiles>\r
</ToolFiles>\r
Name="VCPostBuildEventTool"\r
/>\r
</Configuration>\r
+ <Configuration\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ OutputDirectory="$(SolutionDir)Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ ConfigurationType="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ExecutionBucket="7"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
+ RuntimeLibrary="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="coredll.lib corelibc.lib secchk.lib "\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCCodeSignTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory=""\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
+ />\r
+ </Configuration>\r
<Configuration\r
Name="Release|Win32"\r
OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
<Tool\r
Name="VCCLCompilerTool"\r
AdditionalIncludeDirectories="../../include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
RuntimeLibrary="2"\r
UsePrecompiledHeader="0"\r
WarningLevel="3"\r
Name="VCPostBuildEventTool"\r
/>\r
</Configuration>\r
+ <Configuration\r
+ Name="Release|Smartphone 2003 (ARMV4)"\r
+ OutputDirectory="$(SolutionDir)Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ ConfigurationType="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ExecutionBucket="7"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ WarningLevel="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib "\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="1"\r
+ SubSystem="9"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCCodeSignTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory=""\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
+ />\r
+ </Configuration>\r
</Configurations>\r
<References>\r
</References>\r
<Files>\r
- <File\r
- RelativePath="..\..\modules\m3u8_in\m3u8_parser.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\m3u8_in\m3u8_parser.h"\r
- >\r
- </File>\r
<File\r
RelativePath="..\..\modules\modules_export.cpp"\r
>\r
</File>\r
- <File\r
- RelativePath="..\..\modules\mpd_in\mpd.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\mpd_in\mpd.h"\r
- >\r
- </File>\r
<File\r
RelativePath="..\..\modules\mpd_in\mpd_in.c"\r
>\r
</File>\r
- <File\r
- RelativePath="..\..\modules\m3u8_in\playlist.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\modules\m3u8_in\playlist.h"\r
- >\r
- </File>\r
</Files>\r
<Globals>\r
</Globals>\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="lib_SVCdecoderIetr.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
- LinkIncremental="2"\r
+ LinkIncremental="0"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/opensvc_dec/osvc_sdk/lib_w32"\r
- GenerateManifest="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ GenerateManifest="false"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/gm_$(ProjectName).pdb"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/gm_opensvc_dec.pdb"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="lib_SVCdecoderIetr.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/opensvc_dec/osvc_sdk/lib_w32"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile=".\obj/dymmy_in_rel/gm_opensvc_dec.pdb"\r
SubSystem="9"\r
<DeploymentTool\r
ForceDirty="-1"\r
RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
- RegisterOutput="0"\r
+ RegisterOutput="-1"\r
AdditionalFiles=""\r
/>\r
<DebuggerTool\r
ForceDirty="-1"\r
RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
RegisterOutput="0"\r
- AdditionalFiles="gx.dll|D:\CVS\gpac\bin\smartphone 2003 (armv4)\release|%CSIDL_PROGRAM_FILES%\gpac|0;libGLES_CM.dll|D:\CVS\gpac\bin\smartphone 2003 (armv4)\release|%CSIDL_PROGRAM_FILES%\gpac|0;js.dll|D:\CVS\gpac\bin\smartphone 2003 (armv4)\release|%CSIDL_PROGRAM_FILES%\gpac|0"\r
+ AdditionalFiles=""\r
/>\r
<DebuggerTool\r
/>\r
Name="VCCLCompilerTool"\r
Optimization="2"\r
FavorSizeOrSpeed="2"\r
- AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../extra_lib/include/platinum"\r
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
MinimalRebuild="false"\r
BasicRuntimeChecks="0"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_vc8, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
Name="VCCLCompilerTool"\r
ExecutionBucket="7"\r
Optimization="3"\r
- AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../extra_lib/include/platinum"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
MinimalRebuild="true"\r
RuntimeLibrary="2"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_arm, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
<Tool\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../extra_lib/include/platinum"\r
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="platinum_d.lib neptune_d.lib winmm.lib"\r
+ AdditionalDependencies="platinum.lib neptune.lib winmm.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_vc8, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ GenerateManifest="false"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
Name="VCCLCompilerTool"\r
ExecutionBucket="7"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../extra_lib/include/platinum"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
MinimalRebuild="true"\r
RuntimeLibrary="3"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="platinum_d.lib neptune_d.lib ws2.lib coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib Iphlpapi.lib "\r
+ AdditionalDependencies="platinum.lib neptune.lib ws2.lib coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib Iphlpapi.lib "\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_arm, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
<Tool\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include,../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
Name="VCCLCompilerTool"\r
ExecutionBucket="7"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include;../../include/wince;../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
MinimalRebuild="true"\r
RuntimeLibrary="3"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
+ AdditionalDependencies="avcodec-52.lib avformat-52.lib avutil-50.lib swscale-0.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
Name="VCCLCompilerTool"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include,../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
ExecutionBucket="7"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include;../../include/wince;../../include/win32"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
+ AdditionalDependencies="secchk.lib"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile=".\obj/dymmy_in_rel/gm_redirect_av.pdb"\r
SubSystem="9"\r
<Tool\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
- AdditionalIncludeDirectories=""C:\Outils\SDL-1.2.12\include";../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include/SDL"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories=""C:\Outils\SDL-1.2.12\lib""\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
Name="VCCLCompilerTool"\r
ExecutionBucket="7"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
MinimalRebuild="true"\r
RuntimeLibrary="3"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/gm_$(ProjectName).pdb"\r
Name="VCCLCompilerTool"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories=""C:\Outils\SDL-1.2.12\include";../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include/SDL"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories=""C:\Outils\SDL-1.2.12\lib""\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
ExecutionBucket="7"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile=".\obj/sdl_out_rel/gm_sdl_out.pdb"\r
SubSystem="9"\r
<Platform\r
Name="Smartphone 2003 (ARMV4)"\r
/>\r
- <Platform\r
- Name="Pocket PC 2003 (ARMV4)"\r
- />\r
</Platforms>\r
<ToolFiles>\r
</ToolFiles>\r
<DebuggerTool\r
/>\r
</Configuration>\r
- <Configuration\r
- Name="Debug|Pocket PC 2003 (ARMV4)"\r
- OutputDirectory="$(SolutionDir)Pocket PC 2003 (ARMV4)\$(ConfigurationName)"\r
- IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"\r
- ConfigurationType="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- AdditionalIncludeDirectories="../../include"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory=""\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
<Configuration\r
Name="Release|Win32"\r
OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
<DebuggerTool\r
/>\r
</Configuration>\r
- <Configuration\r
- Name="Release|Pocket PC 2003 (ARMV4)"\r
- IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"\r
- ConfigurationType="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCCodeSignTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory=""\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
- </Configuration>\r
</Configurations>\r
<References>\r
</References>\r
/>\r
</Configuration>\r
<Configuration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- OutputDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
- IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ Name="Release|Win32"\r
+ OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
ConfigurationType="2"\r
UseOfMFC="0"\r
UseOfATL="2"\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
- Description=""\r
- CommandLine=""\r
- Outputs=""\r
+ Description="Performing registration"\r
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"\r
+ Outputs="$(OutDir)\regsvr32.trg"\r
/>\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
<Tool\r
Name="VCMIDLTool"\r
- TargetEnvironment="1"\r
- TypeLibraryName=".\obj/w32_deb/GPAX.tlb"\r
+ TypeLibraryName=".\obj/w32_rel/GPAX.tlb"\r
HeaderFileName=""\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="0"\r
+ Optimization="4"\r
AdditionalIncludeDirectories="../../include"\r
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_USR_DLL"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
MinimalRebuild="true"\r
- RuntimeLibrary="3"\r
- PrecompiledHeaderFile=".\obj/w32_deb/GPAX.pch"\r
- AssemblerListingLocation=".\obj/w32_deb/"\r
- ObjectFile=".\obj/w32_deb/"\r
- ProgramDataBaseFileName=".\obj/w32_deb/"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="2"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ AssemblerListingLocation="$(IntDir)\"\r
+ ObjectFile="$(IntDir)\"\r
+ ProgramDataBaseFileName="$(IntDir)\"\r
BrowseInformation="1"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
- DebugInformationFormat="3"\r
+ DebugInformationFormat="4"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),DEBUG,UNICODE,_UNICODE,$(CePlatform),ARM,_ARM_,ARMV4"\r
- Culture="1033"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ Culture="1036"\r
/>\r
<Tool\r
Name="VCPreLinkEventTool"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib"\r
- OutputFile="../../bin/w32_deb_vc8/GPAX.dll"\r
+ AdditionalDependencies="js32.lib zlib.lib winmm.lib ws2_32.lib"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/GPAX.dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../extra_lib/lib/w32_deb"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile="..\..\applications\GPAX\GPAX.def"\r
GenerateDebugInformation="true"\r
- ProgramDatabaseFile=".\obj/w32_deb/GPAX.pdb"\r
- SubSystem="9"\r
+ ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"\r
+ SubSystem="2"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
- ImportLibrary=".\obj/w32_deb/GPAX.lib"\r
- TargetMachine="3"\r
+ SupportUnloadOfDelayLoadedDLL="false"\r
+ ImportLibrary="$(IntDir)\$(ProjectName).lib"\r
+ TargetMachine="1"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
+ OutputFile="$(IntDir)\$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCCodeSignTool"\r
+ Name="VCAppVerifierTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
+ CommandLine=""\r
/>\r
</Configuration>\r
<Configuration\r
- Name="Release|Win32"\r
- OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
- IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ OutputDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
ConfigurationType="2"\r
UseOfMFC="0"\r
UseOfATL="2"\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
- Description="Performing registration"\r
- CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"\r
- Outputs="$(OutDir)\regsvr32.trg"\r
+ Description=""\r
+ CommandLine=""\r
+ Outputs=""\r
/>\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
<Tool\r
Name="VCMIDLTool"\r
- TypeLibraryName=".\obj/w32_rel/GPAX.tlb"\r
+ TargetEnvironment="1"\r
+ TypeLibraryName=".\obj/w32_deb/GPAX.tlb"\r
HeaderFileName=""\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- Optimization="4"\r
+ ExecutionBucket="7"\r
+ Optimization="0"\r
AdditionalIncludeDirectories="../../include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
+ PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_USR_DLL"\r
MinimalRebuild="true"\r
- BasicRuntimeChecks="3"\r
- RuntimeLibrary="2"\r
- PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
- AssemblerListingLocation="$(IntDir)\"\r
- ObjectFile="$(IntDir)\"\r
- ProgramDataBaseFileName="$(IntDir)\"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile=".\obj/w32_deb/GPAX.pch"\r
+ AssemblerListingLocation=".\obj/w32_deb/"\r
+ ObjectFile=".\obj/w32_deb/"\r
+ ProgramDataBaseFileName=".\obj/w32_deb/"\r
BrowseInformation="1"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
- DebugInformationFormat="4"\r
+ DebugInformationFormat="3"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- Culture="1036"\r
+ PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),DEBUG,UNICODE,_UNICODE,$(CePlatform),ARM,_ARM_,ARMV4"\r
+ Culture="1033"\r
/>\r
<Tool\r
Name="VCPreLinkEventTool"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="js32.lib zlib.lib winmm.lib ws2_32.lib"\r
- OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/GPAX.dll"\r
+ AdditionalDependencies="coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib"\r
+ OutputFile="../../bin/w32_deb_vc8/GPAX.dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/w32_deb"\r
ModuleDefinitionFile="..\..\applications\GPAX\GPAX.def"\r
GenerateDebugInformation="true"\r
- ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"\r
- SubSystem="2"\r
+ ProgramDatabaseFile=".\obj/w32_deb/GPAX.pdb"\r
+ SubSystem="9"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
- SupportUnloadOfDelayLoadedDLL="false"\r
- ImportLibrary="$(IntDir)\$(ProjectName).lib"\r
- TargetMachine="1"\r
+ ImportLibrary=".\obj/w32_deb/GPAX.lib"\r
+ TargetMachine="3"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
- OutputFile="$(IntDir)\$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCAppVerifierTool"\r
+ Name="VCCodeSignTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
- CommandLine="if not exist "$(ProgramFiles)\GPAC" md "$(ProgramFiles)\GPAC"
copy ..\..\bin\w32_rel\GPAX.dll "$(ProgramFiles)\GPAC"
"\r
+ />\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
/>\r
</Configuration>\r
<Configuration\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCMIDLTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCMIDLTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCResourceCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCResourceCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
\r
Microsoft Visual Studio Solution File, Format Version 10.00\r
-# Visual Studio 2008\r
+# Visual C++ Express 2008\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPAX", "GPAX.vcproj", "{72486240-A124-496E-A67A-E76FEC7E99BE}"\r
ProjectSection(ProjectDependencies) = postProject\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Osmo4", "Osmo4.vcproj", "{C79C2D73-06E9-4622-92CE-F166B1B51792}"\r
ProjectSection(ProjectDependencies) = postProject\r
- {71071F01-C813-4384-BE38-0F4020BCC0EE} = {71071F01-C813-4384-BE38-0F4020BCC0EE}\r
- {042D3628-67F3-4B5C-8BC0-CD9AFA416974} = {042D3628-67F3-4B5C-8BC0-CD9AFA416974}\r
- {B38E812D-9823-48E7-BE5F-BF09B0AD4165} = {B38E812D-9823-48E7-BE5F-BF09B0AD4165}\r
- {BAE0C03A-56E0-4D37-89F5-62DD03BFC013} = {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}\r
- {01183543-B182-4E32-9FD6-FC15C847316C} = {01183543-B182-4E32-9FD6-FC15C847316C}\r
- {CAA5A551-006A-4119-8115-FB14692E719F} = {CAA5A551-006A-4119-8115-FB14692E719F}\r
- {E2DBD151-9523-4E1A-9478-F3F825668F6E} = {E2DBD151-9523-4E1A-9478-F3F825668F6E}\r
- {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
- {FC8F1F56-078E-470D-B252-68EDDE88AA9D} = {FC8F1F56-078E-470D-B252-68EDDE88AA9D}\r
- {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E} = {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}\r
- {1F7CD37F-DC9A-4AC7-881B-36B263A644C7} = {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}\r
- {073E2381-4FDE-4C4D-A117-C489EB17C48B} = {073E2381-4FDE-4C4D-A117-C489EB17C48B}\r
- {402A8794-B724-44A3-B608-84B600ECA387} = {402A8794-B724-44A3-B608-84B600ECA387}\r
- {879E26B2-48DB-47B3-B82F-893696286E6F} = {879E26B2-48DB-47B3-B82F-893696286E6F}\r
- {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45} = {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}\r
- {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D} = {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}\r
- {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B} = {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}\r
- {464697D2-BA44-446F-8223-1EB3969ED1A8} = {464697D2-BA44-446F-8223-1EB3969ED1A8}\r
- {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60} = {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}\r
- {A86E6EF8-3683-4AD0-8878-7A0D51326088} = {A86E6EF8-3683-4AD0-8878-7A0D51326088}\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aac_in", "aac_in.vcproj", "{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}"\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
EndProjectSection\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpd_in", "mpd_in.vcproj", "{B1AEFA90-318F-459C-96EE-B4DFF3318B7B}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opensvc_dec", "opensvc.vcproj", "{073E2381-4FDE-4C4D-B217-C489EB17C48B}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814} = {D3540754-E0CF-4604-AC11-82DE9BD4D814}\r
+ EndProjectSection\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Mixed Platforms = Debug|Mixed Platforms\r
Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4)\r
Debug|Win32 = Debug|Win32\r
+ Release|Mixed Platforms = Release|Mixed Platforms\r
Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4)\r
Release|Win32 = Release|Win32\r
EndGlobalSection\r
GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Win32.ActiveCfg = Debug|Win32\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Debug|Win32.Build.0 = Debug|Win32\r
+ {72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Win32.ActiveCfg = Release|Win32\r
{72486240-A124-496E-A67A-E76FEC7E99BE}.Release|Win32.Build.0 = Release|Win32\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Win32.ActiveCfg = Debug|Win32\r
{C79C2D73-06E9-4622-92CE-F166B1B51792}.Debug|Win32.Build.0 = Debug|Win32\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Win32.ActiveCfg = Release|Win32\r
{C79C2D73-06E9-4622-92CE-F166B1B51792}.Release|Win32.Build.0 = Release|Win32\r
+ {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Win32.ActiveCfg = Debug|Win32\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Debug|Win32.Build.0 = Debug|Win32\r
+ {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Win32.ActiveCfg = Release|Win32\r
{1F7CD37F-DC9A-4AC7-881B-36B263A644C7}.Release|Win32.Build.0 = Release|Win32\r
+ {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Win32.ActiveCfg = Debug|Win32\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Debug|Win32.Build.0 = Debug|Win32\r
+ {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Win32.ActiveCfg = Release|Win32\r
{73CF10D0-DEC8-4D4B-AAB8-45864694CB8B}.Release|Win32.Build.0 = Release|Win32\r
+ {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Win32.ActiveCfg = Debug|Win32\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Debug|Win32.Build.0 = Debug|Win32\r
+ {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Win32.ActiveCfg = Release|Win32\r
{BAE0C03A-56E0-4D37-89F5-62DD03BFC013}.Release|Win32.Build.0 = Release|Win32\r
+ {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Win32.ActiveCfg = Debug|Win32\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Debug|Win32.Build.0 = Debug|Win32\r
+ {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Win32.ActiveCfg = Release|Win32\r
{073E2381-4FDE-4C4D-A117-C489EB17C48B}.Release|Win32.Build.0 = Release|Win32\r
+ {B64736BD-9245-4F40-961D-EB9822265764}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {B64736BD-9245-4F40-961D-EB9822265764}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {B64736BD-9245-4F40-961D-EB9822265764}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Debug|Win32.ActiveCfg = Debug|Win32\r
{B64736BD-9245-4F40-961D-EB9822265764}.Debug|Win32.Build.0 = Debug|Win32\r
+ {B64736BD-9245-4F40-961D-EB9822265764}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {B64736BD-9245-4F40-961D-EB9822265764}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {B64736BD-9245-4F40-961D-EB9822265764}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{B64736BD-9245-4F40-961D-EB9822265764}.Release|Win32.ActiveCfg = Release|Win32\r
{B64736BD-9245-4F40-961D-EB9822265764}.Release|Win32.Build.0 = Release|Win32\r
+ {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Win32.ActiveCfg = Debug|Win32\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Debug|Win32.Build.0 = Debug|Win32\r
+ {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Win32.ActiveCfg = Release|Win32\r
{9FECAB79-BC70-4EEA-A23B-B64159F904B3}.Release|Win32.Build.0 = Release|Win32\r
+ {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Win32.ActiveCfg = Debug|Win32\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Debug|Win32.Build.0 = Debug|Win32\r
+ {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Win32.ActiveCfg = Release|Win32\r
{042D3628-67F3-4B5C-8BC0-CD9AFA416974}.Release|Win32.Build.0 = Release|Win32\r
+ {CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Win32.ActiveCfg = Debug|Win32\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Debug|Win32.Build.0 = Debug|Win32\r
+ {CAA5A551-006A-4119-8115-FB14692E719F}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {CAA5A551-006A-4119-8115-FB14692E719F}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {CAA5A551-006A-4119-8115-FB14692E719F}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Release|Win32.ActiveCfg = Release|Win32\r
{CAA5A551-006A-4119-8115-FB14692E719F}.Release|Win32.Build.0 = Release|Win32\r
+ {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Win32.ActiveCfg = Debug|Win32\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Debug|Win32.Build.0 = Debug|Win32\r
+ {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Win32.ActiveCfg = Release|Win32\r
{9F0660BC-4582-4D4E-BA83-E2BE5F6BDD45}.Release|Win32.Build.0 = Release|Win32\r
+ {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Win32.ActiveCfg = Debug|Win32\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Debug|Win32.Build.0 = Debug|Win32\r
+ {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Win32.ActiveCfg = Release|Win32\r
{FC8F1F56-078E-470D-B252-68EDDE88AA9D}.Release|Win32.Build.0 = Release|Win32\r
+ {879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Win32.ActiveCfg = Debug|Win32\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Debug|Win32.Build.0 = Debug|Win32\r
+ {879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Win32.ActiveCfg = Release|Win32\r
{879E26B2-48DB-47B3-B82F-893696286E6F}.Release|Win32.Build.0 = Release|Win32\r
+ {233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Win32.ActiveCfg = Debug|Win32\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Debug|Win32.Build.0 = Debug|Win32\r
+ {233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Win32.ActiveCfg = Release|Win32\r
{233014D5-F6E5-419D-8757-FA9CE7337088}.Release|Win32.Build.0 = Release|Win32\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Win32.ActiveCfg = Debug|Win32\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Debug|Win32.Build.0 = Debug|Win32\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Win32.ActiveCfg = Release|Win32\r
{D3540754-E0CF-4604-AC11-82DE9BD4D814}.Release|Win32.Build.0 = Release|Win32\r
+ {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Win32.ActiveCfg = Debug|Win32\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Debug|Win32.Build.0 = Debug|Win32\r
+ {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Win32.ActiveCfg = Release|Win32\r
{4AC7F65D-0DC0-49F9-8B96-AD05F11FF38E}.Release|Win32.Build.0 = Release|Win32\r
+ {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Win32.ActiveCfg = Debug|Win32\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Debug|Win32.Build.0 = Debug|Win32\r
+ {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Win32.ActiveCfg = Release|Win32\r
{48E2C7C6-52EB-46FB-8722-00A62F46F497}.Release|Win32.Build.0 = Release|Win32\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Win32.ActiveCfg = Debug|Win32\r
{A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Debug|Win32.Build.0 = Debug|Win32\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Win32.ActiveCfg = Release|Win32\r
{A35D99BF-D72D-4F56-99A1-97249B22BCE2}.Release|Win32.Build.0 = Release|Win32\r
+ {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Win32.ActiveCfg = Debug|Win32\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Debug|Win32.Build.0 = Debug|Win32\r
+ {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Win32.ActiveCfg = Release|Win32\r
{B38E812D-9823-48E7-BE5F-BF09B0AD4165}.Release|Win32.Build.0 = Release|Win32\r
+ {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Win32.ActiveCfg = Debug|Win32\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Debug|Win32.Build.0 = Debug|Win32\r
+ {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Win32.ActiveCfg = Release|Win32\r
{A86E6EF8-3683-4AD0-8878-7A0D51326088}.Release|Win32.Build.0 = Release|Win32\r
+ {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Win32.ActiveCfg = Debug|Win32\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Debug|Win32.Build.0 = Debug|Win32\r
+ {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Win32.ActiveCfg = Release|Win32\r
{3B4108E4-C8FD-4D82-AF4A-F928CCF36A60}.Release|Win32.Build.0 = Release|Win32\r
+ {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Win32.ActiveCfg = Debug|Win32\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Debug|Win32.Build.0 = Debug|Win32\r
+ {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Win32.ActiveCfg = Release|Win32\r
{A0288B75-0D95-4106-A3A7-779A891E8FEF}.Release|Win32.Build.0 = Release|Win32\r
+ {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Win32.ActiveCfg = Debug|Win32\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Debug|Win32.Build.0 = Debug|Win32\r
+ {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Win32.ActiveCfg = Release|Win32\r
{8162BADA-2FB6-4A71-B998-ABAFAF28E5A8}.Release|Win32.Build.0 = Release|Win32\r
+ {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Win32.ActiveCfg = Debug|Win32\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Debug|Win32.Build.0 = Debug|Win32\r
+ {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Win32.ActiveCfg = Release|Win32\r
{E2DBD151-9523-4E1A-9478-F3F825668F6E}.Release|Win32.Build.0 = Release|Win32\r
+ {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Win32.ActiveCfg = Debug|Win32\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Debug|Win32.Build.0 = Debug|Win32\r
+ {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Win32.ActiveCfg = Release|Win32\r
{2B6AB6CD-E7D0-4706-BB4A-DDD7AE1A510D}.Release|Win32.Build.0 = Release|Win32\r
+ {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Win32.ActiveCfg = Debug|Win32\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Debug|Win32.Build.0 = Debug|Win32\r
+ {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Win32.ActiveCfg = Release|Win32\r
{F346A9A7-CF8D-4409-8776-1D4244F96EF8}.Release|Win32.Build.0 = Release|Win32\r
+ {71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Win32.ActiveCfg = Debug|Win32\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Debug|Win32.Build.0 = Debug|Win32\r
+ {71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Win32.ActiveCfg = Release|Win32\r
{71071F01-C813-4384-BE38-0F4020BCC0EE}.Release|Win32.Build.0 = Release|Win32\r
+ {402A8794-B724-44A3-B608-84B600ECA387}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {402A8794-B724-44A3-B608-84B600ECA387}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {402A8794-B724-44A3-B608-84B600ECA387}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Win32.ActiveCfg = Debug|Win32\r
{402A8794-B724-44A3-B608-84B600ECA387}.Debug|Win32.Build.0 = Debug|Win32\r
+ {402A8794-B724-44A3-B608-84B600ECA387}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {402A8794-B724-44A3-B608-84B600ECA387}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {402A8794-B724-44A3-B608-84B600ECA387}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Win32.ActiveCfg = Release|Win32\r
{402A8794-B724-44A3-B608-84B600ECA387}.Release|Win32.Build.0 = Release|Win32\r
+ {464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Win32.ActiveCfg = Debug|Win32\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Debug|Win32.Build.0 = Debug|Win32\r
+ {464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Win32.ActiveCfg = Release|Win32\r
{464697D2-BA44-446F-8223-1EB3969ED1A8}.Release|Win32.Build.0 = Release|Win32\r
+ {01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Win32.ActiveCfg = Debug|Win32\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Debug|Win32.Build.0 = Debug|Win32\r
+ {01183543-B182-4E32-9FD6-FC15C847316C}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {01183543-B182-4E32-9FD6-FC15C847316C}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {01183543-B182-4E32-9FD6-FC15C847316C}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Win32.ActiveCfg = Release|Win32\r
{01183543-B182-4E32-9FD6-FC15C847316C}.Release|Win32.Build.0 = Release|Win32\r
+ {4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Win32.ActiveCfg = Debug|Win32\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Debug|Win32.Build.0 = Debug|Win32\r
+ {4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Win32.ActiveCfg = Release|Win32\r
{4258687D-4905-46A6-9407-08F4F8A81CC0}.Release|Win32.Build.0 = Release|Win32\r
+ {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Win32.ActiveCfg = Debug|Win32\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Debug|Win32.Build.0 = Debug|Win32\r
+ {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Win32.ActiveCfg = Release|Win32\r
{E08DA5C2-9D97-4CD3-BB13-6FD6BA4458D6}.Release|Win32.Build.0 = Release|Win32\r
+ {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Win32.ActiveCfg = Debug|Win32\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Debug|Win32.Build.0 = Debug|Win32\r
+ {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Win32.ActiveCfg = Release|Win32\r
{1DE72B1E-0DD6-4AFD-95E9-D23ACAB31812}.Release|Win32.Build.0 = Release|Win32\r
+ {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)\r
+ {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)\r
+ {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)\r
+ {F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{F9AF60FE-C2F2-4D94-9667-E4FCC6FAA466}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)\r
+ {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)\r
+ {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)\r
+ {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)\r
+ {CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{CAA7EF3E-C7F4-4F8A-9E17-9A06DEF9E717}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)\r
+ {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Win32.ActiveCfg = Debug|Win32\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Debug|Win32.Build.0 = Debug|Win32\r
+ {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Win32.ActiveCfg = Release|Win32\r
{27F7FDF4-479B-47B5-BFEA-12E9EA41F663}.Release|Win32.Build.0 = Release|Win32\r
+ {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Win32.ActiveCfg = Debug|Win32\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Debug|Win32.Build.0 = Debug|Win32\r
+ {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Win32.ActiveCfg = Release|Win32\r
{C993119B-29B1-49C8-8EA3-A9ABF633164E}.Release|Win32.Build.0 = Release|Win32\r
+ {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Win32.ActiveCfg = Debug|Win32\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Debug|Win32.Build.0 = Debug|Win32\r
+ {694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Win32.ActiveCfg = Release|Win32\r
{694C765F-DFD6-467E-A813-B3F887E822D4}.Release|Win32.Build.0 = Release|Win32\r
+ {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Win32.ActiveCfg = Debug|Win32\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Debug|Win32.Build.0 = Debug|Win32\r
+ {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Win32.ActiveCfg = Release|Win32\r
{07D6FB42-0F4F-487A-BCBA-EC4BBF5CB160}.Release|Win32.Build.0 = Release|Win32\r
+ {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Win32\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Win32.ActiveCfg = Debug|Win32\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Debug|Win32.Build.0 = Debug|Win32\r
+ {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Win32\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Win32.ActiveCfg = Release|Win32\r
{073E2281-4FDE-4C4D-A217-C489DB17C48C}.Release|Win32.Build.0 = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Mixed Platforms.Build.0 = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Debug|Win32.Build.0 = Debug|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Mixed Platforms.ActiveCfg = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Mixed Platforms.Build.0 = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Win32.ActiveCfg = Release|Win32\r
+ {B1AEFA90-318F-459C-96EE-B4DFF3318B7B}.Release|Win32.Build.0 = Release|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Mixed Platforms.ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Mixed Platforms.Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Mixed Platforms.Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Debug|Win32.Build.0 = Debug|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Mixed Platforms.ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Mixed Platforms.Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Mixed Platforms.Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Win32.ActiveCfg = Release|Win32\r
+ {073E2381-4FDE-4C4D-B217-C489EB17C48B}.Release|Win32.Build.0 = Release|Win32\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
>\r
<Tool\r
Name="VCPreBuildEventTool"\r
+ CommandLine=""$(InputDir)..\..\version.bat""\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
>\r
<Tool\r
Name="VCPreBuildEventTool"\r
+ CommandLine=""$(InputDir)..\..\version.bat""\r
/>\r
<Tool\r
Name="VCCustomBuildTool"\r
<Filter\r
Name="utils"\r
>\r
+ <File\r
+ RelativePath="..\..\src\utils\alloc.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\utils\base_encoding.c"\r
>\r
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\utils\cache.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\utils\color.c"\r
>\r
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\utils\ringbuffer.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\utils\token.c"\r
>\r
RelativePath="..\..\src\utils\uni_bidi.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\utils\unicode.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\utils\url.c"\r
>\r
RelativePath="..\..\src\media_tools\m2ts_mux.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\media_tools\m3u8.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\gpac\internal\media_dev.h"\r
>\r
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\media_tools\mpd.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\media_tools\mpeg2_ps.c"\r
>\r
RelativePath="..\..\include\gpac\list.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\gpac\internal\m3u8.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\gpac\math.h"\r
>\r
RelativePath="..\..\include\gpac\module.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\gpac\internal\mpd.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\gpac\mpeg4_odf.h"\r
>\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
+ CommandLine="if not exist "$(ProgramFiles)\GPAC" md "$(ProgramFiles)\GPAC" & copy ..\..\bin\w32_rel\mp4box.exe "$(ProgramFiles)\GPAC""\r
/>\r
</Configuration>\r
<Configuration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
- OutputDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
- IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ Name="Release|Win32"\r
+ OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
ConfigurationType="1"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
/>\r
<Tool\r
Name="VCMIDLTool"\r
- TargetEnvironment="1"\r
- TypeLibraryName=".\obj/mp4box_deb/mp4box.tlb"\r
+ TypeLibraryName=".\obj/mp4box_rel/mp4box.tlb"\r
HeaderFileName=""\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="0"\r
+ Optimization="1"\r
+ InlineFunctionExpansion="1"\r
AdditionalIncludeDirectories="../../include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE"\r
- MinimalRebuild="true"\r
- RuntimeLibrary="3"\r
- PrecompiledHeaderFile=".\obj/mp4box_deb/mp4box.pch"\r
- AssemblerListingLocation=".\obj/mp4box_deb/"\r
- ObjectFile=".\obj/mp4box_deb/"\r
- ProgramDataBaseFileName=".\obj/mp4box_deb/"\r
- BrowseInformation="1"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ EnableFunctionLevelLinking="true"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ AssemblerListingLocation="$(IntDir)\"\r
+ ObjectFile="$(IntDir)\"\r
+ ProgramDataBaseFileName="$(IntDir)\"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
- DebugInformationFormat="3"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG"\r
+ PreprocessorDefinitions="NDEBUG"\r
Culture="1036"\r
/>\r
<Tool\r
<Tool\r
Name="VCLinkerTool"\r
AdditionalDependencies="zlib.lib winmm.lib"\r
- OutputFile="../../bin/w32_deb_vc8/MP4Box.exe"\r
- LinkIncremental="2"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/MP4Box.exe"\r
+ LinkIncremental="1"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../extra_lib/lib/w32_deb"\r
- GenerateDebugInformation="true"\r
- ProgramDatabaseFile=".\obj/mp4box_deb/MP4Box.pdb"\r
- SubSystem="9"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"\r
+ SubSystem="1"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
- TargetMachine="3"\r
+ TargetMachine="1"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
+ OutputFile="$(IntDir)\$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCCodeSignTool"\r
+ Name="VCAppVerifierTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
- />\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
+ CommandLine="if not exist "$(ProgramFiles)\GPAC" md "$(ProgramFiles)\GPAC" & copy ..\..\bin\w32_rel\mp4box.exe "$(ProgramFiles)\GPAC""\r
/>\r
</Configuration>\r
<Configuration\r
- Name="Release|Win32"\r
- OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
- IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ OutputDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
+ IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"\r
ConfigurationType="1"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
/>\r
<Tool\r
Name="VCMIDLTool"\r
- TypeLibraryName=".\obj/mp4box_rel/mp4box.tlb"\r
+ TargetEnvironment="1"\r
+ TypeLibraryName=".\obj/mp4box_deb/mp4box.tlb"\r
HeaderFileName=""\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- Optimization="1"\r
- InlineFunctionExpansion="1"\r
+ ExecutionBucket="7"\r
+ Optimization="0"\r
AdditionalIncludeDirectories="../../include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE"\r
- StringPooling="true"\r
- RuntimeLibrary="2"\r
- EnableFunctionLevelLinking="true"\r
- PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
- AssemblerListingLocation="$(IntDir)\"\r
- ObjectFile="$(IntDir)\"\r
- ProgramDataBaseFileName="$(IntDir)\"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE"\r
+ MinimalRebuild="true"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile=".\obj/mp4box_deb/mp4box.pch"\r
+ AssemblerListingLocation=".\obj/mp4box_deb/"\r
+ ObjectFile=".\obj/mp4box_deb/"\r
+ ProgramDataBaseFileName=".\obj/mp4box_deb/"\r
+ BrowseInformation="1"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
+ DebugInformationFormat="3"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG"\r
+ PreprocessorDefinitions="_DEBUG"\r
Culture="1036"\r
/>\r
<Tool\r
<Tool\r
Name="VCLinkerTool"\r
AdditionalDependencies="zlib.lib winmm.lib"\r
- OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/MP4Box.exe"\r
- LinkIncremental="1"\r
+ OutputFile="../../bin/w32_deb_vc8/MP4Box.exe"\r
+ LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
- ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"\r
- SubSystem="1"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/w32_deb"\r
+ GenerateDebugInformation="true"\r
+ ProgramDatabaseFile=".\obj/mp4box_deb/MP4Box.pdb"\r
+ SubSystem="9"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
- TargetMachine="1"\r
+ TargetMachine="3"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
- OutputFile="$(IntDir)\$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCAppVerifierTool"\r
+ Name="VCCodeSignTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
- CommandLine="if not exist "$(ProgramFiles)\GPAC" md "$(ProgramFiles)\GPAC"
copy ..\..\bin\w32_rel\mp4box.exe "$(ProgramFiles)\GPAC"
"\r
+ />\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
/>\r
</Configuration>\r
<Configuration\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="9,00"\r
+ Name="mpd_in"\r
+ ProjectGUID="{B1AEFA90-318F-459C-96EE-B4DFF3318B7B}"\r
+ RootNamespace="dash"\r
+ Keyword="Win32Proj"\r
+ TargetFrameworkVersion="131072"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="2"\r
+ CharacterSet="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ UsePrecompiledHeader="0"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="2"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="2"\r
+ RandomizedBaseAddress="1"\r
+ DataExecutionPrevention="0"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="2"\r
+ CharacterSet="1"\r
+ WholeProgramOptimization="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
+ RuntimeLibrary="2"\r
+ UsePrecompiledHeader="0"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="1"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="2"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ RandomizedBaseAddress="1"\r
+ DataExecutionPrevention="0"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <File\r
+ RelativePath="..\..\modules\modules_export.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\modules\mpd_in\mpd_in.c"\r
+ >\r
+ </File>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="9,00"\r
+ Name="opensvc_dec"\r
+ ProjectGUID="{073E2381-4FDE-4C4D-B217-C489EB17C48B}"\r
+ RootNamespace="opensvc_dec"\r
+ TargetFrameworkVersion="131072"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ <Platform\r
+ Name="Smartphone 2003 (ARMV4)"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ ConfigurationType="2"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ MkTypLibCompatible="true"\r
+ SuppressStartupBanner="true"\r
+ TargetEnvironment="1"\r
+ TypeLibraryName=".\obj/dymmy_in_deb/opensvc_dec.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="../../modules/opensvc_dec/osvc_sdk/include;../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ AssemblerListingLocation="$(IntDir)\"\r
+ ObjectFile="$(IntDir)\"\r
+ ProgramDataBaseFileName="$(IntDir)\"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies=""\r
+ OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="2"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ GenerateManifest="true"\r
+ ModuleDefinitionFile=""\r
+ GenerateDebugInformation="true"\r
+ ProgramDatabaseFile="$(IntDir)/gm_$(ProjectName).pdb"\r
+ RandomizedBaseAddress="1"\r
+ DataExecutionPrevention="0"\r
+ ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ EmbedManifest="true"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ ConfigurationType="2"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ MkTypLibCompatible="true"\r
+ SuppressStartupBanner="true"\r
+ TargetEnvironment="1"\r
+ TypeLibraryName=".\obj/dymmy_in_deb/opensvc_dec.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ExecutionBucket="7"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
+ MinimalRebuild="true"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ AssemblerListingLocation="$(IntDir)/"\r
+ ObjectFile="$(IntDir)/"\r
+ ProgramDataBaseFileName="$(IntDir)/"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="_DEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="2"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ ModuleDefinitionFile=""\r
+ GenerateDebugInformation="true"\r
+ ProgramDatabaseFile="$(IntDir)/gm_opensvc_dec.pdb"\r
+ SubSystem="9"\r
+ RandomizedBaseAddress="1"\r
+ DataExecutionPrevention="0"\r
+ ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
+ TargetMachine="3"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile="$(OutDir)/$(ProjectName).bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCCodeSignTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ ConfigurationType="2"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ PreprocessorDefinitions="NDEBUG"\r
+ MkTypLibCompatible="true"\r
+ SuppressStartupBanner="true"\r
+ TargetEnvironment="1"\r
+ TypeLibraryName=".\obj/dymmy_in_rel/opensvc_dec.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="2"\r
+ InlineFunctionExpansion="1"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ EnableFunctionLevelLinking="true"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ AssemblerListingLocation="$(IntDir)\"\r
+ ObjectFile="$(IntDir)\"\r
+ ProgramDataBaseFileName="$(IntDir)\"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="NDEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies=""\r
+ OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="1"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ ModuleDefinitionFile=""\r
+ ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
+ RandomizedBaseAddress="1"\r
+ DataExecutionPrevention="0"\r
+ ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile="$(IntDir)\$(ProjectName).bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Smartphone 2003 (ARMV4)"\r
+ OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
+ ConfigurationType="2"\r
+ UseOfMFC="0"\r
+ ATLMinimizesCRunTimeLibraryUsage="false"\r
+ CharacterSet="2"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ PreprocessorDefinitions="NDEBUG"\r
+ MkTypLibCompatible="true"\r
+ SuppressStartupBanner="true"\r
+ TargetEnvironment="1"\r
+ TypeLibraryName=".\obj/dymmy_in_rel/opensvc_dec.tlb"\r
+ HeaderFileName=""\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ ExecutionBucket="7"\r
+ Optimization="2"\r
+ InlineFunctionExpansion="1"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ EnableFunctionLevelLinking="true"\r
+ PrecompiledHeaderFile="$(IntDir)\$(ProjectName).pch"\r
+ AssemblerListingLocation="$(IntDir)\"\r
+ ObjectFile="$(IntDir)\"\r
+ ProgramDataBaseFileName="$(IntDir)\"\r
+ WarningLevel="3"\r
+ SuppressStartupBanner="true"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ PreprocessorDefinitions="NDEBUG"\r
+ Culture="1036"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="1"\r
+ SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
+ ModuleDefinitionFile=""\r
+ ProgramDatabaseFile=".\obj/dymmy_in_rel/gm_opensvc_dec.pdb"\r
+ SubSystem="9"\r
+ RandomizedBaseAddress="1"\r
+ DataExecutionPrevention="0"\r
+ ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
+ TargetMachine="3"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ SuppressStartupBanner="true"\r
+ OutputFile="$(IntDir)\$(ProjectName).bsc"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCCodeSignTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <File\r
+ RelativePath="..\..\modules\modules_export.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\modules\opensvc_dec\opensvc_dec.c"\r
+ >\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""\r
+ PreprocessorDefinitions=""\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""\r
+ PreprocessorDefinitions=""\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""\r
+ PreprocessorDefinitions=""\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Smartphone 2003 (ARMV4)"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""\r
+ PreprocessorDefinitions=""\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
Name="VCCLCompilerTool"\r
Optimization="2"\r
FavorSizeOrSpeed="2"\r
- AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../extra_lib/include/platinum"\r
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
MinimalRebuild="false"\r
BasicRuntimeChecks="0"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_vc8, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
/>\r
</Configuration>\r
<Configuration\r
- Name="Release|Smartphone 2003 (ARMV4)"\r
+ Name="Debug|Win32"\r
OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
ConfigurationType="2"\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="3"\r
- AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../extra_lib/include/platinum"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
MinimalRebuild="true"\r
- RuntimeLibrary="2"\r
- PrecompiledHeaderFile="$(IntDir)\$(ProjectName).pch"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
AssemblerListingLocation="$(IntDir)/"\r
ObjectFile="$(IntDir)/"\r
ProgramDataBaseFileName="$(IntDir)/"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
- DebugInformationFormat="3"\r
+ DebugInformationFormat="4"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="platinum.lib neptune.lib ws2.lib coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib Iphlpapi.lib "\r
+ AdditionalDependencies="platinum.lib neptune.lib winmm.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_arm, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
- SubSystem="9"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
- TargetMachine="0"\r
+ TargetMachine="1"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
- OutputFile="$(IntDir)/$(ProjectName).bsc"\r
+ OutputFile=".\obj/platinum_deb/platinum.bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCCodeSignTool"\r
+ Name="VCAppVerifierTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
/>\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory=""\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
</Configuration>\r
<Configuration\r
- Name="Debug|Win32"\r
+ Name="Release|Smartphone 2003 (ARMV4)"\r
OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
ConfigurationType="2"\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- Optimization="0"\r
+ ExecutionBucket="7"\r
+ Optimization="3"\r
AdditionalIncludeDirectories="../../include;../../extra_lib/include/js;../../modules/platinum/sdk/include"\r
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NDEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
MinimalRebuild="true"\r
- BasicRuntimeChecks="3"\r
- RuntimeLibrary="3"\r
- PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
+ RuntimeLibrary="2"\r
+ PrecompiledHeaderFile="$(IntDir)\$(ProjectName).pch"\r
AssemblerListingLocation="$(IntDir)/"\r
ObjectFile="$(IntDir)/"\r
ProgramDataBaseFileName="$(IntDir)/"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
- DebugInformationFormat="4"\r
+ DebugInformationFormat="3"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- AdditionalDependencies="platinum_d.lib neptune_d.lib winmm.lib"\r
+ AdditionalDependencies="platinum.lib neptune.lib ws2.lib coredll.lib corelibc.lib commctrl.lib secchk.lib ccrtrtti.lib Iphlpapi.lib "\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_vc8, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
+ AdditionalLibraryDirectories="../../modules/platinum/sdk/lib_arm, ../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
ProgramDatabaseFile="$(IntDir)/$(ProjectName).pdb"\r
+ SubSystem="9"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
- TargetMachine="1"\r
+ TargetMachine="0"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
- OutputFile=".\obj/platinum_deb/platinum.bsc"\r
+ OutputFile="$(IntDir)/$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCAppVerifierTool"\r
+ Name="VCCodeSignTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
/>\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory=""\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
+ />\r
</Configuration>\r
<Configuration\r
Name="Debug|Smartphone 2003 (ARMV4)"\r
<Tool\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
+ AdditionalDependencies="avformat-52.lib avcodec-52.lib avutil-50.lib swscale-0.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
Name="VCCLCompilerTool"\r
Optimization="2"\r
InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
StringPooling="true"\r
RuntimeLibrary="2"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
+ AdditionalDependencies="avformat-52.lib avcodec-52.lib avutil-50.lib swscale-0.lib"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)\$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
RandomizedBaseAddress="1"\r
<Tool\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
- AdditionalIncludeDirectories=""C:\Users\Cyril Concolato\code\SDL-1.2.14\include";../../include"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include/SDL"\r
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories=""C:\Users\Cyril Concolato\code\SDL-1.2.14\lib""\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
GenerateManifest="true"\r
ModuleDefinitionFile=""\r
GenerateDebugInformation="true"\r
/>\r
</Configuration>\r
<Configuration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
ConfigurationType="2"\r
/>\r
<Tool\r
Name="VCMIDLTool"\r
- PreprocessorDefinitions="_DEBUG"\r
+ PreprocessorDefinitions="NDEBUG"\r
MkTypLibCompatible="true"\r
SuppressStartupBanner="true"\r
TargetEnvironment="1"\r
- TypeLibraryName=".\obj/sdl_out_deb/sdl_out.tlb"\r
+ TypeLibraryName=".\obj/sdl_out_rel/sdl_out.tlb"\r
HeaderFileName=""\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- ExecutionBucket="7"\r
- Optimization="0"\r
- AdditionalIncludeDirectories="../../include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
- MinimalRebuild="true"\r
- RuntimeLibrary="3"\r
+ Optimization="2"\r
+ InlineFunctionExpansion="1"\r
+ AdditionalIncludeDirectories="../../include,../../extra_lib/include/SDL"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
+ StringPooling="true"\r
+ RuntimeLibrary="2"\r
+ EnableFunctionLevelLinking="true"\r
PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
- AssemblerListingLocation="$(IntDir)/"\r
- ObjectFile="$(IntDir)/"\r
- ProgramDataBaseFileName="$(IntDir)/"\r
+ AssemblerListingLocation="$(IntDir)\"\r
+ ObjectFile="$(IntDir)\"\r
+ ProgramDataBaseFileName="$(IntDir)\"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
- DebugInformationFormat="3"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG"\r
+ PreprocessorDefinitions="NDEBUG"\r
Culture="1036"\r
/>\r
<Tool\r
<Tool\r
Name="VCLinkerTool"\r
AdditionalDependencies="SDL.lib"\r
- OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
- LinkIncremental="2"\r
+ OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="1"\r
SuppressStartupBanner="true"\r
+ AdditionalLibraryDirectories="../../extra_lib/lib/$(PlatformName)/$(ConfigurationName)"\r
ModuleDefinitionFile=""\r
- GenerateDebugInformation="true"\r
- ProgramDatabaseFile="$(IntDir)/gm_$(ProjectName).pdb"\r
- SubSystem="9"\r
+ ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
- TargetMachine="3"\r
+ TargetMachine="1"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
+ OutputFile="$(IntDir)\$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCCodeSignTool"\r
+ Name="VCAppVerifierTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
/>\r
- <DeploymentTool\r
- ForceDirty="-1"\r
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
- RegisterOutput="0"\r
- AdditionalFiles=""\r
- />\r
- <DebuggerTool\r
- />\r
</Configuration>\r
<Configuration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
OutputDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
IntermediateDirectory=".\obj\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"\r
ConfigurationType="2"\r
/>\r
<Tool\r
Name="VCMIDLTool"\r
- PreprocessorDefinitions="NDEBUG"\r
+ PreprocessorDefinitions="_DEBUG"\r
MkTypLibCompatible="true"\r
SuppressStartupBanner="true"\r
TargetEnvironment="1"\r
- TypeLibraryName=".\obj/sdl_out_rel/sdl_out.tlb"\r
+ TypeLibraryName=".\obj/sdl_out_deb/sdl_out.tlb"\r
HeaderFileName=""\r
/>\r
<Tool\r
Name="VCCLCompilerTool"\r
- Optimization="2"\r
- InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories=""C:\Users\Cyril Concolato\code\SDL-1.2.14\include";../../include"\r
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL"\r
- StringPooling="true"\r
- RuntimeLibrary="2"\r
- EnableFunctionLevelLinking="true"\r
+ ExecutionBucket="7"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories="../../include"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_DEBUG;_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;_USR_DLL"\r
+ MinimalRebuild="true"\r
+ RuntimeLibrary="3"\r
PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"\r
- AssemblerListingLocation="$(IntDir)\"\r
- ObjectFile="$(IntDir)\"\r
- ProgramDataBaseFileName="$(IntDir)\"\r
+ AssemblerListingLocation="$(IntDir)/"\r
+ ObjectFile="$(IntDir)/"\r
+ ProgramDataBaseFileName="$(IntDir)/"\r
WarningLevel="3"\r
SuppressStartupBanner="true"\r
+ DebugInformationFormat="3"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
/>\r
<Tool\r
Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG"\r
+ PreprocessorDefinitions="_DEBUG"\r
Culture="1036"\r
/>\r
<Tool\r
<Tool\r
Name="VCLinkerTool"\r
AdditionalDependencies="SDL.lib"\r
- OutputFile="../../bin/$(PlatformName)\$(ConfigurationName)/gm_$(ProjectName).dll"\r
- LinkIncremental="1"\r
+ OutputFile="../../bin/$(PlatformName)/$(ConfigurationName)/gm_$(ProjectName).dll"\r
+ LinkIncremental="2"\r
SuppressStartupBanner="true"\r
- AdditionalLibraryDirectories=""C:\Users\Cyril Concolato\code\SDL-1.2.14\lib""\r
ModuleDefinitionFile=""\r
- ProgramDatabaseFile="$(IntDir)\gm_$(ProjectName).pdb"\r
+ GenerateDebugInformation="true"\r
+ ProgramDatabaseFile="$(IntDir)/gm_$(ProjectName).pdb"\r
+ SubSystem="9"\r
RandomizedBaseAddress="1"\r
DataExecutionPrevention="0"\r
ImportLibrary="$(IntDir)/gm_$(ProjectName).lib"\r
- TargetMachine="1"\r
+ TargetMachine="3"\r
/>\r
<Tool\r
Name="VCALinkTool"\r
/>\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
<Tool\r
Name="VCXDCMakeTool"\r
/>\r
<Tool\r
Name="VCBscMakeTool"\r
SuppressStartupBanner="true"\r
- OutputFile="$(IntDir)\$(ProjectName).bsc"\r
/>\r
<Tool\r
Name="VCFxCopTool"\r
/>\r
<Tool\r
- Name="VCAppVerifierTool"\r
+ Name="VCCodeSignTool"\r
/>\r
<Tool\r
Name="VCPostBuildEventTool"\r
/>\r
+ <DeploymentTool\r
+ ForceDirty="-1"\r
+ RemoteDirectory="%CSIDL_PROGRAM_FILES%\gpac"\r
+ RegisterOutput="0"\r
+ AdditionalFiles=""\r
+ />\r
+ <DebuggerTool\r
+ />\r
</Configuration>\r
<Configuration\r
Name="Release|Smartphone 2003 (ARMV4)"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Smartphone 2003 (ARMV4)"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Smartphone 2003 (ARMV4)"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>bt</string>
+ <string>xmt</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-4 BIFS Text</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>wrl</string>
+ <string>x3d</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_model.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Web3D VRML/X3D File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>svg</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>W3C SVG File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>saf</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-4 SAF/LASeR File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>flv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Flash Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>pls</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Shoutcast playlist</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m3u</string>
+ <string>m3u8</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Playlist file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>aiff</string>
+ <string>aif</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>AIFF file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>sdp</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Session Description Protocol File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>wav</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>WAVE Audio File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>vob</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>DVD Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>a52</string>
+ <string>ac3</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Digital Audio</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>aac</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>AAC file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>ogm</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Ogg MPEG-4 Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>ogg</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>audio/ogg</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Ogg Vorbis File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>ogv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>video/ogg</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Ogg Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>avi</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>AVI container</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>mov</string>
+ <string>moov</string>
+ <string>qt</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>video/quicktime</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Apple QuickTime container</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>asf</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Advanced Streaming Format</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>wma</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Windows Media Audio</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>wmv</string>
+ <string>wm</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Windows Media Video</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>mpg</string>
+ <string>mpeg</string>
+ <string>mpeg1</string>
+ <string>mpeg2</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>multiplexed MPEG-1/2</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m1v</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-1 Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m2a</string>
+ <string>mp1</string>
+ <string>mp2</string>
+ <string>mp3</string>
+ <string>mpa</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG Audio File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m2p</string>
+ <string>ps</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-2 Program Stream</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>ts</string>
+ <string>m2ts</string>
+ <string>mts</string>
+ <string>mt2s</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>video/mp2t</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-2 Transport Stream</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m2v</string>
+ <string>mpv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-2 Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>mp4</string>
+ <string>mpeg4</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_generic.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-4 File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m4v</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-4 Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>m4a</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>MPEG-4 Audio File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>3gp</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>3GPP File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>mka</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Matroska Audio File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>mkv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Matroska Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>webm</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_video.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>WebM Video File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>srt</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_subs.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Subrip Subtitle File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>Binary</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>ttxt</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>osmo_subs.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>3GPP Subtitle File</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>Binary</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>Osmo4</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Copyright © 2003-2011 Telecom ParisTech</string>
+ <key>CFBundleIconFile</key>
+ <string>osmo.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.enst.gpac</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Osmo4</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+<!-- Please do not remove the comment in the next line
+ It allows mkdmg.sh to perform a Version remplacement -->
+ <string>0.4.5</string><!-- VERSION_REV_REPLACE -->
+ <key>CFBundleSignature</key>
+ <string>gpac</string>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleURLIconFile</key>
+ <string>generic</string>
+ <key>CFBundleURLName</key>
+ <string>http url</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>http</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleURLIconFile</key>
+ <string>generic</string>
+ <key>CFBundleURLName</key>
+ <string>Multimedia Stream URL</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>mms</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleURLIconFile</key>
+ <string>generic</string>
+ <key>CFBundleURLName</key>
+ <string>RTSP</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>rtsp</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleURLIconFile</key>
+ <string>generic</string>
+ <key>CFBundleURLName</key>
+ <string>udp url</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>udp</string>
+ </array>
+ </dict>
+ </array>
+ <key>CFBundleVersion</key>
+<!-- Please do not remove the comment in the next line
+ It allows mkdmg.sh to perform a Version remplacement -->
+ <string>2200</string><!-- BUILD_REV_REPLACE -->
+ <key>LSMinimumSystemVersion</key>
+ <string>10.5.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+ <key>SUEnableAutomaticChecks</key>
+ <string>NO</string>
+ <key>SUEnableSystemProfiling</key>
+ <string>YES</string>
+</dict>
+</plist>
--- /dev/null
+APPLgpac
\ No newline at end of file
--- /dev/null
+data 'LPic' (5000) {
+ $"0002 0011 0003 0001 0000 0000 0002 0000"
+ $"0008 0003 0000 0001 0004 0000 0004 0005"
+ $"0000 000E 0006 0001 0005 0007 0000 0007"
+ $"0008 0000 0047 0009 0000 0034 000A 0001"
+ $"0035 000B 0001 0020 000C 0000 0011 000D"
+ $"0000 005B 0004 0000 0033 000F 0001 000C"
+ $"0010 0000 000B 000E 0000"
+};
+
+
+data 'TEXT' (5002, "English") {
+ "Copyright (c) 2003, 2011 Telecom ParisTech. All rights reserved.\n"
+ "For more information, visit <http://gpac.sourceforge.net>\n"
+ "\n"
+ "This software package includes many Multimedia Technologies. Some of these technologies may be covered by various patents hard to identify. These patents may or may not apply in your local jurisdiction.\n"
+ "\n"
+ "By installing this software, you acknowledge that you may have to pay royalty fees in order to legally use this software.\n"
+ "\n"
+ "DO NOT PROCEED with this installation if you do not understand or do not agree with these terms.\n"
+ "\n"
+ "Telecom ParisTech bears no liability for any infringing usage of this software, which is provided for educational or research purposes.\n"
+ "\n"
+ "This software is distributed under the GNU LESSER GENERAL PUBLIC LICENSE\n"
+ "See <http://www.gnu.org/licenses/lgpl-2.1.html> for more details\n"
+};
+
+
+resource 'STR#' (5001, "German") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Deutsch",
+ /* [2] */
+ "Akzeptieren",
+ /* [3] */
+ "Ablehnen",
+ /* [4] */
+ "Drucken",
+ /* [5] */
+ "Sichern...",
+ /* [6] */
+ "Klicken Sie auf ÒAkzeptierenÓ, wenn Sie mit den Bestimmungen des "
+ "Software-Lizenzvertrages einverstanden sind. Falls nicht, klicken "
+ "Sie bitte ÒAblehnenÓ an. Sie k\9annen die Software nur installieren, "
+ "wenn Sie ÒAkzeptierenÓ angeklickt haben.",
+ /* [7] */
+ "Software-Lizenzvertrag",
+ /* [8] */
+ "Dieser Text kann nicht gesichert werden. Diese Festplatte ist "
+ "m\9aglicherweise voll oder gesch\9ftzt oder der Ordner ist gesch\9ftzt.",
+ /* [9] */
+ "Es kann nicht gedruckt werden. Bitte stellen Sie sicher, da§ ein "
+ "Drucker ausgew\8ahlt ist."
+ }
+};
+
+resource 'STR#' (5002, "English") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "English",
+ /* [2] */
+ "Agree",
+ /* [3] */
+ "Disagree",
+ /* [4] */
+ "Print",
+ /* [5] */
+ "Save...",
+ /* [6] */
+ "IMPORTANT - Read this License Agreement carefully before clicking on "
+ "the \"Agree\" button. By clicking on the \"Agree\" button, you agree "
+ "to be bound by the terms of the License Agreement.",
+ /* [7] */
+ "Software License Agreement",
+ /* [8] */
+ "This text cannot be saved. This disk may be full or locked, or the file "
+ "may be locked.",
+ /* [9] */
+ "Unable to print. Make sure youÕve selected a printer."
+ }
+};
+
+resource 'STR#' (5003, "Spanish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Espa\96ol",
+ /* [2] */
+ "Aceptar",
+ /* [3] */
+ "No aceptar",
+ /* [4] */
+ "Imprimir",
+ /* [5] */
+ "Guardar...",
+ /* [6] */
+ "Si est\87 de acuerdo con los t\8erminos de esta licencia, pulse \"Aceptar\" "
+ "para instalar el software. En el supuesto de que no est\8e de acuerdo con "
+ "los t\8erminos de esta licencia, pulse \"No aceptar.\"",
+ /* [7] */
+ "Licencia de Software",
+ /* [8] */
+ "Este texto no se puede guardar. El disco puede estar lleno o bloqueado, "
+ "o el archivo puede estar bloqueado.",
+ /* [9] */
+ "No se puede imprimir. Compruebe que ha seleccionado una impresora."
+ }
+};
+
+resource 'STR#' (5004, "French") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Fran\8dais",
+ /* [2] */
+ "Accepter",
+ /* [3] */
+ "Refuser",
+ /* [4] */
+ "Imprimer",
+ /* [5] */
+ "Enregistrer...",
+ /* [6] */
+ "Si vous acceptez les termes de la pr\8esente licence, cliquez sur "
+ "\"Accepter\" afin d'installer le logiciel. Si vous n'\90tes pas d'accord "
+ "avec les termes de la licence, cliquez sur \"Refuser\".",
+ /* [7] */
+ "Contrat de licence de logiciel",
+ /* [8] */
+ "Ce texte ne peut \90tre sauvegard\8e. Le disque est peut-\90tre satur\8e ou "
+ "verrouill\8e, ou bien le fichier est peut-\90tre verrouill\8e.",
+ /* [9] */
+ "Impression impossible. Assurez-vous dÕavoir s\8electionn\8e une imprimante."
+ }
+};
+
+resource 'STR#' (5005, "Italian") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Italiano",
+ /* [2] */
+ "Accetto",
+ /* [3] */
+ "Rifiuto",
+ /* [4] */
+ "Stampa",
+ /* [5] */
+ "Registra...",
+ /* [6] */
+ "Se accetti le condizioni di questa licenza, fai clic su \"Accetto\" per "
+ "installare il software. Altrimenti fai clic su \"Rifiuto\".",
+ /* [7] */
+ "Licenza Software",
+ /* [8] */
+ "Non posso registrare il testo. Il disco potrebbe essere pieno o protetto "
+ "oppure il documento potrebbe essere protetto.",
+ /* [9] */
+ "Non posso stampare. Assicurati di aver selezionato una stampante."
+ }
+};
+
+resource 'STR#' (5006, "Japanese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Japanese",
+ /* [2] */
+ "\93¯\88Ó\82µ\82Ü\82·",
+ /* [3] */
+ "\93¯\88Ó\82µ\82Ü\82¹\82ñ",
+ /* [4] */
+ "\88ó\8dü\82·\82é",
+ /* [5] */
+ "\95Û\91¶...",
+ /* [6] */
+ "\96{\83\\\83t\83g\83E\83G\83A\8eg\97p\8b\96\91ø\8c_\96ñ\82Ì\8fð\8c\8f\82É\93¯\88Ó\82³"
+ "\82ê\82é\8fê\8d\87\82É\82Í\81A\83\\\83t\83g\83E\83G\83A\82ð\83C\83\93\83X\83g\81[\83\8b"
+ "\82·\82é\82½\82ß\82É\81u\93¯\88Ó\82µ\82Ü\82·\81v\82ð\89\9f\82µ\82Ä\82\82¾\82³\82¢"
+ "\81B\81@\93¯\88Ó\82³\82ê\82È\82¢\8fê\8d\87\82É\82Í\81A\81u\93¯\88Ó\82µ\82Ü\82¹\82ñ"
+ "\81v\82ð\89\9f\82µ\82Ä\82\82¾\82³\82¢\81B",
+ /* [7] */
+ "\83\\\83t\83g\83E\83F\83A\8eg\97p\8b\96\91ø\8c_\96ñ",
+ /* [8] */
+ "\82±\82Ì\83e\83L\83X\83g\82Í\81A\95Û\91¶\82Å\82«\82Ü\82¹\82ñ\81B\82±\82Ì\83f\83B"
+ "\83X\83N\82É\8bó\82«\82ª\96³\82¢\82©\83\8d\83b\83N\82³\82ê\82Ä\82¢\82é\89Â\94\\\90«"
+ "\82ª\82 \82è\82Ü\82·\81B\82Ü\82½\82Í\81A\82±\82Ì\83t\83@\83C\83\8b\82ª\83\8d\83b\83N"
+ "\82³\82ê\82Ä\82¢\82é\89Â\94\\\90«\82ª\82 \82è\82Ü\82·\81B",
+ /* [9] */
+ "\88ó\8dü\82Å\82«\82Ü\82¹\82ñ\81B\83v\83\8a\83\93\83^\82ª\90³\82µ\82\91I\91ð\82³\82ê"
+ "\82Ä\82¢\82é\82±\82Æ\82ð\8am\94F\82µ\82Ä\82\82¾\82³\82¢\81B"
+ }
+};
+
+resource 'STR#' (5007, "Dutch") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Nederlands",
+ /* [2] */
+ "Ja",
+ /* [3] */
+ "Nee",
+ /* [4] */
+ "Print",
+ /* [5] */
+ "Bewaar...",
+ /* [6] */
+ "Indien u akkoord gaat met de voorwaarden van deze licentie, kunt u op 'Ja' "
+ "klikken om de programmatuur te installeren. Indien u niet akkoord gaat, "
+ "klikt u op 'Nee'.",
+ /* [7] */
+ "Softwarelicentie",
+ /* [8] */
+ "De tekst kan niet worden bewaard. Het kan zijn dat uw schijf vol of "
+ "beveiligd is of dat het bestand beveiligd is.",
+ /* [9] */
+ "Afdrukken niet mogelijk. Zorg dat er een printer is geselecteerd."
+ }
+};
+
+resource 'STR#' (5008, "Swedish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Svensk",
+ /* [2] */
+ "Godk\8anns",
+ /* [3] */
+ "Avb\9ajs",
+ /* [4] */
+ "Skriv ut",
+ /* [5] */
+ "Spara...",
+ /* [6] */
+ "Om Du godk\8anner licensvillkoren klicka p\8c \"Godk\8anns\" f\9ar att installera "
+ "programprodukten. Om Du inte godk\8anner licensvillkoren, klicka p\8c \"Avb\9ajs\".",
+ /* [7] */
+ "Licensavtal f\9ar Programprodukt",
+ /* [8] */
+ "Den h\8ar texten kan inte sparas eftersom antingen skivan \8ar full eller skivan "
+ "och/eller dokumentet \8ar l\8cst.",
+ /* [9] */
+ "Kan inte skriva ut. Kontrollera att du har valt en skrivare. "
+ }
+};
+
+resource 'STR#' (5009, "Brazilian Portuguese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Portugu\90s, Brasil",
+ /* [2] */
+ "Concordar",
+ /* [3] */
+ "Discordar",
+ /* [4] */
+ "Imprimir",
+ /* [5] */
+ "Salvar...",
+ /* [6] */
+ "Se est\87 de acordo com os termos desta licen\8da, pressione \"Concordar\" para "
+ "instalar o software. Se n\8bo est\87 de acordo, pressione \"Discordar\".",
+ /* [7] */
+ "Licen\8da de Uso de Software",
+ /* [8] */
+ "Este texto n\8bo pode ser salvo. O disco pode estar cheio ou\nbloqueado, ou o "
+ "arquivo pode estar bloqueado.",
+ /* [9] */
+ "N\8bo \8e poss\92vel imprimir. Comprove que voc\90 selecionou uma impressora."
+ }
+};
+
+resource 'STR#' (5010, "Simplified Chinese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Simplified Chinese",
+ /* [2] */
+ "ͬÒâ",
+ /* [3] */
+ "²»Í¬Òâ",
+ /* [4] */
+ "´òÓ¡",
+ /* [5] */
+ "´æ´¢¡",
+ /* [6] */
+ "Èç¹ûÄúͬÒâ±¾Ðí¿ÉÐÒéµÄÌõ¿î£¬Çë°´¡°Í¬Ò⡱"
+ "À´°²×°´ËÈí¼þ¡£Èç¹ûÄú²»Í¬Ò⣬Çë°´¡°²»Í¬Òâ"
+ "¡±¡£",
+ /* [7] */
+ "Èí¼þÐí¿ÉÐÒé",
+ /* [8] */
+ "²»ÄÜ´æ´¢Õâ¸öÎļþ¡£´ÅÅÌ¿ÉÄܱ»Ëø¶¨»òÒÑÂú£¬"
+ "Ò²ÐíÊÇÎļþ±»Ëø¶¨ÁË¡£",
+ /* [9] */
+ "ÎÞ·¨´òÓ¡¡£ÇëÈ·¶¨ÄúÒÑÑ¡ÔñÁËһ̨´òÓ¡»ú¡£"
+ }
+};
+
+resource 'STR#' (5011, "Traditional Chinese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Traditional Chinese",
+ /* [2] */
+ "¦P·N",
+ /* [3] */
+ "¤£¦P·N",
+ /* [4] */
+ "¦C¦L",
+ /* [5] */
+ "Àx¦s¡K",
+ /* [6] */
+ "¦pªG±z¦P·N¥»³\\¥iÃҸ̪º±ø´Ú¡A½Ð«ö¡§¦P·N¡¨"
+ "¥H¦w¸Ë³nÅé¡C¦pªG¤£¦P·N¡A½Ð«ö¡§¤£¦P·N¡¨¡C",
+ /* [7] */
+ "³nÅé³\\¥i¨óij",
+ /* [8] */
+ "¥»¤å¦rµLªkÀx¦s¡C³oӺϺХi¯à¤wº¡©Î¬OÂê©w"
+ "¡A©ÎÀɮפw¸gÂê©w¡C",
+ /* [9] */
+ "µLªk¦C¦L¡C½Ð½T©w±z¤w¸g¿ï¾Ü¤F¦Lªí¾÷¡C"
+ }
+};
+
+resource 'STR#' (5012, "Danish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Dansk",
+ /* [2] */
+ "Enig",
+ /* [3] */
+ "Uenig",
+ /* [4] */
+ "Udskriv",
+ /* [5] */
+ "Arkiver...",
+ /* [6] */
+ "Hvis du accepterer betingelserne i licensaftalen, skal du klikke p\8c ÒEnigÓ "
+ "for at installere softwaren. Klik p\8c ÒUenigÓ for at annullere installeringen.",
+ /* [7] */
+ "Licensaftale for software",
+ /* [8] */
+ "Teksten kan ikke arkiveres. Disken er evt. fuld eller l\8cst, eller ogs\8c er "
+ "arkivet l\8cst.",
+ /* [9] */
+ "Kan ikke udskrive. S¿rg for, at der er valgt en printer."
+ }
+};
+
+resource 'STR#' (5013, "Finnish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Suomi",
+ /* [2] */
+ "Hyv\8aksyn",
+ /* [3] */
+ "En hyv\8aksy",
+ /* [4] */
+ "Tulosta",
+ /* [5] */
+ "TallennaÉ",
+ /* [6] */
+ "Hyv\8aksy lisenssisopimuksen ehdot osoittamalla ÕHyv\8aksyÕ. Jos et hyv\8aksy "
+ "sopimuksen ehtoja, osoita ÕEn hyv\8aksyÕ.",
+ /* [7] */
+ "Lisenssisopimus",
+ /* [8] */
+ "Teksti\8a ei voida tallentaa. Levy voi olla t\8aynn\8a tai lukittu.",
+ /* [9] */
+ "Teksti\8a ei voida tulostaa. Varmista, ett\8a kirjoitin on valittu."
+ }
+};
+
+resource 'STR#' (5014, "French Canadian") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Fran\8dais canadien",
+ /* [2] */
+ "Accepter",
+ /* [3] */
+ "Refuser",
+ /* [4] */
+ "Imprimer",
+ /* [5] */
+ "Enregistrer...",
+ /* [6] */
+ "Si vous acceptez les termes de la pr\8esente licence, cliquez sur \"Accepter\" "
+ "afin d'installer le logiciel. Si vous n'\90tes pas d'accord avec les termes de "
+ "la licence, cliquez sur \"Refuser\".",
+ /* [7] */
+ "Contrat de licence de logiciel",
+ /* [8] */
+ "Ce texte ne peut \90tre sauvegard\8e. Le disque est peut-\90tre satur\8e ou verrouill\8e, "
+ "ou bien le fichier est peut-\90tre verrouill\8e.",
+ /* [9] */
+ "Impression impossible. Assurez-vous dÕavoir s\8electionn\8e une imprimante."
+ }
+};
+
+resource 'STR#' (5015, "Korean") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Korean",
+ /* [2] */
+ "µ¿ÀÇ",
+ /* [3] */
+ "µ¿ÀÇ ¾ÈÇÔ",
+ /* [4] */
+ "ÇÁ¸°Æ®",
+ /* [5] */
+ "ÀúÀå...",
+ /* [6] */
+ "»ç¿ë °è¾à¼ÀÇ ³»¿ë¿¡ µ¿ÀÇÇϸé, \"µ¿ÀÇ\" ´Ü"
+ "Ã߸¦ ´·¯ ¼ÒÇÁÆ®¿þ¾î¸¦ ¼³Ä¡ÇϽʽÿÀ. µ¿À"
+ "ÇÇÏÁö ¾Ê´Â´Ù¸é, \"µ¿ÀÇ ¾ÈÇÔ\" ´ÜÃ߸¦ ´©¸£½"
+ "ʽÿÀ.",
+ /* [7] */
+ "»ç¿ë °è¾à µ¿ÀǼ",
+ /* [8] */
+ "ÀÌ ÅØ½ºÆ®¸¦ ÀúÀåÇÒ ¼ö ¾ø½À´Ï´Ù. ÀÌ µð½ºÅ"
+ "©´Â ²Ë á°Å³ª Àá°Ü ÀÖ½À´Ï´Ù. ¶Ç´Â ÆÄÀÏÀÌ"
+ " Àá°Ü ÀÖÀ» ¼öµµ ÀÖ½À´Ï´Ù.",
+ /* [9] */
+ "ÇÁ¸°Æ®ÇÒ ¼ö ¾ø½À´Ï´Ù. ÇÁ¸°Å͸¦ ¼±ÅÃÇß´ÂÁ"
+ "ö È®ÀÎÇϽʽÿÀ."
+ }
+};
+
+resource 'STR#' (5016, "Norwegian") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Norsk",
+ /* [2] */
+ "Enig",
+ /* [3] */
+ "Ikke enig",
+ /* [4] */
+ "Skriv ut",
+ /* [5] */
+ "Arkiver...",
+ /* [6] */
+ "Hvis De er enig i bestemmelsene i denne lisensavtalen, klikker De p\8c "
+ "\"Enig\"-knappen for \8c installere programvaren. Hvis De ikke er enig, "
+ "klikker De p\8c \"Ikke enig\".",
+ /* [7] */
+ "Programvarelisensavtale",
+ /* [8] */
+ "Denne teksten kan ikke arkiveres. Disken kan v¾re full eller l\8cst, "
+ "eller filen kan v¾re l\8cst. ",
+ /* [9] */
+ "Kan ikke skrive ut. Forsikre deg om at du har valgt en skriver. "
+ }
+};
--- /dev/null
+How to build GPAC for iOS
+
+Tested revision: 2264
+Tested XCode (SDK): 3.2.4 (4.1)
+
+You have to have GPAC extra_libs in your extra_lib/lib/gcc directory
+Be careful when building SDL in Release, I never made it work
+
+1) Open the XCode project.
+2) Build libgpac_dynamic via XCode (should end on link error)
+3) Execute "script_libgpac.sh Debug" (or Release)
+4) Build libgpac_dynamic via XCode (should succeed)
+5) Build all modules on one click via XCode (should end on link error)
+6) Execute "script_libgpac.sh Debug" (or Release)
+7) Build all modules via XCode (should succeed)
+8) Build osmo4ios via XCode
--- /dev/null
+/*xcode dynamic library generation (e.g. from a static library) needs to compile at least one file, even empty...*/
--- /dev/null
+#!/bin/sh
+
+#echo "*** Compile libgpac for Simulator (i386) ***"
+xcodebuild -target libgpac_dynamic -sdk iphonesimulator -configuration Release -project gpac4ios.xcodeproj
+
+echo "*** Compile libgpac for iOS (arm) ***"
+xcodebuild -target libgpac_dynamic -sdk iphoneos -configuration Release -project gpac4ios.xcodeproj
+./script_libgpac.sh Release
+#xcodebuild -target libgpac_dynamic -sdk iphoneos -configuration Release -project gpac4ios.xcodeproj
+
+#echo "*** Compile modules and osmo4ios for Simulator (i386) ***"
+#xcodebuild -alltargets -parallelizeTargets -sdk iphonesimulator -configuration Release -project gpac4ios.xcodeproj
+
+echo "*** Compile modules for iOS (arm) ***"
+xcodebuild -alltargets -parallelizeTargets -sdk iphoneos -configuration Release -project gpac4ios.xcodeproj
+./script_modules.sh Release
+
+echo "*** Compile osmo4ios for iOS (arm) ***"
+#link must occur at debug to avoid optimizing that leads to freezes
+xcodebuild -target osmo4ios -sdk iphoneos -configuration Debug -project gpac4ios.xcodeproj
+
+echo "*** Copy the generated libs (arm only) ***"
+cp build/Release-iphoneos/*.dylib ../../bin/iOS/osmo4ios.app/
+cp build/Debug-iphoneos/osmo4ios.app/osmo4ios ../../bin/iOS/osmo4ios.app/
+cp build/Debug-iphoneos/osmo4ios.app/PkgInfo ../../bin/iOS/osmo4ios.app/
+cp build/Debug-iphoneos/osmo4ios.app/Info.plist ../../bin/iOS/osmo4ios.app/
+
+echo "*** Test the presence of target files ***"
+if [ `ls ../../bin/iOS/osmo4ios.app/ | wc -l` -ne 22 ]
+then
+ echo "Error: target files number not correct (expected 22, got `ls ../../bin/iOS/osmo4ios.app/ | wc -l`)"
+ exit 1
+fi
+
+echo "*** Generate an archive and clean ***"
+cd ../..
+version=`grep '#define GPAC_VERSION ' include/gpac/tools.h | cut -d '"' -f 2`
+rev=`LANG=en_US svn info | grep Revision | tr -d 'Revision: '`
+if [ "$rev" != "" ]
+then
+ full_version="$version-r$rev"
+else
+ #if no revision can be extracted from SVN, use date
+ full_version="$version-$(date +%Y%m%d)"
+fi
+cd bin/iOS
+rm -rf osmo4ios.app/.svn
+tar -czf "osmo4ios-$full_version.tar.gz" osmo4ios.app/
+rm -rf osmo4ios.app
+cd ../../build/xcode/
+
+echo "*** Extra Libs generation for iOS completed (full_version)! ***"
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 71179CA31292E7BA00A83216 /* libfaad.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45012830B1400C384DE /* libfaad.a */; };
+ 71179CAE1292E7F700A83216 /* libmad.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45512830B1400C384DE /* libmad.a */; };
+ 71179CC91292EC5200A83216 /* mpd_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71179CBF1292EC1800A83216 /* mpd_in.c */; };
+ 71179CF31292EDED00A83216 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 712986C312928421003B02A1 /* extract.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19B411279713300ACFF58 /* extract.c */; };
+ 712986C41292843B003B02A1 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199991278778800ACFF58 /* audio.c */; };
+ 712986C51292843B003B02A1 /* video.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1999E1278778800ACFF58 /* video.c */; };
+ 712986D8129284BD003B02A1 /* sdl_out.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1999C1278778800ACFF58 /* sdl_out.c */; };
+ 7141FF301292CB9200FCB27D /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 7141FF2F1292CB9200FCB27D /* alloc.c */; };
+ 7147426012B918C900DB5A59 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 7147425F12B918C900DB5A59 /* cache.c */; };
+ 718477E4127817B700917298 /* libgpac_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71CCF1311277037A00339E12 /* libgpac_static.a */; };
+ 718477FA12781DEB00917298 /* empty.c in Sources */ = {isa = PBXBuildFile; fileRef = 718477F912781DEB00917298 /* empty.c */; };
+ 71847812127860F000917298 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71847814127860F000917298 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847813127860F000917298 /* libz.dylib */; };
+ 71A1990A1278765600ACFF58 /* aac_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199071278765600ACFF58 /* aac_in.c */; };
+ 71A1990B1278765600ACFF58 /* faad_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199081278765600ACFF58 /* faad_dec.c */; };
+ 71A199101278767B00ACFF58 /* bifs_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1990E1278767B00ACFF58 /* bifs_dec.c */; };
+ 71A1991E1278769100ACFF58 /* ftgrays.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199151278769100ACFF58 /* ftgrays.c */; };
+ 71A199201278769100ACFF58 /* rast_soft.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A199171278769100ACFF58 /* rast_soft.h */; };
+ 71A199211278769100ACFF58 /* raster_565.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199181278769100ACFF58 /* raster_565.c */; };
+ 71A199221278769100ACFF58 /* raster_argb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199191278769100ACFF58 /* raster_argb.c */; };
+ 71A199231278769100ACFF58 /* raster_load.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1991A1278769100ACFF58 /* raster_load.c */; };
+ 71A199241278769100ACFF58 /* raster_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1991B1278769100ACFF58 /* raster_rgb.c */; };
+ 71A199251278769100ACFF58 /* stencil.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1991C1278769100ACFF58 /* stencil.c */; };
+ 71A199261278769100ACFF58 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1991D1278769100ACFF58 /* surface.c */; };
+ 71A1992A127876A200ACFF58 /* dummy_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19928127876A200ACFF58 /* dummy_in.c */; };
+ 71A1992F127876B000ACFF58 /* ctx_load.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1992D127876B000ACFF58 /* ctx_load.c */; };
+ 71A19935127876C300ACFF58 /* svg_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19933127876C300ACFF58 /* svg_in.c */; };
+ 71A1993A127876D300ACFF58 /* mad_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19937127876D300ACFF58 /* mad_dec.c */; };
+ 71A1993C127876D300ACFF58 /* mp3_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19939127876D300ACFF58 /* mp3_in.c */; };
+ 71A19946127876E300ACFF58 /* bmp_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1993E127876E300ACFF58 /* bmp_dec.c */; };
+ 71A19947127876E300ACFF58 /* img_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1993F127876E300ACFF58 /* img_dec.c */; };
+ 71A19948127876E300ACFF58 /* img_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19940127876E300ACFF58 /* img_in.c */; };
+ 71A19949127876E300ACFF58 /* img_in.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A19941127876E300ACFF58 /* img_in.h */; };
+ 71A1994A127876E300ACFF58 /* jp2_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19942127876E300ACFF58 /* jp2_dec.c */; };
+ 71A1994B127876E300ACFF58 /* jpeg_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19943127876E300ACFF58 /* jpeg_dec.c */; };
+ 71A1994D127876E300ACFF58 /* png_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19945127876E300ACFF58 /* png_dec.c */; };
+ 71A19951127876FA00ACFF58 /* gpac_js.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1994F127876FA00ACFF58 /* gpac_js.c */; };
+ 71A1995A1278770900ACFF58 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199541278770900ACFF58 /* cache.c */; };
+ 71A1995B1278770900ACFF58 /* isom_in.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A199551278770900ACFF58 /* isom_in.h */; };
+ 71A1995C1278770900ACFF58 /* load.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199561278770900ACFF58 /* load.c */; };
+ 71A1995E1278770900ACFF58 /* read.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199581278770900ACFF58 /* read.c */; };
+ 71A1995F1278770900ACFF58 /* read_ch.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199591278770900ACFF58 /* read_ch.c */; };
+ 71A199631278772500ACFF58 /* laser_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199611278772500ACFF58 /* laser_dec.c */; };
+ 71A199691278773900ACFF58 /* odf_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199671278773900ACFF58 /* odf_dec.c */; };
+ 71A199741278774A00ACFF58 /* rtp_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1996C1278774A00ACFF58 /* rtp_in.c */; };
+ 71A199751278774A00ACFF58 /* rtp_in.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A1996D1278774A00ACFF58 /* rtp_in.h */; };
+ 71A199761278774A00ACFF58 /* rtp_session.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1996E1278774A00ACFF58 /* rtp_session.c */; };
+ 71A199771278774A00ACFF58 /* rtp_signaling.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1996F1278774A00ACFF58 /* rtp_signaling.c */; };
+ 71A199781278774A00ACFF58 /* rtp_stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199701278774A00ACFF58 /* rtp_stream.c */; };
+ 71A199791278774A00ACFF58 /* sdp_fetch.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199711278774A00ACFF58 /* sdp_fetch.c */; };
+ 71A1997A1278774A00ACFF58 /* sdp_load.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199721278774A00ACFF58 /* sdp_load.c */; };
+ 71A1997F1278775900ACFF58 /* mpegts_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1997D1278775900ACFF58 /* mpegts_in.c */; };
+ 71A199841278776700ACFF58 /* ft_font.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199811278776700ACFF58 /* ft_font.c */; };
+ 71A199851278776700ACFF58 /* ft_font.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A199821278776700ACFF58 /* ft_font.h */; };
+ 71A199911278777A00ACFF58 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A199891278777A00ACFF58 /* unzip.c */; };
+ 71A199921278777A00ACFF58 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A1998A1278777A00ACFF58 /* unzip.h */; };
+ 71A199931278777A00ACFF58 /* wgt_load.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1998B1278777A00ACFF58 /* wgt_load.c */; };
+ 71A199951278777A00ACFF58 /* widget.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1998D1278777A00ACFF58 /* widget.c */; };
+ 71A199961278777A00ACFF58 /* widgetman.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A1998E1278777A00ACFF58 /* widgetman.c */; };
+ 71A199971278777A00ACFF58 /* widgetman.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A1998F1278777A00ACFF58 /* widgetman.h */; };
+ 71A19A1A12787BFB00ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A2112787C3200ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A2C12787C6800ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A3F12787CB800ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A4512787CDB00ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A4912787CF000ACFF58 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847813127860F000917298 /* libz.dylib */; };
+ 71A19A5212787D0E00ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A5B12787D2A00ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A6112787D4000ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A6712787D8300ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A6D12787D9800ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A7712787DC100ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A7D12787DD700ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A8312787DED00ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19A8912787E0400ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19AA612795BE100ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19AAF12795C3100ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19AB312795C4900ACFF58 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847813127860F000917298 /* libz.dylib */; };
+ 71A19ABE12795C7E00ACFF58 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847811127860F000917298 /* libc.dylib */; };
+ 71A19B2112796B6F00ACFF58 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19B2012796B6F00ACFF58 /* main.c */; };
+ 71A19B4012796FCC00ACFF58 /* module_av_generic.c in Sources */ = {isa = PBXBuildFile; fileRef = 71A19B3F12796FCC00ACFF58 /* module_av_generic.c */; };
+ 71A19BB212797D1B00ACFF58 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19BB112797D1B00ACFF58 /* OpenGLES.framework */; };
+ 71A19BB912797D4800ACFF58 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19BB812797D4800ACFF58 /* AudioToolbox.framework */; };
+ 71A19BC412797D9200ACFF58 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19BC312797D9200ACFF58 /* libobjc.dylib */; };
+ 71A19BCD12797DBA00ACFF58 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19BCC12797DBA00ACFF58 /* UIKit.framework */; };
+ 71A19C3B12797E4000ACFF58 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19C3A12797E4000ACFF58 /* CoreGraphics.framework */; };
+ 71A19C3D12797E4000ACFF58 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19C3C12797E4000ACFF58 /* Foundation.framework */; };
+ 71A19C3F12797E4000ACFF58 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19C3E12797E4000ACFF58 /* QuartzCore.framework */; };
+ 71A19C4112797E4000ACFF58 /* libdl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71A19C4012797E4000ACFF58 /* libdl.dylib */; };
+ 71CCF2461277045100339E12 /* arith_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF13A1277045100339E12 /* arith_decoder.c */; };
+ 71CCF2471277045100339E12 /* bifs_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF13B1277045100339E12 /* bifs_codec.c */; };
+ 71CCF2481277045100339E12 /* bifs_node_tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF13C1277045100339E12 /* bifs_node_tables.c */; };
+ 71CCF2491277045100339E12 /* com_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF13D1277045100339E12 /* com_dec.c */; };
+ 71CCF24A1277045100339E12 /* com_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF13E1277045100339E12 /* com_enc.c */; };
+ 71CCF24B1277045100339E12 /* conditional.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF13F1277045100339E12 /* conditional.c */; };
+ 71CCF24C1277045100339E12 /* field_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1401277045100339E12 /* field_decode.c */; };
+ 71CCF24D1277045100339E12 /* field_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1411277045100339E12 /* field_encode.c */; };
+ 71CCF24E1277045100339E12 /* memory_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1421277045100339E12 /* memory_decoder.c */; };
+ 71CCF24F1277045100339E12 /* predictive_mffield.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1431277045100339E12 /* predictive_mffield.c */; };
+ 71CCF2501277045100339E12 /* quant.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1441277045100339E12 /* quant.h */; };
+ 71CCF2511277045100339E12 /* quantize.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1451277045100339E12 /* quantize.c */; };
+ 71CCF2521277045100339E12 /* script.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1461277045100339E12 /* script.h */; };
+ 71CCF2531277045100339E12 /* script_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1471277045100339E12 /* script_dec.c */; };
+ 71CCF2541277045100339E12 /* script_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1481277045100339E12 /* script_enc.c */; };
+ 71CCF2551277045100339E12 /* unquantize.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1491277045100339E12 /* unquantize.c */; };
+ 71CCF2561277045100339E12 /* audio_input.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF14B1277045100339E12 /* audio_input.c */; };
+ 71CCF2571277045100339E12 /* audio_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF14C1277045100339E12 /* audio_mixer.c */; };
+ 71CCF2581277045100339E12 /* audio_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF14D1277045100339E12 /* audio_render.c */; };
+ 71CCF2591277045100339E12 /* bindable.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF14E1277045100339E12 /* bindable.c */; };
+ 71CCF25A1277045100339E12 /* camera.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF14F1277045100339E12 /* camera.c */; };
+ 71CCF25B1277045100339E12 /* compositor.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1501277045100339E12 /* compositor.c */; };
+ 71CCF25C1277045100339E12 /* compositor_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1511277045100339E12 /* compositor_2d.c */; };
+ 71CCF25D1277045100339E12 /* compositor_3d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1521277045100339E12 /* compositor_3d.c */; };
+ 71CCF25E1277045100339E12 /* compositor_node_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1531277045100339E12 /* compositor_node_init.c */; };
+ 71CCF25F1277045100339E12 /* drawable.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1541277045100339E12 /* drawable.c */; };
+ 71CCF2601277045100339E12 /* drawable.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1551277045100339E12 /* drawable.h */; };
+ 71CCF2611277045100339E12 /* events.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1561277045100339E12 /* events.c */; };
+ 71CCF2621277045100339E12 /* font_engine.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1571277045100339E12 /* font_engine.c */; };
+ 71CCF2631277045100339E12 /* gl_inc.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1581277045100339E12 /* gl_inc.h */; };
+ 71CCF2641277045100339E12 /* hardcoded_protos.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1591277045100339E12 /* hardcoded_protos.c */; };
+ 71CCF2651277045100339E12 /* hc_flash_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF15A1277045100339E12 /* hc_flash_shape.c */; };
+ 71CCF2661277045100339E12 /* mesh.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF15B1277045100339E12 /* mesh.c */; };
+ 71CCF2671277045100339E12 /* mesh_collide.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF15C1277045100339E12 /* mesh_collide.c */; };
+ 71CCF2681277045100339E12 /* mesh_tesselate.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF15D1277045100339E12 /* mesh_tesselate.c */; };
+ 71CCF2691277045100339E12 /* mpeg4_animstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF15E1277045100339E12 /* mpeg4_animstream.c */; };
+ 71CCF26A1277045100339E12 /* mpeg4_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF15F1277045100339E12 /* mpeg4_audio.c */; };
+ 71CCF26B1277045100339E12 /* mpeg4_background.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1601277045100339E12 /* mpeg4_background.c */; };
+ 71CCF26C1277045100339E12 /* mpeg4_background2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1611277045100339E12 /* mpeg4_background2d.c */; };
+ 71CCF26D1277045100339E12 /* mpeg4_bitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1621277045100339E12 /* mpeg4_bitmap.c */; };
+ 71CCF26E1277045100339E12 /* mpeg4_composite.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1631277045100339E12 /* mpeg4_composite.c */; };
+ 71CCF26F1277045100339E12 /* mpeg4_form.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1641277045100339E12 /* mpeg4_form.c */; };
+ 71CCF2701277045100339E12 /* mpeg4_geometry_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1651277045100339E12 /* mpeg4_geometry_2d.c */; };
+ 71CCF2711277045100339E12 /* mpeg4_geometry_3d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1661277045100339E12 /* mpeg4_geometry_3d.c */; };
+ 71CCF2721277045100339E12 /* mpeg4_geometry_ifs2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1671277045100339E12 /* mpeg4_geometry_ifs2d.c */; };
+ 71CCF2731277045100339E12 /* mpeg4_geometry_ils2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1681277045100339E12 /* mpeg4_geometry_ils2d.c */; };
+ 71CCF2741277045100339E12 /* mpeg4_gradients.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1691277045100339E12 /* mpeg4_gradients.c */; };
+ 71CCF2751277045100339E12 /* mpeg4_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF16A1277045100339E12 /* mpeg4_grouping.c */; };
+ 71CCF2761277045100339E12 /* mpeg4_grouping.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF16B1277045100339E12 /* mpeg4_grouping.h */; };
+ 71CCF2771277045100339E12 /* mpeg4_grouping_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF16C1277045100339E12 /* mpeg4_grouping_2d.c */; };
+ 71CCF2781277045100339E12 /* mpeg4_grouping_3d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF16D1277045100339E12 /* mpeg4_grouping_3d.c */; };
+ 71CCF2791277045100339E12 /* mpeg4_layer_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF16E1277045100339E12 /* mpeg4_layer_2d.c */; };
+ 71CCF27A1277045100339E12 /* mpeg4_layer_3d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF16F1277045100339E12 /* mpeg4_layer_3d.c */; };
+ 71CCF27B1277045100339E12 /* mpeg4_layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1701277045100339E12 /* mpeg4_layout.c */; };
+ 71CCF27C1277045100339E12 /* mpeg4_lighting.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1711277045100339E12 /* mpeg4_lighting.c */; };
+ 71CCF27D1277045100339E12 /* mpeg4_path_layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1721277045100339E12 /* mpeg4_path_layout.c */; };
+ 71CCF27E1277045100339E12 /* mpeg4_sensors.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1731277045100339E12 /* mpeg4_sensors.c */; };
+ 71CCF27F1277045100339E12 /* mpeg4_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1741277045100339E12 /* mpeg4_sound.c */; };
+ 71CCF2801277045100339E12 /* mpeg4_text.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1751277045100339E12 /* mpeg4_text.c */; };
+ 71CCF2811277045100339E12 /* mpeg4_textures.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1761277045100339E12 /* mpeg4_textures.c */; };
+ 71CCF2821277045100339E12 /* mpeg4_timesensor.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1771277045100339E12 /* mpeg4_timesensor.c */; };
+ 71CCF2831277045100339E12 /* mpeg4_viewport.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1781277045100339E12 /* mpeg4_viewport.c */; };
+ 71CCF2841277045100339E12 /* navigate.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1791277045100339E12 /* navigate.c */; };
+ 71CCF2851277045100339E12 /* nodes_stacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF17A1277045100339E12 /* nodes_stacks.h */; };
+ 71CCF2861277045100339E12 /* offscreen_cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF17B1277045100339E12 /* offscreen_cache.c */; };
+ 71CCF2871277045100339E12 /* offscreen_cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF17C1277045100339E12 /* offscreen_cache.h */; };
+ 71CCF2881277045100339E12 /* svg_base.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF17D1277045100339E12 /* svg_base.c */; };
+ 71CCF2891277045100339E12 /* svg_filters.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF17E1277045100339E12 /* svg_filters.c */; };
+ 71CCF28A1277045100339E12 /* svg_font.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF17F1277045100339E12 /* svg_font.c */; };
+ 71CCF28B1277045100339E12 /* svg_geometry.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1801277045100339E12 /* svg_geometry.c */; };
+ 71CCF28C1277045100339E12 /* svg_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1811277045100339E12 /* svg_grouping.c */; };
+ 71CCF28D1277045100339E12 /* svg_media.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1821277045100339E12 /* svg_media.c */; };
+ 71CCF28E1277045100339E12 /* svg_paint_servers.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1831277045100339E12 /* svg_paint_servers.c */; };
+ 71CCF28F1277045100339E12 /* svg_text.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1841277045100339E12 /* svg_text.c */; };
+ 71CCF2901277045100339E12 /* texturing.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1851277045100339E12 /* texturing.c */; };
+ 71CCF2911277045100339E12 /* texturing.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1861277045100339E12 /* texturing.h */; };
+ 71CCF2921277045100339E12 /* texturing_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1871277045100339E12 /* texturing_gl.c */; };
+ 71CCF2931277045100339E12 /* visual_manager.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1881277045100339E12 /* visual_manager.c */; };
+ 71CCF2941277045100339E12 /* visual_manager.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1891277045100339E12 /* visual_manager.h */; };
+ 71CCF2951277045100339E12 /* visual_manager_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF18A1277045100339E12 /* visual_manager_2d.c */; };
+ 71CCF2961277045100339E12 /* visual_manager_2d.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF18B1277045100339E12 /* visual_manager_2d.h */; };
+ 71CCF2971277045100339E12 /* visual_manager_2d_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF18C1277045100339E12 /* visual_manager_2d_draw.c */; };
+ 71CCF2981277045100339E12 /* visual_manager_3d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF18D1277045100339E12 /* visual_manager_3d.c */; };
+ 71CCF2991277045100339E12 /* visual_manager_3d.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF18E1277045100339E12 /* visual_manager_3d.h */; };
+ 71CCF29A1277045100339E12 /* visual_manager_3d_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF18F1277045100339E12 /* visual_manager_3d_gl.c */; };
+ 71CCF29B1277045100339E12 /* x3d_geometry.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1901277045100339E12 /* x3d_geometry.c */; };
+ 71CCF29C1277045100339E12 /* rtcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1921277045100339E12 /* rtcp.c */; };
+ 71CCF29D1277045100339E12 /* rtp.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1931277045100339E12 /* rtp.c */; };
+ 71CCF29E1277045100339E12 /* rtp_depacketizer.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1941277045100339E12 /* rtp_depacketizer.c */; };
+ 71CCF29F1277045100339E12 /* rtp_packetizer.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1951277045100339E12 /* rtp_packetizer.c */; };
+ 71CCF2A01277045100339E12 /* rtp_pck_3gpp.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1961277045100339E12 /* rtp_pck_3gpp.c */; };
+ 71CCF2A11277045100339E12 /* rtp_pck_mpeg12.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1971277045100339E12 /* rtp_pck_mpeg12.c */; };
+ 71CCF2A21277045100339E12 /* rtp_pck_mpeg4.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1981277045100339E12 /* rtp_pck_mpeg4.c */; };
+ 71CCF2A31277045100339E12 /* rtp_streamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1991277045100339E12 /* rtp_streamer.c */; };
+ 71CCF2A41277045100339E12 /* rtsp_command.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF19A1277045100339E12 /* rtsp_command.c */; };
+ 71CCF2A51277045100339E12 /* rtsp_common.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF19B1277045100339E12 /* rtsp_common.c */; };
+ 71CCF2A61277045100339E12 /* rtsp_response.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF19C1277045100339E12 /* rtsp_response.c */; };
+ 71CCF2A71277045100339E12 /* rtsp_session.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF19D1277045100339E12 /* rtsp_session.c */; };
+ 71CCF2A81277045100339E12 /* sdp.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF19E1277045100339E12 /* sdp.c */; };
+ 71CCF2A91277045100339E12 /* avc_ext.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A01277045100339E12 /* avc_ext.c */; };
+ 71CCF2AA1277045100339E12 /* box_code_3gpp.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A11277045100339E12 /* box_code_3gpp.c */; };
+ 71CCF2AB1277045100339E12 /* box_code_apple.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A21277045100339E12 /* box_code_apple.c */; };
+ 71CCF2AC1277045100339E12 /* box_code_base.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A31277045100339E12 /* box_code_base.c */; };
+ 71CCF2AD1277045100339E12 /* box_code_isma.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A41277045100339E12 /* box_code_isma.c */; };
+ 71CCF2AE1277045100339E12 /* box_code_meta.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A51277045100339E12 /* box_code_meta.c */; };
+ 71CCF2AF1277045100339E12 /* box_dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A61277045100339E12 /* box_dump.c */; };
+ 71CCF2B01277045100339E12 /* box_funcs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A71277045100339E12 /* box_funcs.c */; };
+ 71CCF2B11277045100339E12 /* data_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A81277045100339E12 /* data_map.c */; };
+ 71CCF2B21277045100339E12 /* hint_track.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1A91277045100339E12 /* hint_track.c */; };
+ 71CCF2B31277045100339E12 /* hinting.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1AA1277045100339E12 /* hinting.c */; };
+ 71CCF2B41277045100339E12 /* isma_sample.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1AB1277045100339E12 /* isma_sample.c */; };
+ 71CCF2B51277045100339E12 /* isom_intern.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1AC1277045100339E12 /* isom_intern.c */; };
+ 71CCF2B61277045100339E12 /* isom_read.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1AD1277045100339E12 /* isom_read.c */; };
+ 71CCF2B71277045100339E12 /* isom_store.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1AE1277045100339E12 /* isom_store.c */; };
+ 71CCF2B81277045100339E12 /* isom_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1AF1277045100339E12 /* isom_write.c */; };
+ 71CCF2B91277045100339E12 /* media.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B01277045100339E12 /* media.c */; };
+ 71CCF2BA1277045100339E12 /* media_odf.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B11277045100339E12 /* media_odf.c */; };
+ 71CCF2BB1277045100339E12 /* meta.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B21277045100339E12 /* meta.c */; };
+ 71CCF2BC1277045100339E12 /* movie_fragments.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B31277045100339E12 /* movie_fragments.c */; };
+ 71CCF2BD1277045100339E12 /* sample_descs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B41277045100339E12 /* sample_descs.c */; };
+ 71CCF2BE1277045100339E12 /* stbl_read.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B51277045100339E12 /* stbl_read.c */; };
+ 71CCF2BF1277045100339E12 /* stbl_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B61277045100339E12 /* stbl_write.c */; };
+ 71CCF2C01277045100339E12 /* track.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B71277045100339E12 /* track.c */; };
+ 71CCF2C11277045100339E12 /* tx3g.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1B81277045100339E12 /* tx3g.c */; };
+ 71CCF2C21277045100339E12 /* lsr_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1BA1277045100339E12 /* lsr_dec.c */; };
+ 71CCF2C31277045100339E12 /* lsr_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1BB1277045100339E12 /* lsr_enc.c */; };
+ 71CCF2C41277045100339E12 /* lsr_tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1BC1277045100339E12 /* lsr_tables.c */; };
+ 71CCF2C51277045100339E12 /* cbc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1BE1277045100339E12 /* cbc.c */; };
+ 71CCF2C61277045100339E12 /* cfb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1BF1277045100339E12 /* cfb.c */; };
+ 71CCF2C71277045100339E12 /* ctr.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C01277045100339E12 /* ctr.c */; };
+ 71CCF2C81277045100339E12 /* des.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C11277045100339E12 /* des.c */; };
+ 71CCF2C91277045100339E12 /* ecb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C21277045100339E12 /* ecb.c */; };
+ 71CCF2CA1277045100339E12 /* g_crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C31277045100339E12 /* g_crypt.c */; };
+ 71CCF2CB1277045100339E12 /* ncfb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C41277045100339E12 /* ncfb.c */; };
+ 71CCF2CC1277045100339E12 /* nofb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C51277045100339E12 /* nofb.c */; };
+ 71CCF2CD1277045100339E12 /* ofb.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C61277045100339E12 /* ofb.c */; };
+ 71CCF2CE1277045100339E12 /* rijndael-128.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C71277045100339E12 /* rijndael-128.c */; };
+ 71CCF2CF1277045100339E12 /* rijndael-192.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C81277045100339E12 /* rijndael-192.c */; };
+ 71CCF2D01277045100339E12 /* rijndael-256.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1C91277045100339E12 /* rijndael-256.c */; };
+ 71CCF2D11277045100339E12 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1CA1277045100339E12 /* sha1.c */; };
+ 71CCF2D21277045100339E12 /* stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1CB1277045100339E12 /* stream.c */; };
+ 71CCF2D31277045100339E12 /* tripledes.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1CC1277045100339E12 /* tripledes.c */; };
+ 71CCF2D41277045100339E12 /* av_parsers.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1CE1277045100339E12 /* av_parsers.c */; };
+ 71CCF2D51277045100339E12 /* avilib.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1CF1277045100339E12 /* avilib.c */; };
+ 71CCF2D61277045100339E12 /* dvb_mpe.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D01277045100339E12 /* dvb_mpe.c */; };
+ 71CCF2D71277045100339E12 /* filestreamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D11277045100339E12 /* filestreamer.c */; };
+ 71CCF2D81277045100339E12 /* gpac_ogg.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D21277045100339E12 /* gpac_ogg.c */; };
+ 71CCF2D91277045100339E12 /* img.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D31277045100339E12 /* img.c */; };
+ 71CCF2DA1277045100339E12 /* ismacryp.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D41277045100339E12 /* ismacryp.c */; };
+ 71CCF2DB1277045100339E12 /* isom_hinter.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D51277045100339E12 /* isom_hinter.c */; };
+ 71CCF2DC1277045100339E12 /* isom_tools.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D61277045100339E12 /* isom_tools.c */; };
+ 71CCF2DD1277045100339E12 /* m2ts_mux.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D71277045100339E12 /* m2ts_mux.c */; };
+ 71CCF2DE1277045100339E12 /* media_export.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D81277045100339E12 /* media_export.c */; };
+ 71CCF2DF1277045100339E12 /* media_import.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1D91277045100339E12 /* media_import.c */; };
+ 71CCF2E01277045100339E12 /* mpeg2_ps.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1DA1277045100339E12 /* mpeg2_ps.c */; };
+ 71CCF2E11277045100339E12 /* mpeg2_ps.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF1DB1277045100339E12 /* mpeg2_ps.h */; };
+ 71CCF2E21277045100339E12 /* mpegts.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1DC1277045100339E12 /* mpegts.c */; };
+ 71CCF2E31277045100339E12 /* reedsolomon.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1DD1277045100339E12 /* reedsolomon.c */; };
+ 71CCF2E41277045100339E12 /* saf.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1DE1277045100339E12 /* saf.c */; };
+ 71CCF2E51277045100339E12 /* text_import.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1DF1277045100339E12 /* text_import.c */; };
+ 71CCF2E61277045100339E12 /* vobsub.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E01277045100339E12 /* vobsub.c */; };
+ 71CCF2E71277045100339E12 /* desc_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E21277045100339E12 /* desc_private.c */; };
+ 71CCF2E81277045100339E12 /* descriptors.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E31277045100339E12 /* descriptors.c */; };
+ 71CCF2E91277045100339E12 /* ipmpx_code.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E41277045100339E12 /* ipmpx_code.c */; };
+ 71CCF2EA1277045100339E12 /* ipmpx_dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E51277045100339E12 /* ipmpx_dump.c */; };
+ 71CCF2EB1277045100339E12 /* ipmpx_parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E61277045100339E12 /* ipmpx_parse.c */; };
+ 71CCF2EC1277045100339E12 /* oci_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E71277045100339E12 /* oci_codec.c */; };
+ 71CCF2ED1277045100339E12 /* odf_code.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E81277045100339E12 /* odf_code.c */; };
+ 71CCF2EE1277045100339E12 /* odf_codec.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1E91277045100339E12 /* odf_codec.c */; };
+ 71CCF2EF1277045100339E12 /* odf_command.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1EA1277045100339E12 /* odf_command.c */; };
+ 71CCF2F01277045100339E12 /* odf_dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1EB1277045100339E12 /* odf_dump.c */; };
+ 71CCF2F11277045100339E12 /* odf_parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1EC1277045100339E12 /* odf_parse.c */; };
+ 71CCF2F21277045100339E12 /* qos.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1ED1277045100339E12 /* qos.c */; };
+ 71CCF2F31277045100339E12 /* slc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1EE1277045100339E12 /* slc.c */; };
+ 71CCF2F41277045100339E12 /* encode_isom.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F01277045100339E12 /* encode_isom.c */; };
+ 71CCF2F51277045100339E12 /* loader_bt.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F11277045100339E12 /* loader_bt.c */; };
+ 71CCF2F61277045100339E12 /* loader_isom.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F21277045100339E12 /* loader_isom.c */; };
+ 71CCF2F71277045100339E12 /* loader_qt.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F31277045100339E12 /* loader_qt.c */; };
+ 71CCF2F81277045100339E12 /* loader_svg.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F41277045100339E12 /* loader_svg.c */; };
+ 71CCF2F91277045100339E12 /* loader_xmt.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F51277045100339E12 /* loader_xmt.c */; };
+ 71CCF2FA1277045100339E12 /* scene_dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F61277045100339E12 /* scene_dump.c */; };
+ 71CCF2FB1277045100339E12 /* scene_engine.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F71277045100339E12 /* scene_engine.c */; };
+ 71CCF2FC1277045100339E12 /* scene_manager.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F81277045100339E12 /* scene_manager.c */; };
+ 71CCF2FD1277045100339E12 /* scene_stats.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1F91277045100339E12 /* scene_stats.c */; };
+ 71CCF2FE1277045100339E12 /* swf_bifs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1FA1277045100339E12 /* swf_bifs.c */; };
+ 71CCF2FF1277045100339E12 /* swf_parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1FB1277045100339E12 /* swf_parse.c */; };
+ 71CCF3001277045100339E12 /* text_to_bifs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1FC1277045100339E12 /* text_to_bifs.c */; };
+ 71CCF3011277045100339E12 /* base_scenegraph.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1FE1277045100339E12 /* base_scenegraph.c */; };
+ 71CCF3021277045100339E12 /* commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF1FF1277045100339E12 /* commands.c */; };
+ 71CCF3031277045100339E12 /* dom_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2001277045100339E12 /* dom_events.c */; };
+ 71CCF3041277045100339E12 /* dom_smjs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2011277045100339E12 /* dom_smjs.c */; };
+ 71CCF3051277045100339E12 /* mpeg4_animators.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2021277045100339E12 /* mpeg4_animators.c */; };
+ 71CCF3061277045100339E12 /* mpeg4_nodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2031277045100339E12 /* mpeg4_nodes.c */; };
+ 71CCF3071277045100339E12 /* mpeg4_valuator.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2041277045100339E12 /* mpeg4_valuator.c */; };
+ 71CCF3081277045100339E12 /* smil_anim.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2051277045100339E12 /* smil_anim.c */; };
+ 71CCF3091277045100339E12 /* smil_timing.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2061277045100339E12 /* smil_timing.c */; };
+ 71CCF30A1277045100339E12 /* svg_attributes.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2071277045100339E12 /* svg_attributes.c */; };
+ 71CCF30B1277045100339E12 /* svg_properties.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2081277045100339E12 /* svg_properties.c */; };
+ 71CCF30C1277045100339E12 /* svg_smjs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2091277045100339E12 /* svg_smjs.c */; };
+ 71CCF30D1277045100339E12 /* svg_types.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF20A1277045100339E12 /* svg_types.c */; };
+ 71CCF30E1277045100339E12 /* vrml_interpolators.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF20B1277045100339E12 /* vrml_interpolators.c */; };
+ 71CCF30F1277045100339E12 /* vrml_proto.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF20C1277045100339E12 /* vrml_proto.c */; };
+ 71CCF3101277045100339E12 /* vrml_route.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF20D1277045100339E12 /* vrml_route.c */; };
+ 71CCF3111277045100339E12 /* vrml_script.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF20E1277045100339E12 /* vrml_script.c */; };
+ 71CCF3121277045100339E12 /* vrml_smjs.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF20F1277045100339E12 /* vrml_smjs.c */; };
+ 71CCF3131277045100339E12 /* vrml_tools.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2101277045100339E12 /* vrml_tools.c */; };
+ 71CCF3141277045100339E12 /* x3d_nodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2111277045100339E12 /* x3d_nodes.c */; };
+ 71CCF3151277045100339E12 /* xbl_process.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2121277045100339E12 /* xbl_process.c */; };
+ 71CCF3161277045100339E12 /* xml_ns.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2131277045100339E12 /* xml_ns.c */; };
+ 71CCF3171277045100339E12 /* channel.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2151277045100339E12 /* channel.c */; };
+ 71CCF3181277045100339E12 /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2161277045100339E12 /* clock.c */; };
+ 71CCF3191277045100339E12 /* decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2171277045100339E12 /* decoder.c */; };
+ 71CCF31A1277045100339E12 /* input_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2181277045100339E12 /* input_sensor.c */; };
+ 71CCF31B1277045100339E12 /* input_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF2191277045100339E12 /* input_sensor.h */; };
+ 71CCF31C1277045100339E12 /* media_control.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF21A1277045100339E12 /* media_control.c */; };
+ 71CCF31D1277045100339E12 /* media_control.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF21B1277045100339E12 /* media_control.h */; };
+ 71CCF31E1277045100339E12 /* media_manager.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF21C1277045100339E12 /* media_manager.c */; };
+ 71CCF31F1277045100339E12 /* media_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF21D1277045100339E12 /* media_memory.c */; };
+ 71CCF3201277045100339E12 /* media_memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF21E1277045100339E12 /* media_memory.h */; };
+ 71CCF3211277045100339E12 /* media_object.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF21F1277045100339E12 /* media_object.c */; };
+ 71CCF3221277045100339E12 /* media_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2201277045100339E12 /* media_sensor.c */; };
+ 71CCF3231277045100339E12 /* mpeg4_inline.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2211277045100339E12 /* mpeg4_inline.c */; };
+ 71CCF3241277045100339E12 /* network_service.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2221277045100339E12 /* network_service.c */; };
+ 71CCF3251277045100339E12 /* object_browser.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2231277045100339E12 /* object_browser.c */; };
+ 71CCF3261277045100339E12 /* object_manager.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2241277045100339E12 /* object_manager.c */; };
+ 71CCF3271277045100339E12 /* scene.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2251277045100339E12 /* scene.c */; };
+ 71CCF3281277045100339E12 /* svg_external.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2261277045100339E12 /* svg_external.c */; };
+ 71CCF3291277045100339E12 /* term_node_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2271277045100339E12 /* term_node_init.c */; };
+ 71CCF32A1277045100339E12 /* terminal.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2281277045100339E12 /* terminal.c */; };
+ 71CCF32B1277045100339E12 /* base_encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF22A1277045100339E12 /* base_encoding.c */; };
+ 71CCF32C1277045100339E12 /* bitstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF22B1277045100339E12 /* bitstream.c */; };
+ 71CCF32D1277045100339E12 /* color.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF22C1277045100339E12 /* color.c */; };
+ 71CCF32E1277045100339E12 /* configfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF22D1277045100339E12 /* configfile.c */; };
+ 71CCF32F1277045100339E12 /* dlmalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF22E1277045100339E12 /* dlmalloc.c */; };
+ 71CCF3301277045100339E12 /* downloader.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF22F1277045100339E12 /* downloader.c */; };
+ 71CCF3311277045100339E12 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2301277045100339E12 /* error.c */; };
+ 71CCF3331277045100339E12 /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2321277045100339E12 /* list.c */; };
+ 71CCF3341277045100339E12 /* math.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2331277045100339E12 /* math.c */; };
+ 71CCF3351277045100339E12 /* module.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2341277045100339E12 /* module.c */; };
+ 71CCF3361277045100339E12 /* module_wrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF2351277045100339E12 /* module_wrap.h */; };
+ 71CCF3371277045100339E12 /* os_divers.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2361277045100339E12 /* os_divers.c */; };
+ 71CCF3381277045100339E12 /* os_module.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2371277045100339E12 /* os_module.c */; };
+ 71CCF3391277045100339E12 /* os_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2381277045100339E12 /* os_net.c */; };
+ 71CCF33A1277045100339E12 /* os_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2391277045100339E12 /* os_thread.c */; };
+ 71CCF33B1277045100339E12 /* path2d.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF23A1277045100339E12 /* path2d.c */; };
+ 71CCF33C1277045100339E12 /* path2d_stroker.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF23B1277045100339E12 /* path2d_stroker.c */; };
+ 71CCF33F1277045100339E12 /* token.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF23E1277045100339E12 /* token.c */; };
+ 71CCF3401277045100339E12 /* uni_bidi.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF23F1277045100339E12 /* uni_bidi.c */; };
+ 71CCF3411277045100339E12 /* url.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2401277045100339E12 /* url.c */; };
+ 71CCF3421277045100339E12 /* utf.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2411277045100339E12 /* utf.c */; };
+ 71CCF3431277045100339E12 /* xml_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2421277045100339E12 /* xml_parser.c */; };
+ 71CCF3451277045100339E12 /* zutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2441277045100339E12 /* zutil.c */; };
+ 71CCF3461277045100339E12 /* zutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF2451277045100339E12 /* zutil.h */; };
+ 71CCF3B112770A8C00339E12 /* avparse.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36012770A8C00339E12 /* avparse.h */; };
+ 71CCF3B212770A8C00339E12 /* base_coding.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36112770A8C00339E12 /* base_coding.h */; };
+ 71CCF3B312770A8C00339E12 /* bifs.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36212770A8C00339E12 /* bifs.h */; };
+ 71CCF3B412770A8C00339E12 /* bitstream.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36312770A8C00339E12 /* bitstream.h */; };
+ 71CCF3B512770A8C00339E12 /* color.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36412770A8C00339E12 /* color.h */; };
+ 71CCF3B612770A8C00339E12 /* compositor.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36512770A8C00339E12 /* compositor.h */; };
+ 71CCF3B712770A8C00339E12 /* config_file.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36612770A8C00339E12 /* config_file.h */; };
+ 71CCF3B812770A8C00339E12 /* configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36712770A8C00339E12 /* configuration.h */; };
+ 71CCF3B912770A8C00339E12 /* constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36812770A8C00339E12 /* constants.h */; };
+ 71CCF3BA12770A8C00339E12 /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36912770A8C00339E12 /* crypt.h */; };
+ 71CCF3BB12770A8C00339E12 /* download.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36A12770A8C00339E12 /* download.h */; };
+ 71CCF3BC12770A8C00339E12 /* dvb_mpe.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36B12770A8C00339E12 /* dvb_mpe.h */; };
+ 71CCF3BD12770A8C00339E12 /* esi.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36C12770A8C00339E12 /* esi.h */; };
+ 71CCF3BE12770A8C00339E12 /* events.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36D12770A8C00339E12 /* events.h */; };
+ 71CCF3BF12770A8C00339E12 /* filestreamer.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36E12770A8C00339E12 /* filestreamer.h */; };
+ 71CCF3C012770A8C00339E12 /* ietf.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF36F12770A8C00339E12 /* ietf.h */; };
+ 71CCF3C112770A8C00339E12 /* avilib.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37112770A8C00339E12 /* avilib.h */; };
+ 71CCF3C212770A8C00339E12 /* bifs_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37212770A8C00339E12 /* bifs_dev.h */; };
+ 71CCF3C312770A8C00339E12 /* bifs_tables.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37312770A8C00339E12 /* bifs_tables.h */; };
+ 71CCF3C412770A8C00339E12 /* camera.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37412770A8C00339E12 /* camera.h */; };
+ 71CCF3C512770A8C00339E12 /* compositor_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37512770A8C00339E12 /* compositor_dev.h */; };
+ 71CCF3C612770A8C00339E12 /* crypt_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37612770A8C00339E12 /* crypt_dev.h */; };
+ 71CCF3C712770A8C00339E12 /* dvb_mpe_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37712770A8C00339E12 /* dvb_mpe_dev.h */; };
+ 71CCF3C812770A8C00339E12 /* ietf_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37812770A8C00339E12 /* ietf_dev.h */; };
+ 71CCF3C912770A8C00339E12 /* isomedia_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37912770A8C00339E12 /* isomedia_dev.h */; };
+ 71CCF3CA12770A8C00339E12 /* laser_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37A12770A8C00339E12 /* laser_dev.h */; };
+ 71CCF3CB12770A8C00339E12 /* media_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37B12770A8C00339E12 /* media_dev.h */; };
+ 71CCF3CC12770A8C00339E12 /* mesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37C12770A8C00339E12 /* mesh.h */; };
+ 71CCF3CD12770A8C00339E12 /* odf_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37D12770A8C00339E12 /* odf_dev.h */; };
+ 71CCF3CE12770A8C00339E12 /* ogg.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37E12770A8C00339E12 /* ogg.h */; };
+ 71CCF3CF12770A8C00339E12 /* reedsolomon.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF37F12770A8C00339E12 /* reedsolomon.h */; };
+ 71CCF3D012770A8C00339E12 /* scenegraph_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38012770A8C00339E12 /* scenegraph_dev.h */; };
+ 71CCF3D112770A8C00339E12 /* swf_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38112770A8C00339E12 /* swf_dev.h */; };
+ 71CCF3D212770A8C00339E12 /* terminal_dev.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38212770A8C00339E12 /* terminal_dev.h */; };
+ 71CCF3D312770A8C00339E12 /* vobsub.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38312770A8C00339E12 /* vobsub.h */; };
+ 71CCF3D412770A8C00339E12 /* ismacryp.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38412770A8C00339E12 /* ismacryp.h */; };
+ 71CCF3D512770A8C00339E12 /* iso639.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38512770A8C00339E12 /* iso639.h */; };
+ 71CCF3D612770A8C00339E12 /* isomedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38612770A8C00339E12 /* isomedia.h */; };
+ 71CCF3D712770A8C00339E12 /* laser.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38712770A8C00339E12 /* laser.h */; };
+ 71CCF3D812770A8C00339E12 /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38812770A8C00339E12 /* list.h */; };
+ 71CCF3D912770A8C00339E12 /* math.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38912770A8C00339E12 /* math.h */; };
+ 71CCF3DA12770A8C00339E12 /* media_tools.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38A12770A8C00339E12 /* media_tools.h */; };
+ 71CCF3DB12770A8C00339E12 /* mediaobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38B12770A8C00339E12 /* mediaobject.h */; };
+ 71CCF3DC12770A8C00339E12 /* module.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38C12770A8C00339E12 /* module.h */; };
+ 71CCF3DD12770A8C00339E12 /* audio_out.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38E12770A8C00339E12 /* audio_out.h */; };
+ 71CCF3DE12770A8C00339E12 /* codec.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF38F12770A8C00339E12 /* codec.h */; };
+ 71CCF3DF12770A8C00339E12 /* font.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39012770A8C00339E12 /* font.h */; };
+ 71CCF3E012770A8C00339E12 /* ipmp.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39112770A8C00339E12 /* ipmp.h */; };
+ 71CCF3E112770A8C00339E12 /* js_usr.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39212770A8C00339E12 /* js_usr.h */; };
+ 71CCF3E212770A8C00339E12 /* raster2d.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39312770A8C00339E12 /* raster2d.h */; };
+ 71CCF3E312770A8C00339E12 /* service.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39412770A8C00339E12 /* service.h */; };
+ 71CCF3E412770A8C00339E12 /* term_ext.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39512770A8C00339E12 /* term_ext.h */; };
+ 71CCF3E512770A8C00339E12 /* video_out.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39612770A8C00339E12 /* video_out.h */; };
+ 71CCF3E612770A8C00339E12 /* mpeg4_odf.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39712770A8C00339E12 /* mpeg4_odf.h */; };
+ 71CCF3E712770A8C00339E12 /* mpegts.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39812770A8C00339E12 /* mpegts.h */; };
+ 71CCF3E812770A8C00339E12 /* network.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39912770A8C00339E12 /* network.h */; };
+ 71CCF3E912770A8C00339E12 /* nodes_mpeg4.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39A12770A8C00339E12 /* nodes_mpeg4.h */; };
+ 71CCF3EA12770A8C00339E12 /* nodes_svg.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39B12770A8C00339E12 /* nodes_svg.h */; };
+ 71CCF3EB12770A8C00339E12 /* nodes_x3d.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39C12770A8C00339E12 /* nodes_x3d.h */; };
+ 71CCF3EC12770A8C00339E12 /* nodes_xbl.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39D12770A8C00339E12 /* nodes_xbl.h */; };
+ 71CCF3ED12770A8C00339E12 /* options.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39E12770A8C00339E12 /* options.h */; };
+ 71CCF3EE12770A8C00339E12 /* path2d.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF39F12770A8C00339E12 /* path2d.h */; };
+ 71CCF3EF12770A8C00339E12 /* rtp_streamer.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A012770A8C00339E12 /* rtp_streamer.h */; };
+ 71CCF3F012770A8C00339E12 /* scene_engine.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A112770A8C00339E12 /* scene_engine.h */; };
+ 71CCF3F112770A8C00339E12 /* scene_manager.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A212770A8C00339E12 /* scene_manager.h */; };
+ 71CCF3F212770A8C00339E12 /* scenegraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A312770A8C00339E12 /* scenegraph.h */; };
+ 71CCF3F312770A8C00339E12 /* scenegraph_svg.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A412770A8C00339E12 /* scenegraph_svg.h */; };
+ 71CCF3F412770A8C00339E12 /* scenegraph_vrml.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A512770A8C00339E12 /* scenegraph_vrml.h */; };
+ 71CCF3F512770A8C00339E12 /* setup.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A612770A8C00339E12 /* setup.h */; };
+ 71CCF3F612770A8C00339E12 /* svg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A712770A8C00339E12 /* svg_types.h */; };
+ 71CCF3F712770A8C00339E12 /* sync_layer.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A812770A8C00339E12 /* sync_layer.h */; };
+ 71CCF3F812770A8C00339E12 /* term_info.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3A912770A8C00339E12 /* term_info.h */; };
+ 71CCF3F912770A8C00339E12 /* terminal.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3AA12770A8C00339E12 /* terminal.h */; };
+ 71CCF3FA12770A8C00339E12 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3AB12770A8C00339E12 /* thread.h */; };
+ 71CCF3FB12770A8C00339E12 /* token.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3AC12770A8C00339E12 /* token.h */; };
+ 71CCF3FC12770A8C00339E12 /* tools.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3AD12770A8C00339E12 /* tools.h */; };
+ 71CCF3FD12770A8C00339E12 /* user.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3AE12770A8C00339E12 /* user.h */; };
+ 71CCF3FE12770A8C00339E12 /* utf.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3AF12770A8C00339E12 /* utf.h */; };
+ 71CCF3FF12770A8C00339E12 /* xml.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CCF3B012770A8C00339E12 /* xml.h */; };
+ 71F2A45E12830B5300C384DE /* libjs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45412830B1400C384DE /* libjs.a */; };
+ 71F2A46E12830BE200C384DE /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45312830B1400C384DE /* libjpeg.a */; };
+ 71F2A46F12830BE800C384DE /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45612830B1400C384DE /* libpng.a */; };
+ 71F2A4BA12830E3000C384DE /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45112830B1400C384DE /* libfreetype.a */; };
+ 71F2A4C512830E5A00C384DE /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 71847813127860F000917298 /* libz.dylib */; };
+ 71F2A4D012830E7400C384DE /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2A45712830B1400C384DE /* libSDL.a */; };
+ 970A26C913434D2C0007362C /* m3u8.c in Sources */ = {isa = PBXBuildFile; fileRef = 970A26C713434D2C0007362C /* m3u8.c */; };
+ 970A26CA13434D2C0007362C /* mpd.c in Sources */ = {isa = PBXBuildFile; fileRef = 970A26C813434D2C0007362C /* mpd.c */; };
+ 970A26CD13434D780007362C /* m3u8.h in Headers */ = {isa = PBXBuildFile; fileRef = 970A26CB13434D780007362C /* m3u8.h */; };
+ 970A26CE13434D780007362C /* mpd.h in Headers */ = {isa = PBXBuildFile; fileRef = 970A26CC13434D780007362C /* mpd.h */; };
+ 970A26D213434D960007362C /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 970A26CF13434D960007362C /* cache.h */; };
+ 970A26D313434D960007362C /* ringbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 970A26D013434D960007362C /* ringbuffer.h */; };
+ 970A26D413434D960007362C /* unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = 970A26D113434D960007362C /* unicode.h */; };
+ 970A26D713434DAC0007362C /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 970A26D513434DAC0007362C /* ringbuffer.c */; };
+ 970A26D813434DAC0007362C /* unicode.c in Sources */ = {isa = PBXBuildFile; fileRef = 970A26D613434DAC0007362C /* unicode.c */; };
+ 970A270E1343540C0007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E2134377400007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E3134377430007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E4134377440007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E5134377480007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E6134377490007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E71343774A0007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E81343774B0007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A27E91343774C0007362C /* libgcc_s.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A270D1343540C0007362C /* libgcc_s.1.dylib */; };
+ 970A2840134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2841134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2842134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2843134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2844134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2845134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2846134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2847134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2848134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2849134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A284A134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A284B134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A284C134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A284D134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A284E134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A284F134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2850134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A2851134462AF0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A283F134462AE0007362C /* libgpac_dynamic.dylib */; };
+ 970A28531344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28541344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28551344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28561344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28571344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28581344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28591344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A285A1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A285B1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A285C1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A285D1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A285E1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A285F1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28601344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28611344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28621344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28631344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+ 970A28641344632F0007362C /* libgpac_dynamic.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 970A28521344632F0007362C /* libgpac_dynamic.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 718477D4127814D600917298 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 71CCF1301277037A00339E12;
+ remoteInfo = libgpac_static;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 71179CBF1292EC1800A83216 /* mpd_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpd_in.c; sourceTree = "<group>"; };
+ 71179CC41292EC3400A83216 /* gm_mpd_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_mpd_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7141FF2F1292CB9200FCB27D /* alloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alloc.c; sourceTree = "<group>"; };
+ 7147425F12B918C900DB5A59 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
+ 718477D0127814B200917298 /* libgpac_dynamic.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgpac_dynamic.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718477F912781DEB00917298 /* empty.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = empty.c; sourceTree = "<group>"; };
+ 71847811127860F000917298 /* libc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libc.dylib; path = usr/lib/libc.dylib; sourceTree = SDKROOT; };
+ 71847813127860F000917298 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
+ 718478311278645B00917298 /* gm_soft_raster.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_soft_raster.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478381278647200917298 /* gm_dummy_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_dummy_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71847841127864AC00917298 /* gm_ctx_load.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_ctx_load.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478491278654000917298 /* gm_aac_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_aac_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478501278655800917298 /* gm_svg_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_svg_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478571278656E00917298 /* gm_mp3_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_mp3_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7184785E1278657F00917298 /* gm_img_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_img_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478651278658A00917298 /* gm_bifs_dec.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_bifs_dec.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7184786C127865A200917298 /* gm_gpac_js.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_gpac_js.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71847873127865B700917298 /* gm_isom_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_isom_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7184787A127865CB00917298 /* gm_laser_dec.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_laser_dec.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71847881127865D600917298 /* gm_odf_dec.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_odf_dec.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71847891127865F700917298 /* gm_rtp_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_rtp_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478981278660400917298 /* gm_mpegts_in.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_mpegts_in.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7184789F1278661700917298 /* gm_ft_font.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_ft_font.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478A61278662F00917298 /* gm_widgetman.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_widgetman.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 718478B11278666100917298 /* gm_sdl_out.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = gm_sdl_out.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71A199071278765600ACFF58 /* aac_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aac_in.c; sourceTree = "<group>"; };
+ 71A199081278765600ACFF58 /* faad_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = faad_dec.c; sourceTree = "<group>"; };
+ 71A1990E1278767B00ACFF58 /* bifs_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bifs_dec.c; sourceTree = "<group>"; };
+ 71A199151278769100ACFF58 /* ftgrays.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftgrays.c; sourceTree = "<group>"; };
+ 71A199171278769100ACFF58 /* rast_soft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rast_soft.h; sourceTree = "<group>"; };
+ 71A199181278769100ACFF58 /* raster_565.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raster_565.c; sourceTree = "<group>"; };
+ 71A199191278769100ACFF58 /* raster_argb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raster_argb.c; sourceTree = "<group>"; };
+ 71A1991A1278769100ACFF58 /* raster_load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raster_load.c; sourceTree = "<group>"; };
+ 71A1991B1278769100ACFF58 /* raster_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raster_rgb.c; sourceTree = "<group>"; };
+ 71A1991C1278769100ACFF58 /* stencil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stencil.c; sourceTree = "<group>"; };
+ 71A1991D1278769100ACFF58 /* surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = surface.c; sourceTree = "<group>"; };
+ 71A19928127876A200ACFF58 /* dummy_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dummy_in.c; sourceTree = "<group>"; };
+ 71A1992D127876B000ACFF58 /* ctx_load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctx_load.c; sourceTree = "<group>"; };
+ 71A19933127876C300ACFF58 /* svg_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_in.c; sourceTree = "<group>"; };
+ 71A19937127876D300ACFF58 /* mad_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mad_dec.c; sourceTree = "<group>"; };
+ 71A19939127876D300ACFF58 /* mp3_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mp3_in.c; sourceTree = "<group>"; };
+ 71A1993E127876E300ACFF58 /* bmp_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmp_dec.c; sourceTree = "<group>"; };
+ 71A1993F127876E300ACFF58 /* img_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = img_dec.c; sourceTree = "<group>"; };
+ 71A19940127876E300ACFF58 /* img_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = img_in.c; sourceTree = "<group>"; };
+ 71A19941127876E300ACFF58 /* img_in.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = img_in.h; sourceTree = "<group>"; };
+ 71A19942127876E300ACFF58 /* jp2_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = jp2_dec.c; sourceTree = "<group>"; };
+ 71A19943127876E300ACFF58 /* jpeg_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = jpeg_dec.c; sourceTree = "<group>"; };
+ 71A19945127876E300ACFF58 /* png_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = png_dec.c; sourceTree = "<group>"; };
+ 71A1994F127876FA00ACFF58 /* gpac_js.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gpac_js.c; sourceTree = "<group>"; };
+ 71A199541278770900ACFF58 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
+ 71A199551278770900ACFF58 /* isom_in.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = isom_in.h; sourceTree = "<group>"; };
+ 71A199561278770900ACFF58 /* load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = "<group>"; };
+ 71A199581278770900ACFF58 /* read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = read.c; sourceTree = "<group>"; };
+ 71A199591278770900ACFF58 /* read_ch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = read_ch.c; sourceTree = "<group>"; };
+ 71A199611278772500ACFF58 /* laser_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = laser_dec.c; sourceTree = "<group>"; };
+ 71A199671278773900ACFF58 /* odf_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = odf_dec.c; sourceTree = "<group>"; };
+ 71A1996C1278774A00ACFF58 /* rtp_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_in.c; sourceTree = "<group>"; };
+ 71A1996D1278774A00ACFF58 /* rtp_in.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtp_in.h; sourceTree = "<group>"; };
+ 71A1996E1278774A00ACFF58 /* rtp_session.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_session.c; sourceTree = "<group>"; };
+ 71A1996F1278774A00ACFF58 /* rtp_signaling.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_signaling.c; sourceTree = "<group>"; };
+ 71A199701278774A00ACFF58 /* rtp_stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_stream.c; sourceTree = "<group>"; };
+ 71A199711278774A00ACFF58 /* sdp_fetch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sdp_fetch.c; sourceTree = "<group>"; };
+ 71A199721278774A00ACFF58 /* sdp_load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sdp_load.c; sourceTree = "<group>"; };
+ 71A1997D1278775900ACFF58 /* mpegts_in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegts_in.c; sourceTree = "<group>"; };
+ 71A199811278776700ACFF58 /* ft_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ft_font.c; sourceTree = "<group>"; };
+ 71A199821278776700ACFF58 /* ft_font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ft_font.h; sourceTree = "<group>"; };
+ 71A199891278777A00ACFF58 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
+ 71A1998A1278777A00ACFF58 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
+ 71A1998B1278777A00ACFF58 /* wgt_load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wgt_load.c; sourceTree = "<group>"; };
+ 71A1998C1278777A00ACFF58 /* wgt_load_base.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = wgt_load_base.js; sourceTree = "<group>"; };
+ 71A1998D1278777A00ACFF58 /* widget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = widget.c; sourceTree = "<group>"; };
+ 71A1998E1278777A00ACFF58 /* widgetman.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = widgetman.c; sourceTree = "<group>"; };
+ 71A1998F1278777A00ACFF58 /* widgetman.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = widgetman.h; sourceTree = "<group>"; };
+ 71A199991278778800ACFF58 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio.c; sourceTree = "<group>"; };
+ 71A1999A1278778800ACFF58 /* cursors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cursors.c; sourceTree = "<group>"; };
+ 71A1999C1278778800ACFF58 /* sdl_out.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sdl_out.c; sourceTree = "<group>"; };
+ 71A1999D1278778800ACFF58 /* sdl_out.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sdl_out.h; sourceTree = "<group>"; };
+ 71A1999E1278778800ACFF58 /* video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = video.c; sourceTree = "<group>"; };
+ 71A1999F1278778800ACFF58 /* video2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = video2d.c; sourceTree = "<group>"; };
+ 71A19B1A12796B5600ACFF58 /* osmo4ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = osmo4ios.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71A19B1C12796B5700ACFF58 /* osmo4ios-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "osmo4ios-Info.plist"; path = "../../applications/osmo4_ios/osmo4ios-Info.plist"; sourceTree = "<group>"; };
+ 71A19B2012796B6F00ACFF58 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../../applications/osmo4_ios/main.c; sourceTree = SOURCE_ROOT; };
+ 71A19B3F12796FCC00ACFF58 /* module_av_generic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = module_av_generic.c; sourceTree = SOURCE_ROOT; };
+ 71A19B411279713300ACFF58 /* extract.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = extract.c; path = ../../applications/osmo4_ios/extract.c; sourceTree = SOURCE_ROOT; };
+ 71A19B43127971C700ACFF58 /* libgpac_symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libgpac_symbols.h; sourceTree = "<group>"; };
+ 71A19BB112797D1B00ACFF58 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
+ 71A19BB812797D4800ACFF58 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+ 71A19BC312797D9200ACFF58 /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = usr/lib/libobjc.dylib; sourceTree = SDKROOT; };
+ 71A19BCC12797DBA00ACFF58 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 71A19C3A12797E4000ACFF58 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 71A19C3C12797E4000ACFF58 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 71A19C3E12797E4000ACFF58 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ 71A19C4012797E4000ACFF58 /* libdl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libdl.dylib; path = usr/lib/libdl.dylib; sourceTree = SDKROOT; };
+ 71CCF1311277037A00339E12 /* libgpac_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgpac_static.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 71CCF13A1277045100339E12 /* arith_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arith_decoder.c; sourceTree = "<group>"; };
+ 71CCF13B1277045100339E12 /* bifs_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bifs_codec.c; sourceTree = "<group>"; };
+ 71CCF13C1277045100339E12 /* bifs_node_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bifs_node_tables.c; sourceTree = "<group>"; };
+ 71CCF13D1277045100339E12 /* com_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = com_dec.c; sourceTree = "<group>"; };
+ 71CCF13E1277045100339E12 /* com_enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = com_enc.c; sourceTree = "<group>"; };
+ 71CCF13F1277045100339E12 /* conditional.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = conditional.c; sourceTree = "<group>"; };
+ 71CCF1401277045100339E12 /* field_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = field_decode.c; sourceTree = "<group>"; };
+ 71CCF1411277045100339E12 /* field_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = field_encode.c; sourceTree = "<group>"; };
+ 71CCF1421277045100339E12 /* memory_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory_decoder.c; sourceTree = "<group>"; };
+ 71CCF1431277045100339E12 /* predictive_mffield.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = predictive_mffield.c; sourceTree = "<group>"; };
+ 71CCF1441277045100339E12 /* quant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quant.h; sourceTree = "<group>"; };
+ 71CCF1451277045100339E12 /* quantize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = quantize.c; sourceTree = "<group>"; };
+ 71CCF1461277045100339E12 /* script.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = script.h; sourceTree = "<group>"; };
+ 71CCF1471277045100339E12 /* script_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = script_dec.c; sourceTree = "<group>"; };
+ 71CCF1481277045100339E12 /* script_enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = script_enc.c; sourceTree = "<group>"; };
+ 71CCF1491277045100339E12 /* unquantize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unquantize.c; sourceTree = "<group>"; };
+ 71CCF14B1277045100339E12 /* audio_input.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio_input.c; sourceTree = "<group>"; };
+ 71CCF14C1277045100339E12 /* audio_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio_mixer.c; sourceTree = "<group>"; };
+ 71CCF14D1277045100339E12 /* audio_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio_render.c; sourceTree = "<group>"; };
+ 71CCF14E1277045100339E12 /* bindable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bindable.c; sourceTree = "<group>"; };
+ 71CCF14F1277045100339E12 /* camera.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = camera.c; sourceTree = "<group>"; };
+ 71CCF1501277045100339E12 /* compositor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compositor.c; sourceTree = "<group>"; };
+ 71CCF1511277045100339E12 /* compositor_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compositor_2d.c; sourceTree = "<group>"; };
+ 71CCF1521277045100339E12 /* compositor_3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compositor_3d.c; sourceTree = "<group>"; };
+ 71CCF1531277045100339E12 /* compositor_node_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compositor_node_init.c; sourceTree = "<group>"; };
+ 71CCF1541277045100339E12 /* drawable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drawable.c; sourceTree = "<group>"; };
+ 71CCF1551277045100339E12 /* drawable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drawable.h; sourceTree = "<group>"; };
+ 71CCF1561277045100339E12 /* events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = events.c; sourceTree = "<group>"; };
+ 71CCF1571277045100339E12 /* font_engine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = font_engine.c; sourceTree = "<group>"; };
+ 71CCF1581277045100339E12 /* gl_inc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_inc.h; sourceTree = "<group>"; };
+ 71CCF1591277045100339E12 /* hardcoded_protos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hardcoded_protos.c; sourceTree = "<group>"; };
+ 71CCF15A1277045100339E12 /* hc_flash_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hc_flash_shape.c; sourceTree = "<group>"; };
+ 71CCF15B1277045100339E12 /* mesh.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mesh.c; sourceTree = "<group>"; };
+ 71CCF15C1277045100339E12 /* mesh_collide.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mesh_collide.c; sourceTree = "<group>"; };
+ 71CCF15D1277045100339E12 /* mesh_tesselate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mesh_tesselate.c; sourceTree = "<group>"; };
+ 71CCF15E1277045100339E12 /* mpeg4_animstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_animstream.c; sourceTree = "<group>"; };
+ 71CCF15F1277045100339E12 /* mpeg4_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_audio.c; sourceTree = "<group>"; };
+ 71CCF1601277045100339E12 /* mpeg4_background.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_background.c; sourceTree = "<group>"; };
+ 71CCF1611277045100339E12 /* mpeg4_background2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_background2d.c; sourceTree = "<group>"; };
+ 71CCF1621277045100339E12 /* mpeg4_bitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_bitmap.c; sourceTree = "<group>"; };
+ 71CCF1631277045100339E12 /* mpeg4_composite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_composite.c; sourceTree = "<group>"; };
+ 71CCF1641277045100339E12 /* mpeg4_form.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_form.c; sourceTree = "<group>"; };
+ 71CCF1651277045100339E12 /* mpeg4_geometry_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_geometry_2d.c; sourceTree = "<group>"; };
+ 71CCF1661277045100339E12 /* mpeg4_geometry_3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_geometry_3d.c; sourceTree = "<group>"; };
+ 71CCF1671277045100339E12 /* mpeg4_geometry_ifs2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_geometry_ifs2d.c; sourceTree = "<group>"; };
+ 71CCF1681277045100339E12 /* mpeg4_geometry_ils2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_geometry_ils2d.c; sourceTree = "<group>"; };
+ 71CCF1691277045100339E12 /* mpeg4_gradients.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_gradients.c; sourceTree = "<group>"; };
+ 71CCF16A1277045100339E12 /* mpeg4_grouping.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_grouping.c; sourceTree = "<group>"; };
+ 71CCF16B1277045100339E12 /* mpeg4_grouping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg4_grouping.h; sourceTree = "<group>"; };
+ 71CCF16C1277045100339E12 /* mpeg4_grouping_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_grouping_2d.c; sourceTree = "<group>"; };
+ 71CCF16D1277045100339E12 /* mpeg4_grouping_3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_grouping_3d.c; sourceTree = "<group>"; };
+ 71CCF16E1277045100339E12 /* mpeg4_layer_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_layer_2d.c; sourceTree = "<group>"; };
+ 71CCF16F1277045100339E12 /* mpeg4_layer_3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_layer_3d.c; sourceTree = "<group>"; };
+ 71CCF1701277045100339E12 /* mpeg4_layout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_layout.c; sourceTree = "<group>"; };
+ 71CCF1711277045100339E12 /* mpeg4_lighting.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_lighting.c; sourceTree = "<group>"; };
+ 71CCF1721277045100339E12 /* mpeg4_path_layout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_path_layout.c; sourceTree = "<group>"; };
+ 71CCF1731277045100339E12 /* mpeg4_sensors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_sensors.c; sourceTree = "<group>"; };
+ 71CCF1741277045100339E12 /* mpeg4_sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_sound.c; sourceTree = "<group>"; };
+ 71CCF1751277045100339E12 /* mpeg4_text.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_text.c; sourceTree = "<group>"; };
+ 71CCF1761277045100339E12 /* mpeg4_textures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_textures.c; sourceTree = "<group>"; };
+ 71CCF1771277045100339E12 /* mpeg4_timesensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_timesensor.c; sourceTree = "<group>"; };
+ 71CCF1781277045100339E12 /* mpeg4_viewport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_viewport.c; sourceTree = "<group>"; };
+ 71CCF1791277045100339E12 /* navigate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = navigate.c; sourceTree = "<group>"; };
+ 71CCF17A1277045100339E12 /* nodes_stacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nodes_stacks.h; sourceTree = "<group>"; };
+ 71CCF17B1277045100339E12 /* offscreen_cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = offscreen_cache.c; sourceTree = "<group>"; };
+ 71CCF17C1277045100339E12 /* offscreen_cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = offscreen_cache.h; sourceTree = "<group>"; };
+ 71CCF17D1277045100339E12 /* svg_base.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_base.c; sourceTree = "<group>"; };
+ 71CCF17E1277045100339E12 /* svg_filters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_filters.c; sourceTree = "<group>"; };
+ 71CCF17F1277045100339E12 /* svg_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_font.c; sourceTree = "<group>"; };
+ 71CCF1801277045100339E12 /* svg_geometry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_geometry.c; sourceTree = "<group>"; };
+ 71CCF1811277045100339E12 /* svg_grouping.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_grouping.c; sourceTree = "<group>"; };
+ 71CCF1821277045100339E12 /* svg_media.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_media.c; sourceTree = "<group>"; };
+ 71CCF1831277045100339E12 /* svg_paint_servers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_paint_servers.c; sourceTree = "<group>"; };
+ 71CCF1841277045100339E12 /* svg_text.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_text.c; sourceTree = "<group>"; };
+ 71CCF1851277045100339E12 /* texturing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = texturing.c; sourceTree = "<group>"; };
+ 71CCF1861277045100339E12 /* texturing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = texturing.h; sourceTree = "<group>"; };
+ 71CCF1871277045100339E12 /* texturing_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = texturing_gl.c; sourceTree = "<group>"; };
+ 71CCF1881277045100339E12 /* visual_manager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = visual_manager.c; sourceTree = "<group>"; };
+ 71CCF1891277045100339E12 /* visual_manager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = visual_manager.h; sourceTree = "<group>"; };
+ 71CCF18A1277045100339E12 /* visual_manager_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = visual_manager_2d.c; sourceTree = "<group>"; };
+ 71CCF18B1277045100339E12 /* visual_manager_2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = visual_manager_2d.h; sourceTree = "<group>"; };
+ 71CCF18C1277045100339E12 /* visual_manager_2d_draw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = visual_manager_2d_draw.c; sourceTree = "<group>"; };
+ 71CCF18D1277045100339E12 /* visual_manager_3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = visual_manager_3d.c; sourceTree = "<group>"; };
+ 71CCF18E1277045100339E12 /* visual_manager_3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = visual_manager_3d.h; sourceTree = "<group>"; };
+ 71CCF18F1277045100339E12 /* visual_manager_3d_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = visual_manager_3d_gl.c; sourceTree = "<group>"; };
+ 71CCF1901277045100339E12 /* x3d_geometry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x3d_geometry.c; sourceTree = "<group>"; };
+ 71CCF1921277045100339E12 /* rtcp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtcp.c; sourceTree = "<group>"; };
+ 71CCF1931277045100339E12 /* rtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp.c; sourceTree = "<group>"; };
+ 71CCF1941277045100339E12 /* rtp_depacketizer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_depacketizer.c; sourceTree = "<group>"; };
+ 71CCF1951277045100339E12 /* rtp_packetizer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_packetizer.c; sourceTree = "<group>"; };
+ 71CCF1961277045100339E12 /* rtp_pck_3gpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_pck_3gpp.c; sourceTree = "<group>"; };
+ 71CCF1971277045100339E12 /* rtp_pck_mpeg12.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_pck_mpeg12.c; sourceTree = "<group>"; };
+ 71CCF1981277045100339E12 /* rtp_pck_mpeg4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_pck_mpeg4.c; sourceTree = "<group>"; };
+ 71CCF1991277045100339E12 /* rtp_streamer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtp_streamer.c; sourceTree = "<group>"; };
+ 71CCF19A1277045100339E12 /* rtsp_command.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsp_command.c; sourceTree = "<group>"; };
+ 71CCF19B1277045100339E12 /* rtsp_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsp_common.c; sourceTree = "<group>"; };
+ 71CCF19C1277045100339E12 /* rtsp_response.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsp_response.c; sourceTree = "<group>"; };
+ 71CCF19D1277045100339E12 /* rtsp_session.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsp_session.c; sourceTree = "<group>"; };
+ 71CCF19E1277045100339E12 /* sdp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sdp.c; sourceTree = "<group>"; };
+ 71CCF1A01277045100339E12 /* avc_ext.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avc_ext.c; sourceTree = "<group>"; };
+ 71CCF1A11277045100339E12 /* box_code_3gpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_code_3gpp.c; sourceTree = "<group>"; };
+ 71CCF1A21277045100339E12 /* box_code_apple.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_code_apple.c; sourceTree = "<group>"; };
+ 71CCF1A31277045100339E12 /* box_code_base.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_code_base.c; sourceTree = "<group>"; };
+ 71CCF1A41277045100339E12 /* box_code_isma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_code_isma.c; sourceTree = "<group>"; };
+ 71CCF1A51277045100339E12 /* box_code_meta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_code_meta.c; sourceTree = "<group>"; };
+ 71CCF1A61277045100339E12 /* box_dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_dump.c; sourceTree = "<group>"; };
+ 71CCF1A71277045100339E12 /* box_funcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_funcs.c; sourceTree = "<group>"; };
+ 71CCF1A81277045100339E12 /* data_map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = data_map.c; sourceTree = "<group>"; };
+ 71CCF1A91277045100339E12 /* hint_track.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hint_track.c; sourceTree = "<group>"; };
+ 71CCF1AA1277045100339E12 /* hinting.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hinting.c; sourceTree = "<group>"; };
+ 71CCF1AB1277045100339E12 /* isma_sample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isma_sample.c; sourceTree = "<group>"; };
+ 71CCF1AC1277045100339E12 /* isom_intern.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isom_intern.c; sourceTree = "<group>"; };
+ 71CCF1AD1277045100339E12 /* isom_read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isom_read.c; sourceTree = "<group>"; };
+ 71CCF1AE1277045100339E12 /* isom_store.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isom_store.c; sourceTree = "<group>"; };
+ 71CCF1AF1277045100339E12 /* isom_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isom_write.c; sourceTree = "<group>"; };
+ 71CCF1B01277045100339E12 /* media.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media.c; sourceTree = "<group>"; };
+ 71CCF1B11277045100339E12 /* media_odf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_odf.c; sourceTree = "<group>"; };
+ 71CCF1B21277045100339E12 /* meta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = meta.c; sourceTree = "<group>"; };
+ 71CCF1B31277045100339E12 /* movie_fragments.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = movie_fragments.c; sourceTree = "<group>"; };
+ 71CCF1B41277045100339E12 /* sample_descs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sample_descs.c; sourceTree = "<group>"; };
+ 71CCF1B51277045100339E12 /* stbl_read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stbl_read.c; sourceTree = "<group>"; };
+ 71CCF1B61277045100339E12 /* stbl_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stbl_write.c; sourceTree = "<group>"; };
+ 71CCF1B71277045100339E12 /* track.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = track.c; sourceTree = "<group>"; };
+ 71CCF1B81277045100339E12 /* tx3g.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tx3g.c; sourceTree = "<group>"; };
+ 71CCF1BA1277045100339E12 /* lsr_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsr_dec.c; sourceTree = "<group>"; };
+ 71CCF1BB1277045100339E12 /* lsr_enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsr_enc.c; sourceTree = "<group>"; };
+ 71CCF1BC1277045100339E12 /* lsr_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsr_tables.c; sourceTree = "<group>"; };
+ 71CCF1BE1277045100339E12 /* cbc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbc.c; sourceTree = "<group>"; };
+ 71CCF1BF1277045100339E12 /* cfb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfb.c; sourceTree = "<group>"; };
+ 71CCF1C01277045100339E12 /* ctr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr.c; sourceTree = "<group>"; };
+ 71CCF1C11277045100339E12 /* des.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = des.c; sourceTree = "<group>"; };
+ 71CCF1C21277045100339E12 /* ecb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecb.c; sourceTree = "<group>"; };
+ 71CCF1C31277045100339E12 /* g_crypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g_crypt.c; sourceTree = "<group>"; };
+ 71CCF1C41277045100339E12 /* ncfb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ncfb.c; sourceTree = "<group>"; };
+ 71CCF1C51277045100339E12 /* nofb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nofb.c; sourceTree = "<group>"; };
+ 71CCF1C61277045100339E12 /* ofb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ofb.c; sourceTree = "<group>"; };
+ 71CCF1C71277045100339E12 /* rijndael-128.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "rijndael-128.c"; sourceTree = "<group>"; };
+ 71CCF1C81277045100339E12 /* rijndael-192.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "rijndael-192.c"; sourceTree = "<group>"; };
+ 71CCF1C91277045100339E12 /* rijndael-256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "rijndael-256.c"; sourceTree = "<group>"; };
+ 71CCF1CA1277045100339E12 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = "<group>"; };
+ 71CCF1CB1277045100339E12 /* stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stream.c; sourceTree = "<group>"; };
+ 71CCF1CC1277045100339E12 /* tripledes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tripledes.c; sourceTree = "<group>"; };
+ 71CCF1CE1277045100339E12 /* av_parsers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = av_parsers.c; sourceTree = "<group>"; };
+ 71CCF1CF1277045100339E12 /* avilib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avilib.c; sourceTree = "<group>"; };
+ 71CCF1D01277045100339E12 /* dvb_mpe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dvb_mpe.c; sourceTree = "<group>"; };
+ 71CCF1D11277045100339E12 /* filestreamer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = filestreamer.c; sourceTree = "<group>"; };
+ 71CCF1D21277045100339E12 /* gpac_ogg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gpac_ogg.c; sourceTree = "<group>"; };
+ 71CCF1D31277045100339E12 /* img.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = img.c; sourceTree = "<group>"; };
+ 71CCF1D41277045100339E12 /* ismacryp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ismacryp.c; sourceTree = "<group>"; };
+ 71CCF1D51277045100339E12 /* isom_hinter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isom_hinter.c; sourceTree = "<group>"; };
+ 71CCF1D61277045100339E12 /* isom_tools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isom_tools.c; sourceTree = "<group>"; };
+ 71CCF1D71277045100339E12 /* m2ts_mux.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = m2ts_mux.c; sourceTree = "<group>"; };
+ 71CCF1D81277045100339E12 /* media_export.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_export.c; sourceTree = "<group>"; };
+ 71CCF1D91277045100339E12 /* media_import.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_import.c; sourceTree = "<group>"; };
+ 71CCF1DA1277045100339E12 /* mpeg2_ps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg2_ps.c; sourceTree = "<group>"; };
+ 71CCF1DB1277045100339E12 /* mpeg2_ps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg2_ps.h; sourceTree = "<group>"; };
+ 71CCF1DC1277045100339E12 /* mpegts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegts.c; sourceTree = "<group>"; };
+ 71CCF1DD1277045100339E12 /* reedsolomon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = reedsolomon.c; sourceTree = "<group>"; };
+ 71CCF1DE1277045100339E12 /* saf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = saf.c; sourceTree = "<group>"; };
+ 71CCF1DF1277045100339E12 /* text_import.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = text_import.c; sourceTree = "<group>"; };
+ 71CCF1E01277045100339E12 /* vobsub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vobsub.c; sourceTree = "<group>"; };
+ 71CCF1E21277045100339E12 /* desc_private.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = desc_private.c; sourceTree = "<group>"; };
+ 71CCF1E31277045100339E12 /* descriptors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = descriptors.c; sourceTree = "<group>"; };
+ 71CCF1E41277045100339E12 /* ipmpx_code.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ipmpx_code.c; sourceTree = "<group>"; };
+ 71CCF1E51277045100339E12 /* ipmpx_dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ipmpx_dump.c; sourceTree = "<group>"; };
+ 71CCF1E61277045100339E12 /* ipmpx_parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ipmpx_parse.c; sourceTree = "<group>"; };
+ 71CCF1E71277045100339E12 /* oci_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = oci_codec.c; sourceTree = "<group>"; };
+ 71CCF1E81277045100339E12 /* odf_code.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = odf_code.c; sourceTree = "<group>"; };
+ 71CCF1E91277045100339E12 /* odf_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = odf_codec.c; sourceTree = "<group>"; };
+ 71CCF1EA1277045100339E12 /* odf_command.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = odf_command.c; sourceTree = "<group>"; };
+ 71CCF1EB1277045100339E12 /* odf_dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = odf_dump.c; sourceTree = "<group>"; };
+ 71CCF1EC1277045100339E12 /* odf_parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = odf_parse.c; sourceTree = "<group>"; };
+ 71CCF1ED1277045100339E12 /* qos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qos.c; sourceTree = "<group>"; };
+ 71CCF1EE1277045100339E12 /* slc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = slc.c; sourceTree = "<group>"; };
+ 71CCF1F01277045100339E12 /* encode_isom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = encode_isom.c; sourceTree = "<group>"; };
+ 71CCF1F11277045100339E12 /* loader_bt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loader_bt.c; sourceTree = "<group>"; };
+ 71CCF1F21277045100339E12 /* loader_isom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loader_isom.c; sourceTree = "<group>"; };
+ 71CCF1F31277045100339E12 /* loader_qt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loader_qt.c; sourceTree = "<group>"; };
+ 71CCF1F41277045100339E12 /* loader_svg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loader_svg.c; sourceTree = "<group>"; };
+ 71CCF1F51277045100339E12 /* loader_xmt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loader_xmt.c; sourceTree = "<group>"; };
+ 71CCF1F61277045100339E12 /* scene_dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scene_dump.c; sourceTree = "<group>"; };
+ 71CCF1F71277045100339E12 /* scene_engine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scene_engine.c; sourceTree = "<group>"; };
+ 71CCF1F81277045100339E12 /* scene_manager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scene_manager.c; sourceTree = "<group>"; };
+ 71CCF1F91277045100339E12 /* scene_stats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scene_stats.c; sourceTree = "<group>"; };
+ 71CCF1FA1277045100339E12 /* swf_bifs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = swf_bifs.c; sourceTree = "<group>"; };
+ 71CCF1FB1277045100339E12 /* swf_parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = swf_parse.c; sourceTree = "<group>"; };
+ 71CCF1FC1277045100339E12 /* text_to_bifs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = text_to_bifs.c; sourceTree = "<group>"; };
+ 71CCF1FE1277045100339E12 /* base_scenegraph.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base_scenegraph.c; sourceTree = "<group>"; };
+ 71CCF1FF1277045100339E12 /* commands.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = commands.c; sourceTree = "<group>"; };
+ 71CCF2001277045100339E12 /* dom_events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dom_events.c; sourceTree = "<group>"; };
+ 71CCF2011277045100339E12 /* dom_smjs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dom_smjs.c; sourceTree = "<group>"; };
+ 71CCF2021277045100339E12 /* mpeg4_animators.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_animators.c; sourceTree = "<group>"; };
+ 71CCF2031277045100339E12 /* mpeg4_nodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_nodes.c; sourceTree = "<group>"; };
+ 71CCF2041277045100339E12 /* mpeg4_valuator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_valuator.c; sourceTree = "<group>"; };
+ 71CCF2051277045100339E12 /* smil_anim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smil_anim.c; sourceTree = "<group>"; };
+ 71CCF2061277045100339E12 /* smil_timing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smil_timing.c; sourceTree = "<group>"; };
+ 71CCF2071277045100339E12 /* svg_attributes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_attributes.c; sourceTree = "<group>"; };
+ 71CCF2081277045100339E12 /* svg_properties.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_properties.c; sourceTree = "<group>"; };
+ 71CCF2091277045100339E12 /* svg_smjs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_smjs.c; sourceTree = "<group>"; };
+ 71CCF20A1277045100339E12 /* svg_types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_types.c; sourceTree = "<group>"; };
+ 71CCF20B1277045100339E12 /* vrml_interpolators.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vrml_interpolators.c; sourceTree = "<group>"; };
+ 71CCF20C1277045100339E12 /* vrml_proto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vrml_proto.c; sourceTree = "<group>"; };
+ 71CCF20D1277045100339E12 /* vrml_route.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vrml_route.c; sourceTree = "<group>"; };
+ 71CCF20E1277045100339E12 /* vrml_script.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vrml_script.c; sourceTree = "<group>"; };
+ 71CCF20F1277045100339E12 /* vrml_smjs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vrml_smjs.c; sourceTree = "<group>"; };
+ 71CCF2101277045100339E12 /* vrml_tools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vrml_tools.c; sourceTree = "<group>"; };
+ 71CCF2111277045100339E12 /* x3d_nodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x3d_nodes.c; sourceTree = "<group>"; };
+ 71CCF2121277045100339E12 /* xbl_process.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xbl_process.c; sourceTree = "<group>"; };
+ 71CCF2131277045100339E12 /* xml_ns.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml_ns.c; sourceTree = "<group>"; };
+ 71CCF2151277045100339E12 /* channel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = channel.c; sourceTree = "<group>"; };
+ 71CCF2161277045100339E12 /* clock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = clock.c; sourceTree = "<group>"; };
+ 71CCF2171277045100339E12 /* decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = decoder.c; sourceTree = "<group>"; };
+ 71CCF2181277045100339E12 /* input_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = input_sensor.c; sourceTree = "<group>"; };
+ 71CCF2191277045100339E12 /* input_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = input_sensor.h; sourceTree = "<group>"; };
+ 71CCF21A1277045100339E12 /* media_control.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_control.c; sourceTree = "<group>"; };
+ 71CCF21B1277045100339E12 /* media_control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = media_control.h; sourceTree = "<group>"; };
+ 71CCF21C1277045100339E12 /* media_manager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_manager.c; sourceTree = "<group>"; };
+ 71CCF21D1277045100339E12 /* media_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_memory.c; sourceTree = "<group>"; };
+ 71CCF21E1277045100339E12 /* media_memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = media_memory.h; sourceTree = "<group>"; };
+ 71CCF21F1277045100339E12 /* media_object.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_object.c; sourceTree = "<group>"; };
+ 71CCF2201277045100339E12 /* media_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = media_sensor.c; sourceTree = "<group>"; };
+ 71CCF2211277045100339E12 /* mpeg4_inline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4_inline.c; sourceTree = "<group>"; };
+ 71CCF2221277045100339E12 /* network_service.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = network_service.c; sourceTree = "<group>"; };
+ 71CCF2231277045100339E12 /* object_browser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = object_browser.c; sourceTree = "<group>"; };
+ 71CCF2241277045100339E12 /* object_manager.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = object_manager.c; sourceTree = "<group>"; };
+ 71CCF2251277045100339E12 /* scene.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scene.c; sourceTree = "<group>"; };
+ 71CCF2261277045100339E12 /* svg_external.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg_external.c; sourceTree = "<group>"; };
+ 71CCF2271277045100339E12 /* term_node_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = term_node_init.c; sourceTree = "<group>"; };
+ 71CCF2281277045100339E12 /* terminal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = terminal.c; sourceTree = "<group>"; };
+ 71CCF22A1277045100339E12 /* base_encoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base_encoding.c; sourceTree = "<group>"; };
+ 71CCF22B1277045100339E12 /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = "<group>"; };
+ 71CCF22C1277045100339E12 /* color.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = color.c; sourceTree = "<group>"; };
+ 71CCF22D1277045100339E12 /* configfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = configfile.c; sourceTree = "<group>"; };
+ 71CCF22E1277045100339E12 /* dlmalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dlmalloc.c; sourceTree = "<group>"; };
+ 71CCF22F1277045100339E12 /* downloader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = downloader.c; sourceTree = "<group>"; };
+ 71CCF2301277045100339E12 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = "<group>"; };
+ 71CCF2321277045100339E12 /* list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = list.c; sourceTree = "<group>"; };
+ 71CCF2331277045100339E12 /* math.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = math.c; sourceTree = "<group>"; };
+ 71CCF2341277045100339E12 /* module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = module.c; sourceTree = "<group>"; };
+ 71CCF2351277045100339E12 /* module_wrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = module_wrap.h; sourceTree = "<group>"; };
+ 71CCF2361277045100339E12 /* os_divers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = os_divers.c; sourceTree = "<group>"; };
+ 71CCF2371277045100339E12 /* os_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = os_module.c; sourceTree = "<group>"; };
+ 71CCF2381277045100339E12 /* os_net.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = os_net.c; sourceTree = "<group>"; };
+ 71CCF2391277045100339E12 /* os_thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = os_thread.c; sourceTree = "<group>"; };
+ 71CCF23A1277045100339E12 /* path2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = path2d.c; sourceTree = "<group>"; };
+ 71CCF23B1277045100339E12 /* path2d_stroker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = path2d_stroker.c; sourceTree = "<group>"; };
+ 71CCF23E1277045100339E12 /* token.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = token.c; sourceTree = "<group>"; };
+ 71CCF23F1277045100339E12 /* uni_bidi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uni_bidi.c; sourceTree = "<group>"; };
+ 71CCF2401277045100339E12 /* url.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = url.c; sourceTree = "<group>"; };
+ 71CCF2411277045100339E12 /* utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf.c; sourceTree = "<group>"; };
+ 71CCF2421277045100339E12 /* xml_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml_parser.c; sourceTree = "<group>"; };
+ 71CCF2441277045100339E12 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zutil.c; sourceTree = "<group>"; };
+ 71CCF2451277045100339E12 /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zutil.h; sourceTree = "<group>"; };
+ 71CCF36012770A8C00339E12 /* avparse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avparse.h; sourceTree = "<group>"; };
+ 71CCF36112770A8C00339E12 /* base_coding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base_coding.h; sourceTree = "<group>"; };
+ 71CCF36212770A8C00339E12 /* bifs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bifs.h; sourceTree = "<group>"; };
+ 71CCF36312770A8C00339E12 /* bitstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitstream.h; sourceTree = "<group>"; };
+ 71CCF36412770A8C00339E12 /* color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = color.h; sourceTree = "<group>"; };
+ 71CCF36512770A8C00339E12 /* compositor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compositor.h; sourceTree = "<group>"; };
+ 71CCF36612770A8C00339E12 /* config_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config_file.h; sourceTree = "<group>"; };
+ 71CCF36712770A8C00339E12 /* configuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = configuration.h; sourceTree = "<group>"; };
+ 71CCF36812770A8C00339E12 /* constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constants.h; sourceTree = "<group>"; };
+ 71CCF36912770A8C00339E12 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; };
+ 71CCF36A12770A8C00339E12 /* download.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = download.h; sourceTree = "<group>"; };
+ 71CCF36B12770A8C00339E12 /* dvb_mpe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dvb_mpe.h; sourceTree = "<group>"; };
+ 71CCF36C12770A8C00339E12 /* esi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = esi.h; sourceTree = "<group>"; };
+ 71CCF36D12770A8C00339E12 /* events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = events.h; sourceTree = "<group>"; };
+ 71CCF36E12770A8C00339E12 /* filestreamer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = filestreamer.h; sourceTree = "<group>"; };
+ 71CCF36F12770A8C00339E12 /* ietf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ietf.h; sourceTree = "<group>"; };
+ 71CCF37112770A8C00339E12 /* avilib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avilib.h; sourceTree = "<group>"; };
+ 71CCF37212770A8C00339E12 /* bifs_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bifs_dev.h; sourceTree = "<group>"; };
+ 71CCF37312770A8C00339E12 /* bifs_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bifs_tables.h; sourceTree = "<group>"; };
+ 71CCF37412770A8C00339E12 /* camera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = camera.h; sourceTree = "<group>"; };
+ 71CCF37512770A8C00339E12 /* compositor_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compositor_dev.h; sourceTree = "<group>"; };
+ 71CCF37612770A8C00339E12 /* crypt_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt_dev.h; sourceTree = "<group>"; };
+ 71CCF37712770A8C00339E12 /* dvb_mpe_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dvb_mpe_dev.h; sourceTree = "<group>"; };
+ 71CCF37812770A8C00339E12 /* ietf_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ietf_dev.h; sourceTree = "<group>"; };
+ 71CCF37912770A8C00339E12 /* isomedia_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = isomedia_dev.h; sourceTree = "<group>"; };
+ 71CCF37A12770A8C00339E12 /* laser_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = laser_dev.h; sourceTree = "<group>"; };
+ 71CCF37B12770A8C00339E12 /* media_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = media_dev.h; sourceTree = "<group>"; };
+ 71CCF37C12770A8C00339E12 /* mesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mesh.h; sourceTree = "<group>"; };
+ 71CCF37D12770A8C00339E12 /* odf_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = odf_dev.h; sourceTree = "<group>"; };
+ 71CCF37E12770A8C00339E12 /* ogg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ogg.h; sourceTree = "<group>"; };
+ 71CCF37F12770A8C00339E12 /* reedsolomon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reedsolomon.h; sourceTree = "<group>"; };
+ 71CCF38012770A8C00339E12 /* scenegraph_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scenegraph_dev.h; sourceTree = "<group>"; };
+ 71CCF38112770A8C00339E12 /* swf_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swf_dev.h; sourceTree = "<group>"; };
+ 71CCF38212770A8C00339E12 /* terminal_dev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terminal_dev.h; sourceTree = "<group>"; };
+ 71CCF38312770A8C00339E12 /* vobsub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vobsub.h; sourceTree = "<group>"; };
+ 71CCF38412770A8C00339E12 /* ismacryp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ismacryp.h; sourceTree = "<group>"; };
+ 71CCF38512770A8C00339E12 /* iso639.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iso639.h; sourceTree = "<group>"; };
+ 71CCF38612770A8C00339E12 /* isomedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = isomedia.h; sourceTree = "<group>"; };
+ 71CCF38712770A8C00339E12 /* laser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = laser.h; sourceTree = "<group>"; };
+ 71CCF38812770A8C00339E12 /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = list.h; sourceTree = "<group>"; };
+ 71CCF38912770A8C00339E12 /* math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = math.h; sourceTree = "<group>"; };
+ 71CCF38A12770A8C00339E12 /* media_tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = media_tools.h; sourceTree = "<group>"; };
+ 71CCF38B12770A8C00339E12 /* mediaobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mediaobject.h; sourceTree = "<group>"; };
+ 71CCF38C12770A8C00339E12 /* module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = module.h; sourceTree = "<group>"; };
+ 71CCF38E12770A8C00339E12 /* audio_out.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_out.h; sourceTree = "<group>"; };
+ 71CCF38F12770A8C00339E12 /* codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = codec.h; sourceTree = "<group>"; };
+ 71CCF39012770A8C00339E12 /* font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font.h; sourceTree = "<group>"; };
+ 71CCF39112770A8C00339E12 /* ipmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ipmp.h; sourceTree = "<group>"; };
+ 71CCF39212770A8C00339E12 /* js_usr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_usr.h; sourceTree = "<group>"; };
+ 71CCF39312770A8C00339E12 /* raster2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = raster2d.h; sourceTree = "<group>"; };
+ 71CCF39412770A8C00339E12 /* service.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = service.h; sourceTree = "<group>"; };
+ 71CCF39512770A8C00339E12 /* term_ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = term_ext.h; sourceTree = "<group>"; };
+ 71CCF39612770A8C00339E12 /* video_out.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_out.h; sourceTree = "<group>"; };
+ 71CCF39712770A8C00339E12 /* mpeg4_odf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg4_odf.h; sourceTree = "<group>"; };
+ 71CCF39812770A8C00339E12 /* mpegts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegts.h; sourceTree = "<group>"; };
+ 71CCF39912770A8C00339E12 /* network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = network.h; sourceTree = "<group>"; };
+ 71CCF39A12770A8C00339E12 /* nodes_mpeg4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nodes_mpeg4.h; sourceTree = "<group>"; };
+ 71CCF39B12770A8C00339E12 /* nodes_svg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nodes_svg.h; sourceTree = "<group>"; };
+ 71CCF39C12770A8C00339E12 /* nodes_x3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nodes_x3d.h; sourceTree = "<group>"; };
+ 71CCF39D12770A8C00339E12 /* nodes_xbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nodes_xbl.h; sourceTree = "<group>"; };
+ 71CCF39E12770A8C00339E12 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = "<group>"; };
+ 71CCF39F12770A8C00339E12 /* path2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = path2d.h; sourceTree = "<group>"; };
+ 71CCF3A012770A8C00339E12 /* rtp_streamer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtp_streamer.h; sourceTree = "<group>"; };
+ 71CCF3A112770A8C00339E12 /* scene_engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scene_engine.h; sourceTree = "<group>"; };
+ 71CCF3A212770A8C00339E12 /* scene_manager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scene_manager.h; sourceTree = "<group>"; };
+ 71CCF3A312770A8C00339E12 /* scenegraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scenegraph.h; sourceTree = "<group>"; };
+ 71CCF3A412770A8C00339E12 /* scenegraph_svg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scenegraph_svg.h; sourceTree = "<group>"; };
+ 71CCF3A512770A8C00339E12 /* scenegraph_vrml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scenegraph_vrml.h; sourceTree = "<group>"; };
+ 71CCF3A612770A8C00339E12 /* setup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setup.h; sourceTree = "<group>"; };
+ 71CCF3A712770A8C00339E12 /* svg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svg_types.h; sourceTree = "<group>"; };
+ 71CCF3A812770A8C00339E12 /* sync_layer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sync_layer.h; sourceTree = "<group>"; };
+ 71CCF3A912770A8C00339E12 /* term_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = term_info.h; sourceTree = "<group>"; };
+ 71CCF3AA12770A8C00339E12 /* terminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terminal.h; sourceTree = "<group>"; };
+ 71CCF3AB12770A8C00339E12 /* thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = thread.h; sourceTree = "<group>"; };
+ 71CCF3AC12770A8C00339E12 /* token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = token.h; sourceTree = "<group>"; };
+ 71CCF3AD12770A8C00339E12 /* tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tools.h; sourceTree = "<group>"; };
+ 71CCF3AE12770A8C00339E12 /* user.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user.h; sourceTree = "<group>"; };
+ 71CCF3AF12770A8C00339E12 /* utf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf.h; sourceTree = "<group>"; };
+ 71CCF3B012770A8C00339E12 /* xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = "<group>"; };
+ 71F2A45012830B1400C384DE /* libfaad.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfaad.a; path = ../../extra_lib/lib/iOS/libfaad.a; sourceTree = SOURCE_ROOT; };
+ 71F2A45112830B1400C384DE /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../../extra_lib/lib/iOS/libfreetype.a; sourceTree = SOURCE_ROOT; };
+ 71F2A45312830B1400C384DE /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../../extra_lib/lib/iOS/libjpeg.a; sourceTree = SOURCE_ROOT; };
+ 71F2A45412830B1400C384DE /* libjs.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjs.a; path = ../../extra_lib/lib/iOS/libjs.a; sourceTree = SOURCE_ROOT; };
+ 71F2A45512830B1400C384DE /* libmad.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmad.a; path = ../../extra_lib/lib/iOS/libmad.a; sourceTree = SOURCE_ROOT; };
+ 71F2A45612830B1400C384DE /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../../extra_lib/lib/iOS/libpng.a; sourceTree = SOURCE_ROOT; };
+ 71F2A45712830B1400C384DE /* libSDL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSDL.a; path = ../../extra_lib/lib/iOS/libSDL.a; sourceTree = SOURCE_ROOT; };
+ 970A26C713434D2C0007362C /* m3u8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = m3u8.c; sourceTree = "<group>"; };
+ 970A26C813434D2C0007362C /* mpd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpd.c; sourceTree = "<group>"; };
+ 970A26CB13434D780007362C /* m3u8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = m3u8.h; sourceTree = "<group>"; };
+ 970A26CC13434D780007362C /* mpd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpd.h; sourceTree = "<group>"; };
+ 970A26CF13434D960007362C /* cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = "<group>"; };
+ 970A26D013434D960007362C /* ringbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ringbuffer.h; sourceTree = "<group>"; };
+ 970A26D113434D960007362C /* unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode.h; sourceTree = "<group>"; };
+ 970A26D513434DAC0007362C /* ringbuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ringbuffer.c; sourceTree = "<group>"; };
+ 970A26D613434DAC0007362C /* unicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unicode.c; sourceTree = "<group>"; };
+ 970A270D1343540C0007362C /* libgcc_s.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgcc_s.1.dylib; path = usr/lib/libgcc_s.1.dylib; sourceTree = SDKROOT; };
+ 970A283F134462AE0007362C /* libgpac_dynamic.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgpac_dynamic.dylib; path = "build/Release-iphonesimulator/libgpac_dynamic.dylib"; sourceTree = "<group>"; };
+ 970A28521344632F0007362C /* libgpac_dynamic.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgpac_dynamic.dylib; path = ../../bin/iOS/osmo4ios.app/libgpac_dynamic.dylib; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 71179CC21292EC3400A83216 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71179CF31292EDED00A83216 /* libc.dylib in Frameworks */,
+ 970A2850134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28631344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718477CE127814B200917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 718477E4127817B700917298 /* libgpac_static.a in Frameworks */,
+ 71847812127860F000917298 /* libc.dylib in Frameworks */,
+ 71847814127860F000917298 /* libz.dylib in Frameworks */,
+ 71F2A45E12830B5300C384DE /* libjs.a in Frameworks */,
+ 71F2A46E12830BE200C384DE /* libjpeg.a in Frameworks */,
+ 71F2A46F12830BE800C384DE /* libpng.a in Frameworks */,
+ 970A270E1343540C0007362C /* libgcc_s.1.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184782F1278645B00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A1A12787BFB00ACFF58 /* libc.dylib in Frameworks */,
+ 970A27E2134377400007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A2840134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28531344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478361278647200917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A2112787C3200ACFF58 /* libc.dylib in Frameworks */,
+ 970A2841134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28541344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184783F127864AC00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A2C12787C6800ACFF58 /* libc.dylib in Frameworks */,
+ 970A27E3134377430007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A2843134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28561344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478471278654000917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A3F12787CB800ACFF58 /* libc.dylib in Frameworks */,
+ 71179CA31292E7BA00A83216 /* libfaad.a in Frameworks */,
+ 970A27E4134377440007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A2842134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28551344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184784E1278655800917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A4512787CDB00ACFF58 /* libc.dylib in Frameworks */,
+ 71A19A4912787CF000ACFF58 /* libz.dylib in Frameworks */,
+ 970A2844134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28571344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478551278656E00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A5212787D0E00ACFF58 /* libc.dylib in Frameworks */,
+ 71179CAE1292E7F700A83216 /* libmad.a in Frameworks */,
+ 970A27E5134377480007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A2845134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28581344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184785C1278657F00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A5B12787D2A00ACFF58 /* libc.dylib in Frameworks */,
+ 970A2846134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28591344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478631278658A00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A6112787D4000ACFF58 /* libc.dylib in Frameworks */,
+ 970A2847134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A285A1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184786A127865A200917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A6712787D8300ACFF58 /* libc.dylib in Frameworks */,
+ 970A2848134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A285B1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847871127865B700917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A6D12787D9800ACFF58 /* libc.dylib in Frameworks */,
+ 970A27E6134377490007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A2849134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A285C1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847878127865CB00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A7712787DC100ACFF58 /* libc.dylib in Frameworks */,
+ 970A284A134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A285D1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184787F127865D600917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A7D12787DD700ACFF58 /* libc.dylib in Frameworks */,
+ 970A284B134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A285E1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184788F127865F700917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A8312787DED00ACFF58 /* libc.dylib in Frameworks */,
+ 970A27E71343774A0007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A284D134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28601344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478961278660400917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19A8912787E0400ACFF58 /* libc.dylib in Frameworks */,
+ 970A27E81343774B0007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A284C134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A285F1344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184789D1278661700917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19AA612795BE100ACFF58 /* libc.dylib in Frameworks */,
+ 71F2A4BA12830E3000C384DE /* libfreetype.a in Frameworks */,
+ 71F2A4C512830E5A00C384DE /* libz.dylib in Frameworks */,
+ 970A27E91343774C0007362C /* libgcc_s.1.dylib in Frameworks */,
+ 970A284E134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28611344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478A41278662F00917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19AAF12795C3100ACFF58 /* libc.dylib in Frameworks */,
+ 71A19AB312795C4900ACFF58 /* libz.dylib in Frameworks */,
+ 970A284F134462AE0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28621344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478AF1278666100917298 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19ABE12795C7E00ACFF58 /* libc.dylib in Frameworks */,
+ 970A2851134462AF0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ 970A28641344632F0007362C /* libgpac_dynamic.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71A19B1812796B5600ACFF58 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19BB212797D1B00ACFF58 /* OpenGLES.framework in Frameworks */,
+ 71A19BB912797D4800ACFF58 /* AudioToolbox.framework in Frameworks */,
+ 71A19BC412797D9200ACFF58 /* libobjc.dylib in Frameworks */,
+ 71A19BCD12797DBA00ACFF58 /* UIKit.framework in Frameworks */,
+ 71A19C3B12797E4000ACFF58 /* CoreGraphics.framework in Frameworks */,
+ 71A19C3D12797E4000ACFF58 /* Foundation.framework in Frameworks */,
+ 71A19C3F12797E4000ACFF58 /* QuartzCore.framework in Frameworks */,
+ 71A19C4112797E4000ACFF58 /* libdl.dylib in Frameworks */,
+ 71F2A4D012830E7400C384DE /* libSDL.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71CCF12F1277037A00339E12 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 71179CB91292EC1800A83216 /* mpd_in */,
+ 71A199061278765600ACFF58 /* aac_in */,
+ 71A1990D1278767B00ACFF58 /* bifs_dec */,
+ 71A1992C127876B000ACFF58 /* ctx_load */,
+ 71A19927127876A200ACFF58 /* dummy_in */,
+ 71A199801278776700ACFF58 /* ft_font */,
+ 71A1994E127876FA00ACFF58 /* gpac_js */,
+ 71A1993D127876E300ACFF58 /* img_in */,
+ 71A199531278770900ACFF58 /* isom_in */,
+ 71A199601278772500ACFF58 /* laser_dec */,
+ 71CCF1381277041D00339E12 /* libgpac */,
+ 71A19936127876D300ACFF58 /* mp3_in */,
+ 71A1997B1278775900ACFF58 /* mpegts_in */,
+ 71A199651278773900ACFF58 /* odf_dec */,
+ 71A19B1412796AC700ACFF58 /* osmo4iOS */,
+ 71A1996A1278774A00ACFF58 /* rtp_in */,
+ 71A199981278778800ACFF58 /* sdl_out */,
+ 71A199141278769100ACFF58 /* soft_raster */,
+ 71A19931127876C300ACFF58 /* svg_in */,
+ 71A199871278777A00ACFF58 /* widgetman */,
+ 7184780712785F7B00917298 /* Frameworks */,
+ 71CCF1321277037A00339E12 /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 71179CB91292EC1800A83216 /* mpd_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71179CBF1292EC1800A83216 /* mpd_in.c */,
+ );
+ name = mpd_in;
+ path = ../../modules/mpd_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 7184780712785F7B00917298 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 970A28521344632F0007362C /* libgpac_dynamic.dylib */,
+ 970A283F134462AE0007362C /* libgpac_dynamic.dylib */,
+ 970A270D1343540C0007362C /* libgcc_s.1.dylib */,
+ 71F2A45012830B1400C384DE /* libfaad.a */,
+ 71F2A45112830B1400C384DE /* libfreetype.a */,
+ 71F2A45312830B1400C384DE /* libjpeg.a */,
+ 71F2A45412830B1400C384DE /* libjs.a */,
+ 71F2A45512830B1400C384DE /* libmad.a */,
+ 71F2A45612830B1400C384DE /* libpng.a */,
+ 71F2A45712830B1400C384DE /* libSDL.a */,
+ 71A19C3A12797E4000ACFF58 /* CoreGraphics.framework */,
+ 71A19C3C12797E4000ACFF58 /* Foundation.framework */,
+ 71A19C3E12797E4000ACFF58 /* QuartzCore.framework */,
+ 71A19C4012797E4000ACFF58 /* libdl.dylib */,
+ 71A19BB112797D1B00ACFF58 /* OpenGLES.framework */,
+ 71A19BB812797D4800ACFF58 /* AudioToolbox.framework */,
+ 71A19BC312797D9200ACFF58 /* libobjc.dylib */,
+ 71A19BCC12797DBA00ACFF58 /* UIKit.framework */,
+ 71847811127860F000917298 /* libc.dylib */,
+ 71847813127860F000917298 /* libz.dylib */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 71A199061278765600ACFF58 /* aac_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199071278765600ACFF58 /* aac_in.c */,
+ 71A199081278765600ACFF58 /* faad_dec.c */,
+ );
+ name = aac_in;
+ path = ../../modules/aac_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A1990D1278767B00ACFF58 /* bifs_dec */ = {
+ isa = PBXGroup;
+ children = (
+ 71A1990E1278767B00ACFF58 /* bifs_dec.c */,
+ );
+ name = bifs_dec;
+ path = ../../modules/bifs_dec;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199141278769100ACFF58 /* soft_raster */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199151278769100ACFF58 /* ftgrays.c */,
+ 71A199171278769100ACFF58 /* rast_soft.h */,
+ 71A199181278769100ACFF58 /* raster_565.c */,
+ 71A199191278769100ACFF58 /* raster_argb.c */,
+ 71A1991A1278769100ACFF58 /* raster_load.c */,
+ 71A1991B1278769100ACFF58 /* raster_rgb.c */,
+ 71A1991C1278769100ACFF58 /* stencil.c */,
+ 71A1991D1278769100ACFF58 /* surface.c */,
+ );
+ name = soft_raster;
+ path = ../../modules/soft_raster;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A19927127876A200ACFF58 /* dummy_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A19928127876A200ACFF58 /* dummy_in.c */,
+ );
+ name = dummy_in;
+ path = ../../modules/dummy_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A1992C127876B000ACFF58 /* ctx_load */ = {
+ isa = PBXGroup;
+ children = (
+ 71A1992D127876B000ACFF58 /* ctx_load.c */,
+ );
+ name = ctx_load;
+ path = ../../modules/ctx_load;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A19931127876C300ACFF58 /* svg_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A19933127876C300ACFF58 /* svg_in.c */,
+ );
+ name = svg_in;
+ path = ../../modules/svg_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A19936127876D300ACFF58 /* mp3_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A19937127876D300ACFF58 /* mad_dec.c */,
+ 71A19939127876D300ACFF58 /* mp3_in.c */,
+ );
+ name = mp3_in;
+ path = ../../modules/mp3_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A1993D127876E300ACFF58 /* img_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A1993E127876E300ACFF58 /* bmp_dec.c */,
+ 71A1993F127876E300ACFF58 /* img_dec.c */,
+ 71A19940127876E300ACFF58 /* img_in.c */,
+ 71A19941127876E300ACFF58 /* img_in.h */,
+ 71A19942127876E300ACFF58 /* jp2_dec.c */,
+ 71A19943127876E300ACFF58 /* jpeg_dec.c */,
+ 71A19945127876E300ACFF58 /* png_dec.c */,
+ );
+ name = img_in;
+ path = ../../modules/img_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A1994E127876FA00ACFF58 /* gpac_js */ = {
+ isa = PBXGroup;
+ children = (
+ 71A1994F127876FA00ACFF58 /* gpac_js.c */,
+ );
+ name = gpac_js;
+ path = ../../modules/gpac_js;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199531278770900ACFF58 /* isom_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199541278770900ACFF58 /* cache.c */,
+ 71A199551278770900ACFF58 /* isom_in.h */,
+ 71A199561278770900ACFF58 /* load.c */,
+ 71A199581278770900ACFF58 /* read.c */,
+ 71A199591278770900ACFF58 /* read_ch.c */,
+ );
+ name = isom_in;
+ path = ../../modules/isom_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199601278772500ACFF58 /* laser_dec */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199611278772500ACFF58 /* laser_dec.c */,
+ );
+ name = laser_dec;
+ path = ../../modules/laser_dec;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199651278773900ACFF58 /* odf_dec */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199671278773900ACFF58 /* odf_dec.c */,
+ );
+ name = odf_dec;
+ path = ../../modules/odf_dec;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A1996A1278774A00ACFF58 /* rtp_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A1996C1278774A00ACFF58 /* rtp_in.c */,
+ 71A1996D1278774A00ACFF58 /* rtp_in.h */,
+ 71A1996E1278774A00ACFF58 /* rtp_session.c */,
+ 71A1996F1278774A00ACFF58 /* rtp_signaling.c */,
+ 71A199701278774A00ACFF58 /* rtp_stream.c */,
+ 71A199711278774A00ACFF58 /* sdp_fetch.c */,
+ 71A199721278774A00ACFF58 /* sdp_load.c */,
+ );
+ name = rtp_in;
+ path = ../../modules/rtp_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A1997B1278775900ACFF58 /* mpegts_in */ = {
+ isa = PBXGroup;
+ children = (
+ 71A1997D1278775900ACFF58 /* mpegts_in.c */,
+ );
+ name = mpegts_in;
+ path = ../../modules/mpegts_in;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199801278776700ACFF58 /* ft_font */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199811278776700ACFF58 /* ft_font.c */,
+ 71A199821278776700ACFF58 /* ft_font.h */,
+ );
+ name = ft_font;
+ path = ../../modules/ft_font;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199871278777A00ACFF58 /* widgetman */ = {
+ isa = PBXGroup;
+ children = (
+ 71A199891278777A00ACFF58 /* unzip.c */,
+ 71A1998A1278777A00ACFF58 /* unzip.h */,
+ 71A1998B1278777A00ACFF58 /* wgt_load.c */,
+ 71A1998C1278777A00ACFF58 /* wgt_load_base.js */,
+ 71A1998D1278777A00ACFF58 /* widget.c */,
+ 71A1998E1278777A00ACFF58 /* widgetman.c */,
+ 71A1998F1278777A00ACFF58 /* widgetman.h */,
+ );
+ name = widgetman;
+ path = ../../modules/widgetman;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A199981278778800ACFF58 /* sdl_out */ = {
+ isa = PBXGroup;
+ children = (
+ 71A19B3F12796FCC00ACFF58 /* module_av_generic.c */,
+ 71A199991278778800ACFF58 /* audio.c */,
+ 71A1999A1278778800ACFF58 /* cursors.c */,
+ 71A1999C1278778800ACFF58 /* sdl_out.c */,
+ 71A1999D1278778800ACFF58 /* sdl_out.h */,
+ 71A1999E1278778800ACFF58 /* video.c */,
+ 71A1999F1278778800ACFF58 /* video2d.c */,
+ );
+ name = sdl_out;
+ path = ../../modules/sdl_out;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71A19B1412796AC700ACFF58 /* osmo4iOS */ = {
+ isa = PBXGroup;
+ children = (
+ 71A19B43127971C700ACFF58 /* libgpac_symbols.h */,
+ 71A19B411279713300ACFF58 /* extract.c */,
+ 71A19B2012796B6F00ACFF58 /* main.c */,
+ 71A19B1C12796B5700ACFF58 /* osmo4ios-Info.plist */,
+ );
+ name = osmo4iOS;
+ sourceTree = "<group>";
+ };
+ 71CCF1321277037A00339E12 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1311277037A00339E12 /* libgpac_static.a */,
+ 718477D0127814B200917298 /* libgpac_dynamic.dylib */,
+ 718478311278645B00917298 /* gm_soft_raster.dylib */,
+ 718478381278647200917298 /* gm_dummy_in.dylib */,
+ 71847841127864AC00917298 /* gm_ctx_load.dylib */,
+ 718478491278654000917298 /* gm_aac_in.dylib */,
+ 718478501278655800917298 /* gm_svg_in.dylib */,
+ 718478571278656E00917298 /* gm_mp3_in.dylib */,
+ 7184785E1278657F00917298 /* gm_img_in.dylib */,
+ 718478651278658A00917298 /* gm_bifs_dec.dylib */,
+ 7184786C127865A200917298 /* gm_gpac_js.dylib */,
+ 71847873127865B700917298 /* gm_isom_in.dylib */,
+ 7184787A127865CB00917298 /* gm_laser_dec.dylib */,
+ 71847881127865D600917298 /* gm_odf_dec.dylib */,
+ 71847891127865F700917298 /* gm_rtp_in.dylib */,
+ 718478981278660400917298 /* gm_mpegts_in.dylib */,
+ 7184789F1278661700917298 /* gm_ft_font.dylib */,
+ 718478A61278662F00917298 /* gm_widgetman.dylib */,
+ 718478B11278666100917298 /* gm_sdl_out.dylib */,
+ 71A19B1A12796B5600ACFF58 /* osmo4ios.app */,
+ 71179CC41292EC3400A83216 /* gm_mpd_in.dylib */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 71CCF1381277041D00339E12 /* libgpac */ = {
+ isa = PBXGroup;
+ children = (
+ 718477F912781DEB00917298 /* empty.c */,
+ 71CCF35E12770A8C00339E12 /* include */,
+ 71CCF1391277045100339E12 /* bifs */,
+ 71CCF14A1277045100339E12 /* compositor */,
+ 71CCF1911277045100339E12 /* ietf */,
+ 71CCF19F1277045100339E12 /* isomedia */,
+ 71CCF1B91277045100339E12 /* laser */,
+ 71CCF1BD1277045100339E12 /* mcrypt */,
+ 71CCF1CD1277045100339E12 /* media_tools */,
+ 71CCF1E11277045100339E12 /* odf */,
+ 71CCF1EF1277045100339E12 /* scene_manager */,
+ 71CCF1FD1277045100339E12 /* scenegraph */,
+ 71CCF2141277045100339E12 /* terminal */,
+ 71CCF2291277045100339E12 /* utils */,
+ );
+ name = libgpac;
+ sourceTree = "<group>";
+ };
+ 71CCF1391277045100339E12 /* bifs */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF13A1277045100339E12 /* arith_decoder.c */,
+ 71CCF13B1277045100339E12 /* bifs_codec.c */,
+ 71CCF13C1277045100339E12 /* bifs_node_tables.c */,
+ 71CCF13D1277045100339E12 /* com_dec.c */,
+ 71CCF13E1277045100339E12 /* com_enc.c */,
+ 71CCF13F1277045100339E12 /* conditional.c */,
+ 71CCF1401277045100339E12 /* field_decode.c */,
+ 71CCF1411277045100339E12 /* field_encode.c */,
+ 71CCF1421277045100339E12 /* memory_decoder.c */,
+ 71CCF1431277045100339E12 /* predictive_mffield.c */,
+ 71CCF1441277045100339E12 /* quant.h */,
+ 71CCF1451277045100339E12 /* quantize.c */,
+ 71CCF1461277045100339E12 /* script.h */,
+ 71CCF1471277045100339E12 /* script_dec.c */,
+ 71CCF1481277045100339E12 /* script_enc.c */,
+ 71CCF1491277045100339E12 /* unquantize.c */,
+ );
+ name = bifs;
+ path = ../../src/bifs;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF14A1277045100339E12 /* compositor */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF14B1277045100339E12 /* audio_input.c */,
+ 71CCF14C1277045100339E12 /* audio_mixer.c */,
+ 71CCF14D1277045100339E12 /* audio_render.c */,
+ 71CCF14E1277045100339E12 /* bindable.c */,
+ 71CCF14F1277045100339E12 /* camera.c */,
+ 71CCF1501277045100339E12 /* compositor.c */,
+ 71CCF1511277045100339E12 /* compositor_2d.c */,
+ 71CCF1521277045100339E12 /* compositor_3d.c */,
+ 71CCF1531277045100339E12 /* compositor_node_init.c */,
+ 71CCF1541277045100339E12 /* drawable.c */,
+ 71CCF1551277045100339E12 /* drawable.h */,
+ 71CCF1561277045100339E12 /* events.c */,
+ 71CCF1571277045100339E12 /* font_engine.c */,
+ 71CCF1581277045100339E12 /* gl_inc.h */,
+ 71CCF1591277045100339E12 /* hardcoded_protos.c */,
+ 71CCF15A1277045100339E12 /* hc_flash_shape.c */,
+ 71CCF15B1277045100339E12 /* mesh.c */,
+ 71CCF15C1277045100339E12 /* mesh_collide.c */,
+ 71CCF15D1277045100339E12 /* mesh_tesselate.c */,
+ 71CCF15E1277045100339E12 /* mpeg4_animstream.c */,
+ 71CCF15F1277045100339E12 /* mpeg4_audio.c */,
+ 71CCF1601277045100339E12 /* mpeg4_background.c */,
+ 71CCF1611277045100339E12 /* mpeg4_background2d.c */,
+ 71CCF1621277045100339E12 /* mpeg4_bitmap.c */,
+ 71CCF1631277045100339E12 /* mpeg4_composite.c */,
+ 71CCF1641277045100339E12 /* mpeg4_form.c */,
+ 71CCF1651277045100339E12 /* mpeg4_geometry_2d.c */,
+ 71CCF1661277045100339E12 /* mpeg4_geometry_3d.c */,
+ 71CCF1671277045100339E12 /* mpeg4_geometry_ifs2d.c */,
+ 71CCF1681277045100339E12 /* mpeg4_geometry_ils2d.c */,
+ 71CCF1691277045100339E12 /* mpeg4_gradients.c */,
+ 71CCF16A1277045100339E12 /* mpeg4_grouping.c */,
+ 71CCF16B1277045100339E12 /* mpeg4_grouping.h */,
+ 71CCF16C1277045100339E12 /* mpeg4_grouping_2d.c */,
+ 71CCF16D1277045100339E12 /* mpeg4_grouping_3d.c */,
+ 71CCF16E1277045100339E12 /* mpeg4_layer_2d.c */,
+ 71CCF16F1277045100339E12 /* mpeg4_layer_3d.c */,
+ 71CCF1701277045100339E12 /* mpeg4_layout.c */,
+ 71CCF1711277045100339E12 /* mpeg4_lighting.c */,
+ 71CCF1721277045100339E12 /* mpeg4_path_layout.c */,
+ 71CCF1731277045100339E12 /* mpeg4_sensors.c */,
+ 71CCF1741277045100339E12 /* mpeg4_sound.c */,
+ 71CCF1751277045100339E12 /* mpeg4_text.c */,
+ 71CCF1761277045100339E12 /* mpeg4_textures.c */,
+ 71CCF1771277045100339E12 /* mpeg4_timesensor.c */,
+ 71CCF1781277045100339E12 /* mpeg4_viewport.c */,
+ 71CCF1791277045100339E12 /* navigate.c */,
+ 71CCF17A1277045100339E12 /* nodes_stacks.h */,
+ 71CCF17B1277045100339E12 /* offscreen_cache.c */,
+ 71CCF17C1277045100339E12 /* offscreen_cache.h */,
+ 71CCF17D1277045100339E12 /* svg_base.c */,
+ 71CCF17E1277045100339E12 /* svg_filters.c */,
+ 71CCF17F1277045100339E12 /* svg_font.c */,
+ 71CCF1801277045100339E12 /* svg_geometry.c */,
+ 71CCF1811277045100339E12 /* svg_grouping.c */,
+ 71CCF1821277045100339E12 /* svg_media.c */,
+ 71CCF1831277045100339E12 /* svg_paint_servers.c */,
+ 71CCF1841277045100339E12 /* svg_text.c */,
+ 71CCF1851277045100339E12 /* texturing.c */,
+ 71CCF1861277045100339E12 /* texturing.h */,
+ 71CCF1871277045100339E12 /* texturing_gl.c */,
+ 71CCF1881277045100339E12 /* visual_manager.c */,
+ 71CCF1891277045100339E12 /* visual_manager.h */,
+ 71CCF18A1277045100339E12 /* visual_manager_2d.c */,
+ 71CCF18B1277045100339E12 /* visual_manager_2d.h */,
+ 71CCF18C1277045100339E12 /* visual_manager_2d_draw.c */,
+ 71CCF18D1277045100339E12 /* visual_manager_3d.c */,
+ 71CCF18E1277045100339E12 /* visual_manager_3d.h */,
+ 71CCF18F1277045100339E12 /* visual_manager_3d_gl.c */,
+ 71CCF1901277045100339E12 /* x3d_geometry.c */,
+ );
+ name = compositor;
+ path = ../../src/compositor;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1911277045100339E12 /* ietf */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1921277045100339E12 /* rtcp.c */,
+ 71CCF1931277045100339E12 /* rtp.c */,
+ 71CCF1941277045100339E12 /* rtp_depacketizer.c */,
+ 71CCF1951277045100339E12 /* rtp_packetizer.c */,
+ 71CCF1961277045100339E12 /* rtp_pck_3gpp.c */,
+ 71CCF1971277045100339E12 /* rtp_pck_mpeg12.c */,
+ 71CCF1981277045100339E12 /* rtp_pck_mpeg4.c */,
+ 71CCF1991277045100339E12 /* rtp_streamer.c */,
+ 71CCF19A1277045100339E12 /* rtsp_command.c */,
+ 71CCF19B1277045100339E12 /* rtsp_common.c */,
+ 71CCF19C1277045100339E12 /* rtsp_response.c */,
+ 71CCF19D1277045100339E12 /* rtsp_session.c */,
+ 71CCF19E1277045100339E12 /* sdp.c */,
+ );
+ name = ietf;
+ path = ../../src/ietf;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF19F1277045100339E12 /* isomedia */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1A01277045100339E12 /* avc_ext.c */,
+ 71CCF1A11277045100339E12 /* box_code_3gpp.c */,
+ 71CCF1A21277045100339E12 /* box_code_apple.c */,
+ 71CCF1A31277045100339E12 /* box_code_base.c */,
+ 71CCF1A41277045100339E12 /* box_code_isma.c */,
+ 71CCF1A51277045100339E12 /* box_code_meta.c */,
+ 71CCF1A61277045100339E12 /* box_dump.c */,
+ 71CCF1A71277045100339E12 /* box_funcs.c */,
+ 71CCF1A81277045100339E12 /* data_map.c */,
+ 71CCF1A91277045100339E12 /* hint_track.c */,
+ 71CCF1AA1277045100339E12 /* hinting.c */,
+ 71CCF1AB1277045100339E12 /* isma_sample.c */,
+ 71CCF1AC1277045100339E12 /* isom_intern.c */,
+ 71CCF1AD1277045100339E12 /* isom_read.c */,
+ 71CCF1AE1277045100339E12 /* isom_store.c */,
+ 71CCF1AF1277045100339E12 /* isom_write.c */,
+ 71CCF1B01277045100339E12 /* media.c */,
+ 71CCF1B11277045100339E12 /* media_odf.c */,
+ 71CCF1B21277045100339E12 /* meta.c */,
+ 71CCF1B31277045100339E12 /* movie_fragments.c */,
+ 71CCF1B41277045100339E12 /* sample_descs.c */,
+ 71CCF1B51277045100339E12 /* stbl_read.c */,
+ 71CCF1B61277045100339E12 /* stbl_write.c */,
+ 71CCF1B71277045100339E12 /* track.c */,
+ 71CCF1B81277045100339E12 /* tx3g.c */,
+ );
+ name = isomedia;
+ path = ../../src/isomedia;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1B91277045100339E12 /* laser */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1BA1277045100339E12 /* lsr_dec.c */,
+ 71CCF1BB1277045100339E12 /* lsr_enc.c */,
+ 71CCF1BC1277045100339E12 /* lsr_tables.c */,
+ );
+ name = laser;
+ path = ../../src/laser;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1BD1277045100339E12 /* mcrypt */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1BE1277045100339E12 /* cbc.c */,
+ 71CCF1BF1277045100339E12 /* cfb.c */,
+ 71CCF1C01277045100339E12 /* ctr.c */,
+ 71CCF1C11277045100339E12 /* des.c */,
+ 71CCF1C21277045100339E12 /* ecb.c */,
+ 71CCF1C31277045100339E12 /* g_crypt.c */,
+ 71CCF1C41277045100339E12 /* ncfb.c */,
+ 71CCF1C51277045100339E12 /* nofb.c */,
+ 71CCF1C61277045100339E12 /* ofb.c */,
+ 71CCF1C71277045100339E12 /* rijndael-128.c */,
+ 71CCF1C81277045100339E12 /* rijndael-192.c */,
+ 71CCF1C91277045100339E12 /* rijndael-256.c */,
+ 71CCF1CA1277045100339E12 /* sha1.c */,
+ 71CCF1CB1277045100339E12 /* stream.c */,
+ 71CCF1CC1277045100339E12 /* tripledes.c */,
+ );
+ name = mcrypt;
+ path = ../../src/mcrypt;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1CD1277045100339E12 /* media_tools */ = {
+ isa = PBXGroup;
+ children = (
+ 970A26C713434D2C0007362C /* m3u8.c */,
+ 970A26C813434D2C0007362C /* mpd.c */,
+ 71CCF1CE1277045100339E12 /* av_parsers.c */,
+ 71CCF1CF1277045100339E12 /* avilib.c */,
+ 71CCF1D01277045100339E12 /* dvb_mpe.c */,
+ 71CCF1D11277045100339E12 /* filestreamer.c */,
+ 71CCF1D21277045100339E12 /* gpac_ogg.c */,
+ 71CCF1D31277045100339E12 /* img.c */,
+ 71CCF1D41277045100339E12 /* ismacryp.c */,
+ 71CCF1D51277045100339E12 /* isom_hinter.c */,
+ 71CCF1D61277045100339E12 /* isom_tools.c */,
+ 71CCF1D71277045100339E12 /* m2ts_mux.c */,
+ 71CCF1D81277045100339E12 /* media_export.c */,
+ 71CCF1D91277045100339E12 /* media_import.c */,
+ 71CCF1DA1277045100339E12 /* mpeg2_ps.c */,
+ 71CCF1DB1277045100339E12 /* mpeg2_ps.h */,
+ 71CCF1DC1277045100339E12 /* mpegts.c */,
+ 71CCF1DD1277045100339E12 /* reedsolomon.c */,
+ 71CCF1DE1277045100339E12 /* saf.c */,
+ 71CCF1DF1277045100339E12 /* text_import.c */,
+ 71CCF1E01277045100339E12 /* vobsub.c */,
+ );
+ name = media_tools;
+ path = ../../src/media_tools;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1E11277045100339E12 /* odf */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1E21277045100339E12 /* desc_private.c */,
+ 71CCF1E31277045100339E12 /* descriptors.c */,
+ 71CCF1E41277045100339E12 /* ipmpx_code.c */,
+ 71CCF1E51277045100339E12 /* ipmpx_dump.c */,
+ 71CCF1E61277045100339E12 /* ipmpx_parse.c */,
+ 71CCF1E71277045100339E12 /* oci_codec.c */,
+ 71CCF1E81277045100339E12 /* odf_code.c */,
+ 71CCF1E91277045100339E12 /* odf_codec.c */,
+ 71CCF1EA1277045100339E12 /* odf_command.c */,
+ 71CCF1EB1277045100339E12 /* odf_dump.c */,
+ 71CCF1EC1277045100339E12 /* odf_parse.c */,
+ 71CCF1ED1277045100339E12 /* qos.c */,
+ 71CCF1EE1277045100339E12 /* slc.c */,
+ );
+ name = odf;
+ path = ../../src/odf;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1EF1277045100339E12 /* scene_manager */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1F01277045100339E12 /* encode_isom.c */,
+ 71CCF1F11277045100339E12 /* loader_bt.c */,
+ 71CCF1F21277045100339E12 /* loader_isom.c */,
+ 71CCF1F31277045100339E12 /* loader_qt.c */,
+ 71CCF1F41277045100339E12 /* loader_svg.c */,
+ 71CCF1F51277045100339E12 /* loader_xmt.c */,
+ 71CCF1F61277045100339E12 /* scene_dump.c */,
+ 71CCF1F71277045100339E12 /* scene_engine.c */,
+ 71CCF1F81277045100339E12 /* scene_manager.c */,
+ 71CCF1F91277045100339E12 /* scene_stats.c */,
+ 71CCF1FA1277045100339E12 /* swf_bifs.c */,
+ 71CCF1FB1277045100339E12 /* swf_parse.c */,
+ 71CCF1FC1277045100339E12 /* text_to_bifs.c */,
+ );
+ name = scene_manager;
+ path = ../../src/scene_manager;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF1FD1277045100339E12 /* scenegraph */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF1FE1277045100339E12 /* base_scenegraph.c */,
+ 71CCF1FF1277045100339E12 /* commands.c */,
+ 71CCF2001277045100339E12 /* dom_events.c */,
+ 71CCF2011277045100339E12 /* dom_smjs.c */,
+ 71CCF2021277045100339E12 /* mpeg4_animators.c */,
+ 71CCF2031277045100339E12 /* mpeg4_nodes.c */,
+ 71CCF2041277045100339E12 /* mpeg4_valuator.c */,
+ 71CCF2051277045100339E12 /* smil_anim.c */,
+ 71CCF2061277045100339E12 /* smil_timing.c */,
+ 71CCF2071277045100339E12 /* svg_attributes.c */,
+ 71CCF2081277045100339E12 /* svg_properties.c */,
+ 71CCF2091277045100339E12 /* svg_smjs.c */,
+ 71CCF20A1277045100339E12 /* svg_types.c */,
+ 71CCF20B1277045100339E12 /* vrml_interpolators.c */,
+ 71CCF20C1277045100339E12 /* vrml_proto.c */,
+ 71CCF20D1277045100339E12 /* vrml_route.c */,
+ 71CCF20E1277045100339E12 /* vrml_script.c */,
+ 71CCF20F1277045100339E12 /* vrml_smjs.c */,
+ 71CCF2101277045100339E12 /* vrml_tools.c */,
+ 71CCF2111277045100339E12 /* x3d_nodes.c */,
+ 71CCF2121277045100339E12 /* xbl_process.c */,
+ 71CCF2131277045100339E12 /* xml_ns.c */,
+ );
+ name = scenegraph;
+ path = ../../src/scenegraph;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF2141277045100339E12 /* terminal */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF2151277045100339E12 /* channel.c */,
+ 71CCF2161277045100339E12 /* clock.c */,
+ 71CCF2171277045100339E12 /* decoder.c */,
+ 71CCF2181277045100339E12 /* input_sensor.c */,
+ 71CCF2191277045100339E12 /* input_sensor.h */,
+ 71CCF21A1277045100339E12 /* media_control.c */,
+ 71CCF21B1277045100339E12 /* media_control.h */,
+ 71CCF21C1277045100339E12 /* media_manager.c */,
+ 71CCF21D1277045100339E12 /* media_memory.c */,
+ 71CCF21E1277045100339E12 /* media_memory.h */,
+ 71CCF21F1277045100339E12 /* media_object.c */,
+ 71CCF2201277045100339E12 /* media_sensor.c */,
+ 71CCF2211277045100339E12 /* mpeg4_inline.c */,
+ 71CCF2221277045100339E12 /* network_service.c */,
+ 71CCF2231277045100339E12 /* object_browser.c */,
+ 71CCF2241277045100339E12 /* object_manager.c */,
+ 71CCF2251277045100339E12 /* scene.c */,
+ 71CCF2261277045100339E12 /* svg_external.c */,
+ 71CCF2271277045100339E12 /* term_node_init.c */,
+ 71CCF2281277045100339E12 /* terminal.c */,
+ );
+ name = terminal;
+ path = ../../src/terminal;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF2291277045100339E12 /* utils */ = {
+ isa = PBXGroup;
+ children = (
+ 970A26D513434DAC0007362C /* ringbuffer.c */,
+ 970A26D613434DAC0007362C /* unicode.c */,
+ 7147425F12B918C900DB5A59 /* cache.c */,
+ 7141FF2F1292CB9200FCB27D /* alloc.c */,
+ 71CCF22A1277045100339E12 /* base_encoding.c */,
+ 71CCF22B1277045100339E12 /* bitstream.c */,
+ 71CCF22C1277045100339E12 /* color.c */,
+ 71CCF22D1277045100339E12 /* configfile.c */,
+ 71CCF22E1277045100339E12 /* dlmalloc.c */,
+ 71CCF22F1277045100339E12 /* downloader.c */,
+ 71CCF2301277045100339E12 /* error.c */,
+ 71CCF2321277045100339E12 /* list.c */,
+ 71CCF2331277045100339E12 /* math.c */,
+ 71CCF2341277045100339E12 /* module.c */,
+ 71CCF2351277045100339E12 /* module_wrap.h */,
+ 71CCF2361277045100339E12 /* os_divers.c */,
+ 71CCF2371277045100339E12 /* os_module.c */,
+ 71CCF2381277045100339E12 /* os_net.c */,
+ 71CCF2391277045100339E12 /* os_thread.c */,
+ 71CCF23A1277045100339E12 /* path2d.c */,
+ 71CCF23B1277045100339E12 /* path2d_stroker.c */,
+ 71CCF23E1277045100339E12 /* token.c */,
+ 71CCF23F1277045100339E12 /* uni_bidi.c */,
+ 71CCF2401277045100339E12 /* url.c */,
+ 71CCF2411277045100339E12 /* utf.c */,
+ 71CCF2421277045100339E12 /* xml_parser.c */,
+ 71CCF2441277045100339E12 /* zutil.c */,
+ 71CCF2451277045100339E12 /* zutil.h */,
+ );
+ name = utils;
+ path = ../../src/utils;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF35E12770A8C00339E12 /* include */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF35F12770A8C00339E12 /* gpac */,
+ );
+ name = include;
+ path = ../../include;
+ sourceTree = SOURCE_ROOT;
+ };
+ 71CCF35F12770A8C00339E12 /* gpac */ = {
+ isa = PBXGroup;
+ children = (
+ 970A26CF13434D960007362C /* cache.h */,
+ 970A26D013434D960007362C /* ringbuffer.h */,
+ 970A26D113434D960007362C /* unicode.h */,
+ 71CCF36012770A8C00339E12 /* avparse.h */,
+ 71CCF36112770A8C00339E12 /* base_coding.h */,
+ 71CCF36212770A8C00339E12 /* bifs.h */,
+ 71CCF36312770A8C00339E12 /* bitstream.h */,
+ 71CCF36412770A8C00339E12 /* color.h */,
+ 71CCF36512770A8C00339E12 /* compositor.h */,
+ 71CCF36612770A8C00339E12 /* config_file.h */,
+ 71CCF36712770A8C00339E12 /* configuration.h */,
+ 71CCF36812770A8C00339E12 /* constants.h */,
+ 71CCF36912770A8C00339E12 /* crypt.h */,
+ 71CCF36A12770A8C00339E12 /* download.h */,
+ 71CCF36B12770A8C00339E12 /* dvb_mpe.h */,
+ 71CCF36C12770A8C00339E12 /* esi.h */,
+ 71CCF36D12770A8C00339E12 /* events.h */,
+ 71CCF36E12770A8C00339E12 /* filestreamer.h */,
+ 71CCF36F12770A8C00339E12 /* ietf.h */,
+ 71CCF37012770A8C00339E12 /* internal */,
+ 71CCF38412770A8C00339E12 /* ismacryp.h */,
+ 71CCF38512770A8C00339E12 /* iso639.h */,
+ 71CCF38612770A8C00339E12 /* isomedia.h */,
+ 71CCF38712770A8C00339E12 /* laser.h */,
+ 71CCF38812770A8C00339E12 /* list.h */,
+ 71CCF38912770A8C00339E12 /* math.h */,
+ 71CCF38A12770A8C00339E12 /* media_tools.h */,
+ 71CCF38B12770A8C00339E12 /* mediaobject.h */,
+ 71CCF38C12770A8C00339E12 /* module.h */,
+ 71CCF38D12770A8C00339E12 /* modules */,
+ 71CCF39712770A8C00339E12 /* mpeg4_odf.h */,
+ 71CCF39812770A8C00339E12 /* mpegts.h */,
+ 71CCF39912770A8C00339E12 /* network.h */,
+ 71CCF39A12770A8C00339E12 /* nodes_mpeg4.h */,
+ 71CCF39B12770A8C00339E12 /* nodes_svg.h */,
+ 71CCF39C12770A8C00339E12 /* nodes_x3d.h */,
+ 71CCF39D12770A8C00339E12 /* nodes_xbl.h */,
+ 71CCF39E12770A8C00339E12 /* options.h */,
+ 71CCF39F12770A8C00339E12 /* path2d.h */,
+ 71CCF3A012770A8C00339E12 /* rtp_streamer.h */,
+ 71CCF3A112770A8C00339E12 /* scene_engine.h */,
+ 71CCF3A212770A8C00339E12 /* scene_manager.h */,
+ 71CCF3A312770A8C00339E12 /* scenegraph.h */,
+ 71CCF3A412770A8C00339E12 /* scenegraph_svg.h */,
+ 71CCF3A512770A8C00339E12 /* scenegraph_vrml.h */,
+ 71CCF3A612770A8C00339E12 /* setup.h */,
+ 71CCF3A712770A8C00339E12 /* svg_types.h */,
+ 71CCF3A812770A8C00339E12 /* sync_layer.h */,
+ 71CCF3A912770A8C00339E12 /* term_info.h */,
+ 71CCF3AA12770A8C00339E12 /* terminal.h */,
+ 71CCF3AB12770A8C00339E12 /* thread.h */,
+ 71CCF3AC12770A8C00339E12 /* token.h */,
+ 71CCF3AD12770A8C00339E12 /* tools.h */,
+ 71CCF3AE12770A8C00339E12 /* user.h */,
+ 71CCF3AF12770A8C00339E12 /* utf.h */,
+ 71CCF3B012770A8C00339E12 /* xml.h */,
+ );
+ path = gpac;
+ sourceTree = "<group>";
+ };
+ 71CCF37012770A8C00339E12 /* internal */ = {
+ isa = PBXGroup;
+ children = (
+ 970A26CB13434D780007362C /* m3u8.h */,
+ 970A26CC13434D780007362C /* mpd.h */,
+ 71CCF37112770A8C00339E12 /* avilib.h */,
+ 71CCF37212770A8C00339E12 /* bifs_dev.h */,
+ 71CCF37312770A8C00339E12 /* bifs_tables.h */,
+ 71CCF37412770A8C00339E12 /* camera.h */,
+ 71CCF37512770A8C00339E12 /* compositor_dev.h */,
+ 71CCF37612770A8C00339E12 /* crypt_dev.h */,
+ 71CCF37712770A8C00339E12 /* dvb_mpe_dev.h */,
+ 71CCF37812770A8C00339E12 /* ietf_dev.h */,
+ 71CCF37912770A8C00339E12 /* isomedia_dev.h */,
+ 71CCF37A12770A8C00339E12 /* laser_dev.h */,
+ 71CCF37B12770A8C00339E12 /* media_dev.h */,
+ 71CCF37C12770A8C00339E12 /* mesh.h */,
+ 71CCF37D12770A8C00339E12 /* odf_dev.h */,
+ 71CCF37E12770A8C00339E12 /* ogg.h */,
+ 71CCF37F12770A8C00339E12 /* reedsolomon.h */,
+ 71CCF38012770A8C00339E12 /* scenegraph_dev.h */,
+ 71CCF38112770A8C00339E12 /* swf_dev.h */,
+ 71CCF38212770A8C00339E12 /* terminal_dev.h */,
+ 71CCF38312770A8C00339E12 /* vobsub.h */,
+ );
+ path = internal;
+ sourceTree = "<group>";
+ };
+ 71CCF38D12770A8C00339E12 /* modules */ = {
+ isa = PBXGroup;
+ children = (
+ 71CCF38E12770A8C00339E12 /* audio_out.h */,
+ 71CCF38F12770A8C00339E12 /* codec.h */,
+ 71CCF39012770A8C00339E12 /* font.h */,
+ 71CCF39112770A8C00339E12 /* ipmp.h */,
+ 71CCF39212770A8C00339E12 /* js_usr.h */,
+ 71CCF39312770A8C00339E12 /* raster2d.h */,
+ 71CCF39412770A8C00339E12 /* service.h */,
+ 71CCF39512770A8C00339E12 /* term_ext.h */,
+ 71CCF39612770A8C00339E12 /* video_out.h */,
+ );
+ path = modules;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 71179CC01292EC3400A83216 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718477CC127814B200917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184782D1278645B00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199201278769100ACFF58 /* rast_soft.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478341278647200917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184783D127864AC00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478451278654000917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184784C1278655800917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478531278656E00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184785A1278657F00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19949127876E300ACFF58 /* img_in.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478611278658A00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847868127865A200917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184786F127865B700917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1995B1278770900ACFF58 /* isom_in.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847876127865CB00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184787D127865D600917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184788D127865F700917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199751278774A00ACFF58 /* rtp_in.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478941278660400917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184789B1278661700917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199851278776700ACFF58 /* ft_font.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478A21278662F00917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199921278777A00ACFF58 /* unzip.h in Headers */,
+ 71A199971278777A00ACFF58 /* widgetman.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478AD1278666100917298 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71CCF12D1277037A00339E12 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71CCF2501277045100339E12 /* quant.h in Headers */,
+ 71CCF2521277045100339E12 /* script.h in Headers */,
+ 71CCF2601277045100339E12 /* drawable.h in Headers */,
+ 71CCF2631277045100339E12 /* gl_inc.h in Headers */,
+ 71CCF2761277045100339E12 /* mpeg4_grouping.h in Headers */,
+ 71CCF2851277045100339E12 /* nodes_stacks.h in Headers */,
+ 71CCF2871277045100339E12 /* offscreen_cache.h in Headers */,
+ 71CCF2911277045100339E12 /* texturing.h in Headers */,
+ 71CCF2941277045100339E12 /* visual_manager.h in Headers */,
+ 71CCF2961277045100339E12 /* visual_manager_2d.h in Headers */,
+ 71CCF2991277045100339E12 /* visual_manager_3d.h in Headers */,
+ 71CCF2E11277045100339E12 /* mpeg2_ps.h in Headers */,
+ 71CCF31B1277045100339E12 /* input_sensor.h in Headers */,
+ 71CCF31D1277045100339E12 /* media_control.h in Headers */,
+ 71CCF3201277045100339E12 /* media_memory.h in Headers */,
+ 71CCF3361277045100339E12 /* module_wrap.h in Headers */,
+ 71CCF3461277045100339E12 /* zutil.h in Headers */,
+ 71CCF3B112770A8C00339E12 /* avparse.h in Headers */,
+ 71CCF3B212770A8C00339E12 /* base_coding.h in Headers */,
+ 71CCF3B312770A8C00339E12 /* bifs.h in Headers */,
+ 71CCF3B412770A8C00339E12 /* bitstream.h in Headers */,
+ 71CCF3B512770A8C00339E12 /* color.h in Headers */,
+ 71CCF3B612770A8C00339E12 /* compositor.h in Headers */,
+ 71CCF3B712770A8C00339E12 /* config_file.h in Headers */,
+ 71CCF3B812770A8C00339E12 /* configuration.h in Headers */,
+ 71CCF3B912770A8C00339E12 /* constants.h in Headers */,
+ 71CCF3BA12770A8C00339E12 /* crypt.h in Headers */,
+ 71CCF3BB12770A8C00339E12 /* download.h in Headers */,
+ 71CCF3BC12770A8C00339E12 /* dvb_mpe.h in Headers */,
+ 71CCF3BD12770A8C00339E12 /* esi.h in Headers */,
+ 71CCF3BE12770A8C00339E12 /* events.h in Headers */,
+ 71CCF3BF12770A8C00339E12 /* filestreamer.h in Headers */,
+ 71CCF3C012770A8C00339E12 /* ietf.h in Headers */,
+ 71CCF3C112770A8C00339E12 /* avilib.h in Headers */,
+ 71CCF3C212770A8C00339E12 /* bifs_dev.h in Headers */,
+ 71CCF3C312770A8C00339E12 /* bifs_tables.h in Headers */,
+ 71CCF3C412770A8C00339E12 /* camera.h in Headers */,
+ 71CCF3C512770A8C00339E12 /* compositor_dev.h in Headers */,
+ 71CCF3C612770A8C00339E12 /* crypt_dev.h in Headers */,
+ 71CCF3C712770A8C00339E12 /* dvb_mpe_dev.h in Headers */,
+ 71CCF3C812770A8C00339E12 /* ietf_dev.h in Headers */,
+ 71CCF3C912770A8C00339E12 /* isomedia_dev.h in Headers */,
+ 71CCF3CA12770A8C00339E12 /* laser_dev.h in Headers */,
+ 71CCF3CB12770A8C00339E12 /* media_dev.h in Headers */,
+ 71CCF3CC12770A8C00339E12 /* mesh.h in Headers */,
+ 71CCF3CD12770A8C00339E12 /* odf_dev.h in Headers */,
+ 71CCF3CE12770A8C00339E12 /* ogg.h in Headers */,
+ 71CCF3CF12770A8C00339E12 /* reedsolomon.h in Headers */,
+ 71CCF3D012770A8C00339E12 /* scenegraph_dev.h in Headers */,
+ 71CCF3D112770A8C00339E12 /* swf_dev.h in Headers */,
+ 71CCF3D212770A8C00339E12 /* terminal_dev.h in Headers */,
+ 71CCF3D312770A8C00339E12 /* vobsub.h in Headers */,
+ 71CCF3D412770A8C00339E12 /* ismacryp.h in Headers */,
+ 71CCF3D512770A8C00339E12 /* iso639.h in Headers */,
+ 71CCF3D612770A8C00339E12 /* isomedia.h in Headers */,
+ 71CCF3D712770A8C00339E12 /* laser.h in Headers */,
+ 71CCF3D812770A8C00339E12 /* list.h in Headers */,
+ 71CCF3D912770A8C00339E12 /* math.h in Headers */,
+ 71CCF3DA12770A8C00339E12 /* media_tools.h in Headers */,
+ 71CCF3DB12770A8C00339E12 /* mediaobject.h in Headers */,
+ 71CCF3DC12770A8C00339E12 /* module.h in Headers */,
+ 71CCF3DD12770A8C00339E12 /* audio_out.h in Headers */,
+ 71CCF3DE12770A8C00339E12 /* codec.h in Headers */,
+ 71CCF3DF12770A8C00339E12 /* font.h in Headers */,
+ 71CCF3E012770A8C00339E12 /* ipmp.h in Headers */,
+ 71CCF3E112770A8C00339E12 /* js_usr.h in Headers */,
+ 71CCF3E212770A8C00339E12 /* raster2d.h in Headers */,
+ 71CCF3E312770A8C00339E12 /* service.h in Headers */,
+ 71CCF3E412770A8C00339E12 /* term_ext.h in Headers */,
+ 71CCF3E512770A8C00339E12 /* video_out.h in Headers */,
+ 71CCF3E612770A8C00339E12 /* mpeg4_odf.h in Headers */,
+ 71CCF3E712770A8C00339E12 /* mpegts.h in Headers */,
+ 71CCF3E812770A8C00339E12 /* network.h in Headers */,
+ 71CCF3E912770A8C00339E12 /* nodes_mpeg4.h in Headers */,
+ 71CCF3EA12770A8C00339E12 /* nodes_svg.h in Headers */,
+ 71CCF3EB12770A8C00339E12 /* nodes_x3d.h in Headers */,
+ 71CCF3EC12770A8C00339E12 /* nodes_xbl.h in Headers */,
+ 71CCF3ED12770A8C00339E12 /* options.h in Headers */,
+ 71CCF3EE12770A8C00339E12 /* path2d.h in Headers */,
+ 71CCF3EF12770A8C00339E12 /* rtp_streamer.h in Headers */,
+ 71CCF3F012770A8C00339E12 /* scene_engine.h in Headers */,
+ 71CCF3F112770A8C00339E12 /* scene_manager.h in Headers */,
+ 71CCF3F212770A8C00339E12 /* scenegraph.h in Headers */,
+ 71CCF3F312770A8C00339E12 /* scenegraph_svg.h in Headers */,
+ 71CCF3F412770A8C00339E12 /* scenegraph_vrml.h in Headers */,
+ 71CCF3F512770A8C00339E12 /* setup.h in Headers */,
+ 71CCF3F612770A8C00339E12 /* svg_types.h in Headers */,
+ 71CCF3F712770A8C00339E12 /* sync_layer.h in Headers */,
+ 71CCF3F812770A8C00339E12 /* term_info.h in Headers */,
+ 71CCF3F912770A8C00339E12 /* terminal.h in Headers */,
+ 71CCF3FA12770A8C00339E12 /* thread.h in Headers */,
+ 71CCF3FB12770A8C00339E12 /* token.h in Headers */,
+ 71CCF3FC12770A8C00339E12 /* tools.h in Headers */,
+ 71CCF3FD12770A8C00339E12 /* user.h in Headers */,
+ 71CCF3FE12770A8C00339E12 /* utf.h in Headers */,
+ 71CCF3FF12770A8C00339E12 /* xml.h in Headers */,
+ 970A26CD13434D780007362C /* m3u8.h in Headers */,
+ 970A26CE13434D780007362C /* mpd.h in Headers */,
+ 970A26D213434D960007362C /* cache.h in Headers */,
+ 970A26D313434D960007362C /* ringbuffer.h in Headers */,
+ 970A26D413434D960007362C /* unicode.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 71179CC31292EC3400A83216 /* mpd_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71179CD11292ECAC00A83216 /* Build configuration list for PBXNativeTarget "mpd_in" */;
+ buildPhases = (
+ 71179CC01292EC3400A83216 /* Headers */,
+ 71179CC11292EC3400A83216 /* Sources */,
+ 71179CC21292EC3400A83216 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = mpd_in;
+ productName = mpd_in;
+ productReference = 71179CC41292EC3400A83216 /* gm_mpd_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718477CF127814B200917298 /* libgpac_dynamic */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 718477D3127814D100917298 /* Build configuration list for PBXNativeTarget "libgpac_dynamic" */;
+ buildPhases = (
+ 718477CC127814B200917298 /* Headers */,
+ 718477CD127814B200917298 /* Sources */,
+ 718477CE127814B200917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 718477D5127814D600917298 /* PBXTargetDependency */,
+ );
+ name = libgpac_dynamic;
+ productName = libgpac_dynamic;
+ productReference = 718477D0127814B200917298 /* libgpac_dynamic.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478301278645B00917298 /* soft_raster */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7184783B1278649100917298 /* Build configuration list for PBXNativeTarget "soft_raster" */;
+ buildPhases = (
+ 7184782D1278645B00917298 /* Headers */,
+ 7184782E1278645B00917298 /* Sources */,
+ 7184782F1278645B00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = soft_raster;
+ productName = soft_raster;
+ productReference = 718478311278645B00917298 /* gm_soft_raster.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478371278647200917298 /* dummy_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7184783C1278649100917298 /* Build configuration list for PBXNativeTarget "dummy_in" */;
+ buildPhases = (
+ 718478341278647200917298 /* Headers */,
+ 718478351278647200917298 /* Sources */,
+ 718478361278647200917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = dummy_in;
+ productName = dummy_in;
+ productReference = 718478381278647200917298 /* gm_dummy_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 71847840127864AC00917298 /* ctx_load */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847844127864CB00917298 /* Build configuration list for PBXNativeTarget "ctx_load" */;
+ buildPhases = (
+ 7184783D127864AC00917298 /* Headers */,
+ 7184783E127864AC00917298 /* Sources */,
+ 7184783F127864AC00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ctx_load;
+ productName = ctx_load;
+ productReference = 71847841127864AC00917298 /* gm_ctx_load.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478481278654000917298 /* aac_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847884127865F500917298 /* Build configuration list for PBXNativeTarget "aac_in" */;
+ buildPhases = (
+ 718478451278654000917298 /* Headers */,
+ 718478461278654000917298 /* Sources */,
+ 718478471278654000917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = aac_in;
+ productName = aac_in;
+ productReference = 718478491278654000917298 /* gm_aac_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 7184784F1278655800917298 /* svg_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847885127865F500917298 /* Build configuration list for PBXNativeTarget "svg_in" */;
+ buildPhases = (
+ 7184784C1278655800917298 /* Headers */,
+ 7184784D1278655800917298 /* Sources */,
+ 7184784E1278655800917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = svg_in;
+ productName = svg_in;
+ productReference = 718478501278655800917298 /* gm_svg_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478561278656E00917298 /* mp3_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847886127865F500917298 /* Build configuration list for PBXNativeTarget "mp3_in" */;
+ buildPhases = (
+ 718478531278656E00917298 /* Headers */,
+ 718478541278656E00917298 /* Sources */,
+ 718478551278656E00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = mp3_in;
+ productName = mp3_in;
+ productReference = 718478571278656E00917298 /* gm_mp3_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 7184785D1278657F00917298 /* img_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847887127865F500917298 /* Build configuration list for PBXNativeTarget "img_in" */;
+ buildPhases = (
+ 7184785A1278657F00917298 /* Headers */,
+ 7184785B1278657F00917298 /* Sources */,
+ 7184785C1278657F00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = img_in;
+ productName = img_in;
+ productReference = 7184785E1278657F00917298 /* gm_img_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478641278658A00917298 /* bifs_dec */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847888127865F500917298 /* Build configuration list for PBXNativeTarget "bifs_dec" */;
+ buildPhases = (
+ 718478611278658A00917298 /* Headers */,
+ 718478621278658A00917298 /* Sources */,
+ 718478631278658A00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = bifs_dec;
+ productName = bifs_dec;
+ productReference = 718478651278658A00917298 /* gm_bifs_dec.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 7184786B127865A200917298 /* gpac_js */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71847889127865F500917298 /* Build configuration list for PBXNativeTarget "gpac_js" */;
+ buildPhases = (
+ 71847868127865A200917298 /* Headers */,
+ 71847869127865A200917298 /* Sources */,
+ 7184786A127865A200917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = gpac_js;
+ productName = gpac_js;
+ productReference = 7184786C127865A200917298 /* gm_gpac_js.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 71847872127865B700917298 /* isom_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7184788A127865F500917298 /* Build configuration list for PBXNativeTarget "isom_in" */;
+ buildPhases = (
+ 7184786F127865B700917298 /* Headers */,
+ 71847870127865B700917298 /* Sources */,
+ 71847871127865B700917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = isom_in;
+ productName = isom_in;
+ productReference = 71847873127865B700917298 /* gm_isom_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 71847879127865CB00917298 /* laser_dec */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7184788B127865F500917298 /* Build configuration list for PBXNativeTarget "laser_dec" */;
+ buildPhases = (
+ 71847876127865CB00917298 /* Headers */,
+ 71847877127865CB00917298 /* Sources */,
+ 71847878127865CB00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = laser_dec;
+ productName = laser_dec;
+ productReference = 7184787A127865CB00917298 /* gm_laser_dec.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 71847880127865D600917298 /* odf_dec */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7184788C127865F500917298 /* Build configuration list for PBXNativeTarget "odf_dec" */;
+ buildPhases = (
+ 7184787D127865D600917298 /* Headers */,
+ 7184787E127865D600917298 /* Sources */,
+ 7184787F127865D600917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = odf_dec;
+ productName = odf_dec;
+ productReference = 71847881127865D600917298 /* gm_odf_dec.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 71847890127865F700917298 /* rtp_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 718478A91278664D00917298 /* Build configuration list for PBXNativeTarget "rtp_in" */;
+ buildPhases = (
+ 7184788D127865F700917298 /* Headers */,
+ 7184788E127865F700917298 /* Sources */,
+ 7184788F127865F700917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = rtp_in;
+ productName = rtp_in;
+ productReference = 71847891127865F700917298 /* gm_rtp_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478971278660400917298 /* mpegts_in */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 718478AA1278664D00917298 /* Build configuration list for PBXNativeTarget "mpegts_in" */;
+ buildPhases = (
+ 718478941278660400917298 /* Headers */,
+ 718478951278660400917298 /* Sources */,
+ 718478961278660400917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = mpegts_in;
+ productName = mpegts_in;
+ productReference = 718478981278660400917298 /* gm_mpegts_in.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 7184789E1278661700917298 /* ft_font */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 718478AB1278664D00917298 /* Build configuration list for PBXNativeTarget "ft_font" */;
+ buildPhases = (
+ 7184789B1278661700917298 /* Headers */,
+ 7184789C1278661700917298 /* Sources */,
+ 7184789D1278661700917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ft_font;
+ productName = ft_font;
+ productReference = 7184789F1278661700917298 /* gm_ft_font.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478A51278662F00917298 /* widgetman */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 718478AC1278664D00917298 /* Build configuration list for PBXNativeTarget "widgetman" */;
+ buildPhases = (
+ 718478A21278662F00917298 /* Headers */,
+ 718478A31278662F00917298 /* Sources */,
+ 718478A41278662F00917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = widgetman;
+ productName = widgetman;
+ productReference = 718478A61278662F00917298 /* gm_widgetman.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 718478B01278666100917298 /* sdl_out */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 718478B41278667F00917298 /* Build configuration list for PBXNativeTarget "sdl_out" */;
+ buildPhases = (
+ 718478AD1278666100917298 /* Headers */,
+ 718478AE1278666100917298 /* Sources */,
+ 718478AF1278666100917298 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = sdl_out;
+ productName = sdl_out;
+ productReference = 718478B11278666100917298 /* gm_sdl_out.dylib */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 71A19B1912796B5600ACFF58 /* osmo4ios */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71A19B1F12796B5800ACFF58 /* Build configuration list for PBXNativeTarget "osmo4ios" */;
+ buildPhases = (
+ 71A19B1612796B5600ACFF58 /* Resources */,
+ 71A19B1712796B5600ACFF58 /* Sources */,
+ 71A19B1812796B5600ACFF58 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = osmo4ios;
+ productName = osmo4ios;
+ productReference = 71A19B1A12796B5600ACFF58 /* osmo4ios.app */;
+ productType = "com.apple.product-type.application";
+ };
+ 71CCF1301277037A00339E12 /* libgpac_static */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 71CCF1351277037B00339E12 /* Build configuration list for PBXNativeTarget "libgpac_static" */;
+ buildPhases = (
+ 970AE51B1340DD1100501CF4 /* ShellScript */,
+ 71CCF12D1277037A00339E12 /* Headers */,
+ 71CCF12E1277037A00339E12 /* Sources */,
+ 71CCF12F1277037A00339E12 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = libgpac_static;
+ productName = libgpac;
+ productReference = 71CCF1311277037A00339E12 /* libgpac_static.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "gpac4ios" */;
+ compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ productRefGroup = 71CCF1321277037A00339E12 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 71CCF1301277037A00339E12 /* libgpac_static */,
+ 718477CF127814B200917298 /* libgpac_dynamic */,
+ 718478301278645B00917298 /* soft_raster */,
+ 718478371278647200917298 /* dummy_in */,
+ 71847840127864AC00917298 /* ctx_load */,
+ 718478481278654000917298 /* aac_in */,
+ 7184784F1278655800917298 /* svg_in */,
+ 718478561278656E00917298 /* mp3_in */,
+ 7184785D1278657F00917298 /* img_in */,
+ 718478641278658A00917298 /* bifs_dec */,
+ 7184786B127865A200917298 /* gpac_js */,
+ 71847872127865B700917298 /* isom_in */,
+ 71847879127865CB00917298 /* laser_dec */,
+ 71847880127865D600917298 /* odf_dec */,
+ 71847890127865F700917298 /* rtp_in */,
+ 718478971278660400917298 /* mpegts_in */,
+ 7184789E1278661700917298 /* ft_font */,
+ 718478A51278662F00917298 /* widgetman */,
+ 718478B01278666100917298 /* sdl_out */,
+ 71A19B1912796B5600ACFF58 /* osmo4ios */,
+ 71179CC31292EC3400A83216 /* mpd_in */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 71A19B1612796B5600ACFF58 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 970AE51B1340DD1100501CF4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if which svnversion 2>/dev/null; then echo \"#define GPAC_SVN_REVISION \\\"`svnversion`\\\"\" > ../../include/gpac/version.h ; else echo \"No SVN Version found\"; fi\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 71179CC11292EC3400A83216 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71179CC91292EC5200A83216 /* mpd_in.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718477CD127814B200917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 718477FA12781DEB00917298 /* empty.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184782E1278645B00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1991E1278769100ACFF58 /* ftgrays.c in Sources */,
+ 71A199211278769100ACFF58 /* raster_565.c in Sources */,
+ 71A199221278769100ACFF58 /* raster_argb.c in Sources */,
+ 71A199231278769100ACFF58 /* raster_load.c in Sources */,
+ 71A199241278769100ACFF58 /* raster_rgb.c in Sources */,
+ 71A199251278769100ACFF58 /* stencil.c in Sources */,
+ 71A199261278769100ACFF58 /* surface.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478351278647200917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1992A127876A200ACFF58 /* dummy_in.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184783E127864AC00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1992F127876B000ACFF58 /* ctx_load.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478461278654000917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1990A1278765600ACFF58 /* aac_in.c in Sources */,
+ 71A1990B1278765600ACFF58 /* faad_dec.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184784D1278655800917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19935127876C300ACFF58 /* svg_in.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478541278656E00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1993A127876D300ACFF58 /* mad_dec.c in Sources */,
+ 71A1993C127876D300ACFF58 /* mp3_in.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184785B1278657F00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19946127876E300ACFF58 /* bmp_dec.c in Sources */,
+ 71A19947127876E300ACFF58 /* img_dec.c in Sources */,
+ 71A19948127876E300ACFF58 /* img_in.c in Sources */,
+ 71A1994A127876E300ACFF58 /* jp2_dec.c in Sources */,
+ 71A1994B127876E300ACFF58 /* jpeg_dec.c in Sources */,
+ 71A1994D127876E300ACFF58 /* png_dec.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478621278658A00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199101278767B00ACFF58 /* bifs_dec.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847869127865A200917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19951127876FA00ACFF58 /* gpac_js.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847870127865B700917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1995A1278770900ACFF58 /* cache.c in Sources */,
+ 71A1995C1278770900ACFF58 /* load.c in Sources */,
+ 71A1995E1278770900ACFF58 /* read.c in Sources */,
+ 71A1995F1278770900ACFF58 /* read_ch.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71847877127865CB00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199631278772500ACFF58 /* laser_dec.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184787E127865D600917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199691278773900ACFF58 /* odf_dec.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184788E127865F700917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199741278774A00ACFF58 /* rtp_in.c in Sources */,
+ 71A199761278774A00ACFF58 /* rtp_session.c in Sources */,
+ 71A199771278774A00ACFF58 /* rtp_signaling.c in Sources */,
+ 71A199781278774A00ACFF58 /* rtp_stream.c in Sources */,
+ 71A199791278774A00ACFF58 /* sdp_fetch.c in Sources */,
+ 71A1997A1278774A00ACFF58 /* sdp_load.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478951278660400917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A1997F1278775900ACFF58 /* mpegts_in.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7184789C1278661700917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199841278776700ACFF58 /* ft_font.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478A31278662F00917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A199911278777A00ACFF58 /* unzip.c in Sources */,
+ 71A199931278777A00ACFF58 /* wgt_load.c in Sources */,
+ 71A199951278777A00ACFF58 /* widget.c in Sources */,
+ 71A199961278777A00ACFF58 /* widgetman.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 718478AE1278666100917298 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19B4012796FCC00ACFF58 /* module_av_generic.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71A19B1712796B5600ACFF58 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71A19B2112796B6F00ACFF58 /* main.c in Sources */,
+ 712986C312928421003B02A1 /* extract.c in Sources */,
+ 712986C41292843B003B02A1 /* audio.c in Sources */,
+ 712986C51292843B003B02A1 /* video.c in Sources */,
+ 712986D8129284BD003B02A1 /* sdl_out.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 71CCF12E1277037A00339E12 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 71CCF2461277045100339E12 /* arith_decoder.c in Sources */,
+ 71CCF2471277045100339E12 /* bifs_codec.c in Sources */,
+ 71CCF2481277045100339E12 /* bifs_node_tables.c in Sources */,
+ 71CCF2491277045100339E12 /* com_dec.c in Sources */,
+ 71CCF24A1277045100339E12 /* com_enc.c in Sources */,
+ 71CCF24B1277045100339E12 /* conditional.c in Sources */,
+ 71CCF24C1277045100339E12 /* field_decode.c in Sources */,
+ 71CCF24D1277045100339E12 /* field_encode.c in Sources */,
+ 71CCF24E1277045100339E12 /* memory_decoder.c in Sources */,
+ 71CCF24F1277045100339E12 /* predictive_mffield.c in Sources */,
+ 71CCF2511277045100339E12 /* quantize.c in Sources */,
+ 71CCF2531277045100339E12 /* script_dec.c in Sources */,
+ 71CCF2541277045100339E12 /* script_enc.c in Sources */,
+ 71CCF2551277045100339E12 /* unquantize.c in Sources */,
+ 71CCF2561277045100339E12 /* audio_input.c in Sources */,
+ 71CCF2571277045100339E12 /* audio_mixer.c in Sources */,
+ 71CCF2581277045100339E12 /* audio_render.c in Sources */,
+ 71CCF2591277045100339E12 /* bindable.c in Sources */,
+ 71CCF25A1277045100339E12 /* camera.c in Sources */,
+ 71CCF25B1277045100339E12 /* compositor.c in Sources */,
+ 71CCF25C1277045100339E12 /* compositor_2d.c in Sources */,
+ 71CCF25D1277045100339E12 /* compositor_3d.c in Sources */,
+ 71CCF25E1277045100339E12 /* compositor_node_init.c in Sources */,
+ 71CCF25F1277045100339E12 /* drawable.c in Sources */,
+ 71CCF2611277045100339E12 /* events.c in Sources */,
+ 71CCF2621277045100339E12 /* font_engine.c in Sources */,
+ 71CCF2641277045100339E12 /* hardcoded_protos.c in Sources */,
+ 71CCF2651277045100339E12 /* hc_flash_shape.c in Sources */,
+ 71CCF2661277045100339E12 /* mesh.c in Sources */,
+ 71CCF2671277045100339E12 /* mesh_collide.c in Sources */,
+ 71CCF2681277045100339E12 /* mesh_tesselate.c in Sources */,
+ 71CCF2691277045100339E12 /* mpeg4_animstream.c in Sources */,
+ 71CCF26A1277045100339E12 /* mpeg4_audio.c in Sources */,
+ 71CCF26B1277045100339E12 /* mpeg4_background.c in Sources */,
+ 71CCF26C1277045100339E12 /* mpeg4_background2d.c in Sources */,
+ 71CCF26D1277045100339E12 /* mpeg4_bitmap.c in Sources */,
+ 71CCF26E1277045100339E12 /* mpeg4_composite.c in Sources */,
+ 71CCF26F1277045100339E12 /* mpeg4_form.c in Sources */,
+ 71CCF2701277045100339E12 /* mpeg4_geometry_2d.c in Sources */,
+ 71CCF2711277045100339E12 /* mpeg4_geometry_3d.c in Sources */,
+ 71CCF2721277045100339E12 /* mpeg4_geometry_ifs2d.c in Sources */,
+ 71CCF2731277045100339E12 /* mpeg4_geometry_ils2d.c in Sources */,
+ 71CCF2741277045100339E12 /* mpeg4_gradients.c in Sources */,
+ 71CCF2751277045100339E12 /* mpeg4_grouping.c in Sources */,
+ 71CCF2771277045100339E12 /* mpeg4_grouping_2d.c in Sources */,
+ 71CCF2781277045100339E12 /* mpeg4_grouping_3d.c in Sources */,
+ 71CCF2791277045100339E12 /* mpeg4_layer_2d.c in Sources */,
+ 71CCF27A1277045100339E12 /* mpeg4_layer_3d.c in Sources */,
+ 71CCF27B1277045100339E12 /* mpeg4_layout.c in Sources */,
+ 71CCF27C1277045100339E12 /* mpeg4_lighting.c in Sources */,
+ 71CCF27D1277045100339E12 /* mpeg4_path_layout.c in Sources */,
+ 71CCF27E1277045100339E12 /* mpeg4_sensors.c in Sources */,
+ 71CCF27F1277045100339E12 /* mpeg4_sound.c in Sources */,
+ 71CCF2801277045100339E12 /* mpeg4_text.c in Sources */,
+ 71CCF2811277045100339E12 /* mpeg4_textures.c in Sources */,
+ 71CCF2821277045100339E12 /* mpeg4_timesensor.c in Sources */,
+ 71CCF2831277045100339E12 /* mpeg4_viewport.c in Sources */,
+ 71CCF2841277045100339E12 /* navigate.c in Sources */,
+ 71CCF2861277045100339E12 /* offscreen_cache.c in Sources */,
+ 71CCF2881277045100339E12 /* svg_base.c in Sources */,
+ 71CCF2891277045100339E12 /* svg_filters.c in Sources */,
+ 71CCF28A1277045100339E12 /* svg_font.c in Sources */,
+ 71CCF28B1277045100339E12 /* svg_geometry.c in Sources */,
+ 71CCF28C1277045100339E12 /* svg_grouping.c in Sources */,
+ 71CCF28D1277045100339E12 /* svg_media.c in Sources */,
+ 71CCF28E1277045100339E12 /* svg_paint_servers.c in Sources */,
+ 71CCF28F1277045100339E12 /* svg_text.c in Sources */,
+ 71CCF2901277045100339E12 /* texturing.c in Sources */,
+ 71CCF2921277045100339E12 /* texturing_gl.c in Sources */,
+ 71CCF2931277045100339E12 /* visual_manager.c in Sources */,
+ 71CCF2951277045100339E12 /* visual_manager_2d.c in Sources */,
+ 71CCF2971277045100339E12 /* visual_manager_2d_draw.c in Sources */,
+ 71CCF2981277045100339E12 /* visual_manager_3d.c in Sources */,
+ 71CCF29A1277045100339E12 /* visual_manager_3d_gl.c in Sources */,
+ 71CCF29B1277045100339E12 /* x3d_geometry.c in Sources */,
+ 71CCF29C1277045100339E12 /* rtcp.c in Sources */,
+ 71CCF29D1277045100339E12 /* rtp.c in Sources */,
+ 71CCF29E1277045100339E12 /* rtp_depacketizer.c in Sources */,
+ 71CCF29F1277045100339E12 /* rtp_packetizer.c in Sources */,
+ 71CCF2A01277045100339E12 /* rtp_pck_3gpp.c in Sources */,
+ 71CCF2A11277045100339E12 /* rtp_pck_mpeg12.c in Sources */,
+ 71CCF2A21277045100339E12 /* rtp_pck_mpeg4.c in Sources */,
+ 71CCF2A31277045100339E12 /* rtp_streamer.c in Sources */,
+ 71CCF2A41277045100339E12 /* rtsp_command.c in Sources */,
+ 71CCF2A51277045100339E12 /* rtsp_common.c in Sources */,
+ 71CCF2A61277045100339E12 /* rtsp_response.c in Sources */,
+ 71CCF2A71277045100339E12 /* rtsp_session.c in Sources */,
+ 71CCF2A81277045100339E12 /* sdp.c in Sources */,
+ 71CCF2A91277045100339E12 /* avc_ext.c in Sources */,
+ 71CCF2AA1277045100339E12 /* box_code_3gpp.c in Sources */,
+ 71CCF2AB1277045100339E12 /* box_code_apple.c in Sources */,
+ 71CCF2AC1277045100339E12 /* box_code_base.c in Sources */,
+ 71CCF2AD1277045100339E12 /* box_code_isma.c in Sources */,
+ 71CCF2AE1277045100339E12 /* box_code_meta.c in Sources */,
+ 71CCF2AF1277045100339E12 /* box_dump.c in Sources */,
+ 71CCF2B01277045100339E12 /* box_funcs.c in Sources */,
+ 71CCF2B11277045100339E12 /* data_map.c in Sources */,
+ 71CCF2B21277045100339E12 /* hint_track.c in Sources */,
+ 71CCF2B31277045100339E12 /* hinting.c in Sources */,
+ 71CCF2B41277045100339E12 /* isma_sample.c in Sources */,
+ 71CCF2B51277045100339E12 /* isom_intern.c in Sources */,
+ 71CCF2B61277045100339E12 /* isom_read.c in Sources */,
+ 71CCF2B71277045100339E12 /* isom_store.c in Sources */,
+ 71CCF2B81277045100339E12 /* isom_write.c in Sources */,
+ 71CCF2B91277045100339E12 /* media.c in Sources */,
+ 71CCF2BA1277045100339E12 /* media_odf.c in Sources */,
+ 71CCF2BB1277045100339E12 /* meta.c in Sources */,
+ 71CCF2BC1277045100339E12 /* movie_fragments.c in Sources */,
+ 71CCF2BD1277045100339E12 /* sample_descs.c in Sources */,
+ 71CCF2BE1277045100339E12 /* stbl_read.c in Sources */,
+ 71CCF2BF1277045100339E12 /* stbl_write.c in Sources */,
+ 71CCF2C01277045100339E12 /* track.c in Sources */,
+ 71CCF2C11277045100339E12 /* tx3g.c in Sources */,
+ 71CCF2C21277045100339E12 /* lsr_dec.c in Sources */,
+ 71CCF2C31277045100339E12 /* lsr_enc.c in Sources */,
+ 71CCF2C41277045100339E12 /* lsr_tables.c in Sources */,
+ 71CCF2C51277045100339E12 /* cbc.c in Sources */,
+ 71CCF2C61277045100339E12 /* cfb.c in Sources */,
+ 71CCF2C71277045100339E12 /* ctr.c in Sources */,
+ 71CCF2C81277045100339E12 /* des.c in Sources */,
+ 71CCF2C91277045100339E12 /* ecb.c in Sources */,
+ 71CCF2CA1277045100339E12 /* g_crypt.c in Sources */,
+ 71CCF2CB1277045100339E12 /* ncfb.c in Sources */,
+ 71CCF2CC1277045100339E12 /* nofb.c in Sources */,
+ 71CCF2CD1277045100339E12 /* ofb.c in Sources */,
+ 71CCF2CE1277045100339E12 /* rijndael-128.c in Sources */,
+ 71CCF2CF1277045100339E12 /* rijndael-192.c in Sources */,
+ 71CCF2D01277045100339E12 /* rijndael-256.c in Sources */,
+ 71CCF2D11277045100339E12 /* sha1.c in Sources */,
+ 71CCF2D21277045100339E12 /* stream.c in Sources */,
+ 71CCF2D31277045100339E12 /* tripledes.c in Sources */,
+ 71CCF2D41277045100339E12 /* av_parsers.c in Sources */,
+ 71CCF2D51277045100339E12 /* avilib.c in Sources */,
+ 71CCF2D61277045100339E12 /* dvb_mpe.c in Sources */,
+ 71CCF2D71277045100339E12 /* filestreamer.c in Sources */,
+ 71CCF2D81277045100339E12 /* gpac_ogg.c in Sources */,
+ 71CCF2D91277045100339E12 /* img.c in Sources */,
+ 71CCF2DA1277045100339E12 /* ismacryp.c in Sources */,
+ 71CCF2DB1277045100339E12 /* isom_hinter.c in Sources */,
+ 71CCF2DC1277045100339E12 /* isom_tools.c in Sources */,
+ 71CCF2DD1277045100339E12 /* m2ts_mux.c in Sources */,
+ 71CCF2DE1277045100339E12 /* media_export.c in Sources */,
+ 71CCF2DF1277045100339E12 /* media_import.c in Sources */,
+ 71CCF2E01277045100339E12 /* mpeg2_ps.c in Sources */,
+ 71CCF2E21277045100339E12 /* mpegts.c in Sources */,
+ 71CCF2E31277045100339E12 /* reedsolomon.c in Sources */,
+ 71CCF2E41277045100339E12 /* saf.c in Sources */,
+ 71CCF2E51277045100339E12 /* text_import.c in Sources */,
+ 71CCF2E61277045100339E12 /* vobsub.c in Sources */,
+ 71CCF2E71277045100339E12 /* desc_private.c in Sources */,
+ 71CCF2E81277045100339E12 /* descriptors.c in Sources */,
+ 71CCF2E91277045100339E12 /* ipmpx_code.c in Sources */,
+ 71CCF2EA1277045100339E12 /* ipmpx_dump.c in Sources */,
+ 71CCF2EB1277045100339E12 /* ipmpx_parse.c in Sources */,
+ 71CCF2EC1277045100339E12 /* oci_codec.c in Sources */,
+ 71CCF2ED1277045100339E12 /* odf_code.c in Sources */,
+ 71CCF2EE1277045100339E12 /* odf_codec.c in Sources */,
+ 71CCF2EF1277045100339E12 /* odf_command.c in Sources */,
+ 71CCF2F01277045100339E12 /* odf_dump.c in Sources */,
+ 71CCF2F11277045100339E12 /* odf_parse.c in Sources */,
+ 71CCF2F21277045100339E12 /* qos.c in Sources */,
+ 71CCF2F31277045100339E12 /* slc.c in Sources */,
+ 71CCF2F41277045100339E12 /* encode_isom.c in Sources */,
+ 71CCF2F51277045100339E12 /* loader_bt.c in Sources */,
+ 71CCF2F61277045100339E12 /* loader_isom.c in Sources */,
+ 71CCF2F71277045100339E12 /* loader_qt.c in Sources */,
+ 71CCF2F81277045100339E12 /* loader_svg.c in Sources */,
+ 71CCF2F91277045100339E12 /* loader_xmt.c in Sources */,
+ 71CCF2FA1277045100339E12 /* scene_dump.c in Sources */,
+ 71CCF2FB1277045100339E12 /* scene_engine.c in Sources */,
+ 71CCF2FC1277045100339E12 /* scene_manager.c in Sources */,
+ 71CCF2FD1277045100339E12 /* scene_stats.c in Sources */,
+ 71CCF2FE1277045100339E12 /* swf_bifs.c in Sources */,
+ 71CCF2FF1277045100339E12 /* swf_parse.c in Sources */,
+ 71CCF3001277045100339E12 /* text_to_bifs.c in Sources */,
+ 71CCF3011277045100339E12 /* base_scenegraph.c in Sources */,
+ 71CCF3021277045100339E12 /* commands.c in Sources */,
+ 71CCF3031277045100339E12 /* dom_events.c in Sources */,
+ 71CCF3041277045100339E12 /* dom_smjs.c in Sources */,
+ 71CCF3051277045100339E12 /* mpeg4_animators.c in Sources */,
+ 71CCF3061277045100339E12 /* mpeg4_nodes.c in Sources */,
+ 71CCF3071277045100339E12 /* mpeg4_valuator.c in Sources */,
+ 71CCF3081277045100339E12 /* smil_anim.c in Sources */,
+ 71CCF3091277045100339E12 /* smil_timing.c in Sources */,
+ 71CCF30A1277045100339E12 /* svg_attributes.c in Sources */,
+ 71CCF30B1277045100339E12 /* svg_properties.c in Sources */,
+ 71CCF30C1277045100339E12 /* svg_smjs.c in Sources */,
+ 71CCF30D1277045100339E12 /* svg_types.c in Sources */,
+ 71CCF30E1277045100339E12 /* vrml_interpolators.c in Sources */,
+ 71CCF30F1277045100339E12 /* vrml_proto.c in Sources */,
+ 71CCF3101277045100339E12 /* vrml_route.c in Sources */,
+ 71CCF3111277045100339E12 /* vrml_script.c in Sources */,
+ 71CCF3121277045100339E12 /* vrml_smjs.c in Sources */,
+ 71CCF3131277045100339E12 /* vrml_tools.c in Sources */,
+ 71CCF3141277045100339E12 /* x3d_nodes.c in Sources */,
+ 71CCF3151277045100339E12 /* xbl_process.c in Sources */,
+ 71CCF3161277045100339E12 /* xml_ns.c in Sources */,
+ 71CCF3171277045100339E12 /* channel.c in Sources */,
+ 71CCF3181277045100339E12 /* clock.c in Sources */,
+ 71CCF3191277045100339E12 /* decoder.c in Sources */,
+ 71CCF31A1277045100339E12 /* input_sensor.c in Sources */,
+ 71CCF31C1277045100339E12 /* media_control.c in Sources */,
+ 71CCF31E1277045100339E12 /* media_manager.c in Sources */,
+ 71CCF31F1277045100339E12 /* media_memory.c in Sources */,
+ 71CCF3211277045100339E12 /* media_object.c in Sources */,
+ 71CCF3221277045100339E12 /* media_sensor.c in Sources */,
+ 71CCF3231277045100339E12 /* mpeg4_inline.c in Sources */,
+ 71CCF3241277045100339E12 /* network_service.c in Sources */,
+ 71CCF3251277045100339E12 /* object_browser.c in Sources */,
+ 71CCF3261277045100339E12 /* object_manager.c in Sources */,
+ 71CCF3271277045100339E12 /* scene.c in Sources */,
+ 71CCF3281277045100339E12 /* svg_external.c in Sources */,
+ 71CCF3291277045100339E12 /* term_node_init.c in Sources */,
+ 71CCF32A1277045100339E12 /* terminal.c in Sources */,
+ 71CCF32B1277045100339E12 /* base_encoding.c in Sources */,
+ 71CCF32C1277045100339E12 /* bitstream.c in Sources */,
+ 71CCF32D1277045100339E12 /* color.c in Sources */,
+ 71CCF32E1277045100339E12 /* configfile.c in Sources */,
+ 71CCF32F1277045100339E12 /* dlmalloc.c in Sources */,
+ 71CCF3301277045100339E12 /* downloader.c in Sources */,
+ 71CCF3311277045100339E12 /* error.c in Sources */,
+ 71CCF3331277045100339E12 /* list.c in Sources */,
+ 71CCF3341277045100339E12 /* math.c in Sources */,
+ 71CCF3351277045100339E12 /* module.c in Sources */,
+ 71CCF3371277045100339E12 /* os_divers.c in Sources */,
+ 71CCF3381277045100339E12 /* os_module.c in Sources */,
+ 71CCF3391277045100339E12 /* os_net.c in Sources */,
+ 71CCF33A1277045100339E12 /* os_thread.c in Sources */,
+ 71CCF33B1277045100339E12 /* path2d.c in Sources */,
+ 71CCF33C1277045100339E12 /* path2d_stroker.c in Sources */,
+ 71CCF33F1277045100339E12 /* token.c in Sources */,
+ 71CCF3401277045100339E12 /* uni_bidi.c in Sources */,
+ 71CCF3411277045100339E12 /* url.c in Sources */,
+ 71CCF3421277045100339E12 /* utf.c in Sources */,
+ 71CCF3431277045100339E12 /* xml_parser.c in Sources */,
+ 71CCF3451277045100339E12 /* zutil.c in Sources */,
+ 7141FF301292CB9200FCB27D /* alloc.c in Sources */,
+ 7147426012B918C900DB5A59 /* cache.c in Sources */,
+ 970A26C913434D2C0007362C /* m3u8.c in Sources */,
+ 970A26CA13434D2C0007362C /* mpd.c in Sources */,
+ 970A26D713434DAC0007362C /* ringbuffer.c in Sources */,
+ 970A26D813434DAC0007362C /* unicode.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 718477D5127814D600917298 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 71CCF1301277037A00339E12 /* libgpac_static */;
+ targetProxy = 718477D4127814D600917298 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 71179CC51292EC3500A83216 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_mpd_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = mpd_in;
+ };
+ name = Debug;
+ };
+ 71179CC61292EC3500A83216 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_mpd_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = mpd_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718477D1127814B300917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = "";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ ONLY_ACTIVE_ARCH = NO;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/libgpac_dynamic.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = libgpac_dynamic;
+ };
+ name = Debug;
+ };
+ 718477D2127814B300917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = "";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ ONLY_ACTIVE_ARCH = NO;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/libgpac_dynamic.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = libgpac_dynamic;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478321278645C00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_CFLAGS = "-fgnu89-inline";
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_soft_raster.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = soft_raster;
+ };
+ name = Debug;
+ };
+ 718478331278645C00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_soft_raster.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = soft_raster;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478391278647300917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_dummy_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = dummy_in;
+ };
+ name = Debug;
+ };
+ 7184783A1278647300917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_dummy_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = dummy_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 71847842127864AD00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_ctx_load.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ctx_load;
+ };
+ name = Debug;
+ };
+ 71847843127864AD00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_ctx_load.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ctx_load;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7184784A1278654100917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ GPAC_HAS_FAAD,
+ );
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/faad,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_aac_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = aac_in;
+ };
+ name = Debug;
+ };
+ 7184784B1278654100917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ GPAC_HAS_FAAD,
+ );
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/faad,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_aac_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = aac_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478511278655900917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_svg_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = svg_in;
+ };
+ name = Debug;
+ };
+ 718478521278655900917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_svg_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = svg_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478581278656F00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ GPAC_HAS_MAD,
+ );
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/mad,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_mp3_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = mp3_in;
+ };
+ name = Debug;
+ };
+ 718478591278656F00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ GPAC_HAS_MAD,
+ );
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/mad,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_mp3_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = mp3_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7184785F1278657F00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ );
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_img_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = img_in;
+ };
+ name = Debug;
+ };
+ 718478601278657F00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ );
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_img_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = img_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478661278658B00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_bifs_dec.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = bifs_dec;
+ };
+ name = Debug;
+ };
+ 718478671278658B00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_bifs_dec.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = bifs_dec;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7184786D127865A300917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_HAS_SPIDERMONKEY,
+ MOZILLA_1_8_BRANCH,
+ XP_UNIX,
+ );
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/js,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_gpac_js.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = gpac_js;
+ };
+ name = Debug;
+ };
+ 7184786E127865A300917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_HAS_SPIDERMONKEY,
+ MOZILLA_1_8_BRANCH,
+ XP_UNIX,
+ );
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/js,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_gpac_js.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = gpac_js;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 71847874127865B700917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_isom_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = isom_in;
+ };
+ name = Debug;
+ };
+ 71847875127865B700917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_isom_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = isom_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7184787B127865CC00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_laser_dec.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = laser_dec;
+ };
+ name = Debug;
+ };
+ 7184787C127865CC00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_laser_dec.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = laser_dec;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 71847882127865D700917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_odf_dec.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = odf_dec;
+ };
+ name = Debug;
+ };
+ 71847883127865D700917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_odf_dec.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = odf_dec;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 71847892127865F800917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_rtp_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = rtp_in;
+ };
+ name = Debug;
+ };
+ 71847893127865F800917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_rtp_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = rtp_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478991278660400917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_mpegts_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = mpegts_in;
+ };
+ name = Debug;
+ };
+ 7184789A1278660400917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = ../../include;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_mpegts_in.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = mpegts_in;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478A01278661800917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = (
+ ../../extra_lib/include/freetype,
+ ../../include,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_ft_font.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ft_font;
+ };
+ name = Debug;
+ };
+ 718478A11278661800917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = (
+ ../../extra_lib/include/freetype,
+ ../../include,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_ft_font.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ft_font;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478A71278662F00917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/js,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_widgetman.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = widgetman;
+ };
+ name = Debug;
+ };
+ 718478A81278662F00917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/js,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_widgetman.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = widgetman;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 718478B21278666100917298 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/SDL,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_sdl_out.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = sdl_out;
+ };
+ name = Debug;
+ };
+ 718478B31278666100917298 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_EXTENSION = dylib;
+ EXECUTABLE_PREFIX = gm_;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/SDL,
+ );
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ "\"$(SRCROOT)/build/Release-iphonesimulator\"",
+ "\"$(SRCROOT)/../../bin/iOS\"",
+ );
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = (
+ "-dynamic",
+ "-install_name",
+ "@loader_path/gm_sdl_out.dylib",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = sdl_out;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 71A19B1D12796B5700ACFF58 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEAD_CODE_STRIPPING = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OBJC_CALL_CXX_CDTORS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = NO;
+ GCC_PREFIX_HEADER = "";
+ GCC_PREPROCESSOR_DEFINITIONS = GPAC_IPHONE;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/SDL,
+ );
+ INFOPLIST_FILE = "../../applications/osmo4_ios/osmo4ios-Info.plist";
+ INSTALL_PATH = "$(HOME)/Applications";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.6;
+ OTHER_LDFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = osmo4ios;
+ PROVISIONING_PROFILE = "";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 71A19B1E12796B5700ACFF58 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = NO;
+ GCC_PREFIX_HEADER = "";
+ GCC_PREPROCESSOR_DEFINITIONS = GPAC_IPHONE;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../extra_lib/include/SDL,
+ );
+ INFOPLIST_FILE = "../../applications/osmo4_ios/osmo4ios-Info.plist";
+ INSTALL_PATH = "$(HOME)/Applications";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS\"",
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.6;
+ OTHER_LDFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = osmo4ios;
+ PROVISIONING_PROFILE = "";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 71CCF1331277037B00339E12 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ EXECUTABLE_PREFIX = "";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ XP_UNIX,
+ GPAC_CONFIG_DARWIN,
+ GPAC_IPHONE,
+ );
+ GCC_THUMB_SUPPORT = NO;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../..,
+ ../../extra_lib/include/png,
+ ../../extra_lib/include/jpeg,
+ ../../extra_lib/include/js,
+ ../../extra_lib/include/zlib,
+ ../../modules/sdl_out,
+ ../../extra_lib/include/SDL,
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS/Debug-iphonesimulator\"",
+ );
+ ONLY_ACTIVE_ARCH = NO;
+ OTHER_CFLAGS = "-fms-extensions";
+ PREBINDING = NO;
+ PRODUCT_NAME = libgpac_static;
+ };
+ name = Debug;
+ };
+ 71CCF1341277037B00339E12 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ EXECUTABLE_PREFIX = "";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ XP_UNIX,
+ GPAC_CONFIG_DARWIN,
+ GPAC_IPHONE,
+ );
+ GCC_THUMB_SUPPORT = NO;
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../..,
+ ../../extra_lib/include/png,
+ ../../extra_lib/include/jpeg,
+ ../../extra_lib/include/js,
+ ../../extra_lib/include/zlib,
+ ../../modules/sdl_out,
+ ../../extra_lib/include/SDL,
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../extra_lib/lib/iOS/Debug-iphonesimulator\"",
+ );
+ ONLY_ACTIVE_ARCH = NO;
+ OTHER_CFLAGS = (
+ "-fms-extensions",
+ "-DNS_BLOCK_ASSERTIONS=1",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = libgpac_static;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_FAST_OBJC_DISPATCH = NO;
+ GCC_OBJC_CALL_CXX_CDTORS = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ );
+ GCC_THUMB_SUPPORT = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ ONLY_ACTIVE_ARCH = NO;
+ PREBINDING = NO;
+ PROVISIONING_PROFILE = "";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_FAST_OBJC_DISPATCH = NO;
+ GCC_OBJC_CALL_CXX_CDTORS = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ GPAC_CONFIG_DARWIN,
+ XP_UNIX,
+ );
+ GCC_THUMB_SUPPORT = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ ONLY_ACTIVE_ARCH = NO;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PREBINDING = NO;
+ PROVISIONING_PROFILE = "";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 71179CD11292ECAC00A83216 /* Build configuration list for PBXNativeTarget "mpd_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71179CC51292EC3500A83216 /* Debug */,
+ 71179CC61292EC3500A83216 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 718477D3127814D100917298 /* Build configuration list for PBXNativeTarget "libgpac_dynamic" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718477D1127814B300917298 /* Debug */,
+ 718477D2127814B300917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7184783B1278649100917298 /* Build configuration list for PBXNativeTarget "soft_raster" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478321278645C00917298 /* Debug */,
+ 718478331278645C00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7184783C1278649100917298 /* Build configuration list for PBXNativeTarget "dummy_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478391278647300917298 /* Debug */,
+ 7184783A1278647300917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847844127864CB00917298 /* Build configuration list for PBXNativeTarget "ctx_load" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71847842127864AD00917298 /* Debug */,
+ 71847843127864AD00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847884127865F500917298 /* Build configuration list for PBXNativeTarget "aac_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7184784A1278654100917298 /* Debug */,
+ 7184784B1278654100917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847885127865F500917298 /* Build configuration list for PBXNativeTarget "svg_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478511278655900917298 /* Debug */,
+ 718478521278655900917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847886127865F500917298 /* Build configuration list for PBXNativeTarget "mp3_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478581278656F00917298 /* Debug */,
+ 718478591278656F00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847887127865F500917298 /* Build configuration list for PBXNativeTarget "img_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7184785F1278657F00917298 /* Debug */,
+ 718478601278657F00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847888127865F500917298 /* Build configuration list for PBXNativeTarget "bifs_dec" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478661278658B00917298 /* Debug */,
+ 718478671278658B00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71847889127865F500917298 /* Build configuration list for PBXNativeTarget "gpac_js" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7184786D127865A300917298 /* Debug */,
+ 7184786E127865A300917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7184788A127865F500917298 /* Build configuration list for PBXNativeTarget "isom_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71847874127865B700917298 /* Debug */,
+ 71847875127865B700917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7184788B127865F500917298 /* Build configuration list for PBXNativeTarget "laser_dec" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7184787B127865CC00917298 /* Debug */,
+ 7184787C127865CC00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7184788C127865F500917298 /* Build configuration list for PBXNativeTarget "odf_dec" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71847882127865D700917298 /* Debug */,
+ 71847883127865D700917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 718478A91278664D00917298 /* Build configuration list for PBXNativeTarget "rtp_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71847892127865F800917298 /* Debug */,
+ 71847893127865F800917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 718478AA1278664D00917298 /* Build configuration list for PBXNativeTarget "mpegts_in" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478991278660400917298 /* Debug */,
+ 7184789A1278660400917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 718478AB1278664D00917298 /* Build configuration list for PBXNativeTarget "ft_font" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478A01278661800917298 /* Debug */,
+ 718478A11278661800917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 718478AC1278664D00917298 /* Build configuration list for PBXNativeTarget "widgetman" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478A71278662F00917298 /* Debug */,
+ 718478A81278662F00917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 718478B41278667F00917298 /* Build configuration list for PBXNativeTarget "sdl_out" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 718478B21278666100917298 /* Debug */,
+ 718478B31278666100917298 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71A19B1F12796B5800ACFF58 /* Build configuration list for PBXNativeTarget "osmo4ios" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71A19B1D12796B5700ACFF58 /* Debug */,
+ 71A19B1E12796B5700ACFF58 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 71CCF1351277037B00339E12 /* Build configuration list for PBXNativeTarget "libgpac_static" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 71CCF1331277037B00339E12 /* Debug */,
+ 71CCF1341277037B00339E12 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "gpac4ios" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
--- /dev/null
+/*
+ * libgpac_hack.h
+ * mp4client
+ *
+ * Created by bouqueau on 17/06/10.
+ * Copyright 2010 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+
+/*exports for dlopen*/
+#define gf_log_lt _gf_log_lt
+#define AVI_close _AVI_close
+#define gf_term_del _gf_term_del
+#define gf_sleep _gf_sleep
+#define gf_sc_release_screen_buffer _gf_sc_release_screen_buffer
+#define gf_log_set_callback _gf_log_set_callback
+#define gf_prompt_get_char _gf_prompt_get_char
+#define gf_set_progress _gf_set_progress
+#define gf_term_new _gf_term_new
+#define gf_term_process_step _gf_term_process_step
+#define gf_sc_get_screen_buffer _gf_sc_get_screen_buffer
+#define gf_iphone_set_sdl_audio_module _gf_iphone_set_sdl_audio_module
+#define gf_term_step_clocks _gf_term_step_clocks
+#define gf_prompt_set_echo_off _gf_prompt_set_echo_off
+#define gf_log_get_tools _gf_log_get_tools
+#define gf_log_get_level _gf_log_get_level
+#define gf_cfg_set_key _gf_cfg_set_key
+#define gf_cfg_get_section_count _gf_cfg_get_section_count
+#define gf_term_get_service_info _gf_term_get_service_info
+#define gf_term_set_size _gf_term_set_size
+#define gf_sys_get_rti _gf_sys_get_rti
+#define gf_log_set_tools _gf_log_set_tools
+#define gf_term_play_from_time _gf_term_play_from_time
+#define gf_malloc _gf_malloc
+#define gf_log_set_level _gf_log_set_level
+#define gf_iphone_set_sdl_video_module _gf_iphone_set_sdl_video_module
+#define gf_term_get_option _gf_term_get_option
+#define gf_term_user_event _gf_term_user_event
+#define gf_modules_get_file_name _gf_modules_get_file_name
+#define gf_mx_new _gf_mx_new
+#define gf_list_count _gf_list_count
+#define gf_free _gf_free
+#define gf_term_get_world_info _gf_term_get_world_info
+#define gf_cfg_get_section_name _gf_cfg_get_section_name
+#define gf_term_navigate_to _gf_term_navigate_to
+#define gf_modules_del _gf_modules_del
+#define gf_modules_new _gf_modules_new
+#define gf_sys_init _gf_sys_init
+#define gf_log _gf_log
+#define gf_term_get_object_info _gf_term_get_object_info
+#define gf_mx_p _gf_mx_p
+#define gf_mx_v _gf_mx_v
+#define gf_mx_del _gf_mx_del
+#define gf_term_process_flush _gf_term_process_flush
+#define gf_cfg_get_key_name _gf_cfg_get_key_name
+#define AVI_write_frame _AVI_write_frame
+#define gf_cfg_del _gf_cfg_del
+#define gf_term_get_channel_net_info _gf_term_get_channel_net_info
+#define gf_term_process_shortcut _gf_term_process_shortcut
+#define gf_cfg_new _gf_cfg_new
+#define gf_term_get_download_info _gf_term_get_download_info
+#define gf_sys_clock _gf_sys_clock
+#define gf_term_get_object _gf_term_get_object
+#define gf_term_set_option _gf_term_set_option
+#define gf_sys_close _gf_sys_close
+#define gf_term_connect_from_time _gf_term_connect_from_time
+#define AVI_open_output_file _AVI_open_output_file
+#define gf_cfg_get_key _gf_cfg_get_key
+#define AVI_set_video _AVI_set_video
+#define gf_term_set_speed _gf_term_set_speed
+#define gf_cfg_get_key_count _gf_cfg_get_key_count
+#define gf_term_object_subscene_type _gf_term_object_subscene_type
+#define gf_term_get_framerate _gf_term_get_framerate
+#define gf_error_to_string _gf_error_to_string
+#define gf_stretch_bits _gf_stretch_bits
+#define gf_list_del _gf_list_del
+#define gf_list_get _gf_list_get
+#define gf_term_disconnect _gf_term_disconnect
+#define gf_term_is_supported_url _gf_term_is_supported_url
+#define gf_list_new _gf_list_new
+#define gf_modules_get_option _gf_modules_get_option
+#define gf_term_dump_scene _gf_term_dump_scene
+#define gf_prompt_has_input _gf_prompt_has_input
+#define gf_term_scene_update _gf_term_scene_update
+#define gf_term_connect _gf_term_connect
+#define gf_term_get_object_count _gf_term_get_object_count
+#define gf_modules_get_count _gf_modules_get_count
+#define gf_term_get_root_object _gf_term_get_root_object
+#define gf_term_get_time_in_ms _gf_term_get_time_in_ms
+#define gf_term_connect_with_path _gf_term_connect_with_path
+#define gf_log_parse_tools _gf_log_parse_tools
+#define gf_log_parse_level _gf_log_parse_level
+#define gf_term_switch_quality _gf_term_switch_quality
+#define gf_term_release_screen_buffer _gf_term_release_screen_buffer
+#define gf_term_get_screen_buffer _gf_term_get_screen_buffer
+#define gf_f64_open _gf_f64_open
+#define gf_img_png_enc _gf_img_png_enc
+#define utf8_to_ucs4 _utf8_to_ucs4
+
+/*includes both terminal and od browser*/
+#include <gpac/terminal.h>
+#include <gpac/term_info.h>
+#include <gpac/constants.h>
+#include <gpac/options.h>
+#include <gpac/modules/service.h>
+
+/*ISO 639 languages*/
+#include <gpac/iso639.h>
+#include "sdl_out.h"
+#include "dlfcn.h"
+
+
+/*exports for dlopen*/
+#include <gpac/internal/avilib.h>
+#include <gpac/internal/terminal_dev.h>
+#include <gpac/internal/compositor_dev.h>
+#undef gf_log_lt
+extern void (*gf_log_lt)(u32 ll, u32 lt);
+#undef AVI_close
+extern int (*AVI_close)(avi_t *AVI);
+#undef gf_term_del
+extern GF_Err (*gf_term_del)(GF_Terminal *term);
+#undef gf_sleep
+extern void (*gf_sleep)(u32 ms);
+#undef gf_sc_release_screen_buffer
+extern GF_Err (*gf_sc_release_screen_buffer)(GF_Compositor *sr, GF_VideoSurface *framebuffer);
+#undef gf_prompt_get_char
+extern char (*gf_prompt_get_char)();
+#undef gf_set_progress
+extern void (*gf_set_progress)(char *title, u32 done, u32 total);
+#undef gf_term_new
+extern GF_Terminal *(*gf_term_new)(GF_User *user);
+#undef gf_term_process_step
+extern GF_Err (*gf_term_process_step)(GF_Terminal *term);
+#undef gf_sc_get_screen_buffer
+extern GF_Err (*gf_sc_get_screen_buffer)(GF_Compositor *sr, GF_VideoSurface *framebuffer, Bool depth_buffer);
+#undef gf_iphone_set_sdl_audio_module
+extern void (*gf_iphone_set_sdl_audio_module)(void* (*SDL_Module) (void));
+#undef gf_term_step_clocks
+extern GF_Err (*gf_term_step_clocks)(GF_Terminal * term, u32 ms_diff);
+#undef gf_prompt_set_echo_off
+extern void (*gf_prompt_set_echo_off)(Bool echo_off);
+#undef gf_log_get_tools
+extern u32 (*gf_log_get_tools)();
+#undef gf_log_get_level
+extern u32 (*gf_log_get_level)();
+#undef gf_cfg_set_key
+extern GF_Err (*gf_cfg_set_key)(GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue);
+#undef gf_cfg_get_section_count
+extern u32 (*gf_cfg_get_section_count)(GF_Config *cfgFile);
+#undef gf_term_get_service_info
+extern GF_Err (*gf_term_get_service_info)(GF_Terminal *term, GF_ObjectManager *odm, NetInfoCommand *netcom);
+#undef gf_term_set_size
+extern GF_Err (*gf_term_set_size)(GF_Terminal *term, u32 NewWidth, u32 NewHeight);
+#undef gf_sys_get_rti
+extern Bool (*gf_sys_get_rti)(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags);
+#undef gf_log_set_tools
+extern void (*gf_log_set_tools)(u32 tools);
+#undef gf_term_play_from_time
+extern u32 (*gf_term_play_from_time)(GF_Terminal *term, u64 from_time, u32 pause_at_first_frame);
+#undef gf_malloc
+extern void *(*gf_malloc)(size_t size);
+#undef gf_log_set_level
+extern void (*gf_log_set_level)(u32 level);
+#undef gf_iphone_set_sdl_video_module
+extern void (*gf_iphone_set_sdl_video_module)(void* (*SDL_Module) (void));
+#undef gf_term_get_option
+extern u32 (*gf_term_get_option)(GF_Terminal *term, u32 opt_type);
+#undef gf_term_user_event
+extern Bool (*gf_term_user_event)(GF_Terminal *term, GF_Event *event);
+#undef gf_modules_get_file_name
+extern const char *(*gf_modules_get_file_name)(GF_ModuleManager *pm, u32 index);
+#undef gf_mx_new
+extern GF_Mutex *(*gf_mx_new)(const char *name);
+#undef gf_list_count
+extern u32 (*gf_list_count)(GF_List *ptr);
+#undef gf_free
+extern void (*gf_free)(void *ptr);
+#undef gf_term_get_world_info
+extern const char *(*gf_term_get_world_info)(GF_Terminal *term, GF_ObjectManager *scene_od, GF_List *descriptions);
+#undef gf_cfg_get_section_name
+extern const char *(*gf_cfg_get_section_name)(GF_Config *cfgFile, u32 secIndex);
+#undef gf_term_navigate_to
+extern void (*gf_term_navigate_to)(GF_Terminal *term, const char *toURL);
+#undef gf_modules_del
+extern void (*gf_modules_del)(GF_ModuleManager *pm);
+#undef gf_modules_new
+extern GF_ModuleManager *(*gf_modules_new)(const char *directory, GF_Config *cfgFile);
+#undef gf_sys_init
+extern void (*gf_sys_init)(Bool enable_memory_tracker);
+#undef gf_log
+extern void (*gf_log)(const char *fmt, ...);
+#undef gf_term_get_object_info
+extern GF_Err (*gf_term_get_object_info)(GF_Terminal *term, GF_ObjectManager *odm, GF_MediaInfo *info);
+#undef gf_mx_p
+extern u32 (*gf_mx_p)(GF_Mutex *mx);
+#undef gf_mx_v
+extern u32 (*gf_mx_v)(GF_Mutex *mx);
+#undef gf_mx_del
+extern void (*gf_mx_del)(GF_Mutex *mx);
+#undef gf_term_process_flush
+extern GF_Err (*gf_term_process_flush)(GF_Terminal *term);
+#undef gf_cfg_get_key_name
+extern const char *(*gf_cfg_get_key_name)(GF_Config *cfgFile, const char *secName, u32 keyIndex);
+#undef AVI_write_frame
+extern int (*AVI_write_frame)(avi_t *AVI, char *data, long bytes, int keyframe);
+#undef gf_cfg_del
+extern void (*gf_cfg_del)(GF_Config *iniFile);
+#undef gf_term_get_channel_net_info
+extern Bool (*gf_term_get_channel_net_info)(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_enum, u32 *chid, NetStatCommand *netcom, GF_Err *ret_code);
+#undef gf_term_process_shortcut
+extern void (*gf_term_process_shortcut)(GF_Terminal *term, GF_Event *ev);
+#undef gf_cfg_new
+extern GF_Config *(*gf_cfg_new)(const char *filePath, const char *fileName);
+#undef gf_term_get_download_info
+extern Bool (*gf_term_get_download_info)(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_enum, const char **server, const char **path, u32 *bytes_done, u32 *total_bytes, u32 *bytes_per_sec);
+#undef gf_sys_clock
+extern u32 (*gf_sys_clock)();
+#undef gf_term_get_object
+extern GF_ObjectManager *(*gf_term_get_object)(GF_Terminal *term, GF_ObjectManager *scene_od, u32 index);
+#undef gf_term_set_option
+extern GF_Err (*gf_term_set_option)(GF_Terminal *term, u32 opt_type, u32 opt_value);
+#undef gf_sys_close
+extern void (*gf_sys_close)();
+#undef gf_term_connect_from_time
+extern void (*gf_term_connect_from_time)(GF_Terminal *term, const char *URL, u64 time_in_ms, Bool pause_at_first_frame);
+#undef AVI_open_output_file
+extern avi_t* (*AVI_open_output_file)(char * filename);
+#undef gf_cfg_get_key
+extern const char *(*gf_cfg_get_key)(GF_Config *cfgFile, const char *secName, const char *keyName);
+#undef AVI_set_video
+extern void (*AVI_set_video)(avi_t *AVI, int width, int height, double fps, char *compressor);
+#undef gf_term_set_speed
+extern void (*gf_term_set_speed)(GF_Terminal *term, Fixed speed);
+#undef gf_cfg_get_key_count
+extern u32 (*gf_cfg_get_key_count)(GF_Config *cfgFile, const char *secName);
+#undef gf_term_object_subscene_type
+extern u32 (*gf_term_object_subscene_type)(GF_Terminal *term, GF_ObjectManager *odm);
+#undef gf_term_get_framerate
+extern Double (*gf_term_get_framerate)(GF_Terminal *term, Bool absoluteFPS);
+#undef gf_error_to_string
+extern const char *(*gf_error_to_string)(GF_Err e);
+#undef gf_stretch_bits
+extern GF_Err (*gf_stretch_bits)(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *dst_wnd, GF_Window *src_wnd, u8 alpha, Bool flip, GF_ColorKey *colorKey, GF_ColorMatrix * cmat);
+#undef gf_list_del
+extern void (*gf_list_del)(GF_List *ptr);
+#undef gf_list_get
+extern void *(*gf_list_get)(GF_List *ptr, u32 itemNumber);
+#undef gf_term_disconnect
+extern void (*gf_term_disconnect)(GF_Terminal *term);
+#undef gf_term_is_supported_url
+extern Bool (*gf_term_is_supported_url)(GF_Terminal *term, const char *fileName, Bool use_parent_url, Bool no_mime_check);
+#undef gf_list_new
+extern GF_List *(*gf_list_new)(void);
+#undef gf_modules_get_option
+extern const char *(*gf_modules_get_option)(GF_BaseInterface *interface_obj, const char *secName, const char *keyName);
+#undef gf_term_dump_scene
+extern GF_Err (*gf_term_dump_scene)(GF_Terminal *term, char *rad_name, char **filename, Bool xml_dump, Bool skip_proto, GF_ObjectManager *odm);
+#undef gf_prompt_has_input
+extern Bool (*gf_prompt_has_input)();
+#undef gf_term_scene_update
+extern GF_Err (*gf_term_scene_update)(GF_Terminal *term, char *type, char *com);
+#undef gf_term_connect
+extern void (*gf_term_connect)(GF_Terminal *term, const char *URL);
+#undef gf_term_get_object_count
+extern u32 (*gf_term_get_object_count)(GF_Terminal *term, GF_ObjectManager *scene_od);
+#undef gf_modules_get_count
+extern u32 (*gf_modules_get_count)(GF_ModuleManager *pm);
+#undef gf_term_get_root_object
+extern GF_ObjectManager *(*gf_term_get_root_object)(GF_Terminal *term);
+#undef gf_term_get_time_in_ms
+extern u32 (*gf_term_get_time_in_ms)(GF_Terminal *term);
+#undef gf_term_connect_with_path
+extern void (*gf_term_connect_with_path)(GF_Terminal *term, const char *URL, const char *parent_URL);
+#undef gf_log_set_callback
+extern gf_log_cbk (*gf_log_set_callback)(void *usr_cbk, gf_log_cbk cbk);
+#undef gf_log_parse_tools
+extern u32 (*gf_log_parse_tools)(const char *val);
+#undef gf_log_parse_level
+extern u32 (*gf_log_parse_level)(const char *val);
+#undef gf_term_switch_quality
+extern void (*gf_term_switch_quality)(GF_Terminal *term, Bool up);
+#undef gf_term_release_screen_buffer
+extern GF_Err (*gf_term_release_screen_buffer)(GF_Terminal *term, GF_VideoSurface *framebuffer);
+#undef gf_term_get_screen_buffer
+extern GF_Err (*gf_term_get_screen_buffer)(GF_Terminal *term, GF_VideoSurface *framebuffer);
+#undef gf_f64_open
+extern FILE *(*gf_f64_open)(const char *file_name, const char *mode);
+#undef gf_img_png_enc
+extern GF_Err (*gf_img_png_enc)(char *data, u32 width, u32 height, s32 stride, u32 pixel_format, char *dst, u32 *dst_size);
+#undef utf8_to_ucs4
+extern u32 (*utf8_to_ucs4)(u32 *ucs4_buf, u32 utf8_len, unsigned char *utf8_buf);
+
--- /dev/null
+/*
+* GPAC - Multimedia Framework C SDK
+*
+* Author: Romain Bouqueau
+* Copyright (c) Telecom ParisTech 2010-20XX
+* All rights reserved
+*
+* GPAC is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2, or (at your option)
+* any later version.
+*
+* GPAC is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; see the file COPYING. If not, write to
+* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
+#include <gpac/tools.h>
+#include <gpac/modules/audio_out.h>
+#include <gpac/modules/video_out.h>
+
+/*interface query*/
+const u32 *QueryInterfaces()
+{
+ static u32 si [] = {
+ GF_VIDEO_OUTPUT_INTERFACE,
+ GF_AUDIO_OUTPUT_INTERFACE,
+ 0
+ };
+ return si;
+}
+/*interface create*/
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
+{
+ /*Hack: return invalid pointers*/
+ if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return 0x1;
+ if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) return 0x2;
+ return NULL;
+}
+/*interface destroy*/
+void ShutdownInterface(GF_BaseInterface *ifce)
+{
+ /*Hack: don't clean anything*/
+ switch (ifce->InterfaceType) {
+ case GF_VIDEO_OUTPUT_INTERFACE:
+ /*SDL_DeleteVideo(ifce);*/
+ break;
+ case GF_AUDIO_OUTPUT_INTERFACE:
+ /*SDL_DeleteAudio(ifce);*/
+ break;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * SDL_Hack.c
+ * mp4client
+ *
+ * Created by bouqueau on 19/04/10.
+ * Copyright 2010 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <gpac/tools.h>
+#include "sdl_out.h"
+
+static Bool is_init = 0;
+static u32 num_users = 0;
+
+Bool SDLOUT_InitSDL()
+{
+ if (is_init) {
+ num_users++;
+ return 1;
+ }
+ if (SDL_Init(0) < 0) return 0;
+ is_init = 1;
+ num_users++;
+ return 1;
+}
+
+void SDLOUT_CloseSDL()
+{
+ if (!is_init) return;
+ assert(num_users);
+ num_users--;
+ if (!num_users) SDL_Quit();
+ return;
+}
+
--- /dev/null
+#!/bin/sh
+
+/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo -create -output build/$1-iphoneos/libgpac_dynamic.dylib build/gpac4ios.build/$1-iphoneos/libgpac_dynamic.build/Objects-normal/armv6/libgpac_dynamic.dylib build/gpac4ios.build/$1-iphoneos/libgpac_dynamic.build/Objects-normal/armv7/libgpac_dynamic.dylib
+
+cp build/$1-iphoneos/libgpac_dynamic.dylib ../../bin/iOS/osmo4ios.app/
--- /dev/null
+#!/bin/sh
+#set -x
+
+for i in `ls ../../modules/`; do /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo -create -output build/$1-iphoneos/gm_$i.dylib build/gpac4ios.build/$1-iphoneos/$i.build/Objects-normal/armv6/gm_$i.dylib build/gpac4ios.build/$1-iphoneos/$i.build/Objects-normal/armv7/gm_$i.dylib ; done
;;
x86_64|amd64)
cpu="x86"
- is_64="yes"
+ if test "$linux" = "yes" ; then
+ is_64="yes"
+ fi
case `uname -s` in
SunOS)
canon_arch=`isainfo -n`
if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
cpu="x86_64"
- libdir="lib64"
+ if test "$linux" = "yes" ; then
+ libdir="lib64"
+ fi
want_pic="yes"
fi
fi
source_path="`echo $0 | sed -e 's#/configure##'`"
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
- source_path=`pwd`
+ source_path="`pwd`"
source_path_used="no"
else
source_path="`cd \"$source_path\"; pwd`"
CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic -fno-common"
;;
4.*)
-CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -fno-common"
+CFLAGS="$CFLAGS -pipe -fomit-frame-pointer -fno-common"
;;
esac
;;
linux="yes"
case "$cpu" in
sh4)
-CFLAGS="$CFLAGS -isystem $prefix/include"
+CFLAGS="$CFLAGS -isystem \"$prefix/include\""
#LDFLAGS="$LDFLAGS -L$prefix/lib"
;;
esac
EOF
has_zlib="no"
if $cc -o $TMPO $TMPC -lz 2> /dev/null ; then
-has_zlib="system"
-elif $cc -o $TMPO $TMPC -I$local_inc/zlib -L$local_lib -lz 2> /dev/null ; then
-has_zlib="local"
+ has_zlib="system"
+elif $cc -o $TMPO $TMPC -I"$local_inc/zlib" -L$local_lib -lz 2> /dev/null ; then
+ has_zlib="local"
else
echo "error: zlib not found on system or in local libs"
exit 1
EOF
if test "$cross_prefix" != "" ; then
- if $cc -o $TMPO $TMPC -I$prefix/include -L$prefix/lib -lxvidcore 2> /dev/null ; then
+ if $cc -o $TMPO $TMPC -I$prefix/include -L$prefix/lib -lxvidcore -lpthread 2> /dev/null ; then
has_xvid="system"
- elif $cc -o $TMPO $TMPC -I$local_inc/xvid -L$local_lib -lxvidcore 2> /dev/null ; then
+ elif $cc -o $TMPO $TMPC -I$local_inc/xvid -L$local_lib -lxvidcore -lpthread 2> /dev/null ; then
has_xvid="local"
fi
else
- if $cc -o $TMPO $TMPC -lxvidcore 2> /dev/null ; then
+ if $cc -o $TMPO $TMPC -lxvidcore -lpthread 2> /dev/null ; then
has_xvid="system"
elif test "$alt_macosx_dir" != "" ; then
- if $cc -o $TMPO $TMPC -I$alt_macosx_dir/include -L$alt_macosx_dir/lib -lxvidcore 2> /dev/null ; then
+ if $cc -o $TMPO $TMPC -I$alt_macosx_dir/include -L$alt_macosx_dir/lib -lxvidcore -lpthread 2> /dev/null ; then
has_xvid="system"
fi
- elif $cc -o $TMPO $TMPC -I$local_inc/xvid -L$local_lib -lxvidcore 2> /dev/null ; then
+ elif $cc -o $TMPO $TMPC -I$local_inc/xvid -L$local_lib -lxvidcore -lpthread 2> /dev/null ; then
has_xvid="local"
fi
fi
if pkg-config --exists libavcodec libavformat libswscale 2> /dev/null ; then
- ffmpeg_cflags=`pkg-config --cflags libavcodec libavformat libswscale`
- ffmpeg_lflags=`pkg-config --libs libavcodec libavformat libswscale`
+ ffmpeg_cflags=`pkg-config --cflags libavcodec libavformat libswscale libavutil`
+ ffmpeg_lflags=`pkg-config --libs libavcodec libavformat libswscale libavutil`
has_ffmpeg="system"
else
if test "$cross_prefix" != "" ; then
if $cc -o $TMPO $TMPC -I$prefix/include -L$prefix/lib -lz -lavcodec -lavformat -lavutil 2> /dev/null ; then
has_ffmpeg="system"
+ ffmpeg_cflags="-I$prefix/include"
+ ffmpeg_lflags="-L$prefix/lib -lz -lavcodec -lavformat -lavutil"
else
if $cc -o $TMPO $TMPC -I$local_inc -L$local_lib -lz -lavcodec -lavformat 2> /dev/null ; then
has_ffmpeg="local"
+ ffmpeg_cflags="-I$local_inc/include"
+ ffmpeg_lflags="-L$local_lib/lib -lz -lavcodec -lavformat -lavutil"
echo OK
fi
fi
if $cc -o $TMPO $TMPC -lz -lavcodec -lavformat 2> /dev/null ; then
has_ffmpeg="system"
elif test "$alt_macosx_dir" != "" ; then
- if $cc -o $TMPO $TMPC -I$alt_macosx_dir/include -L$alt_macosx_dir/lib -lz -lavcodec -lavformat 2> /dev/null ; then
- has_ffmpeg="system"
- fi
+ if $cc -o $TMPO $TMPC -I$alt_macosx_dir/include -L$alt_macosx_dir/lib -lz -lavcodec -lavformat 2> /dev/null ; then
+ has_ffmpeg="system"
+ ffmpeg_cflags="-I$alt_macosx_dir/include"
+ ffmpeg_lflags="-L$alt_macosx_dir/lib -lz -lavcodec -lavformat"
+ fi
elif $cc -o $TMPO $TMPC -I$local_inc -L$local_lib -lz -lavcodec -lavformat 2> /dev/null ; then
- has_ffmpeg="local"
+ has_ffmpeg="local"
+ ffmpeg_cflags="-I$local_inc"
+ ffmpeg_lflags="-L$local_lib -lz -lavcodec -lavformat -lavutil"
fi
fi
has_jack="yes"
fi
+#look for X11 shared memory support
+cat > $TMPC << EOF
+#include <X11/Xlib.h>
+int main( void ) { return 0; }
+EOF
+if $cc -o $TMPO $TMPC -I$X11_PATH/include -L$X11_PATH/lib 2> /dev/null ; then
+has_x11="yes"
+
+#look for X11 shared memory support
+cat > $TMPC << EOF
+#include <X11/Xlib.h>
+#include <X11/extensions/XShm.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+int main( void ) { return 0; }
+EOF
+
+if $cc -o $TMPO $TMPC -I$X11_PATH/include -L$X11_PATH/lib 2> /dev/null ; then
+has_x11_shm="yes"
+fi
+
+#look for XVideo support
+cat > $TMPC << EOF
+#include <X11/Xlib.h>
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvlib.h>
+int main( void ) { return 0; }
+EOF
+
+if $cc -o $TMPO $TMPC -I$X11_PATH/include -L$X11_PATH/lib 2> /dev/null ; then
+has_x11_xv="yes"
+fi
+
+fi
+
for opt do
case "$opt" in
--sdl-cfg=*) sdl_path=`echo $opt | cut -d '=' -f 2`; sdl_local="yes"
;;
--disable-jack=*) has_jack="no"
;;
+ --disable-alsa=*) has_alsa="no"
+ ;;
--enable-debug) debuginfo="yes"; no_gcc_opt="yes"
;;
--enable-gprof) gprof_build="yes";
--enable-pulseaudio=*) has_pulseaudio="yes"
;;
- --disable-all) has_pulseaudio="yes"; disable_3d="yes"; disable_svg="yes"; disable_vrml="yes"; disable_od="yes"; disable_bifs="yes"; disable_bifs_enc="yes"; disable_laser="yes"; disable_beng="yes"; disable_qtvr="yes"; disable_avi="yes"; disable_ogg="yes"; disable_m2ps="yes"; disable_m2ts="yes"; disable_m2ts_mux="yes"; disable_parsers="yes"; disable_import="yes"; disable_export="yes"; disable_swf="yes"; disable_scene_stats="yes"; disable_scene_dump="yes"; disable_scene_encode="yes"; disable_loader_isoff="yes"; disable_od_dump="yes"; disable_mcrypt="yes"; disable_isoff="yes"; disable_isoff_write="yes"; disable_isoff_hint="yes"; disable_isoff_frag="yes"; disable_streaming="yes"; disable_x3d="yes"; disable_loader_bt="yes"; disable_loader_xmt="yes"
+ --disable-all) has_pulseaudio="no"; disable_3d="yes"; disable_svg="yes"; disable_vrml="yes"; disable_od="yes"; disable_bifs="yes"; disable_bifs_enc="yes"; disable_laser="yes"; disable_beng="yes"; disable_qtvr="yes"; disable_avi="yes"; disable_ogg="yes"; disable_m2ps="yes"; disable_m2ts="yes"; disable_m2ts_mux="yes"; disable_parsers="yes"; disable_import="yes"; disable_export="yes"; disable_swf="yes"; disable_scene_stats="yes"; disable_scene_dump="yes"; disable_scene_encode="yes"; disable_loader_isoff="yes"; disable_od_dump="yes"; disable_mcrypt="yes"; disable_isoff="yes"; disable_isoff_write="yes"; disable_isoff_hint="yes"; disable_isoff_frag="yes"; disable_streaming="yes"; disable_x3d="yes"; disable_loader_bt="yes"; disable_loader_xmt="yes"
;;
--disable-3d) disable_3d="yes"
if test "$disable_3d" = "no" ; then
if test "$win32" = "yes" ; then
- LINK3D="-lopengl32 -lglu32"
+ if test "$cygwin" = "yes" ; then
+ LINK3D="-lw32api/opengl32 -lw32api/glu32"
+ else
+ LINK3D="-lopengl32 -lglu32"
+ fi
elif test "$darwin" = "yes" ; then
LINK3D="-framework OpenGL -framework GLUT"
DarwinGL="yes"
#include <GL/gl.h>
int main( void ) { int a ; a = TINYGL ; }
EOF
-#if $cc $CFLAGS -o $TMPO $TMPC 2> /dev/null ; then
-# has_tinygl="system"
-# LINK3D="-lTinyGL"
if test "$enable_tinygl" = "yes" ;then
- if $cc -o $TMPO $TMPC -I${source_path}/../tiny-gl/include -L${source_path}/../tiny-gl/lib/$target_bin_dir -lTinyGL 2> /dev/null ; then
+ if $cc -o $TMPO $TMPC -lTinyGL 2> /dev/null ; then
has_tinygl="yes"
has_opengl="yes"
- LINK3D="-L${source_path}/../tiny-gl/lib/$target_bin_dir -lTinyGL"
- INCL3D="-I${source_path}/../tiny-gl/include"
+ LINK3D="-lTinyGL"
fi
fi
if $cc -o $TMPO $TMPCPP $xul_flags -I$local_inc/gecko-sdk/include 2> /dev/null ; then
has_xul="local"
xul_flags="-I$local_inc/gecko-sdk/include $xul_flags"
+else
+#xulrunner directories are sometimes included through js packages
+if test "$has_js" = "system" ;then
+ if $cpp -o $TMPO $TMPCPP $js_flags $js_lib_pkg 2> /dev/null ; then
+ xul_flags=`pkg-config --cflags mozilla-js`
+ has_xul="system"
+ fi
+fi
fi
fi
fi
fi
-#look for X11 shared memory support
-cat > $TMPC << EOF
-#include <X11/Xlib.h>
-int main( void ) { return 0; }
-EOF
-if $cc -o $TMPO $TMPC -I$X11_PATH/include -L$X11_PATH/lib 2> /dev/null ; then
-has_x11="yes"
-
-#look for X11 shared memory support
-cat > $TMPC << EOF
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-int main( void ) { return 0; }
-EOF
-
-if $cc -o $TMPO $TMPC -I$X11_PATH/include -L$X11_PATH/lib 2> /dev/null ; then
-has_x11_shm="yes"
-fi
-
-#look for XVideo support
-cat > $TMPC << EOF
-#include <X11/Xlib.h>
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-int main( void ) { return 0; }
-EOF
-
-if $cc -o $TMPO $TMPC -I$X11_PATH/include -L$X11_PATH/lib 2> /dev/null ; then
-has_x11_xv="yes"
-fi
-
-fi
-
#GCC opt
if test "$no_gcc_opt" = "no"; then
-CFLAGS="-O3 $CFLAGS"
+if $cc --version | grep 'sbox-arm-linux-gcc (GCC) 3.4.4'
+then
+ echo "Detected buggy arm GCC (diablo), using -O2"
+ CFLAGS="-O2 $CFLAGS"
+else
+ CFLAGS="-O3 $CFLAGS"
+fi
fi
#look for DX support
fi
if test "$cpu" = "sh4"; then
-viren_dir="`ls $source_path/modules | grep viren_out`"
+viren_dir="`ls \"$source_path/modules\" | grep viren_out`"
if test "$viren_dir" = "viren_out"; then
enable_depth_compositor="yes"
enable_renoir="yes"
echo "#define GPAC_CONFIGURATION \"$GPAC_CONFIGURATION\"" >> $TMPH
-version=`grep '#define GPAC_VERSION ' $source_path/include/gpac/tools.h | cut -d '"' -f 2`
+version="`grep '#define GPAC_VERSION ' \"$source_path/include/gpac/tools.h\" | cut -d '"' -f 2`"
+
+if which svnversion >/dev/null
+then
+ revision="`svnversion \"$source_path\"`"
+ echo "#define GPAC_SVN_REVISION \"$revision\"" > $source_path/include/gpac/version.h
+else
+ echo "Cannot find SVN revision"
+fi
+
echo ""
echo "** System Configuration"
echo "Install prefix: $prefix"
echo "MMI enabled: $mmi"
fi
echo ""
-echo "** GPAC $version Core Configuration **"
+echo "** GPAC $version rev$revision Core Configuration **"
echo "debug version: $debuginfo"
echo "GProf enabled: $gprof_build"
echo "Static build enabled: $static_build"
fi
ldir=`pwd`
-CFLAGS="$CFLAGS -DGPAC_HAVE_CONFIG_H -I$ldir"
-CPPFLAGS="$CPPFLAGS -DGPAC_HAVE_CONFIG_H -I$ldir"
+CFLAGS="$CFLAGS -DGPAC_HAVE_CONFIG_H -I\"$ldir\""
+CPPFLAGS="$CPPFLAGS -DGPAC_HAVE_CONFIG_H -I\"$ldir\""
echo "Creating config.mak"
if test "$cpu" = "x86" ; then
echo "TARGET_ARCH_X86=yes" >> config.mak
elif test "$cpu" = "armv4l" ; then
-echo "CONFIG_PULSEAUDIO=$has_pulseaudio" >> config.mak
echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
elif test "$cpu" = "alpha" ; then
echo "TARGET_ARCH_ALPHA=yes" >> config.mak
echo "CONFIG_VORBIS=$has_vorbis" >> config.mak
echo "CONFIG_THEORA=$has_theora" >> config.mak
echo "CONFIG_FFMPEG=$has_ffmpeg" >> config.mak
+if test "$has_ffmpeg" != "no"
+then
+ echo "ffmpeg_cflags=$ffmpeg_cflags" >> config.mak
+ echo "ffmpeg_lflags=$ffmpeg_lflags" >> config.mak
+fi
echo "CONFIG_FFMPEG_OLD=$old_ffmpeg_inc" >> config.mak
echo "CONFIG_OSS_AUDIO=$has_oss_audio" >> config.mak
echo "CONFIG_ALSA=$has_alsa" >> config.mak
echo "CONFIG_JACK=$has_jack" >> config.mak
echo "CONFIG_A52=$has_a52" >> config.mak
+echo "CONFIG_PULSEAUDIO=$has_pulseaudio" >> config.mak
echo "DISABLE_SVG=$disable_svg" >> config.mak
echo "HAS_LIBXML2=$has_libxml2" >> config.mak
GPAC_ENST_INC=no
GPAC_ENST=no
-enst_dir="`ls $source_path/src/ | grep enst`"
+enst_dir="`ls \"$source_path/src/\" | grep enst`"
if test "$enst_dir" = "enst"; then
echo "GPAC Proprietary Extensions enabled"
GPAC_ENST_INC=yes
echo "Creating compilation tree image"
SRC_DIRS="src src/utils src/isomedia src/ietf src/odf src/bifs src/scenegraph src/terminal src/mcrypt src/media_tools src/scene_manager src/compositor src/laser"
- APP_DIRS="applications/mp4box applications/mp4client applications/mp4box applications/osmozilla applications/osmo4_wx applications/testapps/mp4_streamer applications/testapps/mp42ts"
+ APP_DIRS="applications/mp4box applications/mp4client applications/osmozilla applications/osmo4_wx applications/mp42ts"
for dir in $SRC_DIRS ; do
- mkdir -p $dir
+ mkdir -p "$dir"
done
- ln -sf $source_path/Makefile Makefile
- ln -sf $source_path/src/Makefile src/Makefile
+ ln -sf "$source_path/Makefile" Makefile
+ ln -sf "$source_path/src/Makefile" src/Makefile
mkdir -p applications
- ln -sf $source_path/applications/Makefile applications/Makefile
+ ln -sf "$source_path/applications/Makefile" applications/Makefile
mkdir -p applications/testapps
for dir in $APP_DIRS ; do
- mkdir -p $dir
- ln -sf $source_path/$dir/Makefile $dir/Makefile
+ mkdir -p "$dir"
+ ln -sf "$source_path/$dir/Makefile" "$dir/Makefile"
done
cur_dir="`pwd`"
- cd $source_path/
+ cd "$source_path/"
MOD_DIRS="`ls -d modules/*/`"
- cd $cur_dir
+ cd "$cur_dir"
mkdir -p modules
- ln -sf $source_path/modules/Makefile modules/Makefile
+ ln -sf "$source_path/modules/Makefile" modules/Makefile
for dir in $MOD_DIRS ; do
- if ls $source_path/$dir/Makefile > /dev/null 2>&1; then
- mkdir -p $dir
- ln -sf $source_path/$dir/Makefile $dir/Makefile
+ if ls "$source_path/$dir/Makefile" > /dev/null 2>&1; then
+ mkdir -p "$dir"
+ ln -sf "$source_path/$dir/Makefile" "$dir/Makefile"
fi
done
if test "$has_mingw_directx" = "yes"; then
- ln -sf $source_path/modules/dx_hw/hand.cur modules/dx_hw/hand.cur
- ln -sf $source_path/modules/dx_hw/collide.cur modules/dx_hw/collide.cur
+ ln -sf "$source_path/modules/dx_hw/hand.cur" modules/dx_hw/hand.cur
+ ln -sf "$source_path/modules/dx_hw/collide.cur" modules/dx_hw/collide.cur
fi
- cd $cur_dir
+ cd "$cur_dir"
echo "SRC_LOCAL_PATH=no" >> config.mak
else
<p style="text-indent: 5%">
Specifies whether the bounding volume of an object shall be drawn or not. Note that the 2D renderer only uses rectangles as bounding volumes. The "AABB" value is used by the
3D renderer only, and specifies the object bounding-box tree shall be drawn.</p>
-<b>StressMode</b> [value: <i>"yes" "no"</i>]
-<p style="text-indent: 5%">
-Specifies whether the renderer shall redraw the scene and reload texture at each simulation tick or whenever needed
-</p>
<b>ColorKey</b> [value: <i>unsigned hexadecimal integer, formated as AARRGGBB</i>]
<p style="text-indent: 5%">
Specifies the color key to use for windowless rendering. GPAC currently doesn't support true alpha blitting to desktop due to limitations in most windowing toolkit, it therefore uses color keying mechanism. The alpha part of the key is used for global transparency of GPAC's output, if supported.
</p>
-<b>DirectDraw</b> [value: <i>"yes" "no"</i>]
+<b>DrawMode</b> [value: <i>"immediate" "defer" "defer-debug"</i>]
<p style="text-indent: 5%">
-Specifies whether direct rendering should be used or not. In direct rendering mode, the screen is completely redrawn at each frame. In indirect rendering
+Specifies whether immediate drawing should be used or not. In immediate mode, the screen is completely redrawn at each frame. In defer mode
object positioning is tracked from frame to frame and dirty rectangles info is collected in order to redraw the minimal amount of the screen buffer. Whether
-the setting is applied or not depends on the graphics module (currently all modules handle both mode).</p>
+the setting is applied or not depends on the graphics module (currently all modules handle both mode). Defer Debug mode only renders changed areas.</p>
<b>ScalableZoom</b> [value: <i>"yes" "no"</i>]
<p style="text-indent: 5%">
Specifies whether scalable zoom should be used or not. When scalable zoom is enabled, resizing the output window will also recompute all vectorial objects. Otherwise only the final buffer is stretched.</p>
<b>ForceOpenGL</b> [value: <i>"yes" "no"</i>]
<p style="text-indent: 5%">
Specifies that 2D rendering will be performed by OpenGL rather than raster 2D. This will involve polygon tesselation which may not be supported on all platforms.</p>
-
+<b>DefaultNavigationMode</b> [value: <i>"Walk", "Fly", "Examine"</i>]
+<p style="text-indent: 5%">
+Overrides the default navigation mode of MPEG-4/VRML (Walk) and X3D (Examine).</p>
<b>RasterOutlines</b> [value: <i>"yes" "no"</i>]
<p style="text-indent: 5%">
Specifies that outlining shall be done through OpenGL pen width rather than vectorial outlining.</p>
<p style="text-indent: 5%">
Read-only option listing the OpenGL extensions supported by the GL driver. Only valid after the 3D renderer has been used.
</p>
+<b>StereoType</b> [value: <i>"None", "SideBySide", "TopToBottom", "Anaglyph", "Columns", "Rows", "Custom"</i>]
+<p style="text-indent: 5%">
+Specifies the stereo output type (default "None"). If your graphic card does not support OpenGL shaders, only <i>SideBySide</i> and <i>TopToBottom</i> modes will be available.</p>
+<ul>
+<li>"SideBySide": images are displayed side by side from left to right.</li>
+<li>"TopToBottom": images are displayed from top (laft view) to bottom (right view).</li>
+<li>"Anaglyph": Standard color anaglyph (red for left view, green and blue for right view) is used.</li>
+<li>"Columns": images are interleaved by columns, left view on even columns and left view on odd columns.</li>
+<li>"Rows": images are interleaved by columns, left view on even rows and left view on odd rows.</li>
+<li>"Custom": images are interleaved according to the shader specified by <i>InterleaverShader</i>
+</ul>
+
+<b>NumViews</b> [value: <i>unsigned integer</i>]
+<p style="text-indent: 5%">
+Specifies the number of views to use in stereo mode. If mode is "Anaglyph", "Columns" or "Rows", the number of views is forced to 2.</p>
+
+<b>InterleaverShader</b> [value: <i>path to fragment shader file</i>]
+<p style="text-indent: 5%">
+Specifies the fragment shader file to use for view interleaving. Each view is rendered in its own texture. The shader is exposed each view as <i>uniform sampler2D gfViewX</i>, where X is the view number starting from the left (<i>gfView1</i>).</p>
+
+<b>ReverseViews</b> [value: <i>"yes", "no"</i>]
+<p style="text-indent: 5%">
+Specifies if the view order should be reversed (from right to left) or not.</p>
+<b>CameraLayout</b> [value: <i>"OffAxis", Linear", "Circular"</i>]
+<p style="text-indent: 5%">
+Specifies the camera layout. The default value is OffAxis in (auto-)stereo modes, ignored in mono mode.</p>
+<b>ViewDistance</b> [value: <i>integer</i>]
+<p style="text-indent: 5%">
+Specifies the distance in cm between the camera and the zero-disparity plane. There is currently no automatic calibration of depth in GPAC.</p>
<br/><br/>
Default audio stereo balance used when launching GPAC - 0 for full left, 100 for full right, 50 for balanced.</p>
<b>Filter</b> [value: string]
<p style="text-indent: 5%">
-Defines a set of audio filters. Audio filters are declared as a list of strings separated with ";;". The exact syntax of the string is filter specific.
-
+Defines a set of audio filters. Audio filters are declared as a list of strings separated with ";;". The exact syntax of the string is filter specific.</p>
+
<br/><br/>
<a name="Video"></a>
<b>SwitchResolution</b> [value: <i>"yes" "no"</i>]
<p style="text-indent: 5%">
Specifies fullscreen resolution mode. If enabled, selects smallest video resolution larger than scene size, otherwise use current video resolution.</p>
-<b>UseHardwareMemory</b> [value: <i>"yes" "no"</i>]
+<b>HardwareMemory</b> [value: <i>"Auto" "Always" "Never"</i>]
<p style="text-indent: 5%">
-Only valid for 2D renderer. Specifies if main video backbuffer is on hardware or system memory. Depending on the scene type, this may drastically change the playback speed.</p>
+Only valid for 2D renderer. Specifies if main video backbuffer is always on hardware, always on system memory or selected by GPAC (default mode). Depending on the scene type, this may drastically change the playback speed.</p>
<b>DisableColorKeying</b> [value: <i>"yes" "no"</i>]
<p style="text-indent: 5%">
Only valid for 2D renderer. Specifies if partial overlays should be disabled. If not disabled, hardware color keying for overlays is tested and used if present. Otherwise, only the top-most video with no overlapping objects will be drawn using overlays. Default value is "no".</p>
<b>FontReader</b> [value: <i>string</i>]
<p style="text-indent: 5%">
Specifies the module to use for font handling. This module cannot be reloaded at run-time, GPAC must be restarted.</p>
+<b>WaitForFontLoad</b> [value: <i>"yes" "no"</i>]
+<p style="text-indent: 5%">
+Forces to wait for SVG fonts to be loaded before displaying frames - default is "no".</p>
<b>FontDirectory</b> (value: <i>path to TrueType (*.ttf, *.ttc) font directory</i>]
<p style="text-indent: 5%">
Specifies the directory where fonts are located - currently only one directory can be specified (however nothing stops a font module from using a private directory).
<i>Note:</i><br/>
The FreeType module uses this section to cache familly names to font file name associations.
+
<br/><br/>
<a name="Downloader"></a>
<span style="text-decoration: underline;"><b>Section "Downloader"</b></span> <i><a href="#Overview">Back to top</a></i>
<b>UserAgent</b> [value: <i>string</i>]
<p style="text-indent: 5%">
Specifies an alternate user agent (default one is "GPAC $VERSION").</p>
+<b>HTTPHeadTimeout</b> [value: <i>positive integer</i>]
+<p style="text-indent: 5%">
+Specifies timeout in milliseconds before considering HEAD request failed. 0 means no HEAD request is issued, only GET.</p>
<br/><br/>
<a name="HTTPProxy"></a>
--- /dev/null
+/* android jconfig.h */
+/*
+ * jconfig.doc
+ *
+ * Copyright (C) 1991-1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file documents the configuration options that are required to
+ * customize the JPEG software for a particular system.
+ *
+ * The actual configuration options for a particular installation are stored
+ * in jconfig.h. On many machines, jconfig.h can be generated automatically
+ * or copied from one of the "canned" jconfig files that we supply. But if
+ * you need to generate a jconfig.h file by hand, this file tells you how.
+ *
+ * DO NOT EDIT THIS FILE --- IT WON'T ACCOMPLISH ANYTHING.
+ * EDIT A COPY NAMED JCONFIG.H.
+ */
+
+
+/*
+ * These symbols indicate the properties of your machine or compiler.
+ * #define the symbol if yes, #undef it if no.
+ */
+
+/* Does your compiler support function prototypes?
+ * (If not, you also need to use ansi2knr, see install.doc)
+ */
+#define HAVE_PROTOTYPES
+
+/* Does your compiler support the declaration "unsigned char" ?
+ * How about "unsigned short" ?
+ */
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+
+/* Define "void" as "char" if your compiler doesn't know about type void.
+ * NOTE: be sure to define void such that "void *" represents the most general
+ * pointer type, e.g., that returned by malloc().
+ */
+/* #define void char */
+
+/* Define "const" as empty if your compiler doesn't know the "const" keyword.
+ */
+/* #define const */
+
+/* Define this if an ordinary "char" type is unsigned.
+ * If you're not sure, leaving it undefined will work at some cost in speed.
+ * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.
+ */
+#undef CHAR_IS_UNSIGNED
+
+/* Define this if your system has an ANSI-conforming <stddef.h> file.
+ */
+#define HAVE_STDDEF_H
+
+/* Define this if your system has an ANSI-conforming <stdlib.h> file.
+ */
+#define HAVE_STDLIB_H
+
+/* Define this if your system does not have an ANSI/SysV <string.h>,
+ * but does have a BSD-style <strings.h>.
+ */
+#undef NEED_BSD_STRINGS
+
+/* Define this if your system does not provide typedef size_t in any of the
+ * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in
+ * <sys/types.h> instead.
+ */
+#undef NEED_SYS_TYPES_H
+
+/* For 80x86 machines, you need to define NEED_FAR_POINTERS,
+ * unless you are using a large-data memory model or 80386 flat-memory mode.
+ * On less brain-damaged CPUs this symbol must not be defined.
+ * (Defining this symbol causes large data structures to be referenced through
+ * "far" pointers and to be allocated with a special version of malloc.)
+ */
+#undef NEED_FAR_POINTERS
+
+/* Define this if your linker needs global names to be unique in less
+ * than the first 15 characters.
+ */
+#undef NEED_SHORT_EXTERNAL_NAMES
+
+/* Although a real ANSI C compiler can deal perfectly well with pointers to
+ * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
+ * and pseudo-ANSI compilers get confused. To keep one of these bozos happy,
+ * define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you
+ * actually get "missing structure definition" warnings or errors while
+ * compiling the JPEG code.
+ */
+#undef INCOMPLETE_TYPES_BROKEN
+
+
+/*
+ * The following options affect code selection within the JPEG library,
+ * but they don't need to be visible to applications using the library.
+ * To minimize application namespace pollution, the symbols won't be
+ * defined unless JPEG_INTERNALS has been defined.
+ */
+
+#ifdef JPEG_INTERNALS
+
+/* Define this if your compiler implements ">>" on signed values as a logical
+ * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
+ * which is the normal and rational definition.
+ */
+#undef RIGHT_SHIFT_IS_UNSIGNED
+
+
+#endif /* JPEG_INTERNALS */
+
+
+/*
+ * The remaining options do not affect the JPEG library proper,
+ * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c).
+ * Other applications can ignore these.
+ */
+
+#ifdef JPEG_CJPEG_DJPEG
+
+/* These defines indicate which image (non-JPEG) file formats are allowed. */
+
+#define BMP_SUPPORTED /* BMP image file format */
+#define GIF_SUPPORTED /* GIF image file format */
+#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
+#undef RLE_SUPPORTED /* Utah RLE image file format */
+#define TARGA_SUPPORTED /* Targa image file format */
+
+/* Define this if you want to name both input and output files on the command
+ * line, rather than using stdout and optionally stdin. You MUST do this if
+ * your system can't cope with binary I/O to stdin/stdout. See comments at
+ * head of cjpeg.c or djpeg.c.
+ */
+#undef TWO_FILE_COMMANDLINE
+
+/* Define this if your system needs explicit cleanup of temporary files.
+ * This is crucial under MS-DOS, where the temporary "files" may be areas
+ * of extended memory; on most other systems it's not as important.
+ */
+#undef NEED_SIGNAL_CATCHER
+
+/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb").
+ * This is necessary on systems that distinguish text files from binary files,
+ * and is harmless on most systems that don't. If you have one of the rare
+ * systems that complains about the "b" spec, define this symbol.
+ */
+#undef DONT_USE_B_MODE
+
+/* Define this if you want percent-done progress reports from cjpeg/djpeg.
+ */
+#undef PROGRESS_REPORT
+
+
+#endif /* JPEG_CJPEG_DJPEG */
--- /dev/null
+/*
+ * jmorecfg.h
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains additional configuration options that customize the
+ * JPEG software for special applications or support machine-dependent
+ * optimizations. Most users will not need to touch this file.
+ */
+
+/*
+ * Define ANDROID_RGB to enable specific optimizations for Android
+ * JCS_RGBA_8888 support
+ * JCS_RGB_565 support
+ *
+ */
+
+#define ANDROID_RGB
+
+#ifdef ANDROID_RGB
+#define PACK_SHORT_565(r,g,b) ((((r)<<8)&0xf800)|(((g)<<3)&0x7E0)|((b)>>3))
+#define PACK_TWO_PIXELS(l,r) ((r<<16) | l)
+#define PACK_NEED_ALIGNMENT(ptr) (((int)(ptr))&3)
+#define WRITE_TWO_PIXELS(addr, pixels) do { \
+ ((INT16*)(addr))[0] = (pixels); \
+ ((INT16*)(addr))[1] = (pixels)>>16; \
+ } while(0)
+#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(INT32*)(addr)) = pixels)
+#define DITHER_565_R(r, dither) ((r) + ((dither)&0xFF))
+#define DITHER_565_G(g, dither) ((g) + (((dither)&0xFF)>>1))
+#define DITHER_565_B(b, dither) ((b) + ((dither)&0xFF))
+#endif
+
+/*
+ * Define BITS_IN_JSAMPLE as either
+ * 8 for 8-bit sample values (the usual setting)
+ * 12 for 12-bit sample values
+ * Only 8 and 12 are legal data precisions for lossy JPEG according to the
+ * JPEG standard, and the IJG code does not support anything else!
+ * We do not support run-time selection of data precision, sorry.
+ */
+
+#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
+
+
+/*
+ * Maximum number of components (color channels) allowed in JPEG image.
+ * To meet the letter of the JPEG spec, set this to 255. However, darn
+ * few applications need more than 4 channels (maybe 5 for CMYK + alpha
+ * mask). We recommend 10 as a reasonable compromise; use 4 if you are
+ * really short on memory. (Each allowed component costs a hundred or so
+ * bytes of storage, whether actually used in an image or not.)
+ */
+
+#define MAX_COMPONENTS 10 /* maximum number of image components */
+
+
+/*
+ * Basic data types.
+ * You may need to change these if you have a machine with unusual data
+ * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
+ * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
+ * but it had better be at least 16.
+ */
+
+/* Representation of a single sample (pixel element value).
+ * We frequently allocate large arrays of these, so it's important to keep
+ * them small. But if you have memory to burn and access to char or short
+ * arrays is very slow on your hardware, you might want to change these.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+/* JSAMPLE should be the smallest type that will hold the values 0..255.
+ * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
+ */
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+typedef unsigned char JSAMPLE;
+#define GETJSAMPLE(value) ((int) (value))
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+typedef char JSAMPLE;
+#ifdef CHAR_IS_UNSIGNED
+#define GETJSAMPLE(value) ((int) (value))
+#else
+#define GETJSAMPLE(value) ((int) (value) & 0xFF)
+#endif /* CHAR_IS_UNSIGNED */
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+#define MAXJSAMPLE 255
+#define CENTERJSAMPLE 128
+
+#endif /* BITS_IN_JSAMPLE == 8 */
+
+
+#if BITS_IN_JSAMPLE == 12
+/* JSAMPLE should be the smallest type that will hold the values 0..4095.
+ * On nearly all machines "short" will do nicely.
+ */
+
+typedef short JSAMPLE;
+#define GETJSAMPLE(value) ((int) (value))
+
+#define MAXJSAMPLE 4095
+#define CENTERJSAMPLE 2048
+
+#endif /* BITS_IN_JSAMPLE == 12 */
+
+
+/* Representation of a DCT frequency coefficient.
+ * This should be a signed value of at least 16 bits; "short" is usually OK.
+ * Again, we allocate large arrays of these, but you can change to int
+ * if you have memory to burn and "short" is really slow.
+ */
+
+typedef short JCOEF;
+
+
+/* Compressed datastreams are represented as arrays of JOCTET.
+ * These must be EXACTLY 8 bits wide, at least once they are written to
+ * external storage. Note that when using the stdio data source/destination
+ * managers, this is also the data type passed to fread/fwrite.
+ */
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+typedef unsigned char JOCTET;
+#define GETJOCTET(value) (value)
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+typedef char JOCTET;
+#ifdef CHAR_IS_UNSIGNED
+#define GETJOCTET(value) (value)
+#else
+#define GETJOCTET(value) ((value) & 0xFF)
+#endif /* CHAR_IS_UNSIGNED */
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+/* These typedefs are used for various table entries and so forth.
+ * They must be at least as wide as specified; but making them too big
+ * won't cost a huge amount of memory, so we don't provide special
+ * extraction code like we did for JSAMPLE. (In other words, these
+ * typedefs live at a different point on the speed/space tradeoff curve.)
+ */
+
+/* UINT8 must hold at least the values 0..255. */
+
+#ifdef HAVE_UNSIGNED_CHAR
+typedef unsigned char UINT8;
+#else /* not HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+typedef char UINT8;
+#else /* not CHAR_IS_UNSIGNED */
+typedef short UINT8;
+#endif /* CHAR_IS_UNSIGNED */
+#endif /* HAVE_UNSIGNED_CHAR */
+
+/* UINT16 must hold at least the values 0..65535. */
+
+#ifdef HAVE_UNSIGNED_SHORT
+typedef unsigned short UINT16;
+#else /* not HAVE_UNSIGNED_SHORT */
+typedef unsigned int UINT16;
+#endif /* HAVE_UNSIGNED_SHORT */
+
+/* INT16 must hold at least the values -32768..32767. */
+
+#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
+typedef short INT16;
+#endif
+
+/* INT32 must hold at least signed 32-bit values. */
+
+#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
+typedef long INT32;
+#endif
+
+/* Datatype used for image dimensions. The JPEG standard only supports
+ * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
+ * "unsigned int" is sufficient on all machines. However, if you need to
+ * handle larger images and you don't mind deviating from the spec, you
+ * can change this datatype.
+ */
+
+typedef unsigned int JDIMENSION;
+
+#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
+
+
+/* These macros are used in all function definitions and extern declarations.
+ * You could modify them if you need to change function linkage conventions;
+ * in particular, you'll need to do that to make the library a Windows DLL.
+ * Another application is to make all functions global for use with debuggers
+ * or code profilers that require it.
+ */
+
+/* a function called through method pointers: */
+#define METHODDEF(type) static type
+/* a function used only in its module: */
+#define LOCAL(type) static type
+/* a function referenced thru EXTERNs: */
+#define GLOBAL(type) type
+/* a reference to a GLOBAL function: */
+#define EXTERN(type) extern type
+
+
+/* This macro is used to declare a "method", that is, a function pointer.
+ * We want to supply prototype parameters if the compiler can cope.
+ * Note that the arglist parameter must be parenthesized!
+ * Again, you can customize this if you need special linkage keywords.
+ */
+
+#ifdef HAVE_PROTOTYPES
+#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
+#else
+#define JMETHOD(type,methodname,arglist) type (*methodname) ()
+#endif
+
+
+/* Here is the pseudo-keyword for declaring pointers that must be "far"
+ * on 80x86 machines. Most of the specialized coding for 80x86 is handled
+ * by just saying "FAR *" where such a pointer is needed. In a few places
+ * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
+ */
+
+#ifdef NEED_FAR_POINTERS
+#define FAR far
+#else
+#define FAR
+#endif
+
+
+/*
+ * On a few systems, type boolean and/or its values FALSE, TRUE may appear
+ * in standard header files. Or you may have conflicts with application-
+ * specific header files that you want to include together with these files.
+ * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
+ */
+
+#ifndef HAVE_BOOLEAN
+typedef int boolean;
+#endif
+#ifndef FALSE /* in case these macros already exist */
+#define FALSE 0 /* values of boolean */
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+
+/*
+ * The remaining options affect code selection within the JPEG library,
+ * but they don't need to be visible to most applications using the library.
+ * To minimize application namespace pollution, the symbols won't be
+ * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
+ */
+
+#ifdef JPEG_INTERNALS
+#define JPEG_INTERNAL_OPTIONS
+#endif
+
+#ifdef JPEG_INTERNAL_OPTIONS
+
+
+/*
+ * These defines indicate whether to include various optional functions.
+ * Undefining some of these symbols will produce a smaller but less capable
+ * library. Note that you can leave certain source files out of the
+ * compilation/linking process if you've #undef'd the corresponding symbols.
+ * (You may HAVE to do that if your compiler doesn't like null source files.)
+ */
+
+/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
+
+/* Capability options common to encoder and decoder: */
+
+#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
+#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
+#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
+
+/* Encoder capability options: */
+
+#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
+#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
+/* Note: if you selected 12-bit data precision, it is dangerous to turn off
+ * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
+ * precision, so jchuff.c normally uses entropy optimization to compute
+ * usable tables for higher precision. If you don't want to do optimization,
+ * you'll have to supply different default Huffman tables.
+ * The exact same statements apply for progressive JPEG: the default tables
+ * don't work for progressive mode. (This may get fixed, however.)
+ */
+#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
+
+/* Decoder capability options: */
+
+#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
+#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
+#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
+#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
+#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
+#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
+#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
+#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
+
+/* more capability options later, no doubt */
+
+
+/*
+ * Ordering of RGB data in scanlines passed to or from the application.
+ * If your application wants to deal with data in the order B,G,R, just
+ * change these macros. You can also deal with formats such as R,G,B,X
+ * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
+ * the offsets will also change the order in which colormap data is organized.
+ * RESTRICTIONS:
+ * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
+ * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
+ * useful if you are using JPEG color spaces other than YCbCr or grayscale.
+ * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
+ * is not 3 (they don't understand about dummy color components!). So you
+ * can't use color quantization if you change that value.
+ */
+
+#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
+#define RGB_GREEN 1 /* Offset of Green */
+#define RGB_BLUE 2 /* Offset of Blue */
+#ifdef ANDROID_RGB
+#define RGB_ALPHA 3 /* Offset of Alpha */
+#endif
+#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
+
+/* Definitions for speed-related optimizations. */
+
+
+/* If your compiler supports inline functions, define INLINE
+ * as the inline keyword; otherwise define it as empty.
+ */
+
+#ifndef INLINE
+#ifdef __GNUC__ /* for instance, GNU C knows about inline */
+#define INLINE __inline__
+#endif
+#ifndef INLINE
+#define INLINE /* default is to define it as empty */
+#endif
+#endif
+
+
+/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
+ * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
+ * as short on such a machine. MULTIPLIER must be at least 16 bits wide.
+ */
+
+#ifndef MULTIPLIER
+#define MULTIPLIER int /* type for fastest integer multiply */
+#endif
+
+
+/* FAST_FLOAT should be either float or double, whichever is done faster
+ * by your compiler. (Note that this type is only used in the floating point
+ * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
+ * Typically, float is faster in ANSI C compilers, while double is faster in
+ * pre-ANSI compilers (because they insist on converting to double anyway).
+ * The code below therefore chooses float if we have ANSI-style prototypes.
+ */
+
+#ifndef FAST_FLOAT
+#ifdef HAVE_PROTOTYPES
+#define FAST_FLOAT float
+#else
+#define FAST_FLOAT double
+#endif
+#endif
+
+#endif /* JPEG_INTERNAL_OPTIONS */
--- /dev/null
+/*
+ * jpeglib.h
+ *
+ * Copyright (C) 1991-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines the application interface for the JPEG library.
+ * Most applications using the library need only include this file,
+ * and perhaps jerror.h if they want to know the exact error codes.
+ */
+
+#ifndef JPEGLIB_H
+#define JPEGLIB_H
+
+/*
+ * First we include the configuration files that record how this
+ * installation of the JPEG library is set up. jconfig.h can be
+ * generated automatically for many systems. jmorecfg.h contains
+ * manual configuration options that most people need not worry about.
+ */
+
+#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
+#include "jconfig.h" /* widely used configuration options */
+#endif
+#include "jmorecfg.h" /* seldom changed options */
+
+
+/* Version ID for the JPEG library.
+ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
+ */
+
+#define JPEG_LIB_VERSION 62 /* Version 6b */
+
+
+/* Various constants determining the sizes of things.
+ * All of these are specified by the JPEG standard, so don't change them
+ * if you want to be compatible.
+ */
+
+#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
+#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
+#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
+#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
+#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */
+#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
+#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
+/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
+ * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
+ * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
+ * to handle it. We even let you do this from the jconfig.h file. However,
+ * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
+ * sometimes emits noncompliant files doesn't mean you should too.
+ */
+#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
+#ifndef D_MAX_BLOCKS_IN_MCU
+#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
+#endif
+
+
+/* Data structures for images (arrays of samples and of DCT coefficients).
+ * On 80x86 machines, the image arrays are too big for near pointers,
+ * but the pointer arrays can fit in near memory.
+ */
+
+typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */
+typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
+typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
+
+typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
+typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */
+typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
+typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
+
+typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */
+
+
+/* Types for JPEG compression parameters and working tables. */
+
+
+/* DCT coefficient quantization tables. */
+
+typedef struct {
+ /* This array gives the coefficient quantizers in natural array order
+ * (not the zigzag order in which they are stored in a JPEG DQT marker).
+ * CAUTION: IJG versions prior to v6a kept this array in zigzag order.
+ */
+ UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */
+ /* This field is used only during compression. It's initialized FALSE when
+ * the table is created, and set TRUE when it's been output to the file.
+ * You could suppress output of a table by setting this to TRUE.
+ * (See jpeg_suppress_tables for an example.)
+ */
+ boolean sent_table; /* TRUE when table has been output */
+} JQUANT_TBL;
+
+
+/* Huffman coding tables. */
+
+typedef struct {
+ /* These two fields directly represent the contents of a JPEG DHT marker */
+ UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
+ /* length k bits; bits[0] is unused */
+ UINT8 huffval[256]; /* The symbols, in order of incr code length */
+ /* This field is used only during compression. It's initialized FALSE when
+ * the table is created, and set TRUE when it's been output to the file.
+ * You could suppress output of a table by setting this to TRUE.
+ * (See jpeg_suppress_tables for an example.)
+ */
+ boolean sent_table; /* TRUE when table has been output */
+} JHUFF_TBL;
+
+
+/* Basic info about one component (color channel). */
+
+typedef struct {
+ /* These values are fixed over the whole image. */
+ /* For compression, they must be supplied by parameter setup; */
+ /* for decompression, they are read from the SOF marker. */
+ int component_id; /* identifier for this component (0..255) */
+ int component_index; /* its index in SOF or cinfo->comp_info[] */
+ int h_samp_factor; /* horizontal sampling factor (1..4) */
+ int v_samp_factor; /* vertical sampling factor (1..4) */
+ int quant_tbl_no; /* quantization table selector (0..3) */
+ /* These values may vary between scans. */
+ /* For compression, they must be supplied by parameter setup; */
+ /* for decompression, they are read from the SOS marker. */
+ /* The decompressor output side may not use these variables. */
+ int dc_tbl_no; /* DC entropy table selector (0..3) */
+ int ac_tbl_no; /* AC entropy table selector (0..3) */
+
+ /* Remaining fields should be treated as private by applications. */
+
+ /* These values are computed during compression or decompression startup: */
+ /* Component's size in DCT blocks.
+ * Any dummy blocks added to complete an MCU are not counted; therefore
+ * these values do not depend on whether a scan is interleaved or not.
+ */
+ JDIMENSION width_in_blocks;
+ JDIMENSION height_in_blocks;
+ /* Size of a DCT block in samples. Always DCTSIZE for compression.
+ * For decompression this is the size of the output from one DCT block,
+ * reflecting any scaling we choose to apply during the IDCT step.
+ * Values of 1,2,4,8 are likely to be supported. Note that different
+ * components may receive different IDCT scalings.
+ */
+ int DCT_scaled_size;
+ /* The downsampled dimensions are the component's actual, unpadded number
+ * of samples at the main buffer (preprocessing/compression interface), thus
+ * downsampled_width = ceil(image_width * Hi/Hmax)
+ * and similarly for height. For decompression, IDCT scaling is included, so
+ * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
+ */
+ JDIMENSION downsampled_width; /* actual width in samples */
+ JDIMENSION downsampled_height; /* actual height in samples */
+ /* This flag is used only for decompression. In cases where some of the
+ * components will be ignored (eg grayscale output from YCbCr image),
+ * we can skip most computations for the unused components.
+ */
+ boolean component_needed; /* do we need the value of this component? */
+
+ /* These values are computed before starting a scan of the component. */
+ /* The decompressor output side may not use these variables. */
+ int MCU_width; /* number of blocks per MCU, horizontally */
+ int MCU_height; /* number of blocks per MCU, vertically */
+ int MCU_blocks; /* MCU_width * MCU_height */
+ int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */
+ int last_col_width; /* # of non-dummy blocks across in last MCU */
+ int last_row_height; /* # of non-dummy blocks down in last MCU */
+
+ /* Saved quantization table for component; NULL if none yet saved.
+ * See jdinput.c comments about the need for this information.
+ * This field is currently used only for decompression.
+ */
+ JQUANT_TBL * quant_table;
+
+ /* Private per-component storage for DCT or IDCT subsystem. */
+ void * dct_table;
+} jpeg_component_info;
+
+
+/* The script for encoding a multiple-scan file is an array of these: */
+
+typedef struct {
+ int comps_in_scan; /* number of components encoded in this scan */
+ int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
+ int Ss, Se; /* progressive JPEG spectral selection parms */
+ int Ah, Al; /* progressive JPEG successive approx. parms */
+} jpeg_scan_info;
+
+/* The decompressor can save APPn and COM markers in a list of these: */
+
+typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr;
+
+struct jpeg_marker_struct {
+ jpeg_saved_marker_ptr next; /* next in list, or NULL */
+ UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
+ unsigned int original_length; /* # bytes of data in the file */
+ unsigned int data_length; /* # bytes of data saved at data[] */
+ JOCTET FAR * data; /* the data contained in the marker */
+ /* the marker length word is not counted in data_length or original_length */
+};
+
+/* Known color spaces. */
+
+typedef enum {
+ JCS_UNKNOWN, /* error/unspecified */
+ JCS_GRAYSCALE, /* monochrome */
+ JCS_RGB, /* red/green/blue */
+ JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
+ JCS_CMYK, /* C/M/Y/K */
+ JCS_YCCK, /* Y/Cb/Cr/K */
+#ifdef ANDROID_RGB
+ JCS_RGBA_8888, /* red/green/blue/alpha */
+ JCS_RGB_565 /* red/green/blue in 565 format */
+#endif
+} J_COLOR_SPACE;
+
+/* DCT/IDCT algorithm options. */
+
+typedef enum {
+ JDCT_ISLOW, /* slow but accurate integer algorithm */
+ JDCT_IFAST, /* faster, less accurate integer method */
+ JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
+} J_DCT_METHOD;
+
+#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
+#define JDCT_DEFAULT JDCT_ISLOW
+#endif
+#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
+#define JDCT_FASTEST JDCT_IFAST
+#endif
+
+/* Dithering options for decompression. */
+
+typedef enum {
+ JDITHER_NONE, /* no dithering */
+ JDITHER_ORDERED, /* simple ordered dither */
+ JDITHER_FS /* Floyd-Steinberg error diffusion dither */
+} J_DITHER_MODE;
+
+
+/* Common fields between JPEG compression and decompression master structs. */
+
+#define jpeg_common_fields \
+ struct jpeg_error_mgr * err; /* Error handler module */\
+ struct jpeg_memory_mgr * mem; /* Memory manager module */\
+ struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
+ void * client_data; /* Available for use by application */\
+ boolean is_decompressor; /* So common code can tell which is which */\
+ int global_state /* For checking call sequence validity */
+
+/* Routines that are to be used by both halves of the library are declared
+ * to receive a pointer to this structure. There are no actual instances of
+ * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
+ */
+struct jpeg_common_struct {
+ jpeg_common_fields; /* Fields common to both master struct types */
+ /* Additional fields follow in an actual jpeg_compress_struct or
+ * jpeg_decompress_struct. All three structs must agree on these
+ * initial fields! (This would be a lot cleaner in C++.)
+ */
+};
+
+typedef struct jpeg_common_struct * j_common_ptr;
+typedef struct jpeg_compress_struct * j_compress_ptr;
+typedef struct jpeg_decompress_struct * j_decompress_ptr;
+
+
+/* Master record for a compression instance */
+
+struct jpeg_compress_struct {
+ jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
+
+ /* Destination for compressed data */
+ struct jpeg_destination_mgr * dest;
+
+ /* Description of source image --- these fields must be filled in by
+ * outer application before starting compression. in_color_space must
+ * be correct before you can even call jpeg_set_defaults().
+ */
+
+ JDIMENSION image_width; /* input image width */
+ JDIMENSION image_height; /* input image height */
+ int input_components; /* # of color components in input image */
+ J_COLOR_SPACE in_color_space; /* colorspace of input image */
+
+ double input_gamma; /* image gamma of input image */
+
+ /* Compression parameters --- these fields must be set before calling
+ * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
+ * initialize everything to reasonable defaults, then changing anything
+ * the application specifically wants to change. That way you won't get
+ * burnt when new parameters are added. Also note that there are several
+ * helper routines to simplify changing parameters.
+ */
+
+ int data_precision; /* bits of precision in image data */
+
+ int num_components; /* # of color components in JPEG image */
+ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
+
+ jpeg_component_info * comp_info;
+ /* comp_info[i] describes component that appears i'th in SOF */
+
+ JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
+ /* ptrs to coefficient quantization tables, or NULL if not defined */
+
+ JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ /* ptrs to Huffman coding tables, or NULL if not defined */
+
+ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
+ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
+ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
+
+ int num_scans; /* # of entries in scan_info array */
+ const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
+ /* The default value of scan_info is NULL, which causes a single-scan
+ * sequential JPEG file to be emitted. To create a multi-scan file,
+ * set num_scans and scan_info to point to an array of scan definitions.
+ */
+
+ boolean raw_data_in; /* TRUE=caller supplies downsampled data */
+ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
+ boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
+ boolean CCIR601_sampling; /* TRUE=first samples are cosited */
+ int smoothing_factor; /* 1..100, or 0 for no input smoothing */
+ J_DCT_METHOD dct_method; /* DCT algorithm selector */
+
+ /* The restart interval can be specified in absolute MCUs by setting
+ * restart_interval, or in MCU rows by setting restart_in_rows
+ * (in which case the correct restart_interval will be figured
+ * for each scan).
+ */
+ unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
+ int restart_in_rows; /* if > 0, MCU rows per restart interval */
+
+ /* Parameters controlling emission of special markers. */
+
+ boolean write_JFIF_header; /* should a JFIF marker be written? */
+ UINT8 JFIF_major_version; /* What to write for the JFIF version number */
+ UINT8 JFIF_minor_version;
+ /* These three values are not used by the JPEG code, merely copied */
+ /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
+ /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
+ /* ratio is defined by X_density/Y_density even when density_unit=0. */
+ UINT8 density_unit; /* JFIF code for pixel size units */
+ UINT16 X_density; /* Horizontal pixel density */
+ UINT16 Y_density; /* Vertical pixel density */
+ boolean write_Adobe_marker; /* should an Adobe marker be written? */
+
+ /* State variable: index of next scanline to be written to
+ * jpeg_write_scanlines(). Application may use this to control its
+ * processing loop, e.g., "while (next_scanline < image_height)".
+ */
+
+ JDIMENSION next_scanline; /* 0 .. image_height-1 */
+
+ /* Remaining fields are known throughout compressor, but generally
+ * should not be touched by a surrounding application.
+ */
+
+ /*
+ * These fields are computed during compression startup
+ */
+ boolean progressive_mode; /* TRUE if scan script uses progressive mode */
+ int max_h_samp_factor; /* largest h_samp_factor */
+ int max_v_samp_factor; /* largest v_samp_factor */
+
+ JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
+ /* The coefficient controller receives data in units of MCU rows as defined
+ * for fully interleaved scans (whether the JPEG file is interleaved or not).
+ * There are v_samp_factor * DCTSIZE sample rows of each component in an
+ * "iMCU" (interleaved MCU) row.
+ */
+
+ /*
+ * These fields are valid during any one scan.
+ * They describe the components and MCUs actually appearing in the scan.
+ */
+ int comps_in_scan; /* # of JPEG components in this scan */
+ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
+ /* *cur_comp_info[i] describes component that appears i'th in SOS */
+
+ JDIMENSION MCUs_per_row; /* # of MCUs across the image */
+ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
+
+ int blocks_in_MCU; /* # of DCT blocks per MCU */
+ int MCU_membership[C_MAX_BLOCKS_IN_MCU];
+ /* MCU_membership[i] is index in cur_comp_info of component owning */
+ /* i'th block in an MCU */
+
+ int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
+
+ /*
+ * Links to compression subobjects (methods and private variables of modules)
+ */
+ struct jpeg_comp_master * master;
+ struct jpeg_c_main_controller * main;
+ struct jpeg_c_prep_controller * prep;
+ struct jpeg_c_coef_controller * coef;
+ struct jpeg_marker_writer * marker;
+ struct jpeg_color_converter * cconvert;
+ struct jpeg_downsampler * downsample;
+ struct jpeg_forward_dct * fdct;
+ struct jpeg_entropy_encoder * entropy;
+ jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
+ int script_space_size;
+};
+
+
+/* Master record for a decompression instance */
+
+struct jpeg_decompress_struct {
+ jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
+
+ /* Source of compressed data */
+ struct jpeg_source_mgr * src;
+
+ /* Basic description of image --- filled in by jpeg_read_header(). */
+ /* Application may inspect these values to decide how to process image. */
+
+ JDIMENSION image_width; /* nominal image width (from SOF marker) */
+ JDIMENSION image_height; /* nominal image height */
+ int num_components; /* # of color components in JPEG image */
+ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
+
+ /* Decompression processing parameters --- these fields must be set before
+ * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
+ * them to default values.
+ */
+
+ J_COLOR_SPACE out_color_space; /* colorspace for output */
+
+ unsigned int scale_num, scale_denom; /* fraction by which to scale image */
+
+ double output_gamma; /* image gamma wanted in output */
+
+ boolean buffered_image; /* TRUE=multiple output passes */
+ boolean raw_data_out; /* TRUE=downsampled data wanted */
+
+ J_DCT_METHOD dct_method; /* IDCT algorithm selector */
+ boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
+ boolean do_block_smoothing; /* TRUE=apply interblock smoothing */
+
+ boolean quantize_colors; /* TRUE=colormapped output wanted */
+ /* the following are ignored if not quantize_colors: */
+ J_DITHER_MODE dither_mode; /* type of color dithering to use */
+ boolean two_pass_quantize; /* TRUE=use two-pass color quantization */
+ int desired_number_of_colors; /* max # colors to use in created colormap */
+ /* these are significant only in buffered-image mode: */
+ boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */
+ boolean enable_external_quant;/* enable future use of external colormap */
+ boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */
+
+ /* Description of actual output image that will be returned to application.
+ * These fields are computed by jpeg_start_decompress().
+ * You can also use jpeg_calc_output_dimensions() to determine these values
+ * in advance of calling jpeg_start_decompress().
+ */
+
+ JDIMENSION output_width; /* scaled image width */
+ JDIMENSION output_height; /* scaled image height */
+ int out_color_components; /* # of color components in out_color_space */
+ int output_components; /* # of color components returned */
+ /* output_components is 1 (a colormap index) when quantizing colors;
+ * otherwise it equals out_color_components.
+ */
+ int rec_outbuf_height; /* min recommended height of scanline buffer */
+ /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
+ * high, space and time will be wasted due to unnecessary data copying.
+ * Usually rec_outbuf_height will be 1 or 2, at most 4.
+ */
+
+ /* When quantizing colors, the output colormap is described by these fields.
+ * The application can supply a colormap by setting colormap non-NULL before
+ * calling jpeg_start_decompress; otherwise a colormap is created during
+ * jpeg_start_decompress or jpeg_start_output.
+ * The map has out_color_components rows and actual_number_of_colors columns.
+ */
+ int actual_number_of_colors; /* number of entries in use */
+ JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
+
+ /* State variables: these variables indicate the progress of decompression.
+ * The application may examine these but must not modify them.
+ */
+
+ /* Row index of next scanline to be read from jpeg_read_scanlines().
+ * Application may use this to control its processing loop, e.g.,
+ * "while (output_scanline < output_height)".
+ */
+ JDIMENSION output_scanline; /* 0 .. output_height-1 */
+
+ /* Current input scan number and number of iMCU rows completed in scan.
+ * These indicate the progress of the decompressor input side.
+ */
+ int input_scan_number; /* Number of SOS markers seen so far */
+ JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */
+
+ /* The "output scan number" is the notional scan being displayed by the
+ * output side. The decompressor will not allow output scan/row number
+ * to get ahead of input scan/row, but it can fall arbitrarily far behind.
+ */
+ int output_scan_number; /* Nominal scan number being displayed */
+ JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
+
+ /* Current progression status. coef_bits[c][i] indicates the precision
+ * with which component c's DCT coefficient i (in zigzag order) is known.
+ * It is -1 when no data has yet been received, otherwise it is the point
+ * transform (shift) value for the most recent scan of the coefficient
+ * (thus, 0 at completion of the progression).
+ * This pointer is NULL when reading a non-progressive file.
+ */
+ int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */
+
+ /* Internal JPEG parameters --- the application usually need not look at
+ * these fields. Note that the decompressor output side may not use
+ * any parameters that can change between scans.
+ */
+
+ /* Quantization and Huffman tables are carried forward across input
+ * datastreams when processing abbreviated JPEG datastreams.
+ */
+
+ JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
+ /* ptrs to coefficient quantization tables, or NULL if not defined */
+
+ JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ /* ptrs to Huffman coding tables, or NULL if not defined */
+
+ /* These parameters are never carried across datastreams, since they
+ * are given in SOF/SOS markers or defined to be reset by SOI.
+ */
+
+ int data_precision; /* bits of precision in image data */
+
+ jpeg_component_info * comp_info;
+ /* comp_info[i] describes component that appears i'th in SOF */
+
+ boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
+ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
+
+ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
+ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
+ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
+
+ unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
+
+ /* These fields record data obtained from optional markers recognized by
+ * the JPEG library.
+ */
+ boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
+ /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
+ UINT8 JFIF_major_version; /* JFIF version number */
+ UINT8 JFIF_minor_version;
+ UINT8 density_unit; /* JFIF code for pixel size units */
+ UINT16 X_density; /* Horizontal pixel density */
+ UINT16 Y_density; /* Vertical pixel density */
+ boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
+ UINT8 Adobe_transform; /* Color transform code from Adobe marker */
+
+ boolean CCIR601_sampling; /* TRUE=first samples are cosited */
+
+ /* Aside from the specific data retained from APPn markers known to the
+ * library, the uninterpreted contents of any or all APPn and COM markers
+ * can be saved in a list for examination by the application.
+ */
+ jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
+
+ /* Remaining fields are known throughout decompressor, but generally
+ * should not be touched by a surrounding application.
+ */
+
+ /*
+ * These fields are computed during decompression startup
+ */
+ int max_h_samp_factor; /* largest h_samp_factor */
+ int max_v_samp_factor; /* largest v_samp_factor */
+
+ int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
+
+ JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
+ /* The coefficient controller's input and output progress is measured in
+ * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
+ * in fully interleaved JPEG scans, but are used whether the scan is
+ * interleaved or not. We define an iMCU row as v_samp_factor DCT block
+ * rows of each component. Therefore, the IDCT output contains
+ * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
+ */
+
+ JSAMPLE * sample_range_limit; /* table for fast range-limiting */
+
+ /*
+ * These fields are valid during any one scan.
+ * They describe the components and MCUs actually appearing in the scan.
+ * Note that the decompressor output side must not use these fields.
+ */
+ int comps_in_scan; /* # of JPEG components in this scan */
+ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
+ /* *cur_comp_info[i] describes component that appears i'th in SOS */
+
+ JDIMENSION MCUs_per_row; /* # of MCUs across the image */
+ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
+
+ int blocks_in_MCU; /* # of DCT blocks per MCU */
+ int MCU_membership[D_MAX_BLOCKS_IN_MCU];
+ /* MCU_membership[i] is index in cur_comp_info of component owning */
+ /* i'th block in an MCU */
+
+ int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
+
+ /* This field is shared between entropy decoder and marker parser.
+ * It is either zero or the code of a JPEG marker that has been
+ * read from the data source, but has not yet been processed.
+ */
+ int unread_marker;
+
+ /*
+ * Links to decompression subobjects (methods, private variables of modules)
+ */
+ struct jpeg_decomp_master * master;
+ struct jpeg_d_main_controller * main;
+ struct jpeg_d_coef_controller * coef;
+ struct jpeg_d_post_controller * post;
+ struct jpeg_input_controller * inputctl;
+ struct jpeg_marker_reader * marker;
+ struct jpeg_entropy_decoder * entropy;
+ struct jpeg_inverse_dct * idct;
+ struct jpeg_upsampler * upsample;
+ struct jpeg_color_deconverter * cconvert;
+ struct jpeg_color_quantizer * cquantize;
+};
+
+
+/* "Object" declarations for JPEG modules that may be supplied or called
+ * directly by the surrounding application.
+ * As with all objects in the JPEG library, these structs only define the
+ * publicly visible methods and state variables of a module. Additional
+ * private fields may exist after the public ones.
+ */
+
+
+/* Error handler object */
+
+struct jpeg_error_mgr {
+ /* Error exit handler: does not return to caller */
+ JMETHOD(void, error_exit, (j_common_ptr cinfo));
+ /* Conditionally emit a trace or warning message */
+ JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
+ /* Routine that actually outputs a trace or error message */
+ JMETHOD(void, output_message, (j_common_ptr cinfo));
+ /* Format a message string for the most recent JPEG error or message */
+ JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
+#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
+ /* Reset error state variables at start of a new image */
+ JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
+
+ /* The message ID code and any parameters are saved here.
+ * A message can have one string parameter or up to 8 int parameters.
+ */
+ int msg_code;
+#define JMSG_STR_PARM_MAX 80
+ union {
+ int i[8];
+ char s[JMSG_STR_PARM_MAX];
+ } msg_parm;
+
+ /* Standard state variables for error facility */
+
+ int trace_level; /* max msg_level that will be displayed */
+
+ /* For recoverable corrupt-data errors, we emit a warning message,
+ * but keep going unless emit_message chooses to abort. emit_message
+ * should count warnings in num_warnings. The surrounding application
+ * can check for bad data by seeing if num_warnings is nonzero at the
+ * end of processing.
+ */
+ long num_warnings; /* number of corrupt-data warnings */
+
+ /* These fields point to the table(s) of error message strings.
+ * An application can change the table pointer to switch to a different
+ * message list (typically, to change the language in which errors are
+ * reported). Some applications may wish to add additional error codes
+ * that will be handled by the JPEG library error mechanism; the second
+ * table pointer is used for this purpose.
+ *
+ * First table includes all errors generated by JPEG library itself.
+ * Error code 0 is reserved for a "no such error string" message.
+ */
+ const char * const * jpeg_message_table; /* Library errors */
+ int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
+ /* Second table can be added by application (see cjpeg/djpeg for example).
+ * It contains strings numbered first_addon_message..last_addon_message.
+ */
+ const char * const * addon_message_table; /* Non-library errors */
+ int first_addon_message; /* code for first string in addon table */
+ int last_addon_message; /* code for last string in addon table */
+};
+
+
+/* Progress monitor object */
+
+struct jpeg_progress_mgr {
+ JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
+
+ long pass_counter; /* work units completed in this pass */
+ long pass_limit; /* total number of work units in this pass */
+ int completed_passes; /* passes completed so far */
+ int total_passes; /* total number of passes expected */
+};
+
+
+/* Data destination object for compression */
+
+struct jpeg_destination_mgr {
+ JOCTET * next_output_byte; /* => next byte to write in buffer */
+ size_t free_in_buffer; /* # of byte spaces remaining in buffer */
+
+ JMETHOD(void, init_destination, (j_compress_ptr cinfo));
+ JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
+ JMETHOD(void, term_destination, (j_compress_ptr cinfo));
+};
+
+
+/* Data source object for decompression */
+
+struct jpeg_source_mgr {
+ const JOCTET * next_input_byte; /* => next byte to read from buffer */
+ size_t bytes_in_buffer; /* # of bytes remaining in buffer */
+
+ JMETHOD(void, init_source, (j_decompress_ptr cinfo));
+ JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
+ JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
+ JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
+ JMETHOD(void, term_source, (j_decompress_ptr cinfo));
+};
+
+
+/* Memory manager object.
+ * Allocates "small" objects (a few K total), "large" objects (tens of K),
+ * and "really big" objects (virtual arrays with backing store if needed).
+ * The memory manager does not allow individual objects to be freed; rather,
+ * each created object is assigned to a pool, and whole pools can be freed
+ * at once. This is faster and more convenient than remembering exactly what
+ * to free, especially where malloc()/free() are not too speedy.
+ * NB: alloc routines never return NULL. They exit to error_exit if not
+ * successful.
+ */
+
+#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
+#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
+#define JPOOL_NUMPOOLS 2
+
+typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
+typedef struct jvirt_barray_control * jvirt_barray_ptr;
+
+
+struct jpeg_memory_mgr {
+ /* Method pointers */
+ JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
+ size_t sizeofobject));
+ JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
+ size_t sizeofobject));
+ JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
+ JDIMENSION samplesperrow,
+ JDIMENSION numrows));
+ JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
+ JDIMENSION blocksperrow,
+ JDIMENSION numrows));
+ JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
+ int pool_id,
+ boolean pre_zero,
+ JDIMENSION samplesperrow,
+ JDIMENSION numrows,
+ JDIMENSION maxaccess));
+ JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
+ int pool_id,
+ boolean pre_zero,
+ JDIMENSION blocksperrow,
+ JDIMENSION numrows,
+ JDIMENSION maxaccess));
+ JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
+ JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
+ jvirt_sarray_ptr ptr,
+ JDIMENSION start_row,
+ JDIMENSION num_rows,
+ boolean writable));
+ JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
+ jvirt_barray_ptr ptr,
+ JDIMENSION start_row,
+ JDIMENSION num_rows,
+ boolean writable));
+ JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
+ JMETHOD(void, self_destruct, (j_common_ptr cinfo));
+
+ /* Limit on memory allocation for this JPEG object. (Note that this is
+ * merely advisory, not a guaranteed maximum; it only affects the space
+ * used for virtual-array buffers.) May be changed by outer application
+ * after creating the JPEG object.
+ */
+ long max_memory_to_use;
+
+ /* Maximum allocation request accepted by alloc_large. */
+ long max_alloc_chunk;
+};
+
+
+/* Routine signature for application-supplied marker processing methods.
+ * Need not pass marker code since it is stored in cinfo->unread_marker.
+ */
+typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
+
+
+/* Declarations for routines called by application.
+ * The JPP macro hides prototype parameters from compilers that can't cope.
+ * Note JPP requires double parentheses.
+ */
+
+#ifdef HAVE_PROTOTYPES
+#define JPP(arglist) arglist
+#else
+#define JPP(arglist) ()
+#endif
+
+
+/* Short forms of external names for systems with brain-damaged linkers.
+ * We shorten external names to be unique in the first six letters, which
+ * is good enough for all known systems.
+ * (If your compiler itself needs names to be unique in less than 15
+ * characters, you are out of luck. Get a better compiler.)
+ */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jpeg_std_error jStdError
+#define jpeg_CreateCompress jCreaCompress
+#define jpeg_CreateDecompress jCreaDecompress
+#define jpeg_destroy_compress jDestCompress
+#define jpeg_destroy_decompress jDestDecompress
+#define jpeg_stdio_dest jStdDest
+#define jpeg_stdio_src jStdSrc
+#define jpeg_set_defaults jSetDefaults
+#define jpeg_set_colorspace jSetColorspace
+#define jpeg_default_colorspace jDefColorspace
+#define jpeg_set_quality jSetQuality
+#define jpeg_set_linear_quality jSetLQuality
+#define jpeg_add_quant_table jAddQuantTable
+#define jpeg_quality_scaling jQualityScaling
+#define jpeg_simple_progression jSimProgress
+#define jpeg_suppress_tables jSuppressTables
+#define jpeg_alloc_quant_table jAlcQTable
+#define jpeg_alloc_huff_table jAlcHTable
+#define jpeg_start_compress jStrtCompress
+#define jpeg_write_scanlines jWrtScanlines
+#define jpeg_finish_compress jFinCompress
+#define jpeg_write_raw_data jWrtRawData
+#define jpeg_write_marker jWrtMarker
+#define jpeg_write_m_header jWrtMHeader
+#define jpeg_write_m_byte jWrtMByte
+#define jpeg_write_tables jWrtTables
+#define jpeg_read_header jReadHeader
+#define jpeg_start_decompress jStrtDecompress
+#define jpeg_read_scanlines jReadScanlines
+#define jpeg_finish_decompress jFinDecompress
+#define jpeg_read_raw_data jReadRawData
+#define jpeg_has_multiple_scans jHasMultScn
+#define jpeg_start_output jStrtOutput
+#define jpeg_finish_output jFinOutput
+#define jpeg_input_complete jInComplete
+#define jpeg_new_colormap jNewCMap
+#define jpeg_consume_input jConsumeInput
+#define jpeg_calc_output_dimensions jCalcDimensions
+#define jpeg_save_markers jSaveMarkers
+#define jpeg_set_marker_processor jSetMarker
+#define jpeg_read_coefficients jReadCoefs
+#define jpeg_write_coefficients jWrtCoefs
+#define jpeg_copy_critical_parameters jCopyCrit
+#define jpeg_abort_compress jAbrtCompress
+#define jpeg_abort_decompress jAbrtDecompress
+#define jpeg_abort jAbort
+#define jpeg_destroy jDestroy
+#define jpeg_resync_to_restart jResyncRestart
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/* Default error-management setup */
+EXTERN(struct jpeg_error_mgr *) jpeg_std_error
+ JPP((struct jpeg_error_mgr * err));
+
+/* Initialization of JPEG compression objects.
+ * jpeg_create_compress() and jpeg_create_decompress() are the exported
+ * names that applications should call. These expand to calls on
+ * jpeg_CreateCompress and jpeg_CreateDecompress with additional information
+ * passed for version mismatch checking.
+ * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
+ */
+#define jpeg_create_compress(cinfo) \
+ jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
+ (size_t) sizeof(struct jpeg_compress_struct))
+#define jpeg_create_decompress(cinfo) \
+ jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
+ (size_t) sizeof(struct jpeg_decompress_struct))
+EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
+ int version, size_t structsize));
+EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
+ int version, size_t structsize));
+/* Destruction of JPEG compression objects */
+EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
+
+/* Standard data source and destination managers: stdio streams. */
+/* Caller is responsible for opening the file before and closing after. */
+EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
+EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
+
+/* Default parameter setup for compression */
+EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
+/* Compression parameter setup aids */
+EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,
+ J_COLOR_SPACE colorspace));
+EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
+ boolean force_baseline));
+EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
+ int scale_factor,
+ boolean force_baseline));
+EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
+ const unsigned int *basic_table,
+ int scale_factor,
+ boolean force_baseline));
+EXTERN(int) jpeg_quality_scaling JPP((int quality));
+EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
+ boolean suppress));
+EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
+EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
+
+/* Main entry points for compression */
+EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
+ boolean write_all_tables));
+EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
+ JSAMPARRAY scanlines,
+ JDIMENSION num_lines));
+EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
+
+/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
+EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
+ JSAMPIMAGE data,
+ JDIMENSION num_lines));
+
+/* Write a special marker. See libjpeg.doc concerning safe usage. */
+EXTERN(void) jpeg_write_marker
+ JPP((j_compress_ptr cinfo, int marker,
+ const JOCTET * dataptr, unsigned int datalen));
+/* Same, but piecemeal. */
+EXTERN(void) jpeg_write_m_header
+ JPP((j_compress_ptr cinfo, int marker, unsigned int datalen));
+EXTERN(void) jpeg_write_m_byte
+ JPP((j_compress_ptr cinfo, int val));
+
+/* Alternate compression function: just write an abbreviated table file */
+EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));
+
+/* Decompression startup: read start of JPEG datastream to see what's there */
+EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
+ boolean require_image));
+/* Return value is one of: */
+#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
+#define JPEG_HEADER_OK 1 /* Found valid image datastream */
+#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
+/* If you pass require_image = TRUE (normal case), you need not check for
+ * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
+ * JPEG_SUSPENDED is only possible if you use a data source module that can
+ * give a suspension return (the stdio source module doesn't).
+ */
+
+/* Main entry points for decompression */
+EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));
+EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
+ JSAMPARRAY scanlines,
+ JDIMENSION max_lines));
+EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
+
+/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
+EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
+ JSAMPIMAGE data,
+ JDIMENSION max_lines));
+
+/* Additional entry points for buffered-image mode. */
+EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
+EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,
+ int scan_number));
+EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));
+EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));
+EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));
+EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
+/* Return value is one of: */
+/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
+#define JPEG_REACHED_SOS 1 /* Reached start of new scan */
+#define JPEG_REACHED_EOI 2 /* Reached end of image */
+#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */
+#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
+
+/* Precalculate output dimensions for current decompression parameters. */
+EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
+
+/* Control saving of COM and APPn markers into marker_list. */
+EXTERN(void) jpeg_save_markers
+ JPP((j_decompress_ptr cinfo, int marker_code,
+ unsigned int length_limit));
+
+/* Install a special processing method for COM or APPn markers. */
+EXTERN(void) jpeg_set_marker_processor
+ JPP((j_decompress_ptr cinfo, int marker_code,
+ jpeg_marker_parser_method routine));
+
+/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
+EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
+EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
+ jvirt_barray_ptr * coef_arrays));
+EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
+ j_compress_ptr dstinfo));
+
+/* If you choose to abort compression or decompression before completing
+ * jpeg_finish_(de)compress, then you need to clean up to release memory,
+ * temporary files, etc. You can just call jpeg_destroy_(de)compress
+ * if you're done with the JPEG object, but if you want to clean it up and
+ * reuse it, call this:
+ */
+EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));
+EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
+
+/* Generic versions of jpeg_abort and jpeg_destroy that work on either
+ * flavor of JPEG object. These may be more convenient in some places.
+ */
+EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));
+EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));
+
+/* Default restart-marker-resync procedure for use by data source modules */
+EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
+ int desired));
+
+
+/* These marker codes are exported since applications and data source modules
+ * are likely to want to use them.
+ */
+
+#define JPEG_RST0 0xD0 /* RST0 marker code */
+#define JPEG_EOI 0xD9 /* EOI marker code */
+#define JPEG_APP0 0xE0 /* APP0 marker code */
+#define JPEG_COM 0xFE /* COM marker code */
+
+
+/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
+ * for structure definitions that are never filled in, keep it quiet by
+ * supplying dummy definitions for the various substructures.
+ */
+
+#ifdef INCOMPLETE_TYPES_BROKEN
+#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
+struct jvirt_sarray_control { long dummy; };
+struct jvirt_barray_control { long dummy; };
+struct jpeg_comp_master { long dummy; };
+struct jpeg_c_main_controller { long dummy; };
+struct jpeg_c_prep_controller { long dummy; };
+struct jpeg_c_coef_controller { long dummy; };
+struct jpeg_marker_writer { long dummy; };
+struct jpeg_color_converter { long dummy; };
+struct jpeg_downsampler { long dummy; };
+struct jpeg_forward_dct { long dummy; };
+struct jpeg_entropy_encoder { long dummy; };
+struct jpeg_decomp_master { long dummy; };
+struct jpeg_d_main_controller { long dummy; };
+struct jpeg_d_coef_controller { long dummy; };
+struct jpeg_d_post_controller { long dummy; };
+struct jpeg_input_controller { long dummy; };
+struct jpeg_marker_reader { long dummy; };
+struct jpeg_entropy_decoder { long dummy; };
+struct jpeg_inverse_dct { long dummy; };
+struct jpeg_upsampler { long dummy; };
+struct jpeg_color_deconverter { long dummy; };
+struct jpeg_color_quantizer { long dummy; };
+#endif /* JPEG_INTERNALS */
+#endif /* INCOMPLETE_TYPES_BROKEN */
+
+
+/*
+ * The JPEG library modules define JPEG_INTERNALS before including this file.
+ * The internal structure declarations are read only when that is true.
+ * Applications using the library should not include jpegint.h, but may wish
+ * to include jerror.h.
+ */
+
+#ifdef JPEG_INTERNALS
+#include "jpegint.h" /* fetch private declarations */
+#include "jerror.h" /* fetch error codes too */
+#endif
+
+#endif /* JPEGLIB_H */
/* The decompressor output side may not use these variables. */
int dc_tbl_no; /* DC entropy table selector (0..3) */
int ac_tbl_no; /* AC entropy table selector (0..3) */
-
+
/* Remaining fields should be treated as private by applications. */
-
+
/* These values are computed during compression or decompression startup: */
/* Component's size in DCT blocks.
* Any dummy blocks added to complete an MCU are not counted; therefore
JCS_RGB, /* red/green/blue */
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
JCS_CMYK, /* C/M/Y/K */
- JCS_YCCK /* Y/Cb/Cr/K */
+ JCS_YCCK, /* Y/Cb/Cr/K */
+#ifdef ANDROID_RGB
+ JCS_RGBA_8888, /* red/green/blue/alpha */
+ JCS_RGB_565 /* red/green/blue in 565 format */
+#endif
} J_COLOR_SPACE;
/* DCT/IDCT algorithm options. */
jpeg_component_info * comp_info;
/* comp_info[i] describes component that appears i'th in SOF */
-
+
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
/* ptrs to coefficient quantization tables, or NULL if not defined */
-
+
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
/* ptrs to Huffman coding tables, or NULL if not defined */
-
+
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
UINT16 X_density; /* Horizontal pixel density */
UINT16 Y_density; /* Vertical pixel density */
boolean write_Adobe_marker; /* should an Adobe marker be written? */
-
+
/* State variable: index of next scanline to be written to
* jpeg_write_scanlines(). Application may use this to control its
* processing loop, e.g., "while (next_scanline < image_height)".
* There are v_samp_factor * DCTSIZE sample rows of each component in an
* "iMCU" (interleaved MCU) row.
*/
-
+
/*
* These fields are valid during any one scan.
* They describe the components and MCUs actually appearing in the scan.
int comps_in_scan; /* # of JPEG components in this scan */
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
/* *cur_comp_info[i] describes component that appears i'th in SOS */
-
+
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
-
+
int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
/* MCU_membership[i] is index in cur_comp_info of component owning */
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
/* Reset error state variables at start of a new image */
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
-
+
/* The message ID code and any parameters are saved here.
* A message can have one string parameter or up to 8 int parameters.
*/
int i[8];
char s[JMSG_STR_PARM_MAX];
} msg_parm;
-
+
/* Standard state variables for error facility */
-
+
int trace_level; /* max msg_level that will be displayed */
-
+
/* For recoverable corrupt-data errors, we emit a warning message,
* but keep going unless emit_message chooses to abort. emit_message
* should count warnings in num_warnings. The surrounding application
/* Short forms of external names for systems with brain-damaged linkers.
* We shorten external names to be unique in the first six letters, which
* is good enough for all known systems.
- * (If your compiler itself needs names to be unique in less than 15
+ * (If your compiler itself needs names to be unique in less than 15
* characters, you are out of luck. Get a better compiler.)
*/
* external API header
*/
-#ifndef _WIN32_WCE
#include <errno.h>
-#endif
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52
#define AVFORMAT_AVFORMAT_H
#define LIBAVFORMAT_VERSION_MAJOR 52
-#define LIBAVFORMAT_VERSION_MINOR 32
+#define LIBAVFORMAT_VERSION_MINOR 33
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
const char *name;
/**
* Descriptive name for the format, meant to be more human-readable
- * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro
+ * than name. You should use the NULL_IF_CONFIG_SMALL() macro
* to define it.
*/
const char *long_name;
const char *name;
/**
* Descriptive name for the format, meant to be more human-readable
- * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro
+ * than name. You should use the NULL_IF_CONFIG_SMALL() macro
* to define it.
*/
const char *long_name;
#endif
/**
- * Parses \p datestr and returns a corresponding number of microseconds.
+ * Parses datestr and returns a corresponding number of microseconds.
* @param datestr String representing a date or a duration.
* - If a date the syntax is:
* @code
* If the year-month-day part is not specified it takes the current
* year-month-day.
* Returns the number of microseconds since 1st of January, 1970 up to
- * the time of the parsed date or INT64_MIN if \p datestr cannot be
+ * the time of the parsed date or INT64_MIN if datestr cannot be
* successfully parsed.
* - If a duration the syntax is:
* @code
* [-]S+[.m...]
* @endcode
* Returns the number of microseconds contained in a time interval
- * with the specified duration or INT64_MIN if \p datestr cannot be
+ * with the specified duration or INT64_MIN if datestr cannot be
* successfully parsed.
- * @param duration Flag which tells how to interpret \p datestr, if
- * not zero \p datestr is interpreted as a duration, otherwise as a
+ * @param duration Flag which tells how to interpret datestr, if
+ * not zero datestr is interpreted as a duration, otherwise as a
* date.
*/
int64_t parse_date(const char *datestr, int duration);
* version bump.
* sizeof(URLContext) must not be used outside libav*.
*/
-struct URLContext {
+typedef struct URLContext {
#if LIBAVFORMAT_VERSION_MAJOR >= 53
const AVClass *av_class; ///< information for av_log(). Set by url_open().
#endif
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
void *priv_data;
char *filename; /**< specified filename */
-};
-
-typedef struct URLContext URLContext;
+} URLContext;
typedef struct URLPollEntry {
URLContext *handle;
#define AVUTIL_COMMON_H
#include <ctype.h>
-#ifndef _WIN32_WCE
#include <errno.h>
-#else
-#define inline __inline
-#endif
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#if !defined(EMULATE_INTTYPES)
-# include <inttypes.h>
+# include <inttypes.h>
#else
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed int int32_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned int uint32_t;
-
-# ifdef CONFIG_WIN32
- typedef signed __int64 int64_t;
- typedef unsigned __int64 uint64_t;
-# else /* other OS */
- typedef signed long long int64_t;
- typedef unsigned long long uint64_t;
-# endif /* other OS */
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+
+# ifdef CONFIG_WIN32
+ typedef signed __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+# else /* other OS */
+ typedef signed long long int64_t;
+ typedef unsigned long long uint64_t;
+# endif /* other OS */
#endif /* HAVE_INTTYPES_H */
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
+#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
/* misc math functions */
extern const uint8_t ff_log2_tab[256];
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Toplevel Include
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NEPTUNE_H_
+#define _NEPTUNE_H_
+
+/*----------------------------------------------------------------------
+| flags
++---------------------------------------------------------------------*/
+#define NPT_EXTERNAL_USE /* do not expose internal definitions */
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#include "NptCommon.h"
+#include "NptResults.h"
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptReferences.h"
+#include "NptStreams.h"
+#include "NptBufferedStreams.h"
+#include "NptFile.h"
+#include "NptNetwork.h"
+#include "NptSockets.h"
+#include "NptTime.h"
+#include "NptThreads.h"
+#include "NptSystem.h"
+#include "NptMessaging.h"
+#include "NptQueue.h"
+#include "NptSimpleMessageQueue.h"
+#include "NptSelectableMessageQueue.h"
+#include "NptXml.h"
+#include "NptStrings.h"
+#include "NptArray.h"
+#include "NptList.h"
+#include "NptMap.h"
+#include "NptStack.h"
+#include "NptUri.h"
+#include "NptHttp.h"
+#include "NptDataBuffer.h"
+#include "NptUtils.h"
+#include "NptRingBuffer.h"
+#include "NptBase64.h"
+#include "NptConsole.h"
+#include "NptLogging.h"
+#include "NptSerialPort.h"
+#include "NptVersion.h"
+#include "NptDynamicLibraries.h"
+#include "NptDynamicCast.h"
+
+// optional modules
+#include "NptZip.h"
+#include "NptTls.h"
+
+#endif // _NEPTUNE_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Arrays
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+
+#ifndef _NPT_ARRAY_H_
+#define _NPT_ARRAY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#if defined(NPT_CONFIG_HAVE_NEW_H)
+#include <new>
+#endif
+#include "NptTypes.h"
+#include "NptResults.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ARRAY_INITIAL_MAX_SIZE = 128; // bytes
+
+/*----------------------------------------------------------------------
+| NPT_Array
++---------------------------------------------------------------------*/
+template <typename T>
+class NPT_Array
+{
+public:
+ // types
+ typedef T Element;
+ typedef T* Iterator;
+
+ // methods
+ NPT_Array<T>(): m_Capacity(0), m_ItemCount(0), m_Items(0) {}
+ explicit NPT_Array<T>(NPT_Cardinal count);
+ NPT_Array<T>(NPT_Cardinal count, const T& item);
+ NPT_Array<T>(const T* items, NPT_Cardinal item_count);
+ ~NPT_Array<T>();
+ NPT_Array<T>(const NPT_Array<T>& copy);
+ NPT_Array<T>& operator=(const NPT_Array<T>& copy);
+ bool operator==(const NPT_Array<T>& other) const;
+ bool operator!=(const NPT_Array<T>& other) const;
+ NPT_Cardinal GetItemCount() const { return m_ItemCount; }
+ NPT_Result Add(const T& item);
+ T& operator[](NPT_Ordinal pos) { return m_Items[pos]; }
+ const T& operator[](NPT_Ordinal pos) const { return m_Items[pos]; }
+ NPT_Result Erase(Iterator which);
+ NPT_Result Erase(NPT_Ordinal which) { return Erase(&m_Items[which]); }
+ NPT_Result Erase(Iterator first, Iterator last);
+ NPT_Result Erase(NPT_Ordinal first, NPT_Ordinal last) { return Erase(&m_Items[first], &m_Items[last]); }
+ NPT_Result Insert(Iterator where, const T& item, NPT_Cardinal count = 1);
+ NPT_Result Reserve(NPT_Cardinal count);
+ NPT_Cardinal GetCapacity() const { return m_Capacity; }
+ NPT_Result Resize(NPT_Cardinal count);
+ NPT_Result Resize(NPT_Cardinal count, const T& fill);
+ NPT_Result Clear();
+ bool Contains(const T& data) const;
+ Iterator GetFirstItem() const { return m_ItemCount?&m_Items[0]:NULL; }
+ Iterator GetLastItem() const { return m_ItemCount?&m_Items[m_ItemCount-1]:NULL; }
+ Iterator GetItem(NPT_Ordinal n) { return n<m_ItemCount?&m_Items[n]:NULL; }
+
+ // template list operations
+ // keep these template members defined here because MSV6 does not let
+ // us define them later
+ template <typename X>
+ NPT_Result Apply(const X& function) const
+ {
+ for (unsigned int i=0; i<m_ItemCount; i++) function(m_Items[i]);
+ return NPT_SUCCESS;
+ }
+
+ template <typename X, typename P>
+ NPT_Result ApplyUntil(const X& function, const P& predicate, bool* match = NULL) const
+ {
+ for (unsigned int i=0; i<m_ItemCount; i++) {
+ NPT_Result return_value;
+ if (predicate(function(m_Items[i]), return_value)) {
+ if (match) *match = true;
+ return return_value;
+ }
+ }
+ if (match) *match = false;
+ return NPT_SUCCESS;
+ }
+
+ template <typename X>
+ T* Find(const X& predicate, NPT_Ordinal n=0, NPT_Ordinal* pos = NULL) const
+ {
+ if (pos) *pos = -1;
+
+ for (unsigned int i=0; i<m_ItemCount; i++) {
+ if (predicate(m_Items[i])) {
+ if (pos) *pos = i;
+ if (n == 0) return &m_Items[i];
+ --n;
+ }
+ }
+ return NULL;
+ }
+
+protected:
+ // methods
+ T* Allocate(NPT_Cardinal count, NPT_Cardinal& allocated);
+
+ // members
+ NPT_Cardinal m_Capacity;
+ NPT_Cardinal m_ItemCount;
+ T* m_Items;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::NPT_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Array<T>::NPT_Array(NPT_Cardinal count) :
+ m_Capacity(0),
+ m_ItemCount(0),
+ m_Items(0)
+{
+ Reserve(count);
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::NPT_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Array<T>::NPT_Array(const NPT_Array<T>& copy) :
+ m_Capacity(0),
+ m_ItemCount(0),
+ m_Items(0)
+{
+ Reserve(copy.GetItemCount());
+ for (NPT_Ordinal i=0; i<copy.m_ItemCount; i++) {
+ new ((void*)&m_Items[i]) T(copy.m_Items[i]);
+ }
+ m_ItemCount = copy.m_ItemCount;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::NPT_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Array<T>::NPT_Array(NPT_Cardinal count, const T& item) :
+ m_Capacity(0),
+ m_ItemCount(count),
+ m_Items(0)
+{
+ Reserve(count);
+ for (NPT_Ordinal i=0; i<count; i++) {
+ new ((void*)&m_Items[i]) T(item);
+ }
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::NPT_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Array<T>::NPT_Array(const T* items, NPT_Cardinal item_count) :
+ m_Capacity(0),
+ m_ItemCount(item_count),
+ m_Items(0)
+{
+ Reserve(item_count);
+ for (NPT_Ordinal i=0; i<item_count; i++) {
+ new ((void*)&m_Items[i]) T(items[i]);
+ }
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::~NPT_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Array<T>::~NPT_Array()
+{
+ // remove all items
+ Clear();
+
+ // free the memory
+ ::operator delete((void*)m_Items);
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::operator=
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Array<T>&
+NPT_Array<T>::operator=(const NPT_Array<T>& copy)
+{
+ // do nothing if we're assigning to ourselves
+ if (this == ©) return *this;
+
+ // destroy all elements
+ Clear();
+
+ // copy all elements from the other object
+ Reserve(copy.GetItemCount());
+ m_ItemCount = copy.m_ItemCount;
+ for (NPT_Ordinal i=0; i<copy.m_ItemCount; i++) {
+ new ((void*)&m_Items[i]) T(copy.m_Items[i]);
+ }
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Clear
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_Array<T>::Clear()
+{
+ // destroy all items
+ for (NPT_Ordinal i=0; i<m_ItemCount; i++) {
+ m_Items[i].~T();
+ }
+
+ m_ItemCount = 0;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Allocate
++---------------------------------------------------------------------*/
+template <typename T>
+T*
+NPT_Array<T>::Allocate(NPT_Cardinal count, NPT_Cardinal& allocated)
+{
+ if (m_Capacity) {
+ allocated = 2*m_Capacity;
+ } else {
+ // start with just enough elements to fill
+ // NPT_ARRAY_INITIAL_MAX_SIZE worth of memory
+ allocated = NPT_ARRAY_INITIAL_MAX_SIZE/sizeof(T);
+ if (allocated == 0) allocated = 1;
+ }
+ if (allocated < count) allocated = count;
+
+ // allocate the items
+ return (T*)::operator new(allocated*sizeof(T));
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Reserve
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_Array<T>::Reserve(NPT_Cardinal count)
+{
+ if (count <= m_Capacity) return NPT_SUCCESS;
+
+ // (re)allocate the items
+ NPT_Cardinal new_capacity;
+ T* new_items = Allocate(count, new_capacity);
+ if (new_items == NULL) {
+ return NPT_ERROR_OUT_OF_MEMORY;
+ }
+ if (m_ItemCount && m_Items) {
+ for (unsigned int i=0; i<m_ItemCount; i++) {
+ // construct the copy
+ new ((void*)&new_items[i])T(m_Items[i]);
+
+ // destroy the item
+ m_Items[i].~T();
+ }
+ }
+ ::operator delete((void*)m_Items);
+ m_Items = new_items;
+ m_Capacity = new_capacity;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Result
+NPT_Array<T>::Add(const T& item)
+{
+ // ensure capacity
+ NPT_Result result = Reserve(m_ItemCount+1);
+ if (result != NPT_SUCCESS) return result;
+
+ // store the item
+ new ((void*)&m_Items[m_ItemCount++]) T(item);
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Erase
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Result
+NPT_Array<T>::Erase(Iterator which)
+{
+ return Erase(which, which);
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Erase
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_Array<T>::Erase(Iterator first, Iterator last)
+{
+ // check parameters
+ if (first == NULL || last == NULL) return NPT_ERROR_INVALID_PARAMETERS;
+
+ // check the bounds
+ NPT_Ordinal first_index = (NPT_Ordinal)(NPT_POINTER_TO_LONG(first-m_Items));
+ NPT_Ordinal last_index = (NPT_Ordinal)(NPT_POINTER_TO_LONG(last-m_Items));
+ if (first_index >= m_ItemCount ||
+ last_index >= m_ItemCount ||
+ first_index > last_index) {
+ return NPT_ERROR_INVALID_PARAMETERS;
+ }
+
+ // shift items to the left
+ NPT_Cardinal interval = last_index-first_index+1;
+ NPT_Cardinal shifted = m_ItemCount-last_index-1;
+ for (NPT_Ordinal i=first_index; i<first_index+shifted; i++) {
+ m_Items[i] = m_Items[i+interval];
+ }
+
+ // destruct the remaining items
+ for (NPT_Ordinal i=first_index+shifted; i<m_ItemCount; i++) {
+ m_Items[i].~T();
+ }
+
+ // update the item count
+ m_ItemCount -= interval;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Insert
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_Array<T>::Insert(Iterator where, const T& item, NPT_Cardinal repeat)
+{
+ // check bounds
+ NPT_Ordinal where_index = where?((NPT_Ordinal)NPT_POINTER_TO_LONG(where-m_Items)):m_ItemCount;
+ if (where > &m_Items[m_ItemCount] || repeat == 0) return NPT_ERROR_INVALID_PARAMETERS;
+
+ NPT_Cardinal needed = m_ItemCount+repeat;
+ if (needed > m_Capacity) {
+ // allocate more memory
+ NPT_Cardinal new_capacity;
+ T* new_items = Allocate(needed, new_capacity);
+ if (new_items == NULL) return NPT_ERROR_OUT_OF_MEMORY;
+ m_Capacity = new_capacity;
+
+ // move the items before the insertion point
+ for (NPT_Ordinal i=0; i<where_index; i++) {
+ new((void*)&new_items[i])T(m_Items[i]);
+ m_Items[i].~T();
+ }
+
+ // move the items after the insertion point
+ for (NPT_Ordinal i=where_index; i<m_ItemCount; i++) {
+ new((void*)&new_items[i+repeat])T(m_Items[i]);
+ m_Items[i].~T();
+ }
+
+ // use the new items instead of the current ones
+ ::operator delete((void*)m_Items);
+ m_Items = new_items;
+ } else {
+ // shift items after the insertion point to the right
+ for (NPT_Ordinal i=m_ItemCount; i>where_index; i--) {
+ new((void*)&m_Items[i+repeat-1])T(m_Items[i-1]);
+ m_Items[i-1].~T();
+ }
+ }
+
+ // insert the new items
+ for (NPT_Cardinal i=where_index; i<where_index+repeat; i++) {
+ new((void*)&m_Items[i])T(item);
+ }
+
+ // update the item count
+ m_ItemCount += repeat;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Resize
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_Array<T>::Resize(NPT_Cardinal size)
+{
+ if (size < m_ItemCount) {
+ // shrink
+ for (NPT_Ordinal i=size; i<m_ItemCount; i++) {
+ m_Items[i].~T();
+ }
+ m_ItemCount = size;
+ } else if (size > m_ItemCount) {
+ return Resize(size, T());
+ }
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Resize
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_Array<T>::Resize(NPT_Cardinal size, const T& fill)
+{
+ if (size < m_ItemCount) {
+ return Resize(size);
+ } else if (size > m_ItemCount) {
+ Reserve(size);
+ for (NPT_Ordinal i=m_ItemCount; i<size; i++) {
+ new ((void*)&m_Items[i]) T(fill);
+ }
+ m_ItemCount = size;
+ }
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::Contains
++---------------------------------------------------------------------*/
+template <typename T>
+bool
+NPT_Array<T>::Contains(const T& data) const
+{
+ for (NPT_Ordinal i=0; i<m_ItemCount; i++) {
+ if (m_Items[i] == data) return true;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::operator==
++---------------------------------------------------------------------*/
+template <typename T>
+bool
+NPT_Array<T>::operator==(const NPT_Array<T>& other) const
+{
+ // we need the same number of items
+ if (other.m_ItemCount != m_ItemCount) return false;
+
+ // compare all items
+ for (NPT_Ordinal i=0; i<m_ItemCount; i++) {
+ if (!(m_Items[i] == other.m_Items[i])) return false;
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Array<T>::operator!=
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+bool
+NPT_Array<T>::operator!=(const NPT_Array<T>& other) const
+{
+ return !(*this == other);
+}
+
+#endif // _NPT_ARRAY_H_
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Base64
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+
+#ifndef _NPT_BASE64_H_
+#define _NPT_BASE64_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptDataBuffer.h"
+#include "NptStrings.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const NPT_Cardinal NPT_BASE64_MIME_BLOCKS_PER_LINE = 19;
+const NPT_Cardinal NPT_BASE64_PEM_BLOCKS_PER_LINE = 16;
+
+/*----------------------------------------------------------------------
+| NPT_Base64
++---------------------------------------------------------------------*/
+class NPT_Base64 {
+public:
+ // class methods
+ static NPT_Result Decode(const char* base64,
+ NPT_Size size,
+ NPT_DataBuffer& data,
+ bool url_safe = false);
+ static NPT_Result Encode(const NPT_Byte* data,
+ NPT_Size size,
+ NPT_String& base64,
+ NPT_Cardinal max_blocks_per_line = 0,
+ bool url_safe = false);
+
+private:
+ // this class is purely static
+ NPT_Base64();
+};
+
+#endif // _NPT_BASE64_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Buffered Byte Stream
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_BUFFERED_STREAMS_H_
+#define _NPT_BUFFERED_STREAMS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptStreams.h"
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptStrings.h"
+#include "NptDebug.h"
+
+/*----------------------------------------------------------------------
+| NPT_BufferedStream
++---------------------------------------------------------------------*/
+const NPT_Size NPT_BUFFERED_BYTE_STREAM_DEFAULT_SIZE = 4096;
+
+/*----------------------------------------------------------------------
+| NPT_BufferedInputStream
++---------------------------------------------------------------------*/
+class NPT_BufferedInputStream : public NPT_InputStream
+{
+public:
+ // constructors and destructor
+ NPT_BufferedInputStream(NPT_InputStreamReference& stream,
+ NPT_Size buffer_size = NPT_BUFFERED_BYTE_STREAM_DEFAULT_SIZE);
+ virtual ~NPT_BufferedInputStream();
+
+ // methods
+ virtual NPT_Result ReadLine(NPT_String& line,
+ NPT_Size max_chars = 4096,
+ bool break_on_cr = false);
+ virtual NPT_Result ReadLine(char* buffer,
+ NPT_Size buffer_size,
+ NPT_Size* chars_read = NULL,
+ bool break_on_cr = false);
+ virtual NPT_Result SetBufferSize(NPT_Size size, bool force = false);
+ virtual NPT_Result Peek(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read);
+
+ // NPT_InputStream methods
+ NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL);
+ NPT_Result Seek(NPT_Position offset);
+ NPT_Result Tell(NPT_Position& offset);
+ NPT_Result GetSize(NPT_LargeSize& size);
+ NPT_Result GetAvailable(NPT_LargeSize& available);
+
+protected:
+ // members
+ NPT_InputStreamReference m_Source;
+ bool m_SkipNewline;
+ bool m_Eos;
+ struct {
+ NPT_Byte* data;
+ NPT_Size offset;
+ NPT_Size valid;
+ NPT_Size size;
+ } m_Buffer;
+
+ // methods
+ virtual NPT_Result FillBuffer();
+ virtual NPT_Result ReleaseBuffer();
+};
+
+typedef NPT_Reference<NPT_BufferedInputStream> NPT_BufferedInputStreamReference;
+
+#endif // _NPT_BUFFERED_STREAMS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Common Definitions
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_COMMON_H_
+#define _NPT_COMMON_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptResults.h"
+
+/*----------------------------------------------------------------------
+| NPT_ObjectDeleter
++---------------------------------------------------------------------*/
+template <class T>
+class NPT_ObjectDeleter {
+public:
+ void operator()(T* object) const {
+ delete object;
+ }
+};
+
+/*----------------------------------------------------------------------
+| NPT_ObjectComparator
++---------------------------------------------------------------------*/
+template <class T>
+class NPT_ObjectComparator {
+public:
+ NPT_ObjectComparator(T& object) : m_Object(object) {}
+ bool operator()(const T& object) const {
+ return object == m_Object;
+ }
+private:
+ T& m_Object;
+};
+
+/*----------------------------------------------------------------------
+| NPT_ContainerFind
++---------------------------------------------------------------------*/
+template <typename T, typename P>
+NPT_Result NPT_ContainerFind(T& container,
+ const P& predicate,
+ typename T::Element& item,
+ NPT_Ordinal n=0)
+{
+ typename T::Iterator found = container.Find(predicate, n);
+ if (found) {
+ item = *found;
+ return NPT_SUCCESS;
+ } else {
+ return NPT_ERROR_NO_SUCH_ITEM;
+ }
+}
+
+/*----------------------------------------------------------------------
+| NPT_ContainerFind
++---------------------------------------------------------------------*/
+template <typename T, typename P>
+NPT_Result NPT_ContainerFind(T& container,
+ const P& predicate,
+ typename T::Iterator& iter,
+ NPT_Ordinal n=0)
+{
+ iter = container.Find(predicate, n);
+ return iter?NPT_SUCCESS:NPT_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| NPT_UntilResultEquals
++---------------------------------------------------------------------*/
+class NPT_UntilResultEquals
+{
+public:
+ // methods
+ NPT_UntilResultEquals(NPT_Result condition_result,
+ NPT_Result return_value = NPT_SUCCESS) :
+ m_ConditionResult(condition_result),
+ m_ReturnValue(return_value) {}
+ bool operator()(NPT_Result result, NPT_Result& return_value) const {
+ if (result == m_ConditionResult) {
+ return_value = m_ReturnValue;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+private:
+ // members
+ NPT_Result m_ConditionResult;
+ NPT_Result m_ReturnValue;
+};
+
+/*----------------------------------------------------------------------
+| NPT_UntilResultNotEquals
++---------------------------------------------------------------------*/
+class NPT_UntilResultNotEquals
+{
+public:
+ // methods
+ NPT_UntilResultNotEquals(NPT_Result condition_result) :
+ m_ConditionResult(condition_result) {}
+ bool operator()(NPT_Result result, NPT_Result& return_value) const {
+ if (result != m_ConditionResult) {
+ return_value = result;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+private:
+ // members
+ NPT_Result m_ConditionResult;
+};
+
+/*----------------------------------------------------------------------
+| NPT_PropertyValue
++---------------------------------------------------------------------*/
+class NPT_PropertyValue
+{
+ public:
+ // typedefs
+ typedef enum {UNKNOWN, INTEGER, STRING} Type;
+
+ // methods
+ NPT_PropertyValue() : m_Type(UNKNOWN), m_Integer(0) {}
+ NPT_PropertyValue(int value) : m_Type(INTEGER), m_Integer(value) {}
+ NPT_PropertyValue(const char* value) : m_Type(STRING), m_String(value) {}
+
+ // members
+ Type m_Type;
+ union {
+ int m_Integer;
+ const char* m_String;
+ };
+};
+
+#endif // _NPT_COMMON_H_
+
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Configuration
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_CONFIG_H_
+#define _NPT_CONFIG_H_
+
+/*----------------------------------------------------------------------
+| defaults
++---------------------------------------------------------------------*/
+#define NPT_CONFIG_HAVE_ASSERT_H
+#define NPT_CONFIG_HAVE_STD_C
+#define NPT_CONFIG_HAVE_STDLIB_H
+#define NPT_CONFIG_HAVE_STDIO_H
+#define NPT_CONFIG_HAVE_STDARG_H
+#define NPT_CONFIG_HAVE_STRING_H
+#define NPT_CONFIG_HAVE_LIMITS_H
+
+/*----------------------------------------------------------------------
+| standard C runtime
++---------------------------------------------------------------------*/
+#if defined(NPT_CONFIG_HAVE_STD_C)
+#define NPT_CONFIG_HAVE_MALLOC
+#define NPT_CONFIG_HAVE_CALLOC
+#define NPT_CONFIG_HAVE_REALLOC
+#define NPT_CONFIG_HAVE_FREE
+#define NPT_CONFIG_HAVE_MEMCPY
+#define NPT_CONFIG_HAVE_MEMSET
+#define NPT_CONFIG_HAVE_MEMCMP
+#define NPT_CONFIG_HAVE_GETENV
+#define NPT_CONFIG_HAVE_READDIR_R
+#endif /* NPT_CONFIG_HAS_STD_C */
+
+#if defined(NPT_CONFIG_HAVE_STRING_H)
+#define NPT_CONFIG_HAVE_STRCMP
+#define NPT_CONFIG_HAVE_STRNCMP
+#define NPT_CONFIG_HAVE_STRDUP
+#define NPT_CONFIG_HAVE_STRLEN
+#define NPT_CONFIG_HAVE_STRCPY
+#define NPT_CONFIG_HAVE_STRNCPY
+#endif /* NPT_CONFIG_HAVE_STRING_H */
+
+#if defined(NPT_CONFIG_HAVE_STDIO_H)
+#define NPT_CONFIG_HAVE_SPRINTF
+#define NPT_CONFIG_HAVE_SNPRINTF
+#define NPT_CONFIG_HAVE_VSPRINTF
+#define NPT_CONFIG_HAVE_VSNPRINTF
+#endif /* NPT_CONFIG_HAVE_STDIO_H */
+
+#if defined(NPT_CONFIG_HAVE_LIMITS_H)
+#define NPT_CONFIG_HAVE_INT_MIN
+#define NPT_CONFIG_HAVE_INT_MAX
+#define NPT_CONFIG_HAVE_UINT_MAX
+#define NPT_CONFIG_HAVE_LONG_MIN
+#define NPT_CONFIG_HAVE_LONG_MAX
+#define NPT_CONFIG_HAVE_ULONG_MAX
+#endif
+
+/*----------------------------------------------------------------------
+| standard C++ runtime
++---------------------------------------------------------------------*/
+#define NPT_CONFIG_HAVE_NEW_H
+
+/*----------------------------------------------------------------------
+| sockets
++---------------------------------------------------------------------*/
+#define NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
+
+/*----------------------------------------------------------------------
+| platform specifics
++---------------------------------------------------------------------*/
+/* Windows 32 */
+#if defined(_WIN32) || defined(_XBOX)
+#if !defined(STRICT)
+#define STRICT
+#endif
+#endif
+
+/* XBox */
+#if defined(_XBOX)
+#define NPT_CONFIG_THREAD_STACK_SIZE 0x10000
+#endif
+
+/* QNX */
+#if defined(__QNX__)
+#endif
+
+/* cygwin */
+#if defined(__CYGWIN__)
+#undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
+#endif
+
+/* linux */
+#if defined(__linux__)
+#undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
+#endif
+
+/* symbian */
+#if defined(__SYMBIAN32__)
+/* If defined, specify the stack size of each NPT_Thread. */
+#define NPT_CONFIG_THREAD_STACK_SIZE 0x14000
+#endif
+
+/*----------------------------------------------------------------------
+| compiler specifics
++---------------------------------------------------------------------*/
+/* GCC */
+#if defined(__GNUC__)
+#define NPT_LocalFunctionName __FUNCTION__
+#define NPT_COMPILER_UNUSED(p) (void)p
+#else
+#define NPT_COMPILER_UNUSED(p)
+#endif
+
+/* TriMedia C/C++ Compiler */
+#if defined(__TCS__)
+#undef NPT_CONFIG_HAVE_ASSERT_H
+#undef NPT_CONFIG_HAVE_SNPRINTF
+#undef NPT_CONFIG_HAVE_VSNPRINTF
+#endif
+
+/* palmos compiler */
+#if defined(__PALMOS__)
+#if __PALMOS__ <= 0x05000000
+#undef NPT_CONFIG_HAVE_ASSERT_H
+#undef NPT_CONFIG_HAVE_SNPRINTF
+#undef NPT_CONFIG_HAVE_VSNPRINTF
+#endif
+#endif
+
+/* Microsoft C/C++ Compiler */
+#if defined(_MSC_VER)
+#define NPT_FORMAT_64 "I64"
+#define NPT_CONFIG_INT64_TYPE __int64
+#define NPT_INT64_MIN _I64_MIN
+#define NPT_INT64_MAX _I64_MAX
+#define NPT_UINT64_MAX _UI64_MAX
+#define NPT_INT64_C(_x) _x##i64
+#define NPT_UINT64_C(_x) _x##ui64
+#define NPT_LocalFunctionName __FUNCTION__
+#if !defined(_WIN32_WCE)
+#define NPT_fseek _fseeki64
+#define NPT_ftell _ftelli64
+#else
+#define NPT_fseek(a,b,c) fseek((a),(long)(b), (c))
+#define NPT_ftell ftell
+#endif
+#define NPT_stat NPT_stat_utf8
+#define NPT_stat_struct struct __stat64
+#if defined(_WIN64)
+typedef __int64 NPT_PointerLong;
+#else
+#if _MSC_VER >= 1400
+typedef __w64 long NPT_PointerLong;
+#else
+typedef long NPT_PointerLong;
+#endif
+#endif
+#define NPT_POINTER_TO_LONG(_p) ((NPT_PointerLong) (_p) )
+#if _MSC_VER >= 1400 && !defined(_WIN32_WCE)
+#define NPT_CONFIG_HAVE_GMTIME_S
+#define NPT_CONFIG_HAVE_LOCALTIME_S
+#define NPT_CONFIG_HAVE_FOPEN_S
+#define NPT_CONFIG_HAVE_FSOPEN
+#define NPT_CONFIG_HAVE_SHARE_H
+#define NPT_vsnprintf(s,c,f,a) _vsnprintf_s(s,c,_TRUNCATE,f,a)
+#define NPT_snprintf(s,c,f,...) _snprintf_s(s,c,_TRUNCATE,f,__VA_ARGS__)
+#define NPT_strncpy(d,s,c) strncpy_s(d,c+1,s,c)
+#define NPT_strcpy(d,s) strcpy_s(d,strlen(s)+1,s)
+#undef NPT_CONFIG_HAVE_GETENV
+#define NPT_CONFIG_HAVE_DUPENV_S
+#define dupenv_s _dupenv_s
+#else
+#define NPT_vsnprintf _vsnprintf
+#define NPT_snprintf _snprintf
+#endif
+#if defined(_DEBUG)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#endif
+
+/* Windows CE */
+#if defined(_WIN32_WCE)
+#if defined(NPT_CONFIG_HAVE_FOPEN_S)
+#undef NPT_CONFIG_HAVE_FOPEN_S
+#endif
+#if defined(NPT_CONFIG_HAVE_GMTIME_S)
+#undef NPT_CONFIG_HAVE_GMTIME_S
+#endif
+#if defined(NPT_CONFIG_HAVE_LOCALTIME_S)
+#undef NPT_CONFIG_HAVE_LOCALTIME_S
+#endif
+#endif
+
+/* Symbian */
+#if defined(__SYMBIAN32__)
+#undef NPT_CONFIG_HAVE_NEW_H
+#include "e32std.h"
+#define explicit
+#define NPT_fseek fseek // no fseeko ?
+#define NPT_ftell ftell // no ftello ?
+#endif
+
+/* Android */
+#if defined(ANDROID)
+#define NPT_CONFIG_NO_RTTI
+#endif
+
+/*----------------------------------------------------------------------
+| defaults
++---------------------------------------------------------------------*/
+#if !defined(NPT_FORMAT_64)
+#define NPT_FORMAT_64 "ll"
+#endif
+
+#if !defined(NPT_POINTER_TO_LONG)
+#define NPT_POINTER_TO_LONG(_p) ((long)(_p))
+#endif
+
+#if !defined(NPT_CONFIG_INT64_TYPE)
+#define NPT_CONFIG_INT64_TYPE long long
+#endif
+
+#if !defined(NPT_INT64_C)
+#define NPT_INT64_C(_x) _x##LL
+#endif
+
+#if !defined(NPT_UINT64_C)
+#define NPT_UINT64_C(_x) _x##ULL
+#endif
+
+#if !defined(NPT_snprintf)
+#define NPT_snprintf snprintf
+#endif
+
+#if !defined(NPT_strcpy)
+#define NPT_strcpy strcpy
+#endif
+
+#if !defined(NPT_strncpy)
+#define NPT_strncpy strncpy
+#endif
+
+#if !defined(NPT_vsnprintf)
+#define NPT_vsnprintf vsnprintf
+#endif
+
+#if !defined(NPT_LocalFunctionName)
+#define NPT_LocalFunctionName (NULL)
+#endif
+
+#if !defined(NPT_CONFIG_THREAD_STACK_SIZE)
+#define NPT_CONFIG_THREAD_STACK_SIZE 0
+#endif
+
+#if !defined(NPT_fseek)
+#define NPT_fseek fseeko
+#endif
+
+#if !defined(NPT_ftell)
+#define NPT_ftell ftello
+#endif
+
+#if !defined(NPT_stat)
+#define NPT_stat stat
+#endif
+
+#if !defined(NPT_stat_struct)
+#define NPT_stat_struct struct stat
+#endif
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#if defined(DMALLOC)
+#include <dmalloc.h>
+#endif
+
+#endif // _NPT_CONFIG_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Console
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+/** @file
+* Header file for console support
+*/
+
+#ifndef _NPT_CONSOLE_H_
+#define _NPT_CONSOLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptResults.h"
+
+/*----------------------------------------------------------------------
+| prototypes
++---------------------------------------------------------------------*/
+class NPT_Console {
+public:
+ // class methods
+ static void Output(const char* message);
+ static void OutputF(const char* format, ...);
+};
+
+
+#endif /* _NPT_CONSOLE_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Constants
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_CONSTANTS_H_
+#define _NPT_CONSTANTS_H_
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#ifndef NULL
+#define NULL 0
+#endif
+
+const int NPT_TIMEOUT_INFINITE = -1;
+
+#endif // _NPT_CONSTANTS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Datagram Packets
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_DATA_BUFFER_H_
+#define _NPT_DATA_BUFFER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptConstants.h"
+
+/*----------------------------------------------------------------------
+| NPT_DataBuffer
++---------------------------------------------------------------------*/
+class NPT_DataBuffer
+{
+ public:
+ // constructors & destructor
+ NPT_DataBuffer(); // size unknown until first set
+ NPT_DataBuffer(NPT_Size size); // initial size specified
+ NPT_DataBuffer(const void* data, NPT_Size size, bool copy = true); // initial data and size specified
+ NPT_DataBuffer(const NPT_DataBuffer& other);
+ virtual ~NPT_DataBuffer();
+
+ // operators
+ NPT_DataBuffer& operator=(const NPT_DataBuffer& copy);
+ bool operator==(const NPT_DataBuffer& other) const;
+
+ // data buffer handling methods
+ virtual NPT_Result SetBuffer(NPT_Byte* buffer, NPT_Size bufferSize);
+ virtual NPT_Result SetBufferSize(NPT_Size bufferSize);
+ virtual NPT_Size GetBufferSize() const { return m_BufferSize; }
+ virtual NPT_Result Reserve(NPT_Size size);
+ virtual NPT_Result Clear();
+
+ // data handling methods
+ virtual const NPT_Byte* GetData() const { return m_Buffer; }
+ virtual NPT_Byte* UseData() { return m_Buffer; };
+ virtual NPT_Size GetDataSize() const { return m_DataSize; }
+ virtual NPT_Result SetDataSize(NPT_Size size);
+ virtual NPT_Result SetData(const NPT_Byte* data, NPT_Size dataSize);
+
+ protected:
+ // members
+ bool m_BufferIsLocal;
+ NPT_Byte* m_Buffer;
+ NPT_Size m_BufferSize;
+ NPT_Size m_DataSize;
+
+ // methods
+ NPT_Result ReallocateBuffer(NPT_Size size);
+};
+
+#endif // _NPT_DATA_BUFFER_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Debug Utilities
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_DEBUG_H_
+#define _NPT_DEBUG_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+
+/*----------------------------------------------------------------------
+| standard macros
++---------------------------------------------------------------------*/
+#if defined(NPT_CONFIG_HAVE_ASSERT_H) && defined(NPT_DEBUG)
+#include <assert.h>
+#define NPT_ASSERT(x) assert(x)
+#else
+#define NPT_ASSERT(x) ((void)0)
+#endif
+
+/*----------------------------------------------------------------------
+| NPT_Debug
++---------------------------------------------------------------------*/
+extern void NPT_Debug(const char* format, ...);
+extern void NPT_DebugOutput(const char* message);
+
+#endif // _NPT_DEBUG_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Dynamic Cast Support
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_DYNAMIC_CAST_H_
+#define _NPT_DYNAMIC_CAST_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptCommon.h"
+#include "NptResults.h"
+#include "NptConfig.h"
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#if defined(NPT_CONFIG_NO_RTTI)
+#define NPT_DYNAMIC_CAST(_class,_object) \
+( ((_object)==0) ? 0 : reinterpret_cast<_class*>((_object)->DynamicCast(&_class::_class_##_class)) )
+#define NPT_IMPLEMENT_DYNAMIC_CAST(_class) \
+static int _class_##_class; \
+virtual void* DynamicCast(const void* class_anchor) { \
+ if (class_anchor == &_class::_class_##_class) { \
+ return static_cast<_class*>(this); \
+ } \
+ return NULL; \
+}
+#define NPT_IMPLEMENT_DYNAMIC_CAST_D(_class,_superclass)\
+static int _class_##_class; \
+virtual void* DynamicCast(const void* class_anchor) { \
+ if (class_anchor == &_class::_class_##_class) { \
+ return static_cast<_class*>(this); \
+ } else { \
+ return _superclass::DynamicCast(class_anchor); \
+ } \
+}
+#define NPT_IMPLEMENT_DYNAMIC_CAST_D2(_class,_superclass,_mixin)\
+static int _class_##_class; \
+virtual void* DynamicCast(const void* class_anchor) { \
+ if (class_anchor == &_class::_class_##_class) { \
+ return static_cast<_class*>(this); \
+ } else { \
+ void* sup = _superclass::DynamicCast(class_anchor); \
+ if (sup) return sup; \
+ return _mixin::DynamicCast(class_anchor); \
+ } \
+}
+#define NPT_DEFINE_DYNAMIC_CAST_ANCHOR(_class) int _class::_class_##_class = 0;
+
+#else
+
+#define NPT_DYNAMIC_CAST(_class,_object) dynamic_cast<_class*>(_object)
+#define NPT_IMPLEMENT_DYNAMIC_CAST(_class)
+#define NPT_IMPLEMENT_DYNAMIC_CAST_D(_class,_superclass)
+#define NPT_IMPLEMENT_DYNAMIC_CAST_D2(_class,_superclass,_mixin)
+#define NPT_DEFINE_DYNAMIC_CAST_ANCHOR(_class)
+
+#endif
+
+#endif // _NPT_DYNAMIC_CAST_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Dynamic Libraries
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_DYNAMIC_LIBRARIES_H_
+#define _NPT_DYNAMIC_LIBRARIES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define NPT_DYANMIC_LIBRARY_LOAD_FLAG_NOW 1
+
+/*----------------------------------------------------------------------
+| NPT_DynamicLibraryInterface
++---------------------------------------------------------------------*/
+class NPT_DynamicLibraryInterface
+{
+public:
+ virtual ~NPT_DynamicLibraryInterface() {}
+ virtual NPT_Result FindSymbol(const char* name, void*& symbol) = 0;
+ virtual NPT_Result Unload() = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_DynamicLibrary
++---------------------------------------------------------------------*/
+class NPT_DynamicLibrary : public NPT_DynamicLibraryInterface
+{
+public:
+ // class methods
+ static NPT_Result Load(const char* name, NPT_Flags flags, NPT_DynamicLibrary*& library);
+
+ // destructor
+ ~NPT_DynamicLibrary() { delete m_Delegate; }
+
+ // NPT_DynamicLibraryInterface methods
+ virtual NPT_Result FindSymbol(const char* name, void*& symbol) {
+ return m_Delegate->FindSymbol(name, symbol);
+ }
+ virtual NPT_Result Unload() {
+ return m_Delegate->Unload();
+ }
+
+private:
+ // methods
+ NPT_DynamicLibrary(NPT_DynamicLibraryInterface* delegate) : m_Delegate(delegate) {}
+
+ // members
+ NPT_DynamicLibraryInterface* m_Delegate;
+};
+
+#endif // _NPT_DYNAMIC_LIBRARIES_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Files
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_FILE_H_
+#define _NPT_FILE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptStreams.h"
+#include "NptTime.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_NO_SUCH_FILE = NPT_ERROR_BASE_FILE - 0;
+const int NPT_ERROR_FILE_NOT_OPEN = NPT_ERROR_BASE_FILE - 1;
+const int NPT_ERROR_FILE_BUSY = NPT_ERROR_BASE_FILE - 2;
+const int NPT_ERROR_FILE_ALREADY_OPEN = NPT_ERROR_BASE_FILE - 3;
+const int NPT_ERROR_FILE_NOT_READABLE = NPT_ERROR_BASE_FILE - 4;
+const int NPT_ERROR_FILE_NOT_WRITABLE = NPT_ERROR_BASE_FILE - 5;
+const int NPT_ERROR_FILE_NOT_DIRECTORY = NPT_ERROR_BASE_FILE - 6;
+const int NPT_ERROR_FILE_ALREADY_EXISTS = NPT_ERROR_BASE_FILE - 7;
+const int NPT_ERROR_FILE_NOT_ENOUGH_SPACE = NPT_ERROR_BASE_FILE - 8;
+const int NPT_ERROR_DIRECTORY_NOT_EMPTY = NPT_ERROR_BASE_FILE - 9;
+
+const unsigned int NPT_FILE_OPEN_MODE_READ = 0x01;
+const unsigned int NPT_FILE_OPEN_MODE_WRITE = 0x02;
+const unsigned int NPT_FILE_OPEN_MODE_CREATE = 0x04;
+const unsigned int NPT_FILE_OPEN_MODE_TRUNCATE = 0x08;
+const unsigned int NPT_FILE_OPEN_MODE_UNBUFFERED = 0x10;
+const unsigned int NPT_FILE_OPEN_MODE_APPEND = 0x20;
+
+const unsigned int NPT_FILE_ATTRIBUTE_READ_ONLY = 0x01;
+const unsigned int NPT_FILE_ATTRIBUTE_LINK = 0x02;
+
+#define NPT_FILE_STANDARD_INPUT "@STDIN"
+#define NPT_FILE_STANDARD_OUTPUT "@STDOUT"
+#define NPT_FILE_STANDARD_ERROR "@STDERR"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class NPT_DataBuffer;
+
+/*----------------------------------------------------------------------
+| NPT_FileInfo
++---------------------------------------------------------------------*/
+struct NPT_FileInfo
+{
+ // types
+ typedef enum {
+ FILE_TYPE_NONE,
+ FILE_TYPE_REGULAR,
+ FILE_TYPE_DIRECTORY,
+ FILE_TYPE_SPECIAL,
+ FILE_TYPE_OTHER
+ } FileType;
+
+ // constructor
+ NPT_FileInfo() : m_Type(FILE_TYPE_NONE), m_Size(0), m_AttributesMask(0), m_Attributes(0) {}
+
+ // members
+ FileType m_Type;
+ NPT_UInt64 m_Size;
+ NPT_Flags m_AttributesMask;
+ NPT_Flags m_Attributes;
+ NPT_TimeStamp m_Created;
+ NPT_TimeStamp m_Modified;
+};
+
+/*----------------------------------------------------------------------
+| NPT_FilePath
++---------------------------------------------------------------------*/
+class NPT_FilePath
+{
+public:
+ // class members
+ static const NPT_String Separator;
+
+ // class methods
+ static NPT_String BaseName(const char* path, bool with_extension = true);
+ static NPT_String DirName(const char* path);
+ static NPT_String FileExtension(const char* path);
+ static NPT_String Create(const char* directory, const char* base);
+
+private:
+ NPT_FilePath() {} // this class can't have instances
+};
+
+/*----------------------------------------------------------------------
+| NPT_FileInterface
++---------------------------------------------------------------------*/
+class NPT_FileInterface
+{
+public:
+ // types
+ typedef unsigned int OpenMode;
+
+ // constructors and destructor
+ virtual ~NPT_FileInterface() {}
+
+ // methods
+ virtual NPT_Result Open(OpenMode mode) = 0;
+ virtual NPT_Result Close() = 0;
+ virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream) = 0;
+ virtual NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_File
++---------------------------------------------------------------------*/
+class NPT_File : public NPT_FileInterface
+{
+public:
+ // class methods
+ static NPT_Result GetRoots(NPT_List<NPT_String>& roots);
+ static NPT_Result GetSize(const char* path, NPT_LargeSize &size);
+ static NPT_Result GetInfo(const char* path, NPT_FileInfo* info = NULL);
+ static NPT_Result GetCount(const char* path, NPT_Cardinal& count);
+ static bool Exists(const char* path) { return NPT_SUCCEEDED(GetInfo(path)); }
+ static NPT_Result Remove(const char* path, bool recursively = false);
+ static NPT_Result RemoveFile(const char* path);
+ static NPT_Result RemoveDir(const char* path);
+ static NPT_Result RemoveDir(const char* path, bool recursively);
+ static NPT_Result Rename(const char* from_path, const char* to_path);
+ static NPT_Result ListDir(const char* path, NPT_List<NPT_String>& entries, NPT_Ordinal start = 0, NPT_Cardinal count = 0);
+ static NPT_Result CreateDir(const char* path);
+ static NPT_Result CreateDir(const char* path, bool recursively);
+ static NPT_Result GetWorkingDir(NPT_String& path);
+ static NPT_Result Load(const char* path, NPT_DataBuffer& buffer, NPT_FileInterface::OpenMode mode = NPT_FILE_OPEN_MODE_READ);
+ static NPT_Result Load(const char* path, NPT_String& data, NPT_FileInterface::OpenMode mode = NPT_FILE_OPEN_MODE_READ);
+ static NPT_Result Save(const char* path, NPT_String& data);
+ static NPT_Result Save(const char* path, const NPT_DataBuffer& buffer);
+
+ // constructors and destructor
+ NPT_File(const char* path);
+ ~NPT_File() { delete m_Delegate; }
+
+ // methods
+ NPT_Result Load(NPT_DataBuffer& buffer);
+ NPT_Result Save(const NPT_DataBuffer& buffer);
+ const NPT_String& GetPath() { return m_Path; }
+ NPT_Result GetSize(NPT_LargeSize &size);
+ NPT_Result GetInfo(NPT_FileInfo& info);
+ NPT_Result ListDir(NPT_List<NPT_String>& entries);
+ NPT_Result Rename(const char* path);
+ NPT_Result GetCount(NPT_Cardinal& count);
+
+ // NPT_FileInterface methods
+ NPT_Result Open(OpenMode mode) {
+ return m_Delegate->Open(mode);
+ }
+ NPT_Result Close() {
+ return m_Delegate->Close();
+ }
+ NPT_Result GetInputStream(NPT_InputStreamReference& stream) {
+ return m_Delegate->GetInputStream(stream);
+ }
+ NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) {
+ return m_Delegate->GetOutputStream(stream);
+ }
+
+ // operators
+ NPT_File& operator=(const NPT_File& file);
+
+protected:
+ // members
+ NPT_FileInterface* m_Delegate;
+ NPT_String m_Path;
+ bool m_IsSpecial;
+};
+
+#endif // _NPT_FILE_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - HTTP Protocol
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_HTTP_H_
+#define _NPT_HTTP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptUri.h"
+#include "NptTypes.h"
+#include "NptList.h"
+#include "NptBufferedStreams.h"
+#include "NptSockets.h"
+#include "NptMap.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const unsigned int NPT_HTTP_DEFAULT_PORT = 80;
+const unsigned int NPT_HTTP_INVALID_PORT = 0;
+
+const NPT_Timeout NPT_HTTP_CLIENT_DEFAULT_CONNECTION_TIMEOUT = 30000;
+const NPT_Timeout NPT_HTTP_CLIENT_DEFAULT_IO_TIMEOUT = 30000;
+const NPT_Timeout NPT_HTTP_CLIENT_DEFAULT_NAME_RESOLVER_TIMEOUT = 60000;
+
+const NPT_Timeout NPT_HTTP_SERVER_DEFAULT_CONNECTION_TIMEOUT = NPT_TIMEOUT_INFINITE;
+const NPT_Timeout NPT_HTTP_SERVER_DEFAULT_IO_TIMEOUT = 60000;
+
+const int NPT_HTTP_PROTOCOL_MAX_LINE_LENGTH = 8192;
+const int NPT_HTTP_PROTOCOL_MAX_HEADER_COUNT = 100;
+
+#define NPT_HTTP_PROTOCOL_1_0 "HTTP/1.0"
+#define NPT_HTTP_PROTOCOL_1_1 "HTTP/1.1"
+#define NPT_HTTP_METHOD_GET "GET"
+#define NPT_HTTP_METHOD_HEAD "HEAD"
+#define NPT_HTTP_METHOD_POST "POST"
+
+#define NPT_HTTP_HEADER_HOST "Host"
+#define NPT_HTTP_HEADER_CONNECTION "Connection"
+#define NPT_HTTP_HEADER_USER_AGENT "User-Agent"
+#define NPT_HTTP_HEADER_SERVER "Server"
+#define NPT_HTTP_HEADER_CONTENT_LENGTH "Content-Length"
+#define NPT_HTTP_HEADER_CONTENT_TYPE "Content-Type"
+#define NPT_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"
+#define NPT_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
+#define NPT_HTTP_HEADER_LOCATION "Location"
+#define NPT_HTTP_HEADER_RANGE "Range"
+#define NPT_HTTP_HEADER_CONTENT_RANGE "Content-Range"
+#define NPT_HTTP_HEADER_COOKIE "Cookie"
+#define NPT_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"
+#define NPT_HTTP_HEADER_CONTENT_RANGE "Content-Range"
+
+#define NPT_HTTP_TRANSFER_ENCODING_CHUNKED "chunked"
+
+#define NPT_HTTP_HEADER_AUTHORIZATION "Authorization"
+
+const int NPT_ERROR_HTTP_INVALID_RESPONSE_LINE = NPT_ERROR_BASE_HTTP - 0;
+const int NPT_ERROR_HTTP_INVALID_REQUEST_LINE = NPT_ERROR_BASE_HTTP - 1;
+const int NPT_ERROR_HTTP_NO_PROXY = NPT_ERROR_BASE_HTTP - 2;
+const int NPT_ERROR_HTTP_INVALID_REQUEST = NPT_ERROR_BASE_HTTP - 3;
+const int NPT_ERROR_HTTP_METHOD_NOT_SUPPORTED = NPT_ERROR_BASE_HTTP - 4;
+
+#define NPT_HTTP_LINE_TERMINATOR "\r\n"
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef unsigned int NPT_HttpStatusCode;
+typedef NPT_UrlQuery NPT_HttpUrlQuery; // for backward compatibility
+
+/*----------------------------------------------------------------------
+| NPT_HttpUrl
++---------------------------------------------------------------------*/
+class NPT_HttpUrl : public NPT_Url {
+public:
+ // constructors
+ NPT_HttpUrl() {}
+ NPT_HttpUrl(const char* host,
+ NPT_UInt16 port,
+ const char* path,
+ const char* query = NULL,
+ const char* fragment = NULL);
+ NPT_HttpUrl(const char* url, bool ignore_scheme = false);
+
+ // methods
+ virtual NPT_String ToString(bool with_fragment = true) const;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpProtocol
++---------------------------------------------------------------------*/
+class NPT_HttpProtocol
+{
+public:
+ // class methods
+ const char* GetStatusCodeString(NPT_HttpStatusCode status_code);
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpHeader
++---------------------------------------------------------------------*/
+class NPT_HttpHeader {
+public:
+ // constructors and destructor
+ NPT_HttpHeader(const char* name, const char* value);
+ ~NPT_HttpHeader();
+
+ // methods
+ NPT_Result Emit(NPT_OutputStream& stream) const;
+ const NPT_String& GetName() const { return m_Name; }
+ const NPT_String& GetValue() const { return m_Value; }
+ NPT_Result SetName(const char* name);
+ NPT_Result SetValue(const char* value);
+
+private:
+ // members
+ NPT_String m_Name;
+ NPT_String m_Value;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpHeaders
++---------------------------------------------------------------------*/
+class NPT_HttpHeaders {
+public:
+ // constructors and destructor
+ NPT_HttpHeaders();
+ ~NPT_HttpHeaders();
+
+ // methods
+ NPT_Result Parse(NPT_BufferedInputStream& stream);
+ NPT_Result Emit(NPT_OutputStream& stream) const;
+ NPT_List<NPT_HttpHeader*>& GetHeaders() { return m_Headers; }
+ NPT_HttpHeader* GetHeader(const char* name) const;
+ const NPT_String* GetHeaderValue(const char* name) const;
+ NPT_Result SetHeader(const char* name, const char* value, bool replace=true);
+ NPT_Result AddHeader(const char* name, const char* value);
+
+private:
+ // members
+ NPT_List<NPT_HttpHeader*> m_Headers;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpEntity
++---------------------------------------------------------------------*/
+class NPT_HttpEntity {
+public:
+ // constructors and destructor
+ NPT_HttpEntity();
+ NPT_HttpEntity(const NPT_HttpHeaders& headers);
+ virtual ~NPT_HttpEntity();
+
+ // methods
+ NPT_Result SetInputStream(const NPT_InputStreamReference& stream,
+ bool update_content_length = false);
+ NPT_Result SetInputStream(const void* data, NPT_Size size);
+ NPT_Result SetInputStream(const NPT_String& string);
+ NPT_Result SetInputStream(const char* string);
+ NPT_Result GetInputStream(NPT_InputStreamReference& stream);
+ NPT_Result Load(NPT_DataBuffer& buffer);
+ NPT_Result SetHeaders(const NPT_HttpHeaders& headers);
+
+ // field access
+ NPT_Result SetContentLength(NPT_LargeSize length);
+ NPT_Result SetContentType(const char* type);
+ NPT_Result SetContentEncoding(const char* encoding);
+ NPT_Result SetTransferEncoding(const char* encoding);
+ NPT_LargeSize GetContentLength() { return m_ContentLength; }
+ const NPT_String& GetContentType() { return m_ContentType; }
+ const NPT_String& GetContentEncoding() { return m_ContentEncoding; }
+ const NPT_String& GetTransferEncoding(){ return m_TransferEncoding;}
+ bool HasContentLength() { return m_HasContentLength;}
+
+private:
+ // members
+ NPT_InputStreamReference m_InputStream;
+ NPT_LargeSize m_ContentLength;
+ NPT_String m_ContentType;
+ NPT_String m_ContentEncoding;
+ NPT_String m_TransferEncoding;
+ bool m_HasContentLength;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpMessage
++---------------------------------------------------------------------*/
+class NPT_HttpMessage {
+public:
+ // constructors and destructor
+ virtual ~NPT_HttpMessage();
+
+ // methods
+ const NPT_String& GetProtocol() const {
+ return m_Protocol;
+ }
+ NPT_Result SetProtocol(const char* protocol) {
+ m_Protocol = protocol;
+ return NPT_SUCCESS;
+ }
+ NPT_HttpHeaders& GetHeaders() {
+ return m_Headers;
+ }
+ NPT_Result SetEntity(NPT_HttpEntity* entity);
+ NPT_HttpEntity* GetEntity() {
+ return m_Entity;
+ }
+ virtual NPT_Result ParseHeaders(NPT_BufferedInputStream& stream);
+
+protected:
+ // constructors
+ NPT_HttpMessage(const char* protocol);
+
+ // members
+ NPT_String m_Protocol;
+ NPT_HttpHeaders m_Headers;
+ NPT_HttpEntity* m_Entity;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpRequest
++---------------------------------------------------------------------*/
+class NPT_HttpRequest : public NPT_HttpMessage {
+public:
+ // class methods
+ static NPT_Result Parse(NPT_BufferedInputStream& stream,
+ const NPT_SocketAddress* endpoint,
+ NPT_HttpRequest*& request);
+
+ // constructors and destructor
+ NPT_HttpRequest(const NPT_HttpUrl& url,
+ const char* method,
+ const char* protocol = NPT_HTTP_PROTOCOL_1_0);
+ NPT_HttpRequest(const char* url,
+ const char* method,
+ const char* protocol = NPT_HTTP_PROTOCOL_1_0);
+ virtual ~NPT_HttpRequest();
+
+ // methods
+ const NPT_HttpUrl& GetUrl() const { return m_Url; }
+ NPT_HttpUrl& GetUrl() { return m_Url; }
+ NPT_Result SetUrl(const char* url);
+ NPT_Result SetUrl(const NPT_HttpUrl& url);
+ const NPT_String& GetMethod() const { return m_Method; }
+ virtual NPT_Result Emit(NPT_OutputStream& stream, bool use_proxy=false) const;
+
+protected:
+ // members
+ NPT_HttpUrl m_Url;
+ NPT_String m_Method;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpResponse
++---------------------------------------------------------------------*/
+class NPT_HttpResponse : public NPT_HttpMessage {
+public:
+ // class methods
+ static NPT_Result Parse(NPT_BufferedInputStream& stream,
+ NPT_HttpResponse*& response,
+ bool reuse_response = false);
+
+ // constructors and destructor
+ NPT_HttpResponse(NPT_HttpStatusCode status_code,
+ const char* reason_phrase,
+ const char* protocol = NPT_HTTP_PROTOCOL_1_0);
+ virtual ~NPT_HttpResponse();
+
+ // methods
+ NPT_Result SetStatus(NPT_HttpStatusCode status_code,
+ const char* reason_phrase,
+ const char* protocol = NPT_HTTP_PROTOCOL_1_0);
+ NPT_Result SetProtocol(const char* protocol);
+ NPT_HttpStatusCode GetStatusCode() { return m_StatusCode; }
+ NPT_String& GetReasonPhrase() { return m_ReasonPhrase; }
+ virtual NPT_Result Emit(NPT_OutputStream& stream) const;
+
+protected:
+ // members
+ NPT_HttpStatusCode m_StatusCode;
+ NPT_String m_ReasonPhrase;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpProxyAddress
++---------------------------------------------------------------------*/
+class NPT_HttpProxyAddress
+{
+public:
+ NPT_HttpProxyAddress() : m_Port(NPT_HTTP_INVALID_PORT) {}
+ NPT_HttpProxyAddress(const char* hostname, NPT_UInt16 port) :
+ m_HostName(hostname), m_Port(port) {}
+
+ const NPT_String& GetHostName() const { return m_HostName; }
+ void SetHostName(const char* hostname) { m_HostName = hostname; }
+ NPT_UInt16 GetPort() const { return m_Port; }
+ void SetPort(NPT_UInt16 port) { m_Port = port; }
+
+private:
+ NPT_String m_HostName;
+ NPT_UInt16 m_Port;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpProxySelector
++---------------------------------------------------------------------*/
+class NPT_HttpProxySelector
+{
+public:
+ // class methods
+ static NPT_HttpProxySelector* GetSystemDefault();
+
+ // methods
+ virtual ~NPT_HttpProxySelector() {};
+ virtual NPT_Result GetProxyForUrl(const NPT_HttpUrl& url, NPT_HttpProxyAddress& proxy) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpClient
++---------------------------------------------------------------------*/
+class NPT_HttpClient {
+public:
+ // types
+ struct Config {
+ NPT_Timeout m_ConnectionTimeout;
+ NPT_Timeout m_IoTimeout;
+ NPT_Timeout m_NameResolverTimeout;
+ bool m_FollowRedirect;
+ };
+
+ class Connector {
+ public:
+ virtual ~Connector() {}
+
+ virtual NPT_Result Connect(const char* hostname,
+ NPT_UInt16 port,
+ NPT_Timeout connection_timeout,
+ NPT_Timeout io_timeout,
+ NPT_Timeout name_resolver_timeout,
+ NPT_InputStreamReference& input_stream,
+ NPT_OutputStreamReference& output_stream) = 0;
+
+ };
+
+ // class methods
+ static NPT_Result WriteRequest(NPT_OutputStream& output_stream,
+ NPT_HttpRequest& request,
+ bool use_proxy = false);
+ static NPT_Result ReadResponse(NPT_InputStreamReference& input_stream,
+ bool expect_entity,
+ NPT_HttpResponse*& response);
+
+ /**
+ * @param connector Pointer to a Connector instance, or NULL to use
+ * the default (TCP) connector.
+ */
+ NPT_HttpClient(Connector* connector = NULL);
+
+ virtual ~NPT_HttpClient();
+
+ // methods
+ NPT_Result SendRequest(NPT_HttpRequest& request,
+ NPT_HttpResponse*& response);
+ NPT_Result SetConfig(const Config& config);
+ NPT_Result SetProxy(const char* hostname, NPT_UInt16 port);
+ NPT_Result SetProxySelector(NPT_HttpProxySelector* selector);
+ NPT_Result SetConnector(Connector* connector);
+ NPT_Result SetTimeouts(NPT_Timeout connection_timeout,
+ NPT_Timeout io_timeout,
+ NPT_Timeout name_resolver_timeout);
+
+protected:
+ // methods
+ NPT_Result SendRequestOnce(NPT_HttpRequest& request,
+ NPT_HttpResponse*& response);
+
+ // members
+ Config m_Config;
+ NPT_HttpProxySelector* m_ProxySelector;
+ bool m_ProxySelectorIsOwned;
+ Connector* m_Connector;
+
+public:
+ static NPT_String m_UserAgentHeader;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpRequestContext
++---------------------------------------------------------------------*/
+class NPT_HttpRequestContext
+{
+public:
+ // constructor
+ NPT_HttpRequestContext() {}
+ NPT_HttpRequestContext(const NPT_SocketAddress* local_address,
+ const NPT_SocketAddress* remote_address);
+
+ // methods
+ const NPT_SocketAddress& GetLocalAddress() const { return m_LocalAddress; }
+ const NPT_SocketAddress& GetRemoteAddress() const { return m_RemoteAddress; }
+ void SetLocalAddress(const NPT_SocketAddress& address) {
+ m_LocalAddress = address;
+ }
+ void SetRemoteAddress(const NPT_SocketAddress& address) {
+ m_RemoteAddress = address;
+ }
+
+private:
+ // members
+ NPT_SocketAddress m_LocalAddress;
+ NPT_SocketAddress m_RemoteAddress;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpRequestHandler
++---------------------------------------------------------------------*/
+class NPT_HttpRequestHandler
+{
+public:
+ // destructor
+ virtual ~NPT_HttpRequestHandler() {}
+
+ // methods
+ virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response) = 0;
+
+ /**
+ * Override this method if you want to write the body yourself.
+ * The default implementation will simply write out the entity's
+ * input stream.
+ */
+ virtual NPT_Result SendResponseBody(const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response,
+ NPT_OutputStream& output);
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpStaticRequestHandler
++---------------------------------------------------------------------*/
+class NPT_HttpStaticRequestHandler : public NPT_HttpRequestHandler
+{
+public:
+ // constructors
+ NPT_HttpStaticRequestHandler(const char* document,
+ const char* mime_type = "text/html",
+ bool copy = true);
+ NPT_HttpStaticRequestHandler(const void* data,
+ NPT_Size size,
+ const char* mime_type = "text/html",
+ bool copy = true);
+
+ // NPT_HttpRequestHandler methods
+ virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+protected:
+ NPT_String m_MimeType;
+ NPT_DataBuffer m_Buffer;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpFileRequestHandler_FileTypeMap
++---------------------------------------------------------------------*/
+typedef struct NPT_HttpFileRequestHandler_FileTypeMapEntry {
+ const char* extension;
+ const char* mime_type;
+} NPT_HttpFileRequestHandler_FileTypeMapEntry;
+
+// specify size here so NPT_ARRAY_SIZE can work
+extern const NPT_HttpFileRequestHandler_FileTypeMapEntry NPT_HttpFileRequestHandler_DefaultFileTypeMap[43];
+
+/*----------------------------------------------------------------------
+| NPT_HttpFileRequestHandler
++---------------------------------------------------------------------*/
+class NPT_HttpFileRequestHandler : public NPT_HttpRequestHandler
+{
+public:
+ // constructors
+ NPT_HttpFileRequestHandler(const char* url_root,
+ const char* file_root,
+ bool auto_dir = false);
+
+ // NPT_HttpRequestHandler methods
+ virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+ // accessors
+ NPT_Map<NPT_String,NPT_String>& GetFileTypeMap() { return m_FileTypeMap; }
+ void SetDefaultMimeType(const char* mime_type) {
+ m_DefaultMimeType = mime_type;
+ }
+ void SetUseDefaultFileTypeMap(bool use_default) {
+ m_UseDefaultFileTypeMap = use_default;
+ }
+
+protected:
+ // methods
+ const char* GetContentType(const NPT_String& filename);
+
+private:
+ NPT_String m_UrlRoot;
+ NPT_String m_FileRoot;
+ NPT_Map<NPT_String, NPT_String> m_FileTypeMap;
+ NPT_String m_DefaultMimeType;
+ bool m_UseDefaultFileTypeMap;
+ bool m_AutoDir;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpServer
++---------------------------------------------------------------------*/
+class NPT_HttpServer {
+public:
+ // types
+ struct Config {
+ NPT_Timeout m_ConnectionTimeout;
+ NPT_Timeout m_IoTimeout;
+ NPT_IpAddress m_ListenAddress;
+ NPT_UInt16 m_ListenPort;
+ bool m_ReuseAddress;
+ };
+
+ // constructors and destructor
+ NPT_HttpServer(NPT_UInt16 listen_port = NPT_HTTP_DEFAULT_PORT,
+ bool reuse_address = true);
+ NPT_HttpServer(NPT_IpAddress listen_address,
+ NPT_UInt16 listen_port = NPT_HTTP_DEFAULT_PORT,
+ bool reuse_address = true);
+ virtual ~NPT_HttpServer();
+
+ // methods
+ NPT_Result SetConfig(const Config& config);
+ const Config& GetConfig() const { return m_Config; }
+ NPT_Result SetListenPort(NPT_UInt16 port, bool reuse_address = true);
+ NPT_Result SetTimeouts(NPT_Timeout connection_timeout, NPT_Timeout io_timeout);
+ NPT_Result Abort();
+ NPT_Result WaitForNewClient(NPT_InputStreamReference& input,
+ NPT_OutputStreamReference& output,
+ NPT_HttpRequestContext* context);
+ NPT_Result Loop();
+ NPT_UInt16 GetPort() { return m_BoundPort; }
+
+ /**
+ * Add a request handler. The ownership of the handler is NOT transfered to this object,
+ * so the caller is responsible for the lifetime management of the handler object.
+ */
+ NPT_Result AddRequestHandler(NPT_HttpRequestHandler* handler, const char* path, bool include_children = false);
+ NPT_HttpRequestHandler* FindRequestHandler(NPT_HttpRequest& request);
+
+ /**
+ * Parse the request from a new client, form a response, and send it back.
+ */
+ NPT_Result RespondToClient(NPT_InputStreamReference& input,
+ NPT_OutputStreamReference& output,
+ const NPT_HttpRequestContext& context);
+
+protected:
+ // types
+ struct HandlerConfig {
+ HandlerConfig(NPT_HttpRequestHandler* handler,
+ const char* path,
+ bool include_children);
+ ~HandlerConfig();
+
+ // methods
+ bool WillHandle(NPT_HttpRequest& request);
+
+ // members
+ NPT_HttpRequestHandler* m_Handler;
+ NPT_String m_Path;
+ bool m_IncludeChildren;
+ };
+
+ // methods
+ NPT_Result Bind();
+
+ // members
+ NPT_TcpServerSocket m_Socket;
+ NPT_UInt16 m_BoundPort;
+ Config m_Config;
+ NPT_List<HandlerConfig*> m_RequestHandlers;
+
+public:
+ static NPT_String m_ServerHeader;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpResponder
++---------------------------------------------------------------------*/
+class NPT_HttpResponder {
+public:
+ // types
+ struct Config {
+ NPT_Timeout m_IoTimeout;
+ };
+
+ // constructors and destructor
+ NPT_HttpResponder(NPT_InputStreamReference& input,
+ NPT_OutputStreamReference& output);
+ virtual ~NPT_HttpResponder();
+
+ // methods
+ NPT_Result SetConfig(const Config& config);
+ NPT_Result SetTimeout(NPT_Timeout io_timeout);
+ NPT_Result ParseRequest(NPT_HttpRequest*& request,
+ const NPT_SocketAddress* local_address = NULL);
+ NPT_Result SendResponseHeaders(NPT_HttpResponse& response);
+
+protected:
+ // members
+ Config m_Config;
+ NPT_BufferedInputStreamReference m_Input;
+ NPT_OutputStreamReference m_Output;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpChunkedInputStream
++---------------------------------------------------------------------*/
+class NPT_HttpChunkedInputStream : public NPT_InputStream
+{
+public:
+ // constructors and destructor
+ NPT_HttpChunkedInputStream(NPT_BufferedInputStreamReference& stream);
+ virtual ~NPT_HttpChunkedInputStream();
+
+ // NPT_InputStream methods
+ NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL);
+ NPT_Result Seek(NPT_Position offset);
+ NPT_Result Tell(NPT_Position& offset);
+ NPT_Result GetSize(NPT_LargeSize& size);
+ NPT_Result GetAvailable(NPT_LargeSize& available);
+
+protected:
+ // members
+ NPT_BufferedInputStreamReference m_Source;
+ NPT_UInt32 m_CurrentChunkSize;
+ bool m_Eos;
+};
+
+/*----------------------------------------------------------------------
+| NPT_HttpChunkedOutputStream
++---------------------------------------------------------------------*/
+class NPT_HttpChunkedOutputStream : public NPT_OutputStream
+{
+public:
+ // constructors and destructor
+ NPT_HttpChunkedOutputStream(NPT_OutputStream& stream);
+ virtual ~NPT_HttpChunkedOutputStream();
+
+ // NPT_OutputStream methods
+ NPT_Result Write(const void* buffer,
+ NPT_Size bytes_to_write,
+ NPT_Size* bytes_written = NULL);
+ NPT_Result Seek(NPT_Position /*offset*/) { return NPT_ERROR_NOT_SUPPORTED;}
+ NPT_Result Tell(NPT_Position& offset) { return m_Stream.Tell(offset); }
+ NPT_Result Flush() { return m_Stream.Flush(); }
+
+protected:
+ // members
+ NPT_OutputStream& m_Stream;
+};
+
+#endif // _NPT_HTTP_H_
+
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Interfaces
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_INTERFACES_H_
+#define _NPT_INTERFACES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptCommon.h"
+#include "NptResults.h"
+#include "NptConfig.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_NO_SUCH_INTERFACE = NPT_ERROR_BASE_INTERFACES - 0;
+
+/*----------------------------------------------------------------------
+| NPT_InterfaceId
++---------------------------------------------------------------------*/
+class NPT_InterfaceId
+{
+ public:
+ // methods
+ bool operator==(const NPT_InterfaceId& id) const {
+ return ((id.m_Id == m_Id) && (id.m_Version == m_Version));
+ }
+
+ // members
+ unsigned long m_Id;
+ unsigned long m_Version;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Polymorphic
++---------------------------------------------------------------------*/
+class NPT_Polymorphic
+{
+public:
+ // destructor
+ virtual ~NPT_Polymorphic() {}
+
+ // methods
+ virtual NPT_Result GetInterface(const NPT_InterfaceId& id,
+ NPT_Interface*& iface) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Interruptible
++---------------------------------------------------------------------*/
+class NPT_Interruptible
+{
+public:
+ // destructor
+ virtual ~NPT_Interruptible() {}
+
+ // methods
+ virtual NPT_Result Interrupt() = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Configurable
++---------------------------------------------------------------------*/
+class NPT_Configurable
+{
+public:
+ // destructor
+ virtual ~NPT_Configurable() {}
+
+ // methods
+ virtual NPT_Result SetProperty(const char* /*name*/,
+ const char* /*value*/) {
+ return NPT_ERROR_NO_SUCH_PROPERTY;
+ }
+ virtual NPT_Result SetProperty(const char* /*name*/,
+ int /*value*/) {
+ return NPT_ERROR_NO_SUCH_PROPERTY;
+ }
+ virtual NPT_Result GetProperty(const char* /*name*/,
+ NPT_PropertyValue& /*value*/) {
+ return NPT_ERROR_NO_SUCH_PROPERTY;
+ }
+};
+
+#endif // _NPT_INTERFACES_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Lists
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_LIST_H_
+#define _NPT_LIST_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptResults.h"
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptCommon.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_LIST_EMPTY = NPT_ERROR_BASE_LIST - 0;
+const int NPT_ERROR_LIST_OPERATION_ABORTED = NPT_ERROR_BASE_LIST - 1;
+const int NPT_ERROR_LIST_OPERATION_CONTINUE = NPT_ERROR_BASE_LIST - 2;
+
+/*----------------------------------------------------------------------
+| NPT_List
++---------------------------------------------------------------------*/
+template <typename T>
+class NPT_List
+{
+protected:
+ class Item;
+
+public:
+ // types
+ typedef T Element;
+
+ class Iterator {
+ public:
+ Iterator() : m_Item(NULL) {}
+ explicit Iterator(Item* item) : m_Item(item) {}
+ Iterator(const Iterator& copy) : m_Item(copy.m_Item) {}
+ T& operator*() const { return m_Item->m_Data; }
+ T* operator->() const { return &m_Item->m_Data;}
+ Iterator& operator++() { // prefix
+ m_Item = m_Item->m_Next;
+ return (*this);
+ }
+ Iterator operator++(int) { // postfix
+ Iterator saved_this = *this;
+ m_Item = m_Item->m_Next;
+ return saved_this;
+ }
+ Iterator& operator--() { // prefix
+ m_Item = m_Item->m_Prev;
+ return (*this);
+ }
+ Iterator operator--(int) { // postfix
+ Iterator saved_this = *this;
+ m_Item = m_Item->m_Prev;
+ return saved_this;
+ }
+ operator bool() const {
+ return m_Item != NULL;
+ }
+ bool operator==(const Iterator& other) const {
+ return m_Item == other.m_Item;
+ }
+ bool operator!=(const Iterator& other) const {
+ return m_Item != other.m_Item;
+ }
+ void operator=(const Iterator& other) {
+ m_Item = other.m_Item;
+ }
+ void operator=(Item* item) {
+ m_Item = item;
+ }
+
+ private:
+ Item* m_Item;
+
+ // friends
+ friend class NPT_List<T>;
+ };
+
+ // methods
+ NPT_List<T>();
+ NPT_List<T>(const NPT_List<T>& list);
+ ~NPT_List<T>();
+ NPT_Result Add(const T& data);
+ NPT_Result Insert(const Iterator where, const T& data);
+ NPT_Result Remove(const T& data, bool all=false);
+ NPT_Result Erase(const Iterator position);
+ NPT_Result PopHead(T& data);
+ bool Contains(const T& data) const;
+ NPT_Result Clear();
+ NPT_Result Get(NPT_Ordinal index, T& data) const;
+ NPT_Result Get(NPT_Ordinal index, T*& data) const;
+ NPT_Cardinal GetItemCount() const { return m_ItemCount; }
+ Iterator GetFirstItem() const { return Iterator(m_Head); }
+ Iterator GetLastItem() const { return Iterator(m_Tail); }
+ Iterator GetItem(NPT_Ordinal index) const;
+
+ // list manipulation
+ NPT_Result Add(NPT_List<T>& list);
+ NPT_Result Remove(const NPT_List<T>& list, bool all=false);
+
+ // item manipulation
+ NPT_Result Add(Item& item);
+ NPT_Result Detach(Item& item);
+ NPT_Result Insert(const Iterator where, Item& item);
+
+ // list operations
+ // keep these template members defined here because MSV6 does not let
+ // us define them later
+ template <typename X>
+ NPT_Result Apply(const X& function) const
+ {
+ Item* item = m_Head;
+ while (item) {
+ function(item->m_Data);
+ item = item->m_Next;
+ }
+
+ return NPT_SUCCESS;
+ }
+
+ template <typename X, typename P>
+ NPT_Result ApplyUntil(const X& function, const P& predicate, bool* match = NULL) const
+ {
+ Item* item = m_Head;
+ while (item) {
+ NPT_Result return_value;
+ if (predicate(function(item->m_Data), return_value)) {
+ if (match) *match = true;
+ return return_value;
+ }
+ item = item->m_Next;
+ }
+
+ if (match) *match = false;
+ return NPT_SUCCESS;
+ }
+
+ template <typename P>
+ Iterator Find(const P& predicate, NPT_Ordinal n=0) const
+ {
+ Item* item = m_Head;
+ while (item) {
+ if (predicate(item->m_Data)) {
+ if (n == 0) {
+ return Iterator(item);
+ }
+ --n;
+ }
+ item = item->m_Next;
+ }
+
+ return Iterator(NULL);
+ }
+
+ // operators
+ void operator=(const NPT_List<T>& other);
+ bool operator==(const NPT_List<T>& other) const;
+ bool operator!=(const NPT_List<T>& other) const;
+
+protected:
+ // types
+ class Item
+ {
+ public:
+ // methods
+ Item(const T& data) : m_Next(0), m_Prev(0), m_Data(data) {}
+
+ // members
+ Item* m_Next;
+ Item* m_Prev;
+ T m_Data;
+
+ // friends
+ //friend class NPT_List<T>;
+ //friend class NPT_List<T>::Iterator;
+ };
+
+ // members
+ NPT_Cardinal m_ItemCount;
+ Item* m_Head;
+ Item* m_Tail;
+};
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::NPT_List
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_List<T>::NPT_List() : m_ItemCount(0), m_Head(0), m_Tail(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::NPT_List
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_List<T>::NPT_List(const NPT_List<T>& list) : m_ItemCount(0), m_Head(0), m_Tail(0)
+{
+ *this = list;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::~NPT_List<T>
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_List<T>::~NPT_List()
+{
+ Clear();
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::operator=
++---------------------------------------------------------------------*/
+template <typename T>
+void
+NPT_List<T>::operator=(const NPT_List<T>& list)
+{
+ // cleanup
+ Clear();
+
+ // copy the new list
+ Item* item = list.m_Head;
+ while (item) {
+ Add(item->m_Data);
+ item = item->m_Next;
+ }
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::operator==
++---------------------------------------------------------------------*/
+template <typename T>
+bool
+NPT_List<T>::operator==(const NPT_List<T>& other) const
+{
+ // quick test
+ if (m_ItemCount != other.m_ItemCount) return false;
+
+ // compare all elements one by one
+ Item* our_item = m_Head;
+ Item* their_item = other.m_Head;
+ while (our_item && their_item) {
+ if (our_item->m_Data != their_item->m_Data) return false;
+ our_item = our_item->m_Next;
+ their_item = their_item->m_Next;
+ }
+
+ return our_item == NULL && their_item == NULL;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::operator!=
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+bool
+NPT_List<T>::operator!=(const NPT_List<T>& other) const
+{
+ return !(*this == other);
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Clear
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Clear()
+{
+ // delete all items
+ Item* item = m_Head;
+ while (item) {
+ Item* next = item->m_Next;
+ delete item;
+ item = next;
+ }
+
+ m_ItemCount = 0;
+ m_Head = NULL;
+ m_Tail = NULL;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Add(Item& item)
+{
+ // add element at the tail
+ if (m_Tail) {
+ item.m_Prev = m_Tail;
+ item.m_Next = NULL;
+ m_Tail->m_Next = &item;
+ m_Tail = &item;
+ } else {
+ m_Head = &item;
+ m_Tail = &item;
+ item.m_Next = NULL;
+ item.m_Prev = NULL;
+ }
+
+ // one more item in the list now
+ ++m_ItemCount;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Add(NPT_List<T>& list)
+{
+ // copy the new list
+ Item* item = list.m_Head;
+ while (item) {
+ Add(item->m_Data);
+ item = item->m_Next;
+ }
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+NPT_Result
+NPT_List<T>::Add(const T& data)
+{
+ return Add(*new Item(data));
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::GetItem
++---------------------------------------------------------------------*/
+template <typename T>
+typename NPT_List<T>::Iterator
+NPT_List<T>::GetItem(NPT_Ordinal n) const
+{
+ Iterator result;
+ if (n >= m_ItemCount) return result;
+
+ result = m_Head;
+ for (unsigned int i=0; i<n; i++) {
+ ++result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Insert
++---------------------------------------------------------------------*/
+template <typename T>
+inline NPT_Result
+NPT_List<T>::Insert(Iterator where, const T&data)
+{
+ return Insert(where, *new Item(data));
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Insert
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Insert(Iterator where, Item& item)
+{
+ // insert the item in the list
+ Item* position = where.m_Item;
+ if (position) {
+ // insert at position
+ item.m_Next = position;
+ item.m_Prev = position->m_Prev;
+ position->m_Prev = &item;
+ if (item.m_Prev) {
+ item.m_Prev->m_Next = &item;
+ } else {
+ // this is the new head
+ m_Head = &item;
+ }
+
+ // one more item in the list now
+ ++m_ItemCount;
+ } else {
+ // insert at tail
+ return Add(item);
+ }
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Erase
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Erase(Iterator position)
+{
+ if (!position) return NPT_ERROR_NO_SUCH_ITEM;
+ Detach(*position.m_Item);
+ delete position.m_Item;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Remove
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Remove(const T& data, bool all)
+{
+ Item* item = m_Head;
+ NPT_Cardinal matches = 0;
+
+ while (item) {
+ Item* next = item->m_Next;
+ if (item->m_Data == data) {
+ // we found a match
+ ++matches;
+
+ // detach item
+ Detach(*item);
+
+ // destroy the item
+ delete item;
+
+ if (!all) return NPT_SUCCESS;
+ }
+ item = next;
+ }
+
+ return matches?NPT_SUCCESS:NPT_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Remove
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Remove(const NPT_List<T>& list, bool all)
+{
+ Item* item = list.m_Head;
+ while (item) {
+ Remove(item->m_Data, all);
+ item = item->m_Next;
+ }
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Detach
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Detach(Item& item)
+{
+ // remove item
+ if (item.m_Prev) {
+ // item is not the head
+ if (item.m_Next) {
+ // item is not the tail
+ item.m_Next->m_Prev = item.m_Prev;
+ item.m_Prev->m_Next = item.m_Next;
+ } else {
+ // item is the tail
+ m_Tail = item.m_Prev;
+ m_Tail->m_Next = NULL;
+ }
+ } else {
+ // item is the head
+ m_Head = item.m_Next;
+ if (m_Head) {
+ // item is not the tail
+ m_Head->m_Prev = NULL;
+ } else {
+ // item is also the tail
+ m_Tail = NULL;
+ }
+ }
+
+ // one less item in the list now
+ --m_ItemCount;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Get
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Get(NPT_Ordinal index, T& data) const
+{
+ T* data_pointer;
+ NPT_CHECK(Get(index, data_pointer));
+ data = *data_pointer;
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Get
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::Get(NPT_Ordinal index, T*& data) const
+{
+ Item* item = m_Head;
+
+ if (index < m_ItemCount) {
+ while (index--) item = item->m_Next;
+ data = &item->m_Data;
+ return NPT_SUCCESS;
+ } else {
+ data = NULL;
+ return NPT_ERROR_NO_SUCH_ITEM;
+ }
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::PopHead
++---------------------------------------------------------------------*/
+template <typename T>
+NPT_Result
+NPT_List<T>::PopHead(T& data)
+{
+ // check that we have an element
+ if (m_Head == NULL) return NPT_ERROR_LIST_EMPTY;
+
+ // copy the head item's data
+ data = m_Head->m_Data;
+
+ // discard the head item
+ Item* head = m_Head;
+ m_Head = m_Head->m_Next;
+ if (m_Head) {
+ m_Head->m_Prev = NULL;
+ } else {
+ m_Tail = NULL;
+ }
+ delete head;
+
+ // update the count
+ --m_ItemCount;
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_List<T>::Contains
++---------------------------------------------------------------------*/
+template <typename T>
+bool
+NPT_List<T>::Contains(const T& data) const
+{
+ Item* item = m_Head;
+ while (item) {
+ if (item->m_Data == data) return true;
+ item = item->m_Next;
+ }
+
+ return false;
+}
+
+#endif // _NPT_LIST_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Logging Support
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+/** @file
+* Header file for logging
+*/
+
+#ifndef _NPT_LOGGING_H_
+#define _NPT_LOGGING_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#include "NptDebug.h"
+#include "NptTypes.h"
+#include "NptTime.h"
+#include "NptStrings.h"
+#include "NptList.h"
+#include "NptStreams.h"
+#include "NptThreads.h"
+#include "NptHttp.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class NPT_LogManager;
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+class NPT_LogRecord {
+public:
+ const char* m_LoggerName;
+ int m_Level;
+ const char* m_Message;
+ NPT_TimeStamp m_TimeStamp;
+ const char* m_SourceFile;
+ unsigned int m_SourceLine;
+ const char* m_SourceFunction;
+};
+
+class NPT_LogHandler {
+public:
+ // class methods
+ static NPT_Result Create(const char* logger_name,
+ const char* handler_name,
+ NPT_LogHandler*& handler);
+
+ // methods
+ virtual ~NPT_LogHandler() {}
+ virtual void Log(const NPT_LogRecord& record) = 0;
+ virtual NPT_String ToString() { return ""; }
+};
+
+class NPT_Logger {
+public:
+ // methods
+ NPT_Logger(const char* name, NPT_LogManager& manager);
+ ~NPT_Logger();
+ void Log(int level,
+ const char* source_file,
+ unsigned int source_line,
+ const char* source_function,
+ const char* msg,
+ ...);
+
+ NPT_Result AddHandler(NPT_LogHandler* handler);
+ NPT_Result DeleteHandlers();
+ NPT_Result SetParent(NPT_Logger* parent);
+ const NPT_String& GetName() const { return m_Name; }
+ int GetLevel() const { return m_Level; }
+ bool GetForwardToParent() const { return m_ForwardToParent; }
+ NPT_List<NPT_LogHandler*>& GetHandlers() { return m_Handlers; }
+
+private:
+ // members
+ NPT_LogManager& m_Manager;
+ NPT_String m_Name;
+ int m_Level;
+ bool m_LevelIsInherited;
+ bool m_ForwardToParent;
+ NPT_Logger* m_Parent;
+ NPT_List<NPT_LogHandler*> m_Handlers;
+
+ // friends
+ friend class NPT_LogManager;
+};
+
+typedef struct {
+ NPT_Logger* logger;
+ const char* name;
+} NPT_LoggerReference;
+
+class NPT_Log {
+public:
+ // class methods
+ static int GetLogLevel(const char* name);
+ static const char* GetLogLevelName(int level);
+ static const char* GetLogLevelAnsiColor(int level);
+ static void FormatRecordToStream(const NPT_LogRecord& record,
+ NPT_OutputStream& stream,
+ bool use_colors,
+ NPT_Flags format_filter);
+};
+
+class NPT_LogConfigEntry {
+public:
+ NPT_LogConfigEntry(const char* key, const char* value) :
+ m_Key(key), m_Value(value) {}
+ NPT_String m_Key;
+ NPT_String m_Value;
+};
+
+class NPT_LogManager {
+public:
+ // class methods
+ static NPT_LogManager& GetDefault();
+ static bool ConfigValueIsBooleanTrue(NPT_String& value);
+ static bool ConfigValueIsBooleanFalse(NPT_String& value);
+ static NPT_Logger* GetLogger(const char* name);
+
+ // methods
+ NPT_LogManager();
+ ~NPT_LogManager();
+ NPT_Result Configure(const char* config_sources = NULL);
+ NPT_String* GetConfigValue(const char* prefix, const char* suffix);
+ NPT_List<NPT_Logger*>& GetLoggers() { return m_Loggers; }
+ NPT_List<NPT_LogConfigEntry>& GetConfig() { return m_Config; }
+ void Enable(bool value) { m_Enabled = value; }
+ void Lock() { m_Lock.Lock(); }
+ void Unlock() { m_Lock.Unlock(); }
+
+private:
+ // methods
+ NPT_Result SetConfigValue(const char* key, const char* value);
+ NPT_Result ParseConfig(const char* config, NPT_Size config_size);
+ NPT_Result ParseConfigSource(NPT_String& source);
+ NPT_Result ParseConfigFile(const char* filename);
+ bool HaveLoggerConfig(const char* name);
+ NPT_Logger* FindLogger(const char* name);
+ NPT_Result ConfigureLogger(NPT_Logger* logger);
+
+ // members
+ NPT_Mutex m_Lock;
+ volatile bool m_Enabled;
+ volatile bool m_Configured;
+ volatile bool m_Configuring;
+ NPT_List<NPT_LogConfigEntry> m_Config;
+ NPT_List<NPT_Logger*> m_Loggers;
+ NPT_Logger* m_Root;
+};
+
+const unsigned short NPT_HTTP_LOGGER_CONFIGURATOR_DEFAULT_PORT = 6378;
+class NPT_HttpLoggerConfigurator : NPT_HttpRequestHandler, public NPT_Thread {
+public:
+ // constructor and destructor
+ NPT_HttpLoggerConfigurator(NPT_UInt16 port = NPT_HTTP_LOGGER_CONFIGURATOR_DEFAULT_PORT,
+ bool detached = true);
+ virtual ~NPT_HttpLoggerConfigurator();
+
+ // NPT_Runnable (NPT_Thread) methods
+ virtual void Run();
+
+private:
+ // NPT_HttpRequestHandler methods
+ virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+ // members
+ NPT_HttpServer* m_Server;
+};
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define NPT_LOG_LEVEL_FATAL 700
+#define NPT_LOG_LEVEL_SEVERE 600
+#define NPT_LOG_LEVEL_WARNING 500
+#define NPT_LOG_LEVEL_INFO 400
+#define NPT_LOG_LEVEL_FINE 300
+#define NPT_LOG_LEVEL_FINER 200
+#define NPT_LOG_LEVEL_FINEST 100
+
+#define NPT_LOG_LEVEL_OFF 32767
+#define NPT_LOG_LEVEL_ALL 0
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define NPT_LOG_GET_LOGGER(_logger) \
+ if ((_logger).logger == NULL) { \
+ (_logger).logger = NPT_LogManager::GetLogger((_logger).name); \
+ }
+
+#if defined(NPT_CONFIG_ENABLE_LOGGING)
+
+#define NPT_DEFINE_LOGGER(_logger, _name) static NPT_LoggerReference _logger = { NULL, (_name) };
+
+#define NPT_LOG_X(_logger, _level, _argsx) \
+do { \
+ NPT_LOG_GET_LOGGER((_logger)) \
+ if ((_logger).logger && (_level) >= (_logger).logger->GetLevel()) { \
+ (_logger).logger->Log _argsx; \
+ } \
+} while(0)
+
+#define NPT_CHECK_LL(_logger, _level, _result) do { \
+ NPT_Result _x = (_result); \
+ if (_x != NPT_SUCCESS) { \
+ NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"NPT_CHECK failed, result=%d (%s) [%s]", _x, NPT_ResultText(_x), #_result)); \
+ return _x; \
+ } \
+} while(0)
+
+#define NPT_CHECK_LABEL_LL(_logger, _level, _result, _label) do { \
+ NPT_Result _x = (_result); \
+ if (_x != NPT_SUCCESS) { \
+ NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"NPT_CHECK failed, result=%d (%s) [%s]", _x, NPT_ResultText(_x), #_result)); \
+ goto _label; \
+ } \
+} while(0)
+#define NPT_CHECK_POINTER_LL(_logger, _level, _p) do { \
+ if ((_p) == NULL) { \
+ NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"@@@ NULL pointer parameter")); \
+ return NPT_ERROR_INVALID_PARAMETERS; \
+ } \
+} while(0)
+#define NPT_CHECK_POINTER_LABEL_LL(_logger, _level, _p, _label) do { \
+ if ((_p) == NULL) { \
+ NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"@@@ NULL pointer parameter")); \
+ goto _label; \
+ } \
+} while(0)
+
+#else /* NPT_CONFIG_ENABLE_LOGGING */
+
+#define NPT_DEFINE_LOGGER(_logger, _name)
+#define NPT_LOG_X(_logger, _level, _argsx)
+#define NPT_CHECK_LL(_logger, _level, _result) NPT_CHECK(_result)
+#define NPT_CHECK_LABEL_LL(_logger, _level, _result, _label) NPT_CHECK_LABEL((_result), _label)
+#define NPT_CHECK_POINTER_LL(_logger, _level, _p) NPT_CHECK_POINTER((_p))
+#define NPT_CHECK_POINTER_LABEL_LL(_logger, _level, _p, _label) NPT_CHECK_POINTER_LABEL((_p), _label)
+
+#endif /* NPT_CONFIG_ENABLE_LOGGING */
+
+#define NPT_SET_LOCAL_LOGGER(_name) NPT_DEFINE_LOGGER(_NPT_LocalLogger, (_name))
+#define NPT_CHECK_L(_level, _result) NPT_CHECK_LL(_NPT_LocalLogger, (_level), (_result))
+#define NPT_CHECK_LABEL_L(_level, _result, _label) NPT_CHECK_LABEL_LL(_NPT_LocalLogger, (_level), NULL, (_result), _label)
+
+/* NOTE: the following are machine-generated, do not edit */
+#define NPT_LOG_LL(_logger,_level,_msg) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg)))
+#define NPT_LOG(_level,_msg) NPT_LOG_LL((_NPT_LocalLogger),(_level),(_msg))
+#define NPT_LOG_L(_logger,_level,_msg) NPT_LOG_LL((_logger),(_level),(_msg))
+#define NPT_LOG_LL1(_logger,_level,_msg,_arg1) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1)))
+#define NPT_LOG_1(_level,_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),(_level),(_msg),(_arg1))
+#define NPT_LOG_L1(_logger,_level,_msg,_arg1) NPT_LOG_LL1((_logger),(_level),(_msg),(_arg1))
+#define NPT_LOG_LL2(_logger,_level,_msg,_arg1,_arg2) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2)))
+#define NPT_LOG_2(_level,_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2))
+#define NPT_LOG_L2(_logger,_level,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),(_level),(_msg),(_arg1),(_arg2))
+#define NPT_LOG_LL3(_logger,_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3)))
+#define NPT_LOG_3(_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_L3(_logger,_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_LL4(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4)))
+#define NPT_LOG_4(_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_L4(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_LL5(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5)))
+#define NPT_LOG_5(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_L5(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_LL6(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6)))
+#define NPT_LOG_6(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_L6(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_LL7(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7)))
+#define NPT_LOG_7(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_L7(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_LL8(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8)))
+#define NPT_LOG_8(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_L8(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_LL9(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9)))
+#define NPT_LOG_9(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_L9(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+
+#define NPT_LOG_FATAL(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg))
+#define NPT_LOG_FATAL_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FATAL,(_msg))
+#define NPT_LOG_FATAL_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1))
+#define NPT_LOG_FATAL_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1))
+#define NPT_LOG_FATAL_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FATAL_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FATAL_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FATAL_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FATAL_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FATAL_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FATAL_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FATAL_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FATAL_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FATAL_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FATAL_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FATAL_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FATAL_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FATAL_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FATAL_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FATAL_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_SEVERE(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg))
+#define NPT_LOG_SEVERE_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_msg))
+#define NPT_LOG_SEVERE_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1))
+#define NPT_LOG_SEVERE_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1))
+#define NPT_LOG_SEVERE_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_SEVERE_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_SEVERE_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_SEVERE_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_SEVERE_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_SEVERE_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_SEVERE_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_SEVERE_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_SEVERE_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_SEVERE_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_SEVERE_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_SEVERE_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_SEVERE_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_SEVERE_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_SEVERE_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_SEVERE_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_WARNING(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg))
+#define NPT_LOG_WARNING_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_WARNING,(_msg))
+#define NPT_LOG_WARNING_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1))
+#define NPT_LOG_WARNING_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1))
+#define NPT_LOG_WARNING_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_WARNING_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_WARNING_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_WARNING_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_WARNING_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_WARNING_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_WARNING_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_WARNING_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_WARNING_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_WARNING_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_WARNING_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_WARNING_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_WARNING_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_WARNING_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_WARNING_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_WARNING_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_INFO(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg))
+#define NPT_LOG_INFO_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_INFO,(_msg))
+#define NPT_LOG_INFO_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1))
+#define NPT_LOG_INFO_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1))
+#define NPT_LOG_INFO_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_INFO_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_INFO_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_INFO_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_INFO_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_INFO_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_INFO_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_INFO_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_INFO_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_INFO_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_INFO_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_INFO_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_INFO_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_INFO_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_INFO_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_INFO_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FINE(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg))
+#define NPT_LOG_FINE_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINE,(_msg))
+#define NPT_LOG_FINE_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1))
+#define NPT_LOG_FINE_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1))
+#define NPT_LOG_FINE_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FINE_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FINE_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FINE_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FINE_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FINE_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FINE_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FINE_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FINE_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FINE_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FINE_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FINE_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FINE_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FINE_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FINE_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FINE_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FINER(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg))
+#define NPT_LOG_FINER_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINER,(_msg))
+#define NPT_LOG_FINER_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1))
+#define NPT_LOG_FINER_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1))
+#define NPT_LOG_FINER_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FINER_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FINER_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FINER_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FINER_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FINER_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FINER_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FINER_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FINER_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FINER_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FINER_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FINER_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FINER_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FINER_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FINER_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FINER_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FINEST(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg))
+#define NPT_LOG_FINEST_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINEST,(_msg))
+#define NPT_LOG_FINEST_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1))
+#define NPT_LOG_FINEST_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1))
+#define NPT_LOG_FINEST_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FINEST_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2))
+#define NPT_LOG_FINEST_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FINEST_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3))
+#define NPT_LOG_FINEST_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FINEST_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
+#define NPT_LOG_FINEST_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FINEST_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
+#define NPT_LOG_FINEST_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FINEST_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
+#define NPT_LOG_FINEST_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FINEST_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
+#define NPT_LOG_FINEST_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FINEST_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
+#define NPT_LOG_FINEST_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+#define NPT_LOG_FINEST_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
+
+#define NPT_CHECK_FATAL(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_result))
+#define NPT_CHECK_FATAL_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FATAL,(_result))
+#define NPT_CHECK_SEVERE(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_result))
+#define NPT_CHECK_SEVERE_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_result))
+#define NPT_CHECK_WARNING(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_result))
+#define NPT_CHECK_WARNING_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_WARNING,(_result))
+#define NPT_CHECK_INFO(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_result))
+#define NPT_CHECK_INFO_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_INFO,(_result))
+#define NPT_CHECK_FINE(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_result))
+#define NPT_CHECK_FINE_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINE,(_result))
+#define NPT_CHECK_FINER(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_result))
+#define NPT_CHECK_FINER_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINER,(_result))
+#define NPT_CHECK_FINEST(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_result))
+#define NPT_CHECK_FINEST_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINEST,(_result))
+
+#define NPT_CHECK_LABEL_FATAL(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_result),_label)
+#define NPT_CHECK_LABEL_FATAL_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FATAL,(_result),_label)
+#define NPT_CHECK_LABEL_SEVERE(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_result),_label)
+#define NPT_CHECK_LABEL_SEVERE_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_result),_label)
+#define NPT_CHECK_LABEL_WARNING(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_result),_label)
+#define NPT_CHECK_LABEL_WARNING_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_WARNING,(_result),_label)
+#define NPT_CHECK_LABEL_INFO(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_result),_label)
+#define NPT_CHECK_LABEL_INFO_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_INFO,(_result),_label)
+#define NPT_CHECK_LABEL_FINE(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_result),_label)
+#define NPT_CHECK_LABEL_FINE_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINE,(_result),_label)
+#define NPT_CHECK_LABEL_FINER(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_result),_label)
+#define NPT_CHECK_LABEL_FINER_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINER,(_result),_label)
+#define NPT_CHECK_LABEL_FINEST(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_result),_label)
+#define NPT_CHECK_LABEL_FINEST_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINEST,(_result),_label)
+
+#define NPT_CHECK_POINTER_FATAL(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_p))
+#define NPT_CHECK_POINTER_FATAL_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FATAL,(_p))
+#define NPT_CHECK_POINTER_SEVERE(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_p))
+#define NPT_CHECK_POINTER_SEVERE_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_SEVERE,(_p))
+#define NPT_CHECK_POINTER_WARNING(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_p))
+#define NPT_CHECK_POINTER_WARNING_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_WARNING,(_p))
+#define NPT_CHECK_POINTER_INFO(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_p))
+#define NPT_CHECK_POINTER_INFO_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_INFO,(_p))
+#define NPT_CHECK_POINTER_FINE(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_p))
+#define NPT_CHECK_POINTER_FINE_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINE,(_p))
+#define NPT_CHECK_POINTER_FINER(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_p))
+#define NPT_CHECK_POINTER_FINER_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINER,(_p))
+#define NPT_CHECK_POINTER_FINEST(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_p))
+#define NPT_CHECK_POINTER_FINEST_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINEST,(_p))
+
+#define NPT_CHECK_POINTER_LABEL_FATAL(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FATAL_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FATAL,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_SEVERE(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_SEVERE_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_SEVERE,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_WARNING(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_WARNING_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_WARNING,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_INFO(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_INFO_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_INFO,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FINE(_p, _label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FINE_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINE,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FINER(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FINER_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINER,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FINEST(_p,_label) NNPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_p),_label)
+#define NPT_CHECK_POINTER_LABEL_FINEST_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINEST,(_p),_label)
+
+#endif /* _NPT_LOGGING_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Maps
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+
+#ifndef _NPT_MAP_H_
+#define _NPT_MAP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptResults.h"
+#include "NptList.h"
+
+/*----------------------------------------------------------------------
+| NPT_Map
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+class NPT_Map
+{
+public:
+ // types
+ class Entry {
+ public:
+ // constructor
+ Entry(const K& key, const V& value) : m_Key(key), m_Value(value) {}
+ Entry(const K& key) : m_Key(key) {}
+
+ // accessors
+ const K& GetKey() const { return m_Key; }
+ const V& GetValue() const { return m_Value; }
+
+ // operators
+ bool operator==(const Entry& other) const {
+ return m_Key == other.m_Key && m_Value == other.m_Value;
+ }
+
+ protected:
+ // methods
+ void SetValue(const V& value) { m_Value = value; }
+
+ // members
+ K m_Key;
+ V m_Value;
+
+ // friends
+ friend class NPT_Map<K,V>;
+ };
+
+ class EntryValueDeleter {
+ public:
+ void operator()(Entry* entry) const {
+ delete entry->GetValue();
+ }
+ };
+
+ // constructors
+ NPT_Map<K,V>() {}
+ NPT_Map<K,V>(const NPT_Map<K,V>& copy);
+
+ // destructor
+ ~NPT_Map<K,V>();
+
+ // methods
+ NPT_Result Put(const K& key, const V& value);
+ NPT_Result Get(const K& key, V*& value) const;
+ bool HasKey(const K& key) const { return GetEntry(key) != NULL; }
+ bool HasValue(const V& value) const;
+ NPT_Result Erase(const K& key);
+ NPT_Cardinal GetEntryCount() const { return m_Entries.GetItemCount(); }
+ const NPT_List<Entry*>& GetEntries() const { return m_Entries; }
+ NPT_Result Clear();
+
+ // operators
+ V& operator[](const K& key);
+ const NPT_Map<K,V>& operator=(const NPT_Map<K,V>& copy);
+ bool operator==(const NPT_Map<K,V>& other) const;
+ bool operator!=(const NPT_Map<K,V>& other) const;
+
+private:
+ // types
+ typedef typename NPT_List<Entry*>::Iterator ListIterator;
+
+ // methods
+ Entry* GetEntry(const K& key) const;
+
+ // members
+ NPT_List<Entry*> m_Entries;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::NPT_Map<K,V>
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+NPT_Map<K,V>::NPT_Map(const NPT_Map<K,V>& copy)
+{
+ *this = copy;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::~NPT_Map<K,V>
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+NPT_Map<K,V>::~NPT_Map()
+{
+ // call Clear to ensure we delete all entry objects
+ Clear();
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::Clear
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+NPT_Result
+NPT_Map<K,V>::Clear()
+{
+ m_Entries.Apply(NPT_ObjectDeleter<Entry>());
+ m_Entries.Clear();
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::GetEntry
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+typename NPT_Map<K,V>::Entry*
+NPT_Map<K,V>::GetEntry(const K& key) const
+{
+ typename NPT_List<Entry*>::Iterator entry = m_Entries.GetFirstItem();
+ while (entry) {
+ if ((*entry)->GetKey() == key) {
+ return *entry;
+ }
+ ++entry;
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::Put
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+NPT_Result
+NPT_Map<K,V>::Put(const K& key, const V& value)
+{
+ Entry* entry = GetEntry(key);
+ if (entry == NULL) {
+ // no existing entry for that key, create one
+ m_Entries.Add(new Entry(key, value));
+ } else {
+ // replace the existing entry for that key
+ entry->SetValue(value);
+ }
+
+ return NPT_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::Get
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+NPT_Result
+NPT_Map<K,V>::Get(const K& key, V*& value) const
+{
+ Entry* entry = GetEntry(key);
+ if (entry == NULL) {
+ // no existing entry for that key
+ value = NULL;
+ return NPT_ERROR_NO_SUCH_ITEM;
+ } else {
+ // found an entry with that key
+ value = &entry->m_Value;
+ return NPT_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::HasValue
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+bool
+NPT_Map<K,V>::HasValue(const V& value) const
+{
+ ListIterator entry = m_Entries.GetFirstItem();
+ while (entry) {
+ if (value == (*entry)->m_Value) {
+ return true;
+ }
+ ++entry;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::operator=
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+const NPT_Map<K,V>&
+NPT_Map<K,V>::operator=(const NPT_Map<K,V>& copy)
+{
+ // do nothing if we're assigning to ourselves
+ if (this == ©) return copy;
+
+ // destroy all entries
+ Clear();
+
+ // copy all entries one by one
+ ListIterator entry = copy.m_Entries.GetFirstItem();
+ while (entry) {
+ m_Entries.Add(new Entry((*entry)->GetKey(), (*entry)->GetValue()));
+ ++entry;
+ }
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::Erase
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+NPT_Result
+NPT_Map<K,V>::Erase(const K& key)
+{
+ ListIterator entry = m_Entries.GetFirstItem();
+ while (entry) {
+ if ((*entry)->GetKey() == key) {
+ delete *entry; // do this before removing the entry from the
+ // list, because Erase() will invalidate the
+ // iterator item
+ m_Entries.Erase(entry);
+ return NPT_SUCCESS;
+ }
+ ++entry;
+ }
+
+ return NPT_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::operator==
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+bool
+NPT_Map<K,V>::operator==(const NPT_Map<K,V>& other) const
+{
+ // quick test
+ if (m_Entries.GetItemCount() != other.m_Entries.GetItemCount()) return false;
+
+ // compare all entries to all other entries
+ ListIterator entry = m_Entries.GetFirstItem();
+ while (entry) {
+ V* value;
+ if (NPT_SUCCEEDED(other.Get((*entry)->m_Key, value))) {
+ // the other map has an entry for this key, check the value
+ if (!(*value == (*entry)->m_Value)) return false;
+ } else {
+ // the other map does not have an entry for this key
+ return false;
+ }
+ ++entry;
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::operator!=
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+bool
+NPT_Map<K,V>::operator!=(const NPT_Map<K,V>& other) const
+{
+ return !(*this == other);
+}
+
+/*----------------------------------------------------------------------
+| NPT_Map<K,V>::operator[]
++---------------------------------------------------------------------*/
+template <typename K, typename V>
+inline
+V&
+NPT_Map<K,V>::operator[](const K& key)
+{
+ Entry* entry = GetEntry(key);
+ if (entry == NULL) {
+ // create a new "default" entry for this key
+ entry = new Entry(key);
+ m_Entries.Add(entry);
+ }
+
+ return entry->m_Value;
+}
+
+#endif // _NPT_MAP_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Messaging System
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_MESSAGING_H_
+#define _NPT_MESSAGING_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConstants.h"
+#include "NptTypes.h"
+#include "NptResults.h"
+#include "NptList.h"
+#include "NptDynamicCast.h"
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+class NPT_Message;
+
+/*----------------------------------------------------------------------
+| NPT_MessageHandler
++---------------------------------------------------------------------*/
+class NPT_MessageHandler
+{
+public:
+ NPT_IMPLEMENT_DYNAMIC_CAST(NPT_MessageHandler)
+
+ // methods
+ virtual ~NPT_MessageHandler() {}
+
+ // default message handler
+ virtual void OnMessage(NPT_Message*) {}
+
+ // this method is a central point of handling for received messages.
+ // it can be overloaded by subclasses who wish to process all
+ // incoming messages
+ virtual NPT_Result HandleMessage(NPT_Message* message);
+};
+
+/*----------------------------------------------------------------------
+| NPT_Messsage
++---------------------------------------------------------------------*/
+class NPT_Message
+{
+public:
+ // types
+ typedef const char* Type;
+
+ // static members
+ static Type MessageType;
+
+ // methods
+ virtual ~NPT_Message() {}
+ virtual Type GetType() { return MessageType; }
+ virtual NPT_Result Dispatch(NPT_MessageHandler* handler) {
+ return DefaultDeliver(handler);
+ }
+ // this method should really be called 'Deliver', but this would
+ // cause a problem when subclasses overload it
+ virtual NPT_Result DefaultDeliver(NPT_MessageHandler* handler) {
+ handler->OnMessage(this);
+ return NPT_SUCCESS;
+ }
+};
+
+/*----------------------------------------------------------------------
+| NPT_TerminateMesssage
++---------------------------------------------------------------------*/
+class NPT_TerminateMessage : public NPT_Message
+{
+ public:
+ // methods
+ NPT_Result Dispatch(NPT_MessageHandler* /*handler*/) {
+ return NPT_ERROR_TERMINATED;
+ }
+};
+
+/*----------------------------------------------------------------------
+| NPT_MessageQueue
++---------------------------------------------------------------------*/
+class NPT_MessageQueue
+{
+ public:
+ // methods
+ virtual ~NPT_MessageQueue() {}
+ virtual NPT_Result PumpMessage(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+ virtual NPT_Result QueueMessage(NPT_Message* message,
+ NPT_MessageHandler* handler) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_MessageReceiver
++---------------------------------------------------------------------*/
+class NPT_MessageReceiver
+{
+public:
+ // methods
+ NPT_MessageReceiver() : m_Queue(NULL), m_Handler(NULL) {}
+ NPT_MessageReceiver(NPT_MessageHandler* handler) :
+ m_Queue(NULL), m_Handler(handler) {}
+ NPT_MessageReceiver(NPT_MessageQueue* queue) :
+ m_Queue(queue), m_Handler(NULL) {}
+ NPT_MessageReceiver(NPT_MessageHandler* handler,
+ NPT_MessageQueue* queue) :
+ m_Queue(queue), m_Handler(handler) {}
+ virtual ~NPT_MessageReceiver() {}
+ NPT_Result SetQueue(NPT_MessageQueue* queue) {
+ m_Queue = queue;
+ return NPT_SUCCESS;
+ }
+ NPT_Result SetHandler(NPT_MessageHandler* handler) {
+ m_Handler = handler;
+ return NPT_SUCCESS;
+ }
+ virtual NPT_Result PostMessage(NPT_Message* message) {
+ if (m_Queue) {
+ return m_Queue->QueueMessage(message, m_Handler);
+ } else {
+ return NPT_FAILURE;
+ }
+ }
+
+protected:
+ // members
+ NPT_MessageQueue* m_Queue;
+ NPT_MessageHandler* m_Handler;
+};
+
+/*----------------------------------------------------------------------
+| NPT_MessageBroadcaster
++---------------------------------------------------------------------*/
+class NPT_MessageBroadcaster
+{
+public:
+ // methods
+ NPT_MessageBroadcaster(NPT_Message* message) : m_Message(message) {}
+ NPT_Result operator()(NPT_MessageReceiver*& receiver) const {
+ receiver->PostMessage(m_Message);
+ return NPT_SUCCESS;
+ }
+
+private:
+ // members
+ NPT_Message* m_Message;
+};
+
+#endif // _NPT_MESSAGING_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Network
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_NETWORK_H_
+#define _NPT_NETWORK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptStrings.h"
+#include "NptList.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const unsigned int NPT_NETWORK_MAX_MAC_ADDRESS_LENGTH = 8;
+
+/*----------------------------------------------------------------------
+| flags
++---------------------------------------------------------------------*/
+#define NPT_NETWORK_INTERFACE_FLAG_LOOPBACK 0x01
+#define NPT_NETWORK_INTERFACE_FLAG_PROMISCUOUS 0x02
+#define NPT_NETWORK_INTERFACE_FLAG_BROADCAST 0x04
+#define NPT_NETWORK_INTERFACE_FLAG_MULTICAST 0x08
+#define NPT_NETWORK_INTERFACE_FLAG_POINT_TO_POINT 0x10
+
+/*----------------------------------------------------------------------
+| workarounds
++---------------------------------------------------------------------*/
+#if defined(_WIN32)
+#if defined(SetPort)
+#undef SetPort
+#endif
+#endif
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef unsigned int NPT_IpPort;
+
+/*----------------------------------------------------------------------
+| NPT_IpAddress
++---------------------------------------------------------------------*/
+class NPT_IpAddress
+{
+public:
+ // class members
+ static const NPT_IpAddress Any;
+
+ // constructors and destructor
+ NPT_IpAddress();
+ NPT_IpAddress(unsigned long address);
+
+ // methods
+ NPT_Result ResolveName(const char* name,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
+ NPT_Result Parse(const char* name);
+ NPT_Result Set(unsigned long address);
+ NPT_Result Set(const unsigned char bytes[4]);
+ const unsigned char* AsBytes() const;
+ unsigned long AsLong() const;
+ NPT_String ToString() const;
+
+ // operators
+ bool operator==(const NPT_IpAddress& other) const;
+
+private:
+ // members
+ unsigned char m_Address[4];
+};
+
+/*----------------------------------------------------------------------
+| NPT_MacAddress
++---------------------------------------------------------------------*/
+class NPT_MacAddress
+{
+public:
+ // typedef enum
+ typedef enum {
+ TYPE_UNKNOWN,
+ TYPE_LOOPBACK,
+ TYPE_ETHERNET,
+ TYPE_PPP,
+ TYPE_IEEE_802_11
+ } Type;
+
+ // constructors and destructor
+ NPT_MacAddress() : m_Type(TYPE_UNKNOWN), m_Length(0) {}
+ NPT_MacAddress(Type type,
+ const unsigned char* addr,
+ unsigned int length);
+
+ // methods
+ void SetAddress(Type type, const unsigned char* addr,
+ unsigned int length);
+ Type GetType() const { return m_Type; }
+ const unsigned char* GetAddress() const { return m_Address; }
+ unsigned int GetLength() const { return m_Length; }
+ NPT_String ToString() const;
+
+private:
+ // members
+ Type m_Type;
+ unsigned char m_Address[NPT_NETWORK_MAX_MAC_ADDRESS_LENGTH];
+ unsigned int m_Length;
+};
+
+/*----------------------------------------------------------------------
+| NPT_NetworkInterfaceAddress
++---------------------------------------------------------------------*/
+class NPT_NetworkInterfaceAddress
+{
+public:
+ // constructors and destructor
+ NPT_NetworkInterfaceAddress(const NPT_IpAddress& primary,
+ const NPT_IpAddress& broadcast,
+ const NPT_IpAddress& destination,
+ const NPT_IpAddress& netmask) :
+ m_PrimaryAddress(primary),
+ m_BroadcastAddress(broadcast),
+ m_DestinationAddress(destination),
+ m_NetMask(netmask) {}
+
+ // methods
+ const NPT_IpAddress& GetPrimaryAddress() const {
+ return m_PrimaryAddress;
+ }
+ const NPT_IpAddress& GetBroadcastAddress() const {
+ return m_BroadcastAddress;
+ }
+ const NPT_IpAddress& GetDestinationAddress() const {
+ return m_DestinationAddress;
+ }
+ const NPT_IpAddress& GetNetMask() const {
+ return m_NetMask;
+ }
+
+ bool IsAddressInNetwork(const NPT_IpAddress& adress) {
+ if (m_PrimaryAddress.AsLong() == adress.AsLong()) return true;
+ if (m_NetMask.AsLong() == 0) return false;
+ return (m_PrimaryAddress.AsLong() & m_NetMask.AsLong()) == (adress.AsLong() & m_NetMask.AsLong());
+ }
+
+private:
+ // members
+ NPT_IpAddress m_PrimaryAddress;
+ NPT_IpAddress m_BroadcastAddress;
+ NPT_IpAddress m_DestinationAddress;
+ NPT_IpAddress m_NetMask;
+};
+
+/*----------------------------------------------------------------------
+| NPT_NetworkInterface
++---------------------------------------------------------------------*/
+class NPT_NetworkInterface
+{
+public:
+ // class methods
+ static NPT_Result GetNetworkInterfaces(NPT_List<NPT_NetworkInterface*>& interfaces);
+
+ // constructors and destructor
+ NPT_NetworkInterface(const char* name,
+ const NPT_MacAddress& mac,
+ NPT_Flags flags);
+ ~NPT_NetworkInterface() {}
+
+ // methods
+ NPT_Result AddAddress(const NPT_NetworkInterfaceAddress& address);
+ const NPT_String& GetName() const {
+ return m_Name;
+ }
+ const NPT_MacAddress& GetMacAddress() const {
+ return m_MacAddress;
+ }
+ NPT_Flags GetFlags() const { return m_Flags; }
+ const NPT_List<NPT_NetworkInterfaceAddress>& GetAddresses() const {
+ return m_Addresses;
+ }
+
+ bool IsAddressInNetwork(const NPT_IpAddress& address) {
+ NPT_List<NPT_NetworkInterfaceAddress>::Iterator iter = m_Addresses.GetFirstItem();
+ while (iter) {
+ if ((*iter).IsAddressInNetwork(address)) return true;
+ ++iter;
+ }
+ return false;
+ }
+
+private:
+ // members
+ NPT_String m_Name;
+ NPT_MacAddress m_MacAddress;
+ NPT_Flags m_Flags;
+ NPT_List<NPT_NetworkInterfaceAddress> m_Addresses;
+};
+
+
+#endif // _NPT_NETWORK_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Queue
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_QUEUE_H_
+#define _NPT_QUEUE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptConstants.h"
+
+/*----------------------------------------------------------------------
+| NPT_QueueItem
++---------------------------------------------------------------------*/
+class NPT_QueueItem;
+
+/*----------------------------------------------------------------------
+| NPT_GenericQueue
++---------------------------------------------------------------------*/
+class NPT_GenericQueue
+{
+ public:
+ // class methods
+ static NPT_GenericQueue* CreateInstance(NPT_Cardinal max_items = 0);
+
+ // methods
+ virtual ~NPT_GenericQueue() {}
+ virtual NPT_Result Push(NPT_QueueItem* item,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+ virtual NPT_Result Pop(NPT_QueueItem*& item,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+ virtual NPT_Result Peek(NPT_QueueItem*& item,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+ protected:
+ // methods
+ NPT_GenericQueue() {}
+};
+
+/*----------------------------------------------------------------------
+| NPT_Queue
++---------------------------------------------------------------------*/
+template <class T>
+class NPT_Queue
+{
+ public:
+ // methods
+ NPT_Queue(NPT_Cardinal max_items = 0) :
+ m_Delegate(NPT_GenericQueue::CreateInstance(max_items)) {}
+ virtual ~NPT_Queue<T>() { delete m_Delegate; }
+ virtual NPT_Result Push(T* item, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_Delegate->Push(reinterpret_cast<NPT_QueueItem*>(item), timeout);
+ }
+ virtual NPT_Result Pop(T*& item, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_Delegate->Pop(reinterpret_cast<NPT_QueueItem*&>(item),
+ timeout);
+ }
+ virtual NPT_Result Peek(T*& item, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_Delegate->Peek(reinterpret_cast<NPT_QueueItem*&>(item),
+ timeout);
+ }
+
+ protected:
+ // members
+ NPT_GenericQueue* m_Delegate;
+};
+
+#endif // _NPT_QUEUE_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - References
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+
+#ifndef _NPT_REFERENCES_H_
+#define _NPT_REFERENCES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConstants.h"
+
+/*----------------------------------------------------------------------
+| NPT_Reference
++---------------------------------------------------------------------*/
+template <typename T>
+class NPT_Reference
+{
+public:
+ // constructors and destructor
+ NPT_Reference() : m_Object(NULL), m_Counter(NULL) {}
+ explicit NPT_Reference(T* object) :
+ m_Object(object), m_Counter(object?new NPT_Cardinal(1):NULL) {}
+
+ NPT_Reference(const NPT_Reference<T>& ref) :
+ m_Object(ref.m_Object), m_Counter(ref.m_Counter) {
+ if (m_Counter) ++(*m_Counter);
+ }
+
+ // this methods should be private, but this causes a problem on some
+ // compilers, because we need this function in order to implement
+ // the cast operator operator NPT_Reference<U>() below, which would
+ // have to be marked as a friend, and friend declarations with the
+ // same class name confuses some compilers
+ NPT_Reference(T* object, NPT_Cardinal* counter) :
+ m_Object(object), m_Counter(counter) {
+ if (m_Counter) ++(*m_Counter);
+ }
+
+ ~NPT_Reference() {
+ Release();
+ }
+
+ // overloaded operators
+ NPT_Reference<T>& operator=(const NPT_Reference<T>& ref) {
+ if (this != &ref) {
+ Release();
+ m_Object = ref.m_Object;
+ m_Counter = ref.m_Counter;
+ if (m_Counter) ++(*m_Counter);
+ }
+ return *this;
+ }
+ NPT_Reference<T>& operator=(T* object) {
+ Release();
+ m_Object = object;
+ m_Counter = object?new NPT_Cardinal(1):NULL;
+ return *this;
+ }
+ T& operator*() const { return *m_Object; }
+ T* operator->() const { return m_Object; }
+
+ bool operator==(const NPT_Reference<T>& ref) const {
+ return m_Object == ref.m_Object;
+ }
+ bool operator!=(const NPT_Reference<T>& ref) const {
+ return m_Object != ref.m_Object;
+ }
+
+ // overloaded cast operators
+ template <typename U> operator NPT_Reference<U>() {
+ return NPT_Reference<U>(m_Object, m_Counter);
+ }
+
+ // methods
+ /**
+ * Returns the naked pointer value.
+ */
+ T* AsPointer() const { return m_Object; }
+
+ /**
+ * Returns the reference counter value.
+ */
+ NPT_Cardinal GetCounter() const { return *m_Counter; }
+
+ /**
+ * Returns wether this references a NULL object.
+ */
+ bool IsNull() const { return m_Object == NULL; }
+
+ /**
+ * Detach the reference from the shared object.
+ * The reference count is decremented, but the object is not deleted if the
+ * reference count becomes 0.
+ * After the method returns, this reference does not point to any shared object.
+ */
+ void Detach() {
+ if (m_Counter && --(*m_Counter) == 0) {
+ delete m_Counter;
+ }
+ m_Counter = NULL;
+ m_Object = NULL;
+ }
+
+private:
+ // methods
+ void Release() {
+ if (m_Counter && --(*m_Counter) == 0) {
+ delete m_Counter; m_Counter = NULL;
+ delete m_Object; m_Object = NULL;
+ }
+ }
+
+ // members
+ T* m_Object;
+ NPT_Cardinal* m_Counter;
+};
+
+#endif // _NPT_REFERENCES_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Result Codes
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_RESULTS_H_
+#define _NPT_RESULTS_H_
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#if defined(NPT_DEBUG)
+#include "NptDebug.h"
+#define NPT_CHECK(_x) \
+do { \
+ NPT_Result _result = (_x); \
+ if (_result != NPT_SUCCESS) { \
+ NPT_Debug("%s(%d): @@@ NPT_CHECK failed, result=%d (%s)", __FILE__, __LINE__, _result, NPT_ResultText(_result)); \
+ return _result; \
+ } \
+} while(0)
+#define NPT_CHECK_POINTER(_p) \
+do { \
+ if ((_p) == NULL) { \
+ NPT_Debug("%s(%d): @@@ NULL pointer parameter", __FILE__, __LINE__); \
+ return NPT_ERROR_INVALID_PARAMETERS; \
+ } \
+} while(0)
+#define NPT_CHECK_LABEL(_x, label) \
+do { \
+ NPT_Result _result = (_x); \
+ if (_result != NPT_SUCCESS) { \
+ NPT_Debug("%s(%d): @@@ NPT_CHECK failed, result=%d (%s)", __FILE__, __LINE__, _result, NPT_ResultText(_result)); \
+ goto label; \
+ } \
+} while(0)
+#define NPT_CHECK_POINTER_LABEL(_p, label) \
+do { \
+ if (_p == NULL) { \
+ NPT_Debug("%s(%d): @@@ NULL pointer parameter", __FILE__, __LINE__); \
+ goto label; \
+ } \
+} while(0)
+#else
+#define NPT_CHECK(_x) \
+do { \
+ NPT_Result _result = (_x); \
+ if (_result != NPT_SUCCESS) { \
+ return _result; \
+ } \
+} while(0)
+#define NPT_CHECK_POINTER(_p) \
+do { \
+ if ((_p) == NULL) return NPT_ERROR_INVALID_PARAMETERS; \
+} while(0)
+#define NPT_CHECK_LABEL(_x, label) \
+do { \
+ NPT_Result _result = (_x); \
+ if (_result != NPT_SUCCESS) { \
+ goto label; \
+ } \
+} while(0)
+#define NPT_CHECK_POINTER_LABEL(_p, label) \
+do { \
+ if ((_p) == NULL) { \
+ goto label; \
+ } \
+} while(0)
+#endif
+
+#define NPT_FAILED(result) ((result) != NPT_SUCCESS)
+#define NPT_SUCCEEDED(result) ((result) == NPT_SUCCESS)
+
+/*----------------------------------------------------------------------
+| result codes
++---------------------------------------------------------------------*/
+/** Result indicating that the operation or call succeeded */
+#define NPT_SUCCESS 0
+
+/** Result indicating an unspecififed failure condition */
+#define NPT_FAILURE (-1)
+
+#if !defined(NPT_ERROR_BASE)
+#define NPT_ERROR_BASE -20000
+#endif
+
+// error bases
+const int NPT_ERROR_BASE_GENERAL = NPT_ERROR_BASE-0;
+const int NPT_ERROR_BASE_LIST = NPT_ERROR_BASE-100;
+const int NPT_ERROR_BASE_FILE = NPT_ERROR_BASE-200;
+const int NPT_ERROR_BASE_IO = NPT_ERROR_BASE-300;
+const int NPT_ERROR_BASE_SOCKET = NPT_ERROR_BASE-400;
+const int NPT_ERROR_BASE_INTERFACES = NPT_ERROR_BASE-500;
+const int NPT_ERROR_BASE_XML = NPT_ERROR_BASE-600;
+const int NPT_ERROR_BASE_UNIX = NPT_ERROR_BASE-700;
+const int NPT_ERROR_BASE_HTTP = NPT_ERROR_BASE-800;
+const int NPT_ERROR_BASE_THREADS = NPT_ERROR_BASE-900;
+const int NPT_ERROR_BASE_SERIAL_PORT = NPT_ERROR_BASE-1000;
+const int NPT_ERROR_BASE_TLS = NPT_ERROR_BASE-1100;
+
+// general errors
+const int NPT_ERROR_INVALID_PARAMETERS = NPT_ERROR_BASE_GENERAL - 0;
+const int NPT_ERROR_PERMISSION_DENIED = NPT_ERROR_BASE_GENERAL - 1;
+const int NPT_ERROR_OUT_OF_MEMORY = NPT_ERROR_BASE_GENERAL - 2;
+const int NPT_ERROR_NO_SUCH_NAME = NPT_ERROR_BASE_GENERAL - 3;
+const int NPT_ERROR_NO_SUCH_PROPERTY = NPT_ERROR_BASE_GENERAL - 4;
+const int NPT_ERROR_NO_SUCH_ITEM = NPT_ERROR_BASE_GENERAL - 5;
+const int NPT_ERROR_NO_SUCH_CLASS = NPT_ERROR_BASE_GENERAL - 6;
+const int NPT_ERROR_OVERFLOW = NPT_ERROR_BASE_GENERAL - 7;
+const int NPT_ERROR_INTERNAL = NPT_ERROR_BASE_GENERAL - 8;
+const int NPT_ERROR_INVALID_STATE = NPT_ERROR_BASE_GENERAL - 9;
+const int NPT_ERROR_INVALID_FORMAT = NPT_ERROR_BASE_GENERAL - 10;
+const int NPT_ERROR_INVALID_SYNTAX = NPT_ERROR_BASE_GENERAL - 11;
+const int NPT_ERROR_NOT_IMPLEMENTED = NPT_ERROR_BASE_GENERAL - 12;
+const int NPT_ERROR_NOT_SUPPORTED = NPT_ERROR_BASE_GENERAL - 13;
+const int NPT_ERROR_TIMEOUT = NPT_ERROR_BASE_GENERAL - 14;
+const int NPT_ERROR_WOULD_BLOCK = NPT_ERROR_BASE_GENERAL - 15;
+const int NPT_ERROR_TERMINATED = NPT_ERROR_BASE_GENERAL - 16;
+const int NPT_ERROR_OUT_OF_RANGE = NPT_ERROR_BASE_GENERAL - 17;
+const int NPT_ERROR_OUT_OF_RESOURCES = NPT_ERROR_BASE_GENERAL - 18;
+
+/* standard error codes */
+/* these are special codes to convey an errno */
+/* the error code is (SHI_ERROR_BASE_ERRNO - errno) */
+/* where errno is the positive integer from errno.h */
+const int NPT_ERROR_BASE_ERRNO = NPT_ERROR_BASE-2000;
+#define NPT_ERROR_ERRNO(e) (NPT_ERROR_BASE_ERRNO - (e))
+
+/*----------------------------------------------------------------------
+| functions
++---------------------------------------------------------------------*/
+const char* NPT_ResultText(int result);
+
+#endif // _NPT_RESULTS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Ring Buffer
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_RING_BUFFER_H_
+#define _NPT_RING_BUFFER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptReferences.h"
+
+/*----------------------------------------------------------------------
+| NPT_RingBuffer
++---------------------------------------------------------------------*/
+class NPT_RingBuffer
+{
+ public:
+ // methods
+ NPT_RingBuffer(NPT_Size size);
+ NPT_RingBuffer(void* buffer, NPT_Size size);
+ virtual ~NPT_RingBuffer();
+ NPT_Size GetSpace() const;
+ NPT_Size GetContiguousSpace() const;
+ NPT_Result Write(const void* buffer, NPT_Size byte_count);
+ NPT_Size GetAvailable() const;
+ NPT_Size GetContiguousAvailable() const;
+ NPT_Result Read(void* buffer, NPT_Size byte_count);
+ unsigned char ReadByte();
+ unsigned char PeekByte(NPT_Position offset);
+ NPT_Result MoveIn(NPT_Position offset);
+ NPT_Result MoveOut(NPT_Position offset);
+ NPT_Result Flush();
+ NPT_Result Close();
+ bool IsClosed() { return m_Closed; }
+
+ // accessors
+ unsigned char* GetWritePointer() { return m_In; }
+ unsigned char* GetReadPointer() { return m_Out;}
+
+ private:
+ // members
+ struct {
+ unsigned char* start;
+ unsigned char* end;
+ } m_Data;
+ unsigned char* m_In;
+ unsigned char* m_Out;
+ NPT_Size m_Size;
+ bool m_BufferIsLocal;
+ bool m_Closed;
+};
+
+typedef NPT_Reference<NPT_RingBuffer> NPT_RingBufferReference;
+
+#endif // _NPT_RING_BUFFER_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Selectable Message Queue
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_SELECTABLE_MESSAGE_QUEUE_H_
+#define _NPT_SELECTABLE_MESSAGE_QUEUE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptMessaging.h"
+#include "NptSimpleMessageQueue.h"
+
+/*----------------------------------------------------------------------
+| NPT_SelectableMessageQueue
++---------------------------------------------------------------------*/
+class NPT_SelectableMessageQueue : public NPT_SimpleMessageQueue
+{
+public:
+ // methods
+ NPT_SelectableMessageQueue();
+ virtual ~NPT_SelectableMessageQueue();
+
+ // NPT_MessageQueue methods
+ virtual NPT_Result PumpMessage(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
+ virtual NPT_Result QueueMessage(NPT_Message* message,
+ NPT_MessageHandler* handler);
+
+ // methods
+ int GetEventFd() { return m_Pipe[0]; }
+
+private:
+ // methods
+ NPT_Result FlushEvent();
+
+ // members
+ int m_Pipe[2];
+};
+
+
+#endif /* _NPT_SELECTABLE_MESSAGE_QUEUE_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Serial Ports
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_SERIAL_PORT_H_
+#define _NPT_SERIAL_PORT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptStreams.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_NO_SUCH_SERIAL_PORT = NPT_ERROR_BASE_SERIAL_PORT - 0;
+const int NPT_ERROR_SERIAL_PORT_NOT_OPEN = NPT_ERROR_BASE_SERIAL_PORT - 1;
+const int NPT_ERROR_SERIAL_PORT_ALREADY_OPEN = NPT_ERROR_BASE_SERIAL_PORT - 2;
+const int NPT_ERROR_SERIAL_PORT_BUSY = NPT_ERROR_BASE_SERIAL_PORT - 3;
+
+typedef enum {
+ NPT_SERIAL_PORT_PARITY_NONE,
+ NPT_SERIAL_PORT_PARITY_EVEN,
+ NPT_SERIAL_PORT_PARITY_ODD,
+ NPT_SERIAL_PORT_PARITY_MARK
+} NPT_SerialPortParity;
+
+typedef enum {
+ NPT_SERIAL_PORT_STOP_BITS_1,
+ NPT_SERIAL_PORT_STOP_BITS_1_5,
+ NPT_SERIAL_PORT_STOP_BITS_2
+} NPT_SerialPortStopBits;
+
+typedef enum {
+ NPT_SERIAL_PORT_FLOW_CONTROL_NONE,
+ NPT_SERIAL_PORT_FLOW_CONTROL_HARDWARE,
+ NPT_SERIAL_PORT_FLOW_CONTROL_XON_XOFF
+} NPT_SerialPortFlowControl;
+
+/*----------------------------------------------------------------------
+| NPT_SerialPortInterface
++---------------------------------------------------------------------*/
+class NPT_SerialPortInterface
+{
+public:
+ // constructors and destructor
+ virtual ~NPT_SerialPortInterface() {}
+
+ // methods
+ virtual NPT_Result Open(unsigned int speed,
+ NPT_SerialPortStopBits stop_bits,
+ NPT_SerialPortFlowControl flow_control,
+ NPT_SerialPortParity parity) = 0;
+ virtual NPT_Result Close() = 0;
+ virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream) = 0;
+ virtual NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_SerialPort
++---------------------------------------------------------------------*/
+class NPT_SerialPort : public NPT_SerialPortInterface
+{
+public:
+ // constructors and destructor
+ NPT_SerialPort(const char* name);
+ ~NPT_SerialPort() { delete m_Delegate; }
+
+ // NPT_SerialPortInterface methods
+ NPT_Result Open(unsigned int speed,
+ NPT_SerialPortStopBits stop_bits = NPT_SERIAL_PORT_STOP_BITS_1,
+ NPT_SerialPortFlowControl flow_control = NPT_SERIAL_PORT_FLOW_CONTROL_NONE,
+ NPT_SerialPortParity parity = NPT_SERIAL_PORT_PARITY_NONE) {
+ return m_Delegate->Open(speed, stop_bits, flow_control, parity);
+ }
+ NPT_Result Close() {
+ return m_Delegate->Close();
+ }
+ NPT_Result GetInputStream(NPT_InputStreamReference& stream) {
+ return m_Delegate->GetInputStream(stream);
+ }
+ NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) {
+ return m_Delegate->GetOutputStream(stream);
+ }
+
+protected:
+ // members
+ NPT_SerialPortInterface* m_Delegate;
+};
+
+#endif // _NPT_SERIAL_PORT_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Simple Message Queue
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_SIMPLE_MESSAGE_QUEUE_H_
+#define _NPT_SIMPLE_MESSAGE_QUEUE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptThreads.h"
+#include "NptMessaging.h"
+#include "NptQueue.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+struct NPT_SimpleMessageCapsule;
+
+/*----------------------------------------------------------------------
+| NPT_SimpleMessageQueue
++---------------------------------------------------------------------*/
+class NPT_SimpleMessageQueue : public NPT_MessageQueue
+{
+ public:
+ // members
+ NPT_SimpleMessageQueue();
+ virtual ~NPT_SimpleMessageQueue();
+
+ // NPT_MessageQueue methods
+ virtual NPT_Result QueueMessage(NPT_Message* message,
+ NPT_MessageHandler* handler);
+ virtual NPT_Result PumpMessage(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
+
+ private:
+ // members
+ NPT_Queue<NPT_SimpleMessageCapsule> m_Queue;
+};
+
+#endif // _NPT_SIMPLE_MESSAGE_QUEUE_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Network Sockets
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_SOCKETS_H_
+#define _NPT_SOCKETS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptStreams.h"
+#include "NptStrings.h"
+#include "NptDataBuffer.h"
+#include "NptNetwork.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_CONNECTION_RESET = NPT_ERROR_BASE_SOCKET - 0;
+const int NPT_ERROR_CONNECTION_ABORTED = NPT_ERROR_BASE_SOCKET - 1;
+const int NPT_ERROR_CONNECTION_REFUSED = NPT_ERROR_BASE_SOCKET - 2;
+const int NPT_ERROR_CONNECTION_FAILED = NPT_ERROR_BASE_SOCKET - 3;
+const int NPT_ERROR_HOST_UNKNOWN = NPT_ERROR_BASE_SOCKET - 4;
+const int NPT_ERROR_SOCKET_FAILED = NPT_ERROR_BASE_SOCKET - 5;
+const int NPT_ERROR_GETSOCKOPT_FAILED = NPT_ERROR_BASE_SOCKET - 6;
+const int NPT_ERROR_SETSOCKOPT_FAILED = NPT_ERROR_BASE_SOCKET - 7;
+const int NPT_ERROR_SOCKET_CONTROL_FAILED = NPT_ERROR_BASE_SOCKET - 8;
+const int NPT_ERROR_BIND_FAILED = NPT_ERROR_BASE_SOCKET - 9;
+const int NPT_ERROR_LISTEN_FAILED = NPT_ERROR_BASE_SOCKET - 10;
+const int NPT_ERROR_ACCEPT_FAILED = NPT_ERROR_BASE_SOCKET - 11;
+const int NPT_ERROR_ADDRESS_IN_USE = NPT_ERROR_BASE_SOCKET - 12;
+const int NPT_ERROR_NETWORK_DOWN = NPT_ERROR_BASE_SOCKET - 13;
+const int NPT_ERROR_NETWORK_UNREACHABLE = NPT_ERROR_BASE_SOCKET - 14;
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+class NPT_Socket;
+
+/*----------------------------------------------------------------------
+| NPT_SocketAddress
++---------------------------------------------------------------------*/
+class NPT_SocketAddress
+{
+public:
+ // constructors and destructor
+ NPT_SocketAddress() : m_Port(0) {}
+ NPT_SocketAddress(const NPT_IpAddress& address, NPT_IpPort port) :
+ m_IpAddress(address),
+ m_Port(port) {}
+
+ // methods
+ NPT_Result SetIpAddress(const NPT_IpAddress& address) {
+ m_IpAddress = address;
+ return NPT_SUCCESS;
+ }
+ const NPT_IpAddress& GetIpAddress() const {
+ return m_IpAddress;
+ }
+ NPT_Result SetPort(NPT_IpPort port) {
+ m_Port = port;
+ return NPT_SUCCESS;
+ }
+ NPT_IpPort GetPort() const {
+ return m_Port;
+ }
+ NPT_String ToString() const;
+
+ // operators
+ bool operator==(const NPT_SocketAddress& other) const;
+
+private:
+ // members
+ NPT_IpAddress m_IpAddress;
+ NPT_IpPort m_Port;
+};
+
+/*----------------------------------------------------------------------
+| NPT_SocketInfo
++---------------------------------------------------------------------*/
+typedef struct {
+ NPT_SocketAddress local_address;
+ NPT_SocketAddress remote_address;
+} NPT_SocketInfo;
+
+/*----------------------------------------------------------------------
+| NPT_SocketInterface
++---------------------------------------------------------------------*/
+class NPT_SocketInterface
+{
+ public:
+ virtual ~NPT_SocketInterface() {}
+
+ // interface methods
+ virtual NPT_Result Bind(const NPT_SocketAddress& address, bool reuse_address = true) = 0;
+ virtual NPT_Result Connect(const NPT_SocketAddress& address, NPT_Timeout timeout) = 0;
+ virtual NPT_Result Disconnect() = 0;
+ virtual NPT_Result WaitForConnection(NPT_Timeout timeout) = 0;
+ virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream) = 0;
+ virtual NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) = 0;
+ virtual NPT_Result GetInfo(NPT_SocketInfo& info) = 0;
+ virtual NPT_Result SetBlockingMode(bool blocking) = 0;
+ virtual NPT_Result SetReadTimeout(NPT_Timeout timeout) = 0;
+ virtual NPT_Result SetWriteTimeout(NPT_Timeout timeout) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_UdpSocketInterface
++---------------------------------------------------------------------*/
+class NPT_UdpSocketInterface
+{
+ public:
+ virtual ~NPT_UdpSocketInterface() {}
+
+ // methods
+ virtual NPT_Result Send(const NPT_DataBuffer& packet,
+ const NPT_SocketAddress* address = NULL) = 0;
+ virtual NPT_Result Receive(NPT_DataBuffer& packet,
+ NPT_SocketAddress* address = NULL) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_UdpMulticastSocketInterface
++---------------------------------------------------------------------*/
+class NPT_UdpMulticastSocketInterface
+{
+ public:
+ virtual ~NPT_UdpMulticastSocketInterface() {}
+
+ // methods
+ virtual NPT_Result JoinGroup(const NPT_IpAddress& group,
+ const NPT_IpAddress& iface) = 0;
+ virtual NPT_Result LeaveGroup(const NPT_IpAddress& group,
+ const NPT_IpAddress& iface) = 0;
+ virtual NPT_Result SetTimeToLive(unsigned char ttl) = 0;
+ virtual NPT_Result SetInterface(const NPT_IpAddress& iface) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_TcpServerSocketInterface
++---------------------------------------------------------------------*/
+class NPT_TcpServerSocketInterface
+{
+ public:
+ virtual ~NPT_TcpServerSocketInterface() {}
+
+ // interface methods
+ virtual NPT_Result Listen(unsigned int max_clients) = 0;
+ virtual NPT_Result WaitForNewClient(NPT_Socket*& client,
+ NPT_Timeout timeout) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Socket
++---------------------------------------------------------------------*/
+class NPT_Socket : public NPT_SocketInterface
+{
+public:
+ // constructor and destructor
+ NPT_Socket(NPT_SocketInterface* delegate) :
+ m_SocketDelegate(delegate) {}
+ virtual ~NPT_Socket();
+
+ // delegate NPT_SocketInterface methods
+ NPT_Result Bind(const NPT_SocketAddress& address, bool reuse_address = true) {
+ return m_SocketDelegate->Bind(address, reuse_address);
+ }
+ NPT_Result Connect(const NPT_SocketAddress& address,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_SocketDelegate->Connect(address, timeout);
+ }
+ NPT_Result Disconnect() {
+ return m_SocketDelegate->Disconnect();
+ }
+ NPT_Result WaitForConnection(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_SocketDelegate->WaitForConnection(timeout);
+ }
+ NPT_Result GetInputStream(NPT_InputStreamReference& stream) {
+ return m_SocketDelegate->GetInputStream(stream);
+ }
+ NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) {
+ return m_SocketDelegate->GetOutputStream(stream);
+ }
+ NPT_Result GetInfo(NPT_SocketInfo& info) {
+ return m_SocketDelegate->GetInfo(info);
+ }
+ NPT_Result SetBlockingMode(bool blocking) {
+ return m_SocketDelegate->SetBlockingMode(blocking);
+ }
+ NPT_Result SetReadTimeout(NPT_Timeout timeout) {
+ return m_SocketDelegate->SetReadTimeout(timeout);
+ }
+ NPT_Result SetWriteTimeout(NPT_Timeout timeout) {
+ return m_SocketDelegate->SetWriteTimeout(timeout);
+ }
+
+protected:
+ // constructor
+ NPT_Socket() {}
+
+ // members
+ NPT_SocketInterface* m_SocketDelegate;
+};
+
+typedef NPT_Reference<NPT_Socket> NPT_SocketReference;
+
+/*----------------------------------------------------------------------
+| NPT_UdpSocket
++---------------------------------------------------------------------*/
+class NPT_UdpSocket : public NPT_Socket,
+ public NPT_UdpSocketInterface
+{
+ public:
+ // constructor and destructor
+ NPT_UdpSocket();
+ virtual ~NPT_UdpSocket();
+
+ // delegate NPT_UdpSocketInterface methods
+ NPT_Result Send(const NPT_DataBuffer& packet,
+ const NPT_SocketAddress* address = NULL) {
+ return m_UdpSocketDelegate->Send(packet, address);
+ }
+ NPT_Result Receive(NPT_DataBuffer& packet,
+ NPT_SocketAddress* address = NULL) {
+ return m_UdpSocketDelegate->Receive(packet, address);
+ }
+
+protected:
+ // constructor
+ NPT_UdpSocket(NPT_UdpSocketInterface* delegate);
+
+ // members
+ NPT_UdpSocketInterface* m_UdpSocketDelegate;
+};
+
+/*----------------------------------------------------------------------
+| NPT_UdpMulticastSocket
++---------------------------------------------------------------------*/
+class NPT_UdpMulticastSocket : public NPT_UdpSocket,
+ public NPT_UdpMulticastSocketInterface
+{
+public:
+ // constructor and destructor
+ NPT_UdpMulticastSocket();
+ virtual ~NPT_UdpMulticastSocket();
+
+ // delegate NPT_UdpMulticastSocketInterface methods
+ NPT_Result JoinGroup(const NPT_IpAddress& group,
+ const NPT_IpAddress& iface =
+ NPT_IpAddress::Any) {
+ return m_UdpMulticastSocketDelegate->JoinGroup(group, iface);
+ }
+ NPT_Result LeaveGroup(const NPT_IpAddress& group,
+ const NPT_IpAddress& iface =
+ NPT_IpAddress::Any) {
+ return m_UdpMulticastSocketDelegate->LeaveGroup(group, iface);
+ }
+ NPT_Result SetTimeToLive(unsigned char ttl) {
+ return m_UdpMulticastSocketDelegate->SetTimeToLive(ttl);
+ }
+ NPT_Result SetInterface(const NPT_IpAddress& iface) {
+ return m_UdpMulticastSocketDelegate->SetInterface(iface);
+ }
+
+protected:
+ // members
+ NPT_UdpMulticastSocketInterface* m_UdpMulticastSocketDelegate;
+};
+
+/*----------------------------------------------------------------------
+| NPT_TcpClientSocket
++---------------------------------------------------------------------*/
+class NPT_TcpClientSocket : public NPT_Socket
+{
+public:
+ // constructors and destructor
+ NPT_TcpClientSocket();
+ virtual ~NPT_TcpClientSocket();
+};
+
+/*----------------------------------------------------------------------
+| NPT_TcpServerSocket
++---------------------------------------------------------------------*/
+class NPT_TcpServerSocket : public NPT_Socket,
+ public NPT_TcpServerSocketInterface
+{
+public:
+ // constructors and destructor
+ NPT_TcpServerSocket();
+ virtual ~NPT_TcpServerSocket();
+
+ // delegate NPT_TcpServerSocketInterface methods
+ NPT_Result Listen(unsigned int max_clients) {
+ return m_TcpServerSocketDelegate->Listen(max_clients);
+ }
+ NPT_Result WaitForNewClient(NPT_Socket*& client,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_TcpServerSocketDelegate->WaitForNewClient(client, timeout);
+ }
+
+protected:
+ // members
+ NPT_TcpServerSocketInterface* m_TcpServerSocketDelegate;
+};
+
+#endif // _NPT_SOCKETS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Stack
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+****************************************************************/
+
+#ifndef _NPT_STACK_H_
+#define _NPT_STACK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptResults.h"
+#include "NptTypes.h"
+#include "NptList.h"
+
+/*----------------------------------------------------------------------
+| NPT_Stack
++---------------------------------------------------------------------*/
+template <typename T>
+class NPT_Stack : public NPT_List<T>
+{
+public:
+ // methods
+ NPT_Result Push(const T& value) {
+ return Add(value);
+ }
+
+ NPT_Result Peek(T& value) {
+ // NOTE: we must use the this-> accessor here because the standard
+ // requires it when the member to look up is in a parent template
+ if (this->m_ItemCount == 0) return NPT_ERROR_NO_SUCH_ITEM;
+ value = this->m_Tail->m_Data;
+ return NPT_SUCCESS;
+ }
+
+ NPT_Result Pop(T& value) {
+ // NOTE: we must use the this-> accessor here because the standard
+ // requires it when the member to look up is in a parent template
+ if (this->m_ItemCount == 0) return NPT_ERROR_NO_SUCH_ITEM;
+ typename NPT_List<T>::Iterator tail = this->GetLastItem();
+ value = *tail;
+ return this->Erase(tail);
+ }
+};
+
+#endif // _NPT_STACK_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Byte Streams
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_STREAMS_H_
+#define _NPT_STREAMS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptReferences.h"
+#include "NptConstants.h"
+#include "NptResults.h"
+#include "NptDataBuffer.h"
+#include "NptStrings.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class NPT_String;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_READ_FAILED = NPT_ERROR_BASE_IO - 0;
+const int NPT_ERROR_WRITE_FAILED = NPT_ERROR_BASE_IO - 1;
+const int NPT_ERROR_EOS = NPT_ERROR_BASE_IO - 2;
+
+/*----------------------------------------------------------------------
+| NPT_InputStream
++---------------------------------------------------------------------*/
+class NPT_InputStream
+{
+ public:
+ // constructor and destructor
+ virtual ~NPT_InputStream() {};
+
+ // methods
+ virtual NPT_Result Load(NPT_DataBuffer& buffer, NPT_Size max_read = 0);
+ virtual NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL) = 0;
+ virtual NPT_Result ReadFully(void* buffer,
+ NPT_Size bytes_to_read);
+ virtual NPT_Result Seek(NPT_Position offset) = 0;
+ virtual NPT_Result Skip(NPT_Size offset);
+ virtual NPT_Result Tell(NPT_Position& offset) = 0;
+ virtual NPT_Result GetSize(NPT_LargeSize& size) = 0;
+ virtual NPT_Result GetAvailable(NPT_LargeSize& available) = 0;
+ virtual NPT_Result Close() { return NPT_SUCCESS; }
+
+ // data access methods
+ NPT_Result ReadUI64(NPT_UInt64& value);
+ NPT_Result ReadUI32(NPT_UInt32& value);
+ NPT_Result ReadUI24(NPT_UInt32& value);
+ NPT_Result ReadUI16(NPT_UInt16& value);
+ NPT_Result ReadUI08(NPT_UInt8& value);
+};
+
+typedef NPT_Reference<NPT_InputStream> NPT_InputStreamReference;
+
+/*----------------------------------------------------------------------
+| NPT_OutputStream
++---------------------------------------------------------------------*/
+class NPT_OutputStream
+{
+public:
+ // constructor and destructor
+ virtual ~NPT_OutputStream() {};
+
+ // methods
+ virtual NPT_Result Write(const void* buffer,
+ NPT_Size bytes_to_write,
+ NPT_Size* bytes_written = NULL) = 0;
+ virtual NPT_Result WriteFully(const void* buffer,
+ NPT_Size bytes_to_write);
+ virtual NPT_Result WriteString(const char* string_buffer);
+ virtual NPT_Result WriteLine(const char* line_buffer);
+ virtual NPT_Result Seek(NPT_Position offset) = 0;
+ virtual NPT_Result Tell(NPT_Position& offset) = 0;
+ virtual NPT_Result Flush() { return NPT_SUCCESS; }
+
+ // data access methods
+ NPT_Result WriteUI64(NPT_UInt64 value);
+ NPT_Result WriteUI32(NPT_UInt32 value);
+ NPT_Result WriteUI24(NPT_UInt32 value);
+ NPT_Result WriteUI16(NPT_UInt16 value);
+ NPT_Result WriteUI08(NPT_UInt8 value);
+};
+
+typedef NPT_Reference<NPT_OutputStream> NPT_OutputStreamReference;
+
+/*----------------------------------------------------------------------
+| NPT_StreamToStreamCopy
++---------------------------------------------------------------------*/
+NPT_Result NPT_StreamToStreamCopy(NPT_InputStream& from,
+ NPT_OutputStream& to,
+ NPT_Position offset = 0,
+ NPT_LargeSize size = 0, /* 0 means the entire stream */
+ NPT_LargeSize* bytes_written = NULL);
+
+/*----------------------------------------------------------------------
+| NPT_DelegatingInputStream
+|
+| Use this class as a base class if you need to inherit both from
+| NPT_InputStream and NPT_OutputStream which share the Seek and Tell
+| method. In this case, you override the base-specific version of
+| those methods, InputSeek, InputTell, instead of the Seek and Tell
+| methods.
++---------------------------------------------------------------------*/
+class NPT_DelegatingInputStream : public NPT_InputStream
+{
+public:
+ // NPT_InputStream methods
+ NPT_Result Seek(NPT_Position offset) {
+ return InputSeek(offset);
+ }
+ NPT_Result Tell(NPT_Position& offset) {
+ return InputTell(offset);
+ }
+
+private:
+ // methods
+ virtual NPT_Result InputSeek(NPT_Position offset) = 0;
+ virtual NPT_Result InputTell(NPT_Position& offset) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_DelegatingOutputStream
+|
+| Use this class as a base class if you need to inherit both from
+| NPT_InputStream and NPT_OutputStream which share the Seek and Tell
+| method. In this case, you override the base-specific version of
+| those methods, OutputSeek and OutputTell, instead of the Seek and
+| Tell methods.
++---------------------------------------------------------------------*/
+class NPT_DelegatingOutputStream : public NPT_OutputStream
+{
+public:
+ // NPT_OutputStream methods
+ NPT_Result Seek(NPT_Position offset) {
+ return OutputSeek(offset);
+ }
+ NPT_Result Tell(NPT_Position& offset) {
+ return OutputTell(offset);
+ }
+
+private:
+ // methods
+ virtual NPT_Result OutputSeek(NPT_Position offset) = 0;
+ virtual NPT_Result OutputTell(NPT_Position& offset) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_MemoryStream
++---------------------------------------------------------------------*/
+class NPT_MemoryStream :
+ public NPT_DelegatingInputStream,
+ public NPT_DelegatingOutputStream
+{
+public:
+ // constructor and destructor
+ NPT_MemoryStream(NPT_Size initial_capacity = 0);
+ NPT_MemoryStream(const void* data, NPT_Size size);
+ virtual ~NPT_MemoryStream() {}
+
+ // accessors
+ const NPT_DataBuffer& GetBuffer() const { return m_Buffer; }
+
+ // NPT_InputStream methods
+ NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL);
+ NPT_Result GetSize(NPT_LargeSize& size) {
+ size = m_Buffer.GetDataSize();
+ return NPT_SUCCESS;
+ }
+ NPT_Result GetAvailable(NPT_LargeSize& available) {
+ available = (NPT_LargeSize)m_Buffer.GetDataSize()-m_ReadOffset;
+ return NPT_SUCCESS;
+ }
+
+ // NPT_OutputStream methods
+ NPT_Result Write(const void* buffer,
+ NPT_Size bytes_to_write,
+ NPT_Size* bytes_written = NULL);
+
+ // methods delegated to m_Buffer
+ const NPT_Byte* GetData() const { return m_Buffer.GetData(); }
+ NPT_Byte* UseData() { return m_Buffer.UseData(); }
+ NPT_Size GetDataSize() const { return m_Buffer.GetDataSize(); }
+ NPT_Size GetBufferSize() const { return m_Buffer.GetBufferSize();}
+
+ // methods
+ NPT_Result SetDataSize(NPT_Size size);
+
+private:
+ // NPT_DelegatingInputStream methods
+ NPT_Result InputSeek(NPT_Position offset);
+ NPT_Result InputTell(NPT_Position& offset) {
+ offset = m_ReadOffset;
+ return NPT_SUCCESS;
+ }
+
+ // NPT_DelegatingOutputStream methods
+ NPT_Result OutputSeek(NPT_Position offset);
+ NPT_Result OutputTell(NPT_Position& offset) {
+ offset = m_WriteOffset;
+ return NPT_SUCCESS;
+ }
+
+protected:
+ // members
+ NPT_DataBuffer m_Buffer;
+ NPT_Size m_ReadOffset;
+ NPT_Size m_WriteOffset;
+};
+
+typedef NPT_Reference<NPT_MemoryStream> NPT_MemoryStreamReference;
+
+/*----------------------------------------------------------------------
+| NPT_StringOutputStream
++---------------------------------------------------------------------*/
+class NPT_StringOutputStream : public NPT_OutputStream
+{
+public:
+ // methods
+ NPT_StringOutputStream(NPT_Size size = 4096);
+ NPT_StringOutputStream(NPT_String* storage);
+ virtual ~NPT_StringOutputStream() ;
+
+ const NPT_String& GetString() const { return *m_String; }
+ NPT_Result Reset() { if (m_String) m_String->SetLength(0); return NPT_SUCCESS; }
+
+ // NPT_OutputStream methods
+ NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL);
+
+ NPT_Result Seek(NPT_Position /*offset*/) { return NPT_ERROR_NOT_SUPPORTED; }
+ NPT_Result Tell(NPT_Position& offset) { offset = m_String->GetLength(); return NPT_SUCCESS; }
+
+protected:
+ NPT_String* m_String;
+ bool m_StringIsOwned;
+};
+
+typedef NPT_Reference<NPT_StringOutputStream> NPT_StringOutputStreamReference;
+
+/*----------------------------------------------------------------------
+| NPT_SubInputStream
++---------------------------------------------------------------------*/
+class NPT_SubInputStream : public NPT_InputStream
+{
+public:
+ // constructor and destructor
+ NPT_SubInputStream(NPT_InputStreamReference& source,
+ NPT_Position start,
+ NPT_LargeSize size);
+
+ // methods
+ virtual NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL) = 0;
+ virtual NPT_Result Seek(NPT_Position offset) = 0;
+ virtual NPT_Result Tell(NPT_Position& offset) = 0;
+ virtual NPT_Result GetSize(NPT_LargeSize& size) = 0;
+ virtual NPT_Result GetAvailable(NPT_LargeSize& available) = 0;
+
+private:
+ NPT_InputStreamReference m_Source;
+ NPT_Position m_Position;
+ NPT_Position m_Start;
+ NPT_LargeSize m_Size;
+};
+
+/*----------------------------------------------------------------------
+| NPT_NullOutputStream
++---------------------------------------------------------------------*/
+class NPT_NullOutputStream : public NPT_OutputStream
+{
+public:
+ // methods
+ NPT_NullOutputStream() {}
+ virtual ~NPT_NullOutputStream() {}
+
+ // NPT_OutputStream methods
+ NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL);
+
+ NPT_Result Seek(NPT_Position /*offset*/) { return NPT_ERROR_NOT_SUPPORTED; }
+ NPT_Result Tell(NPT_Position& /*offset*/) { return NPT_ERROR_NOT_SUPPORTED; }
+};
+
+typedef NPT_Reference<NPT_NullOutputStream> NPT_NullOutputStreamReference;
+
+#endif // _NPT_STREAMS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - String Objects
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_STRINGS_H_
+#define _NPT_STRINGS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#if defined(NPT_CONFIG_HAVE_NEW_H)
+#include <new>
+#endif
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptList.h"
+#include "NptDebug.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_STRING_SEARCH_FAILED = -1;
+
+/*----------------------------------------------------------------------
+| NPT_String
++---------------------------------------------------------------------*/
+class NPT_String
+{
+public:
+ // factories
+ static NPT_String FromInteger(NPT_Int64 value);
+ static NPT_String FromIntegerU(NPT_UInt64 value);
+ static NPT_String Format(const char* format, ...);
+
+ // constructors
+ NPT_String(const NPT_String& str);
+ NPT_String(const char* str);
+ NPT_String(const char* str, NPT_Size length);
+ NPT_String(const char* str, NPT_Ordinal first, NPT_Size length);
+ NPT_String(char c, NPT_Cardinal repeat = 1);
+ NPT_String() : m_Chars(NULL) {}
+ ~NPT_String() { if (m_Chars) delete GetBuffer(); }
+
+ // string info and manipulations
+ bool IsEmpty() const { return m_Chars == NULL || GetBuffer()->GetLength() == 0; }
+ NPT_Size GetLength() const { return m_Chars ? GetBuffer()->GetLength() : 0; }
+ NPT_Size GetCapacity() const { return m_Chars ? GetBuffer()->GetAllocated() : 0; }
+ NPT_Result SetLength(NPT_Size length, bool pad = false);
+ void Assign(const char* chars, NPT_Size size);
+ void Append(const char* chars, NPT_Size size);
+ void Append(const char* s) { Append(s, StringLength(s)); }
+ int Compare(const char* s, bool ignore_case = false) const;
+ static int Compare(const char* s1, const char* s2, bool ignore_case = false);
+ int CompareN(const char* s, NPT_Size count, bool ignore_case = false) const;
+ static int CompareN(const char* s1, const char* s2, NPT_Size count, bool ignore_case = false);
+
+ // substrings
+ NPT_String SubString(NPT_Ordinal first, NPT_Size length) const;
+ NPT_String SubString(NPT_Ordinal first) const {
+ return SubString(first, GetLength());
+ }
+ NPT_String Left(NPT_Size length) const {
+ return SubString(0, length);
+ }
+ NPT_String Right(NPT_Size length) const {
+ return length >= GetLength() ?
+ *this :
+ SubString(GetLength()-length, length);
+ }
+ NPT_List<NPT_String> Split(const char* separator) const;
+ static NPT_String Join(NPT_List<NPT_String>& args, const char* separator);
+
+ // buffer management
+ void Reserve(NPT_Size length);
+
+ // conversions
+ NPT_String ToLowercase() const;
+ NPT_String ToUppercase() const;
+ NPT_Result ToInteger(int& value, bool relaxed = true) const;
+ NPT_Result ToInteger(unsigned int& value, bool relaxed = true) const;
+ NPT_Result ToInteger(long& value, bool relaxed = true) const;
+ NPT_Result ToInteger(unsigned long& value, bool relaxed = true) const;
+ NPT_Result ToInteger32(NPT_Int32& value, bool relaxed = true) const;
+ NPT_Result ToInteger32(NPT_UInt32& value, bool relaxed = true) const;
+ NPT_Result ToInteger64(NPT_Int64& value, bool relaxed = true) const;
+ NPT_Result ToInteger64(NPT_UInt64& value, bool relaxed = true) const;
+ NPT_Result ToFloat(float& value, bool relaxed = true) const;
+
+ // processing
+ void MakeLowercase();
+ void MakeUppercase();
+ void Replace(char a, char b);
+ void Replace(char a, const char* b);
+
+ // search
+ int Find(char c, NPT_Ordinal start = 0, bool ignore_case = false) const;
+ int Find(const char* s, NPT_Ordinal start = 0, bool ignore_case = false) const;
+ int ReverseFind(char c, NPT_Ordinal start = 0, bool ignore_case = false) const;
+ int ReverseFind(const char* s, NPT_Ordinal start = 0, bool ignore_case = false) const;
+ bool StartsWith(const char* s, bool ignore_case = false) const;
+ bool EndsWith(const char* s, bool ignore_case = false) const;
+
+ // editing
+ void Insert(const char* s, NPT_Ordinal where = 0);
+ void Erase(NPT_Ordinal start, NPT_Cardinal count = 1);
+ void Replace(NPT_Ordinal start, NPT_Cardinal count, const char* s);
+ void TrimLeft();
+ void TrimLeft(char c);
+ void TrimLeft(const char* chars);
+ void TrimRight();
+ void TrimRight(char c);
+ void TrimRight(const char* chars);
+ void Trim();
+ void Trim(char c);
+ void Trim(const char* chars);
+
+ // type casting
+ operator char*() const { return m_Chars ? m_Chars: &EmptyString; }
+ operator const char* () const { return m_Chars ? m_Chars: &EmptyString; }
+ const char* GetChars() const { return m_Chars ? m_Chars: &EmptyString; }
+ char* UseChars() { return m_Chars ? m_Chars: &EmptyString; }
+
+ // operator overloading
+ NPT_String& operator=(const char* str);
+ NPT_String& operator=(const NPT_String& str);
+ NPT_String& operator=(char c);
+ const NPT_String& operator+=(const NPT_String& s) {
+ Append(s.GetChars(), s.GetLength());
+ return *this;
+ }
+ const NPT_String& operator+=(const char* s) {
+ Append(s);
+ return *this;
+ }
+ const NPT_String& operator+=(char c) {
+ Append(&c, 1);
+ return *this;
+ }
+ char operator[](int index) const {
+ NPT_ASSERT((unsigned int)index < GetLength());
+ return GetChars()[index];
+ }
+ char& operator[](int index) {
+ NPT_ASSERT((unsigned int)index < GetLength());
+ return UseChars()[index];
+ }
+
+ // friend operators
+ friend NPT_String operator+(const NPT_String& s1, const NPT_String& s2) {
+ return s1+s2.GetChars();
+ }
+ friend NPT_String operator+(const NPT_String& s1, const char* s2);
+ friend NPT_String operator+(const char* s1, const NPT_String& s2);
+ friend NPT_String operator+(const NPT_String& s, char c);
+ friend NPT_String operator+(char c, const NPT_String& s);
+
+protected:
+ // inner classes
+ class Buffer {
+ public:
+ // class methods
+ static Buffer* Allocate(NPT_Size allocated, NPT_Size length) {
+ void* mem = ::operator new(sizeof(Buffer)+allocated+1);
+ return new(mem) Buffer(allocated, length);
+ }
+ static char* Create(NPT_Size allocated, NPT_Size length=0) {
+ Buffer* shared = Allocate(allocated, length);
+ return shared->GetChars();
+ }
+ static char* Create(const char* copy) {
+ NPT_Size length = StringLength(copy);
+ Buffer* shared = Allocate(length, length);
+ CopyString(shared->GetChars(), copy);
+ return shared->GetChars();
+ }
+ static char* Create(const char* copy, NPT_Size length) {
+ Buffer* shared = Allocate(length, length);
+ CopyBuffer(shared->GetChars(), copy, length);
+ shared->GetChars()[length] = '\0';
+ return shared->GetChars();
+ }
+ static char* Create(char c, NPT_Cardinal repeat) {
+ Buffer* shared = Allocate(repeat, repeat);
+ char* s = shared->GetChars();
+ while (repeat--) {
+ *s++ = c;
+ }
+ *s = '\0';
+ return shared->GetChars();
+ }
+
+ // methods
+ char* GetChars() {
+ // return a pointer to the first char
+ return reinterpret_cast<char*>(this+1);
+ }
+ NPT_Size GetLength() const { return m_Length; }
+ void SetLength(NPT_Size length) { m_Length = length; }
+ NPT_Size GetAllocated() const { return m_Allocated; }
+
+ private:
+ // methods
+ Buffer(NPT_Size allocated, NPT_Size length = 0) :
+ m_Length(length),
+ m_Allocated(allocated) {}
+
+ // members
+ NPT_Cardinal m_Length;
+ NPT_Cardinal m_Allocated;
+ // the actual string data follows
+
+ };
+
+ // members
+ char* m_Chars;
+
+private:
+ // friends
+ friend class Buffer;
+
+ // static members
+ static char EmptyString;
+
+ // methods
+ Buffer* GetBuffer() const {
+ return reinterpret_cast<Buffer*>(m_Chars)-1;
+ }
+ void Reset() {
+ if (m_Chars != NULL) {
+ delete GetBuffer();
+ m_Chars = NULL;
+ }
+ }
+ char* PrepareToWrite(NPT_Size length);
+ void PrepareToAppend(NPT_Size length, NPT_Size allocate);
+
+ // static methods
+ static void CopyString(char* dst, const char* src) {
+ while ((*dst++ = *src++)){}
+ }
+
+ static void CopyBuffer(char* dst, const char* src, NPT_Size size) {
+ while (size--) *dst++ = *src++;
+ }
+
+ static NPT_Size StringLength(const char* str) {
+ NPT_Size length = 0;
+ while (*str++) length++;
+ return length;
+ }
+};
+
+/*----------------------------------------------------------------------
+| external operators
++---------------------------------------------------------------------*/
+inline bool operator==(const NPT_String& s1, const NPT_String& s2) {
+ return s1.Compare(s2) == 0;
+}
+inline bool operator==(const NPT_String& s1, const char* s2) {
+ return s1.Compare(s2) == 0;
+}
+inline bool operator==(const char* s1, const NPT_String& s2) {
+ return s2.Compare(s1) == 0;
+}
+inline bool operator!=(const NPT_String& s1, const NPT_String& s2) {
+ return s1.Compare(s2) != 0;
+}
+inline bool operator!=(const NPT_String& s1, const char* s2) {
+ return s1.Compare(s2) != 0;
+}
+inline bool operator!=(const char* s1, const NPT_String& s2) {
+ return s2.Compare(s1) != 0;
+}
+inline bool operator<(const NPT_String& s1, const NPT_String& s2) {
+ return s1.Compare(s2) < 0;
+}
+inline bool operator<(const NPT_String& s1, const char* s2) {
+ return s1.Compare(s2) < 0;
+}
+inline bool operator<(const char* s1, const NPT_String& s2) {
+ return s2.Compare(s1) > 0;
+}
+inline bool operator>(const NPT_String& s1, const NPT_String& s2) {
+ return s1.Compare(s2) > 0;
+}
+inline bool operator>(const NPT_String& s1, const char* s2) {
+ return s1.Compare(s2) > 0;
+}
+inline bool operator>(const char* s1, const NPT_String& s2) {
+ return s2.Compare(s1) < 0;
+}
+inline bool operator<=(const NPT_String& s1, const NPT_String& s2) {
+ return s1.Compare(s2) <= 0;
+}
+inline bool operator<=(const NPT_String& s1, const char* s2) {
+ return s1.Compare(s2) <= 0;
+}
+inline bool operator<=(const char* s1, const NPT_String& s2) {
+ return s2.Compare(s1) >= 0;
+}
+inline bool operator>=(const NPT_String& s1, const NPT_String& s2) {
+ return s1.Compare(s2) >= 0;
+}
+inline bool operator>=(const NPT_String& s1, const char* s2) {
+ return s1.Compare(s2) >= 0;
+}
+inline bool operator>=(const char* s1, const NPT_String& s2) {
+ return s2.Compare(s1) <= 0;
+}
+
+#endif // _NPT_STRINGS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - System
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_SYSTEM_H_
+#define _NPT_SYSTEM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptTime.h"
+
+/*----------------------------------------------------------------------
+| NPT_System
++---------------------------------------------------------------------*/
+class NPT_System
+{
+public:
+ // methods
+ static NPT_Result GetProcessId(NPT_UInt32& id);
+ static NPT_Result GetCurrentTimeStamp(NPT_TimeStamp& now);
+ static NPT_Result Sleep(const NPT_TimeInterval& duration);
+ static NPT_Result SleepUntil(const NPT_TimeStamp& when);
+ static NPT_Result SetRandomSeed(unsigned int seed);
+ static NPT_UInt32 GetRandomInteger();
+
+protected:
+ // constructor
+ NPT_System() {}
+};
+
+#endif // _NPT_SYSTEM_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Threads
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_THREADS_H_
+#define _NPT_THREADS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptConstants.h"
+#include "NptInterfaces.h"
+
+/*----------------------------------------------------------------------
+| error codes
++---------------------------------------------------------------------*/
+const int NPT_ERROR_CALLBACK_HANDLER_SHUTDOWN = NPT_ERROR_BASE_THREADS-0;
+const int NPT_ERROR_CALLBACK_NOTHING_PENDING = NPT_ERROR_BASE_THREADS-1;
+
+/*----------------------------------------------------------------------
+| NPT_MutexInterface
++---------------------------------------------------------------------*/
+class NPT_MutexInterface
+{
+ public:
+ // methods
+ virtual ~NPT_MutexInterface() {}
+ virtual NPT_Result Lock() = 0;
+ virtual NPT_Result Unlock() = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Mutex
++---------------------------------------------------------------------*/
+class NPT_Mutex : public NPT_MutexInterface
+{
+ public:
+ // methods
+ NPT_Mutex();
+ ~NPT_Mutex() { delete m_Delegate; }
+ NPT_Result Lock() { return m_Delegate->Lock(); }
+ NPT_Result Unlock() { return m_Delegate->Unlock(); }
+
+ private:
+ // members
+ NPT_MutexInterface* m_Delegate;
+};
+
+/*----------------------------------------------------------------------
+| NPT_AutoLock
++---------------------------------------------------------------------*/
+class NPT_AutoLock
+{
+ public:
+ // methods
+ NPT_AutoLock(NPT_Mutex &mutex) : m_Mutex(mutex) {
+ m_Mutex.Lock();
+ }
+ ~NPT_AutoLock() {
+ m_Mutex.Unlock();
+ }
+
+ private:
+ // members
+ NPT_Mutex& m_Mutex;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Lock
++---------------------------------------------------------------------*/
+template <typename T>
+class NPT_Lock : public T,
+ public NPT_Mutex
+{
+};
+
+/*----------------------------------------------------------------------
+| NPT_SharedVariableInterface
++---------------------------------------------------------------------*/
+class NPT_SharedVariableInterface
+{
+ public:
+ // methods
+ virtual ~NPT_SharedVariableInterface() {}
+ virtual void SetValue(int value)= 0;
+ virtual int GetValue() = 0;
+ virtual NPT_Result WaitUntilEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+ virtual NPT_Result WaitWhileEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_SharedVariable
++---------------------------------------------------------------------*/
+class NPT_SharedVariable : public NPT_SharedVariableInterface
+{
+ public:
+ // methods
+ NPT_SharedVariable(int value = 0);
+ ~NPT_SharedVariable() { delete m_Delegate; }
+ void SetValue(int value) {
+ m_Delegate->SetValue(value);
+ }
+ int GetValue() {
+ return m_Delegate->GetValue();
+ }
+ NPT_Result WaitUntilEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_Delegate->WaitUntilEquals(value, timeout);
+ }
+ NPT_Result WaitWhileEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_Delegate->WaitWhileEquals(value, timeout);
+ }
+
+ private:
+ // members
+ NPT_SharedVariableInterface* m_Delegate;
+};
+
+/*----------------------------------------------------------------------
+| NPT_AtomicVariableInterface
++---------------------------------------------------------------------*/
+class NPT_AtomicVariableInterface
+{
+ public:
+ // methods
+ virtual ~NPT_AtomicVariableInterface() {}
+ virtual int Increment() = 0;
+ virtual int Decrement() = 0;
+ virtual int GetValue() = 0;
+ virtual void SetValue(int value) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_AtomicVariable
++---------------------------------------------------------------------*/
+class NPT_AtomicVariable : public NPT_AtomicVariableInterface
+{
+ public:
+ // methods
+ NPT_AtomicVariable(int value = 0);
+ ~NPT_AtomicVariable() { delete m_Delegate; }
+ int Increment() { return m_Delegate->Increment();}
+ int Decrement() { return m_Delegate->Decrement();}
+ void SetValue(int value) { m_Delegate->SetValue(value); }
+ int GetValue() { return m_Delegate->GetValue(); }
+
+ private:
+ // members
+ NPT_AtomicVariableInterface* m_Delegate;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Runnable
++---------------------------------------------------------------------*/
+class NPT_Runnable
+{
+public:
+ virtual ~NPT_Runnable() {}
+ virtual void Run() = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_ThreadInterface
++---------------------------------------------------------------------*/
+class NPT_ThreadInterface: public NPT_Runnable, public NPT_Interruptible
+{
+ public:
+ // methods
+ virtual ~NPT_ThreadInterface() {}
+ virtual NPT_Result Start() = 0;
+ virtual NPT_Result Wait(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Thread
++---------------------------------------------------------------------*/
+class NPT_Thread : public NPT_ThreadInterface
+{
+ public:
+ // types
+ typedef unsigned long ThreadId;
+
+ // class methods
+ static ThreadId GetCurrentThreadId();
+
+ // methods
+ explicit NPT_Thread(bool detached = false);
+ explicit NPT_Thread(NPT_Runnable& target, bool detached = false);
+ ~NPT_Thread() { delete m_Delegate; }
+
+ // NPT_ThreadInterface methods
+ NPT_Result Start() {
+ return m_Delegate->Start();
+ }
+ NPT_Result Wait(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return m_Delegate->Wait(timeout);
+ }
+
+ // NPT_Runnable methods
+ virtual void Run() {}
+
+ // NPT_Interruptible methods
+ virtual NPT_Result Interrupt() {
+ return m_Delegate->Interrupt();
+ }
+
+ private:
+ // members
+ NPT_ThreadInterface* m_Delegate;
+};
+
+
+/*----------------------------------------------------------------------
+| NPT_ThreadCallbackReceiver
++---------------------------------------------------------------------*/
+class NPT_ThreadCallbackReceiver
+{
+public:
+ virtual ~NPT_ThreadCallbackReceiver() {}
+ virtual void OnCallback(void* args) = 0;
+};
+
+/*----------------------------------------------------------------------
+| NPT_ThreadCallbackSlot
++---------------------------------------------------------------------*/
+class NPT_ThreadCallbackSlot
+{
+public:
+ // types
+ class NotificationHelper {
+ public:
+ virtual ~NotificationHelper() {};
+ virtual void Notify(void) = 0;
+ };
+
+ // constructor
+ NPT_ThreadCallbackSlot();
+
+ // methods
+ NPT_Result ReceiveCallback(NPT_ThreadCallbackReceiver& receiver, NPT_Timeout timeout = 0);
+ NPT_Result SendCallback(void* args);
+ NPT_Result SetNotificationHelper(NotificationHelper* helper);
+ NPT_Result Shutdown();
+
+protected:
+ // members
+ volatile void* m_CallbackArgs;
+ volatile bool m_Shutdown;
+ NPT_SharedVariable m_Pending;
+ NPT_SharedVariable m_Ack;
+ NPT_Mutex m_ReadLock;
+ NPT_Mutex m_WriteLock;
+ NotificationHelper* m_NotificationHelper;
+};
+
+#endif // _NPT_THREADS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Time
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_TIME_H_
+#define _NPT_TIME_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+
+/*----------------------------------------------------------------------
+| NPT_TimeStamp
++---------------------------------------------------------------------*/
+class NPT_TimeStamp
+{
+ public:
+ // methods
+ NPT_TimeStamp(unsigned long seconds = 0, unsigned long nano_seconds = 0) :
+ m_Seconds(seconds), m_NanoSeconds(nano_seconds) {}
+ NPT_TimeStamp(float seconds);
+ operator float() const;
+ NPT_TimeStamp& operator+=(const NPT_TimeStamp& time_stamp);
+ NPT_TimeStamp& operator-=(const NPT_TimeStamp& time_stamp);
+ bool operator==(const NPT_TimeStamp& time_stamp) const;
+ bool operator!=(const NPT_TimeStamp& time_stamp) const;
+ bool operator>(const NPT_TimeStamp& time_stamp) const;
+ bool operator<(const NPT_TimeStamp& time_stamp) const;
+ bool operator>=(const NPT_TimeStamp& time_stamp) const;
+ bool operator<=(const NPT_TimeStamp& time_stamp) const;
+
+ // friend operators
+ friend NPT_TimeStamp operator+(const NPT_TimeStamp& timestamp, long seconds);
+ friend NPT_TimeStamp operator-(const NPT_TimeStamp& timestamp, long seconds);
+
+ // members
+ long m_Seconds;
+ long m_NanoSeconds;
+};
+
+/*----------------------------------------------------------------------
+| operator+
++---------------------------------------------------------------------*/
+inline
+NPT_TimeStamp
+operator+(const NPT_TimeStamp& t1, const NPT_TimeStamp& t2)
+{
+ NPT_TimeStamp t = t1;
+ return t += t2;
+}
+
+/*----------------------------------------------------------------------
+| operator-
++---------------------------------------------------------------------*/
+inline
+NPT_TimeStamp
+operator-(const NPT_TimeStamp& t1, const NPT_TimeStamp& t2)
+{
+ NPT_TimeStamp t = t1;
+ return t -= t2;
+}
+
+/*----------------------------------------------------------------------
+| NPT_TimeInterval
++---------------------------------------------------------------------*/
+typedef NPT_TimeStamp NPT_TimeInterval;
+
+/*----------------------------------------------------------------------
+| NPT_DateTime
++---------------------------------------------------------------------*/
+typedef struct {
+ NPT_Int32 year;
+ NPT_Int32 month;
+ NPT_Int32 day;
+ NPT_Int32 hours;
+ NPT_Int32 minutes;
+ NPT_Int32 seconds;
+ NPT_Int32 milliseconds;
+} NPT_DateTime;
+
+typedef NPT_Int32 NPT_TimeZone; /* minutes westward of GMT */
+typedef NPT_DateTime NPT_LocalDate;
+
+/*----------------------------------------------------------------------
+| NPT_Date
++---------------------------------------------------------------------*/
+typedef struct {
+ NPT_LocalDate local;
+ NPT_TimeZone timezone;
+} NPT_Date;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define NPT_TIME_MIN_YEAR 1970
+#define NPT_TIME_MAX_YEAR 2106
+
+/*----------------------------------------------------------------------
+| NPT_Time
++---------------------------------------------------------------------*/
+class NPT_Time
+{
+public:
+ // methods
+ static NPT_Result GetGMTDateFromTimeStamp(const NPT_TimeStamp& timestamp,
+ NPT_Date& date);
+ static NPT_Result GetLocalDate(NPT_LocalDate& today, NPT_TimeStamp& now);
+
+ // helper functions
+ static NPT_Result FormatDate(const NPT_Date& date,
+ char* output,
+ NPT_Size size);
+ static NPT_Result GetDateFromString(const char* input,
+ NPT_Date& date);
+ static NPT_Result ParseANSIDate(const char* ansi_date,
+ NPT_Date& date,
+ bool relaxed = true);
+ static NPT_Result ParseRFC850Date(const char* rfc850_date,
+ NPT_Date& date);
+};
+
+#endif // _NPT_TIME_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - TLS/SSL Support
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_TLS_H_
+#define _NPT_TLS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#include "NptStreams.h"
+
+/*----------------------------------------------------------------------
+| error codes
++---------------------------------------------------------------------*/
+const NPT_Result NPT_ERROR_INVALID_PASSWORD = (NPT_ERROR_BASE_TLS-1);
+const NPT_Result NPT_ERROR_TLS_INVALID_HANDSHAKE = (NPT_ERROR_BASE_TLS-2);
+const NPT_Result NPT_ERROR_TLS_INVALID_PROTOCOL_MESSAGE = (NPT_ERROR_BASE_TLS-3);
+const NPT_Result NPT_ERROR_TLS_INVALID_HMAC = (NPT_ERROR_BASE_TLS-4);
+const NPT_Result NPT_ERROR_TLS_INVALID_VERSION = (NPT_ERROR_BASE_TLS-5);
+const NPT_Result NPT_ERROR_TLS_INVALID_SESSION = (NPT_ERROR_BASE_TLS-6);
+const NPT_Result NPT_ERROR_TLS_NO_CIPHER = (NPT_ERROR_BASE_TLS-7);
+const NPT_Result NPT_ERROR_TLS_BAD_CERTIFICATE = (NPT_ERROR_BASE_TLS-8);
+const NPT_Result NPT_ERROR_INVALID_KEY = (NPT_ERROR_BASE_TLS-9);
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const unsigned int NPT_TLS_NULL_WITH_NULL_NULL = 0x00;
+const unsigned int NPT_TLS_RSA_WITH_RC4_128_MD5 = 0x04;
+const unsigned int NPT_TLS_RSA_WITH_RC4_128_SHA = 0x05;
+const unsigned int NPT_TLS_RSA_WITH_AES_128_CBC_SHA = 0x2F;
+const unsigned int NPT_TLS_RSA_WITH_AES_256_CBC_SHA = 0x35;
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class NPT_TlsContextImpl;
+class NPT_TlsSessionImpl;
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef enum {
+ NPT_TLS_KEY_FORMAT_RSA_PRIVATE,
+ NPT_TLS_KEY_FORMAT_PKCS8,
+ NPT_TLS_KEY_FORMAT_PKCS12
+} NPT_TlsKeyFormat;
+
+/*----------------------------------------------------------------------
+| NPT_TlsContext
++---------------------------------------------------------------------*/
+class NPT_TlsContext
+{
+public:
+ NPT_TlsContext();
+ ~NPT_TlsContext();
+
+ // methods
+ NPT_Result LoadKey(NPT_TlsKeyFormat key_format,
+ const unsigned char* key_data,
+ NPT_Size key_data_size,
+ const char* password);
+
+
+protected:
+ NPT_TlsContextImpl* m_Impl;
+
+ // friends
+ friend class NPT_TlsClientSession;
+ friend class NPT_TlsServerSession;
+};
+
+typedef NPT_Reference<NPT_TlsContext> NPT_TlsContextReference;
+
+/*----------------------------------------------------------------------
+| NPT_TlsCertificateInfo
++---------------------------------------------------------------------*/
+struct NPT_TlsCertificateInfo
+{
+ struct {
+ NPT_String common_name;
+ NPT_String organization;
+ NPT_String organizational_name;
+ } subject;
+ struct {
+ NPT_String common_name;
+ NPT_String organization;
+ NPT_String organizational_name;
+ } issuer;
+ struct {
+ unsigned char sha1[20];
+ unsigned char md5[16];
+ } fingerprint;
+};
+
+/*----------------------------------------------------------------------
+| NPT_TlsClientSession
++---------------------------------------------------------------------*/
+class NPT_TlsClientSession
+{
+public:
+ NPT_TlsClientSession(NPT_TlsContextReference& context,
+ NPT_InputStreamReference& input,
+ NPT_OutputStreamReference& output);
+ ~NPT_TlsClientSession();
+ NPT_Result Handshake();
+ NPT_Result GetSessionId(NPT_DataBuffer& session_id);
+ NPT_UInt32 GetCipherSuiteId();
+ NPT_Result GetPeerCertificateInfo(NPT_TlsCertificateInfo& info);
+ NPT_Result GetInputStream(NPT_InputStreamReference& stream);
+ NPT_Result GetOutputStream(NPT_OutputStreamReference& stream);
+
+protected:
+ NPT_TlsContextReference m_Context;
+ NPT_Reference<NPT_TlsSessionImpl> m_Impl;
+};
+
+/*----------------------------------------------------------------------
+| NPT_TlsServerSession
++---------------------------------------------------------------------*/
+class NPT_TlsServerSession
+{
+public:
+ NPT_TlsServerSession(NPT_TlsContext& context,
+ NPT_InputStreamReference input,
+ NPT_OutputStreamReference output);
+
+protected:
+ NPT_TlsSessionImpl* m_Impl;
+};
+
+#endif // _NPT_TLS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Types
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_TYPES_H_
+#define _NPT_TYPES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+
+/*----------------------------------------------------------------------
+| sized types (this assumes that ints are 32 bits)
++---------------------------------------------------------------------*/
+typedef NPT_CONFIG_INT64_TYPE NPT_Int64;
+typedef unsigned NPT_CONFIG_INT64_TYPE NPT_UInt64;
+typedef unsigned int NPT_UInt32;
+typedef int NPT_Int32;
+typedef unsigned short NPT_UInt16;
+typedef short NPT_Int16;
+typedef unsigned char NPT_UInt8;
+typedef char NPT_Int8;
+typedef float NPT_Float;
+
+/*----------------------------------------------------------------------
+| named types
++---------------------------------------------------------------------*/
+typedef int NPT_Result;
+typedef unsigned int NPT_Cardinal;
+typedef unsigned int NPT_Ordinal;
+typedef unsigned long NPT_Size;
+typedef NPT_UInt64 NPT_LargeSize;
+typedef signed long NPT_Offset;
+typedef NPT_UInt64 NPT_Position;
+typedef long NPT_Timeout;
+typedef void NPT_Interface;
+typedef unsigned char NPT_Byte;
+typedef unsigned int NPT_Flags;
+typedef void* NPT_Any;
+typedef const void* NPT_AnyConst;
+
+/*----------------------------------------------------------------------
+| limits
++---------------------------------------------------------------------*/
+#if defined(NPT_CONFIG_HAVE_LIMITS_H)
+#include <limits.h>
+#endif
+
+#if !defined(NPT_INT_MIN)
+#if defined(NPT_CONFIG_HAVE_INT_MIN)
+#define NPT_INT_MIN INT_MIN
+#endif
+#endif
+
+#if !defined(NPT_INT_MAX)
+#if defined(NPT_CONFIG_HAVE_INT_MAX)
+#define NPT_INT_MAX INT_MAX
+#endif
+#endif
+
+#if !defined(NPT_UINT_MAX)
+#if defined(NPT_CONFIG_HAVE_UINT_MAX)
+#define NPT_UINT_MAX UINT_MAX
+#endif
+#endif
+
+#if !defined(NPT_LONG_MIN)
+#if defined(NPT_CONFIG_HAVE_LONG_MIN)
+#define NPT_LONG_MIN LONG_MIN
+#endif
+#endif
+
+#if !defined(NPT_LONG_MAX)
+#if defined(NPT_CONFIG_HAVE_LONG_MAX)
+#define NPT_LONG_MAX LONG_MAX
+#endif
+#endif
+
+#if !defined(NPT_ULONG_MAX)
+#if defined(NPT_CONFIG_HAVE_ULONG_MAX)
+#define NPT_ULONG_MAX ULONG_MAX
+#endif
+#endif
+
+#if !defined(NPT_INT32_MAX)
+#define NPT_INT32_MAX 0x7FFFFFFF
+#endif
+
+#if !defined(NPT_INT32_MIN)
+#define NPT_INT32_MIN (-NPT_INT32_MAX - 1)
+#endif
+
+#if !defined(NPT_UINT32_MAX)
+#define NPT_UINT32_MAX 0xFFFFFFFF
+#endif
+
+#if !defined(NPT_INT64_MAX)
+#if defined(NPT_CONFIG_HAVE_LLONG_MAX)
+#define NPT_INT64_MAX LLONG_MAX
+#else
+#define NPT_INT64_MAX 0x7FFFFFFFFFFFFFFFLL
+#endif
+#endif
+
+#if !defined(NPT_INT64_MIN)
+#if defined(NPT_CONFIG_HAVE_LLONG_MIN)
+#define NPT_INT64_MIN LLONG_MIN
+#else
+#define NPT_INT64_MIN (-NPT_INT64_MAX - 1LL)
+#endif
+#endif
+
+#if !defined(NPT_UINT64_MAX)
+#if defined(NPT_CONFIG_HAVE_ULLONG_MAX)
+#define NPT_UINT64_MAX ULLONG_MAX
+#else
+#define NPT_UINT64_MAX 0xFFFFFFFFFFFFFFFFULL
+#endif
+#endif
+
+#endif // _NPT_TYPES_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - URI
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_URI_H_
+#define _NPT_URI_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptStrings.h"
+#include "NptList.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const NPT_UInt16 NPT_URL_INVALID_PORT = 0;
+
+/*----------------------------------------------------------------------
+| NPT_Uri
++---------------------------------------------------------------------*/
+class NPT_Uri {
+public:
+ // types
+ typedef enum {
+ SCHEME_ID_UNKNOWN,
+ SCHEME_ID_HTTP
+ } SchemeId;
+
+ // constants. use as a parameter to Encode()
+ static const char* const PathCharsToEncode;
+ static const char* const QueryCharsToEncode;
+ static const char* const FragmentCharsToEncode;
+ static const char* const UnsafeCharsToEncode;
+
+ // class methods
+ static NPT_String PercentEncode(const char* str, const char* chars, bool encode_percents=true);
+ static NPT_String PercentDecode(const char* str);
+ static SchemeId ParseScheme(const NPT_String& scheme);
+
+ // methods
+ NPT_Uri() : m_SchemeId(SCHEME_ID_UNKNOWN) {}
+ virtual ~NPT_Uri() {}
+ const NPT_String& GetScheme() const {
+ return m_Scheme;
+ }
+ void SetScheme(const char* scheme);
+ NPT_Result SetSchemeFromUri(const char* uri);
+ SchemeId GetSchemeId() const {
+ return m_SchemeId;
+ }
+
+protected:
+ // members
+ NPT_String m_Scheme;
+ SchemeId m_SchemeId;
+};
+
+/*----------------------------------------------------------------------
+| NPT_UrlQuery
++---------------------------------------------------------------------*/
+class NPT_UrlQuery
+{
+public:
+ // class methods
+ static NPT_String UrlEncode(const char* str, bool encode_percents=true);
+ static NPT_String UrlDecode(const char* str);
+
+ // types
+ struct Field {
+ Field(const char* name, const char* value) :
+ m_Name(name), m_Value(value) {}
+ NPT_String m_Name;
+ NPT_String m_Value;
+ };
+
+ // constructor
+ NPT_UrlQuery() {}
+ NPT_UrlQuery(const char* query);
+
+ // accessors
+ NPT_List<Field>& GetFields() { return m_Fields; }
+
+ // methods
+ NPT_Result Parse(const char* query);
+ NPT_Result SetField(const char* name, const char* value);
+ NPT_Result AddField(const char* name, const char* value);
+ const char* GetField(const char* name);
+ NPT_String ToString();
+
+private:
+ // members
+ NPT_List<Field> m_Fields;
+};
+
+/*----------------------------------------------------------------------
+| NPT_Url
++---------------------------------------------------------------------*/
+class NPT_Url : public NPT_Uri {
+public:
+ // constructors and destructor
+ NPT_Url();
+ NPT_Url(const char* url,
+ SchemeId expected_scheme = SCHEME_ID_UNKNOWN,
+ NPT_UInt16 default_port = NPT_URL_INVALID_PORT);
+ NPT_Url(const char* scheme,
+ const char* host,
+ NPT_UInt16 port,
+ const char* path,
+ const char* query = NULL,
+ const char* fragment = NULL);
+
+ // methods
+ const NPT_String& GetHost() const { return m_Host; }
+ NPT_UInt16 GetPort() const { return m_Port; }
+ const NPT_String& GetPath() const { return m_Path; }
+ const NPT_String& GetQuery() const { return m_Query; }
+ const NPT_String& GetFragment() const { return m_Fragment; }
+ virtual bool IsValid() const;
+ bool HasQuery() const { return m_HasQuery; }
+ bool HasFragment() const { return m_HasFragment; }
+ NPT_Result SetHost(const char* host);
+ NPT_Result SetPort(NPT_UInt16 port);
+ NPT_Result SetPath(const char* path);
+ NPT_Result SetPathPlus(const char* path_plus);
+ NPT_Result SetQuery(const char* query);
+ NPT_Result SetFragment(const char* fragment);
+ virtual NPT_String ToRequestString(bool with_fragment = false) const;
+ virtual NPT_String ToStringWithDefaultPort(NPT_UInt16 default_port, bool with_fragment = true) const;
+ virtual NPT_String ToString(bool with_fragment = true) const;
+
+protected:
+ // members
+ NPT_String m_Host;
+ NPT_UInt16 m_Port;
+ NPT_String m_Path;
+ bool m_HasQuery;
+ NPT_String m_Query;
+ bool m_HasFragment;
+ NPT_String m_Fragment;
+};
+
+#endif // _NPT_URI_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune Utils
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_UTILS_H_
+#define _NPT_UTILS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#include "NptTypes.h"
+#include "NptStrings.h"
+#include "NptMap.h"
+
+#if defined (NPT_CONFIG_HAVE_STDIO_H)
+#include <stdio.h>
+#endif
+
+#if defined (NPT_CONFIG_HAVE_STRING_H)
+#include <string.h>
+#endif
+
+#if defined(NPT_CONFIG_HAVE_STDARG_H)
+#include <stdarg.h>
+#endif
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define NPT_ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0]))
+
+/*----------------------------------------------------------------------
+| byte I/O
++---------------------------------------------------------------------*/
+extern void NPT_BytesFromInt64Be(unsigned char* buffer, NPT_UInt64 value);
+extern void NPT_BytesFromInt32Be(unsigned char* buffer, NPT_UInt32 value);
+extern void NPT_BytesFromInt24Be(unsigned char* buffer, NPT_UInt32 value);
+extern void NPT_BytesFromInt16Be(unsigned char* buffer, NPT_UInt16 value);
+extern NPT_UInt64 NPT_BytesToInt64Be(const unsigned char* buffer);
+extern NPT_UInt32 NPT_BytesToInt32Be(const unsigned char* buffer);
+extern NPT_UInt32 NPT_BytesToInt24Be(const unsigned char* buffer);
+extern NPT_UInt16 NPT_BytesToInt16Be(const unsigned char* buffer);
+
+extern void NPT_BytesFromInt64Le(unsigned char* buffer, NPT_UInt64 value);
+extern void NPT_BytesFromInt32Le(unsigned char* buffer, NPT_UInt32 value);
+extern void NPT_BytesFromInt24Le(unsigned char* buffer, NPT_UInt32 value);
+extern void NPT_BytesFromInt16Le(unsigned char* buffer, NPT_UInt16 value);
+extern NPT_UInt64 NPT_BytesToInt64Le(const unsigned char* buffer);
+extern NPT_UInt32 NPT_BytesToInt32Le(const unsigned char* buffer);
+extern NPT_UInt32 NPT_BytesToInt24Le(const unsigned char* buffer);
+extern NPT_UInt16 NPT_BytesToInt16Le(const unsigned char* buffer);
+
+/*----------------------------------------------------------------------
+| conversion utilities
++---------------------------------------------------------------------*/
+extern NPT_Result
+NPT_ParseFloat(const char* str, float& result, bool relaxed = true);
+
+extern NPT_Result
+NPT_ParseInteger(const char* str, long& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger(const char* str, unsigned long& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger(const char* str, int& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger(const char* str, unsigned int& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger32(const char* str, NPT_Int32& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger32(const char* str, NPT_UInt32& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger64(const char* str, NPT_Int64& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+extern NPT_Result
+NPT_ParseInteger64(const char* str, NPT_UInt64& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
+
+/*----------------------------------------------------------------------
+| formatting
++---------------------------------------------------------------------*/
+void
+NPT_FormatOutput(void (*function)(void* parameter, const char* message),
+ void* function_parameter,
+ const char* format,
+ va_list args);
+
+void NPT_ByteToHex(NPT_Byte b, char* buffer, bool uppercase=false);
+NPT_Result NPT_HexToByte(const char* buffer, NPT_Byte& b);
+NPT_String NPT_HexString(const unsigned char* data,
+ NPT_Size data_size,
+ const char* separator = NULL,
+ bool uppercase=false);
+char NPT_NibbleToHex(unsigned int nibble, bool uppercase = true);
+int NPT_HexToNibble(char hex);
+
+/*----------------------------------------------------------------------
+| parsing
++---------------------------------------------------------------------*/
+NPT_Result
+NPT_ParseMimeParameters(const char* encoded,
+ NPT_Map<NPT_String, NPT_String>& parameters);
+
+/*----------------------------------------------------------------------
+| environment variables
++---------------------------------------------------------------------*/
+NPT_Result NPT_GetEnvironment(const char* name, NPT_String& value);
+
+/*----------------------------------------------------------------------
+| string utils
++---------------------------------------------------------------------*/
+#if defined (NPT_CONFIG_HAVE_STDIO_H)
+#include <stdio.h>
+#endif
+
+#if defined (NPT_CONFIG_HAVE_STRING_H)
+#include <string.h>
+#endif
+
+#if defined (NPT_CONFIG_HAVE_SNPRINTF)
+#define NPT_FormatString NPT_snprintf
+#else
+int NPT_FormatString(char* str, NPT_Size size, const char* format, ...);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_VSNPRINTF)
+#define NPT_FormatStringVN(s,c,f,a) NPT_vsnprintf(s,c,f,a)
+#else
+extern int NPT_FormatStringVN(char *buffer, size_t count, const char *format, va_list argptr);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_MEMCPY)
+#define NPT_CopyMemory memcpy
+#else
+extern void NPT_CopyMemory(void* dest, void* src, NPT_Size size);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_STRCMP)
+#define NPT_StringsEqual(s1, s2) (strcmp((s1), (s2)) == 0)
+#else
+extern int NPT_StringsEqual(const char* s1, const char* s2);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_STRNCMP)
+#define NPT_StringsEqualN(s1, s2, n) (strncmp((s1), (s2), (n)) == 0)
+#else
+extern int NPT_StringsEqualN(const char* s1, const char* s2, unsigned long size);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_STRLEN)
+#define NPT_StringLength(s) (NPT_Size)(strlen(s))
+#else
+extern unsigned long NPT_StringLength(const char* s);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_STRCPY)
+#define NPT_CopyString(dst, src) ((void)NPT_strcpy((dst), (src)))
+#else
+extern void NPT_CopyString(char* dst, const char* src);
+#endif
+
+/**
+ * Copy up to n characters from src to dst.
+ * The destination buffer will be null-terminated, so it must
+ * have enough space for n+1 characters (n from the source plus
+ * the null terminator).
+ */
+#if defined(NPT_CONFIG_HAVE_STRNCPY)
+#define NPT_CopyStringN(dst, src, n) \
+do { ((void)NPT_strncpy((dst), (src), n)); (dst)[(n)] = '\0'; } while(0)
+#else
+extern int NPT_CopyStringN(char* dst, const char* src, unsigned long n);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_MEMSET)
+#define NPT_SetMemory memset
+#else
+extern void NPT_SetMemory(void* dest, int c, NPT_Size size);
+#endif
+
+#if defined(NPT_CONFIG_HAVE_MEMCMP)
+#define NPT_MemoryEqual(s1, s2, n) (memcmp((s1), (s2), (n)) == 0)
+#else
+extern int NPT_MemoryEqual(const void* s1, const void* s2, unsigned long n);
+#endif
+
+#endif // _NPT_UTILS_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Version Info
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_VERSION_H_
+#define _NPT_VERSION_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#define NPT_NEPTUNE_VERSION 0x01000200
+#define NPT_NEPTUNE_VERSION_STRING "1.0.2"
+
+#endif // _NPT_VERSION_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Xml Support
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_XML_H_
+#define _NPT_XML_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptList.h"
+#include "NptStrings.h"
+#include "NptStreams.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int NPT_ERROR_XML_INVALID_NESTING = NPT_ERROR_BASE_XML - 0;
+const int NPT_ERROR_XML_TAG_MISMATCH = NPT_ERROR_BASE_XML - 1;
+
+#define NPT_XML_ANY_NAMESPACE "*"
+#define NPT_XML_NO_NAMESPACE NULL
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class NPT_XmlProcessor;
+
+/*----------------------------------------------------------------------
+| NPT_XmlAttribute
++---------------------------------------------------------------------*/
+class NPT_XmlAttribute
+{
+ public:
+ // methods
+ NPT_XmlAttribute(const char* name, const char* value);
+ NPT_XmlAttribute(const char* prefix, const char* name, const char* value) :
+ m_Prefix(prefix), m_Name(name), m_Value(value) {}
+ const NPT_String& GetPrefix() const { return m_Prefix; }
+ const NPT_String& GetName() const { return m_Name; }
+ const NPT_String& GetValue() const { return m_Value; }
+ void SetValue(const char* value) { m_Value = value; }
+
+ private:
+ // members
+ NPT_String m_Prefix;
+ NPT_String m_Name;
+ NPT_String m_Value;
+
+ NPT_XmlAttribute(const NPT_XmlAttribute& attribute) :
+ m_Prefix(attribute.m_Prefix),
+ m_Name(attribute.m_Name),
+ m_Value(attribute.m_Value) {}
+ NPT_XmlAttribute& operator=(const NPT_XmlAttribute& a);
+
+ // friends
+ friend class NPT_XmlAttributeFinder;
+ friend class NPT_XmlAttributeFinderWithPrefix;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlNamespaceMap
++---------------------------------------------------------------------*/
+class NPT_XmlNamespaceMap
+{
+public:
+ // destructor
+ ~NPT_XmlNamespaceMap();
+
+ // methods
+ NPT_Result SetNamespaceUri(const char* prefix, const char* uri);
+ const NPT_String* GetNamespaceUri(const char* prefix);
+ const NPT_String* GetNamespacePrefix(const char* uri);
+
+private:
+ // types
+ class Entry {
+ public:
+ // constructor
+ Entry(const char* prefix, const char* uri) :
+ m_Prefix(prefix), m_Uri(uri) {}
+
+ // members
+ NPT_String m_Prefix;
+ NPT_String m_Uri;
+ };
+
+ // members
+ NPT_List<Entry*> m_Entries;
+
+ // friends
+ friend class NPT_XmlWriter;
+ friend class NPT_XmlNodeWriter;
+ friend class NPT_XmlNodeCanonicalWriter;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlNode
++---------------------------------------------------------------------*/
+class NPT_XmlElementNode;
+class NPT_XmlTextNode;
+class NPT_XmlNode
+{
+ public:
+ // types
+ typedef enum {
+ DOCUMENT,
+ ELEMENT,
+ TEXT
+ } Type;
+
+ // methods
+ NPT_XmlNode(Type type) : m_Type(type), m_Parent(NULL) {}
+ virtual ~NPT_XmlNode() {}
+ Type GetType() const { return m_Type; }
+ NPT_XmlNode* GetParent() const { return m_Parent; }
+
+ // type casting
+ virtual NPT_XmlElementNode* AsElementNode() { return NULL; }
+ virtual const NPT_XmlElementNode* AsElementNode() const { return NULL; }
+ virtual NPT_XmlTextNode* AsTextNode() { return NULL; }
+ virtual const NPT_XmlTextNode* AsTextNode() const { return NULL; }
+
+ protected:
+ // methods
+ virtual void SetParent(NPT_XmlNode* parent) { m_Parent = parent; }
+
+ // members
+ Type m_Type;
+ NPT_XmlNode* m_Parent;
+
+ // friends
+ friend class NPT_XmlNodeFinder;
+ friend class NPT_XmlSerializer;
+ friend class NPT_XmlWriter;
+ friend class NPT_XmlElementNode; // to allow access to SetParent()
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlElementNode
++---------------------------------------------------------------------*/
+class NPT_XmlElementNode : public NPT_XmlNode
+{
+ public:
+ // methods
+ NPT_XmlElementNode(const char* tag);
+ NPT_XmlElementNode(const char* prefix, const char* tag);
+ virtual ~NPT_XmlElementNode();
+ NPT_List<NPT_XmlNode*>& GetChildren() { return m_Children; }
+ const NPT_List<NPT_XmlNode*>&
+ GetChildren() const { return m_Children; }
+ NPT_XmlElementNode* GetChild(const char* tag,
+ const char* namespc = NPT_XML_NO_NAMESPACE,
+ NPT_Ordinal n=0) const;
+ NPT_Result AddChild(NPT_XmlNode* child);
+ NPT_Result SetAttribute(const char* prefix,
+ const char* name,
+ const char* value);
+ NPT_Result SetAttribute(const char* name,
+ const char* value);
+ NPT_Result AddText(const char* text);
+ NPT_List<NPT_XmlAttribute*>&
+ GetAttributes() { return m_Attributes; }
+ const NPT_List<NPT_XmlAttribute*>&
+ GetAttributes() const { return m_Attributes; }
+ const NPT_String* GetAttribute(const char* name,
+ const char* namespc = NPT_XML_NO_NAMESPACE) const;
+ const NPT_String& GetPrefix() const { return m_Prefix; }
+ const NPT_String& GetTag() const { return m_Tag; }
+ const NPT_String* GetText(NPT_Ordinal n=0) const;
+
+ // bring all the namespace definitions used in this element of one of its descendants
+ // into the namespace map of this element so that it may be serialized as a
+ // standalone element without any prefixes with undefined namespace uris
+ NPT_Result MakeStandalone();
+
+ // namespace methods
+ const NPT_String* GetNamespace() const;
+ NPT_Result SetNamespaceUri(const char* prefix, const char* uri);
+ const NPT_String* GetNamespaceUri(const char* prefix) const;
+ const NPT_String* GetNamespacePrefix(const char* uri) const;
+
+ // type casting
+ NPT_XmlElementNode* AsElementNode() { return this; }
+ const NPT_XmlElementNode* AsElementNode() const { return this; }
+
+protected:
+ // methods
+ void SetParent(NPT_XmlNode* parent);
+ void SetNamespaceParent(NPT_XmlElementNode* parent);
+ void RelinkNamespaceMaps();
+
+ NPT_Result AddAttribute(const char* name, const char* value);
+
+ // members
+ NPT_String m_Prefix;
+ NPT_String m_Tag;
+ NPT_List<NPT_XmlNode*> m_Children;
+ NPT_List<NPT_XmlAttribute*> m_Attributes;
+ NPT_XmlNamespaceMap* m_NamespaceMap;
+ NPT_XmlElementNode* m_NamespaceParent;
+
+ // friends
+ friend class NPT_XmlTagFinder;
+ friend class NPT_XmlSerializer;
+ friend class NPT_XmlWriter;
+ friend class NPT_XmlNodeWriter;
+ friend class NPT_XmlNodeCanonicalWriter;
+ friend class NPT_XmlParser;
+ friend class NPT_XmlProcessor;
+ friend class NPT_XmlNamespaceCollapser;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlTextNode
++---------------------------------------------------------------------*/
+class NPT_XmlTextNode : public NPT_XmlNode
+{
+ public:
+ // types
+ typedef enum {
+ CHARACTER_DATA,
+ IGNORABLE_WHITESPACE,
+ CDATA_SECTION,
+ ENTITY_REFERENCE,
+ COMMENT
+ } TokenType;
+
+ // constructor
+ NPT_XmlTextNode(TokenType token_type, const char* text);
+
+ // methods
+ const NPT_String& GetString() const { return m_Text; }
+
+ // type casting
+ NPT_XmlTextNode* AsTextNode() { return this; }
+ const NPT_XmlTextNode* AsTextNode() const { return this; }
+
+ private:
+ // members
+ TokenType m_TokenType;
+ NPT_String m_Text;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlParser
++---------------------------------------------------------------------*/
+class NPT_XmlParser
+{
+ public:
+ // methods
+ NPT_XmlParser(bool keep_whitespace = true);
+ virtual ~NPT_XmlParser();
+ virtual NPT_Result Parse(const char* xml,
+ NPT_XmlNode*& tree,
+ bool incremental=false);
+ virtual NPT_Result Parse(const char* xml,
+ NPT_Size size,
+ NPT_XmlNode*& tree,
+ bool incremental=false);
+ virtual NPT_Result Parse(NPT_InputStream& stream,
+ NPT_XmlNode*& tree,
+ bool incremental=false);
+ virtual NPT_Result Parse(NPT_InputStream& stream,
+ NPT_Size& size,
+ NPT_XmlNode*& tree,
+ bool incremental=false);
+
+ protected:
+ // NPT_XmlHandler methods
+ NPT_Result OnStartElement(const char* name);
+ NPT_Result OnElementAttribute(const char* name, const char* value);
+ NPT_Result OnEndElement(const char* name);
+ NPT_Result OnCharacterData(const char* data, unsigned long size);
+ void RemoveIgnorableWhitespace();
+
+ // members
+ NPT_XmlProcessor* m_Processor;
+ NPT_XmlElementNode* m_Tree;
+ NPT_XmlElementNode* m_CurrentElement;
+ bool m_KeepWhitespace;
+
+ // friends
+ friend class NPT_XmlProcessor;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlSerializer
++---------------------------------------------------------------------*/
+class NPT_XmlSerializer
+{
+public:
+ // methods
+ NPT_XmlSerializer(NPT_OutputStream* output,
+ NPT_Cardinal indentation = 0,
+ bool shrink_empty_elements = true,
+ bool add_header = true);
+ virtual ~NPT_XmlSerializer();
+ virtual NPT_Result StartDocument();
+ virtual NPT_Result EndDocument();
+ virtual NPT_Result StartElement(const char* prefix, const char* name);
+ virtual NPT_Result EndElement(const char* prefix, const char* name);
+ virtual NPT_Result Attribute(const char* prefix, const char* name, const char* value);
+ virtual NPT_Result Text(const char* text);
+ virtual NPT_Result CdataSection(const char* data);
+ virtual NPT_Result Comment(const char* comment);
+
+protected:
+ // methods
+ void EscapeChar(unsigned char c, char* text);
+ NPT_Result ProcessPending();
+ NPT_Result OutputEscapedString(const char* text, bool attribute);
+ void OutputIndentation(bool start);
+
+ // members
+ NPT_OutputStream* m_Output;
+ bool m_ElementPending;
+ NPT_Cardinal m_Depth;
+ NPT_Cardinal m_Indentation;
+ NPT_String m_IndentationPrefix;
+ bool m_ElementHasText;
+ bool m_ShrinkEmptyElements;
+ bool m_AddHeader;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlWriter
++---------------------------------------------------------------------*/
+class NPT_XmlWriter
+{
+public:
+ // constructor
+ explicit NPT_XmlWriter(NPT_Cardinal indentation = 0) : m_Indentation(indentation) {}
+
+ // methods
+ NPT_Result Serialize(NPT_XmlNode& node,
+ NPT_OutputStream& stream,
+ bool add_header = true);
+
+private:
+ // members
+ NPT_Cardinal m_Indentation;
+};
+
+/*----------------------------------------------------------------------
+| NPT_XmlCanonicalizer
++---------------------------------------------------------------------*/
+class NPT_XmlCanonicalizer
+{
+public:
+ // methods
+ NPT_Result Serialize(NPT_XmlNode& node,
+ NPT_OutputStream& stream,
+ bool add_header = true);
+};
+
+#endif // _NPT_XML_H_
--- /dev/null
+/*****************************************************************
+|
+| Neptune - Zip Support
+|
+| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
+| All rights reserved.
+|
+| Redistribution and use in source and binary forms, with or without
+| modification, are permitted provided that the following conditions are met:
+| * Redistributions of source code must retain the above copyright
+| notice, this list of conditions and the following disclaimer.
+| * Redistributions in binary form must reproduce the above copyright
+| notice, this list of conditions and the following disclaimer in the
+| documentation and/or other materials provided with the distribution.
+| * Neither the name of Axiomatic Systems nor the
+| names of its contributors may be used to endorse or promote products
+| derived from this software without specific prior written permission.
+|
+| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|
+ ****************************************************************/
+
+#ifndef _NPT_ZIP_H_
+#define _NPT_ZIP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptConfig.h"
+#include "NptStreams.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class NPT_ZipInflateState;
+class NPT_ZipDeflateState;
+
+/*----------------------------------------------------------------------
+| NPT_Zip
++---------------------------------------------------------------------*/
+const int NPT_ZIP_COMPRESSION_LEVEL_DEFAULT = -1;
+const int NPT_ZIP_COMPRESSION_LEVEL_MIN = 0;
+const int NPT_ZIP_COMPRESSION_LEVEL_MAX = 9;
+const int NPT_ZIP_COMPRESSION_LEVEL_NONE = 0;
+class NPT_Zip
+{
+public:
+ // class methods
+ static NPT_Result MapError(int err);
+
+ /**
+ * Compressed data format
+ */
+ typedef enum {
+ ZLIB,
+ GZIP
+ } Format;
+
+ /**
+ * Deflate (i.e compress) a buffer
+ */
+ static NPT_Result Deflate(const NPT_DataBuffer& in,
+ NPT_DataBuffer& out,
+ int compression_level = NPT_ZIP_COMPRESSION_LEVEL_DEFAULT,
+ Format format = ZLIB);
+
+ /**
+ * Inflate (i.e decompress) a buffer
+ */
+ static NPT_Result Inflate(const NPT_DataBuffer& in,
+ NPT_DataBuffer& out);
+};
+
+/*----------------------------------------------------------------------
+| NPT_ZipInflatingInputStream
++---------------------------------------------------------------------*/
+class NPT_ZipInflatingInputStream : public NPT_InputStream
+{
+public:
+ NPT_ZipInflatingInputStream(NPT_InputStreamReference& source);
+ ~NPT_ZipInflatingInputStream();
+
+ // NPT_InputStream methods
+ virtual NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL);
+ virtual NPT_Result Seek(NPT_Position offset);
+ virtual NPT_Result Tell(NPT_Position& offset);
+ virtual NPT_Result GetSize(NPT_LargeSize& size);
+ virtual NPT_Result GetAvailable(NPT_LargeSize& available);
+
+private:
+ NPT_InputStreamReference m_Source;
+ NPT_Position m_Position;
+ NPT_ZipInflateState* m_State;
+ NPT_DataBuffer m_Buffer;
+};
+
+/*----------------------------------------------------------------------
+| NPT_ZipInflatingOutputStream
++---------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------
+| NPT_ZipDeflatingInputStream
++---------------------------------------------------------------------*/
+class NPT_ZipDeflatingInputStream : public NPT_InputStream
+{
+public:
+ NPT_ZipDeflatingInputStream(NPT_InputStreamReference& source,
+ int compression_level = NPT_ZIP_COMPRESSION_LEVEL_DEFAULT,
+ NPT_Zip::Format format = NPT_Zip::ZLIB);
+ ~NPT_ZipDeflatingInputStream();
+
+ // NPT_InputStream methods
+ virtual NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL);
+ virtual NPT_Result Seek(NPT_Position offset);
+ virtual NPT_Result Tell(NPT_Position& offset);
+ virtual NPT_Result GetSize(NPT_LargeSize& size);
+ virtual NPT_Result GetAvailable(NPT_LargeSize& available);
+
+private:
+ NPT_InputStreamReference m_Source;
+ NPT_Position m_Position;
+ bool m_Eos;
+ NPT_ZipDeflateState* m_State;
+ NPT_DataBuffer m_Buffer;
+};
+
+/*----------------------------------------------------------------------
+| NPT_ZipDeflatingInputStream
++---------------------------------------------------------------------*/
+
+#endif // _NPT_ZIP_H_
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Top Level Include
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+ ****************************************************************/
+
+#ifndef _PLATINUM_H_
+#define _PLATINUM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltUPnP.h"
+#include "PltCtrlPoint.h"
+#include "PltDeviceData.h"
+#include "PltHttpServer.h"
+#include "PltVersion.h"
+#include "PltSvnVersion.h"
+#include "PltTime.h"
+
+#ifdef PLT_DEVICE_HEADERS_INCLUDE
+#include "PltMediaServer.h"
+#include "PltMediaBrowser.h"
+#include "PltMediaRenderer.h"
+#include "PltMediaController.h"
+#endif
+
+#endif /* _PLATINUM_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Service Action
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_ACTION_H_
+#define _PLT_ACTION_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltArgument.h"
+#include "PltDeviceData.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_Service;
+
+/*----------------------------------------------------------------------
+| PLT_ActionDesc
++---------------------------------------------------------------------*/
+class PLT_ActionDesc
+{
+public:
+ PLT_ActionDesc(const char* name, PLT_Service* service);
+ ~PLT_ActionDesc();
+
+ NPT_Array<PLT_ArgumentDesc*>& GetArgumentDescs() {
+ return m_ArgumentDescs;
+ }
+
+ const NPT_String& GetName() const { return m_Name;}
+ PLT_ArgumentDesc* GetArgumentDesc(const char* name);
+ NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
+ PLT_Service* GetService();
+
+protected:
+ //members
+ NPT_String m_Name;
+ PLT_Service* m_Service;
+ NPT_Array<PLT_ArgumentDesc*> m_ArgumentDescs;
+};
+
+/*----------------------------------------------------------------------
+| PLT_Action
++---------------------------------------------------------------------*/
+class PLT_Action
+{
+public:
+ ~PLT_Action();
+
+ PLT_ActionDesc& GetActionDesc() { return m_ActionDesc; }
+
+ NPT_Result GetArgumentValue(const char* name, NPT_String& value);
+ NPT_Result GetArgumentValue(const char* name, NPT_UInt32& value);
+ NPT_Result GetArgumentValue(const char* name, NPT_Int32& value);
+ NPT_Result GetArgumentValue(const char* name, bool& value);
+ NPT_Result VerifyArgumentValue(const char* name, const char* value);
+ NPT_Result VerifyArguments(bool input);
+ NPT_Result SetArgumentOutFromStateVariable(const char* name);
+ NPT_Result SetArgumentsOutFromStateVariable();
+ NPT_Result SetArgumentValue(const char* name, const char* value);
+
+ NPT_Result SetError(unsigned int code, const char* description);
+ const char* GetError(unsigned int& code);
+ unsigned int GetErrorCode();
+
+ NPT_Result FormatSoapRequest(NPT_OutputStream& stream);
+ NPT_Result FormatSoapResponse(NPT_OutputStream& stream);
+
+ static NPT_Result FormatSoapError(unsigned int code,
+ NPT_String desc,
+ NPT_OutputStream& stream);
+
+private:
+ // only PLT_DeviceHost and PLT_CtrlPoint can instantiate those directly
+ friend class PLT_DeviceHost;
+ friend class PLT_CtrlPoint;
+ PLT_Action(PLT_ActionDesc& action_desc);
+ PLT_Action(PLT_ActionDesc& action_desc, PLT_DeviceDataReference& root_device);
+
+private:
+ NPT_Result SetArgumentOutFromStateVariable(PLT_ArgumentDesc* arg_desc);
+ PLT_Argument* GetArgument(const char* name);
+
+protected:
+ // members
+ PLT_ActionDesc& m_ActionDesc;
+ PLT_Arguments m_Arguments;
+ unsigned int m_ErrorCode;
+ NPT_String m_ErrorDescription;
+ // keep reference to device to prevent it
+ // from being released during action lifetime
+ PLT_DeviceDataReference m_RootDevice;
+};
+
+typedef NPT_Reference<PLT_Action> PLT_ActionReference;
+
+/*----------------------------------------------------------------------
+| PLT_GetSCPDXMLIterator
++---------------------------------------------------------------------*/
+template <class T>
+class PLT_GetSCPDXMLIterator
+{
+public:
+ PLT_GetSCPDXMLIterator<T>(NPT_XmlElementNode* node) :
+ m_Node(node) {}
+
+ NPT_Result operator()(T* const & data) const {
+ return data->GetSCPDXML(m_Node);
+ }
+
+private:
+ NPT_XmlElementNode* m_Node;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ActionDescNameFinder
++---------------------------------------------------------------------*/
+class PLT_ActionDescNameFinder
+{
+public:
+ // methods
+ PLT_ActionDescNameFinder(PLT_Service* service, const char* name) :
+ m_Service(service), m_Name(name) {}
+ virtual ~PLT_ActionDescNameFinder() {}
+
+ bool operator()(const PLT_ActionDesc* const & action_desc) const {
+ return action_desc->GetName().Compare(m_Name, true) ? false : true;
+ }
+
+private:
+ // members
+ PLT_Service* m_Service;
+ NPT_String m_Name;
+};
+
+#endif /* _PLT_ACTION_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Action Argument
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_ARGUMENT_H_
+#define _PLT_ARGUMENT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_StateVariable;
+class PLT_Argument;
+class PLT_ActionDesc;
+typedef NPT_Array<PLT_Argument*> PLT_Arguments;
+
+/*----------------------------------------------------------------------
+| PLT_ArgumentDesc
++---------------------------------------------------------------------*/
+class PLT_ArgumentDesc
+{
+public:
+ PLT_ArgumentDesc(const char* name,
+ NPT_Ordinal position,
+ const char* direction = "in",
+ PLT_StateVariable* variable = NULL,
+ bool has_ret = false);
+
+ // accessor methods
+ NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
+ const NPT_String& GetName() const { return m_Name; }
+ const NPT_String& GetDirection() const { return m_Direction; }
+ NPT_Ordinal GetPosition() { return m_Position; }
+ PLT_StateVariable* GetRelatedStateVariable() { return m_RelatedStateVariable; }
+ bool HasRetValue() { return m_HasReturnValue; }
+
+protected:
+ NPT_String m_Name;
+ NPT_Ordinal m_Position;
+ NPT_String m_Direction;
+ PLT_StateVariable* m_RelatedStateVariable;
+ bool m_HasReturnValue;
+};
+
+/*----------------------------------------------------------------------
+| PLT_Argument
++---------------------------------------------------------------------*/
+class PLT_Argument
+{
+public:
+ PLT_Argument(PLT_ArgumentDesc& arg_desc);
+
+ // class methods
+ static NPT_Result CreateArgument(PLT_ActionDesc& action_desc,
+ const char* arg_name,
+ const char* arg_value,
+ PLT_Argument*& arg);
+
+ // accessor methods
+ PLT_ArgumentDesc& GetDesc() { return m_ArgDesc; }
+ NPT_Ordinal GetPosition() { return m_ArgDesc.GetPosition(); }
+ NPT_Result SetValue(const char* value);
+ const NPT_String& GetValue();
+
+private:
+ NPT_Result ValidateValue(const char* value);
+
+protected:
+ PLT_ArgumentDesc& m_ArgDesc;
+ NPT_String m_Value;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ArgumentNameFinder
++---------------------------------------------------------------------*/
+class PLT_ArgumentNameFinder
+{
+public:
+ // methods
+ PLT_ArgumentNameFinder(const char* name) : m_Name(name) {}
+
+ bool operator()(PLT_Argument* const & argument) const {
+ return argument->GetDesc().GetName().Compare(m_Name, true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_Name;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ArgumentDescNameFinder
++---------------------------------------------------------------------*/
+class PLT_ArgumentDescNameFinder
+{
+public:
+ // methods
+ PLT_ArgumentDescNameFinder(const char* name) : m_Name(name) {}
+
+ bool operator()(PLT_ArgumentDesc* const & arg_desc) const {
+ return arg_desc->GetName().Compare(m_Name, true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_Name;
+};
+
+#endif /* _PLT_ARGUMENT_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - UPnP Constants
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_UPNP_CONSTANTS_H_
+#define _PLT_UPNP_CONSTANTS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| PLT_Constants
++---------------------------------------------------------------------*/
+class PLT_Constants
+{
+public:
+ // class methods
+ static PLT_Constants& GetInstance();
+
+ PLT_Constants();
+ ~PLT_Constants() {};
+
+ // members
+ NPT_TimeInterval m_DefaultDeviceLease;
+ NPT_TimeInterval m_DefaultSubscribeLease;
+};
+
+#endif /* _PLT_UPNP_CONSTANTS_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Control Point
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_CONTROL_POINT_H_
+#define _PLT_CONTROL_POINT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltService.h"
+#include "PltHttpServerListener.h"
+#include "PltSsdpListener.h"
+#include "PltDeviceData.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_HttpServer;
+class PLT_CtrlPointHouseKeepingTask;
+class PLT_SsdpSearchTask;
+class PLT_SsdpListenTask;
+class PLT_CtrlPointGetSCPDRequest;
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointListener class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointListener
+{
+public:
+ virtual ~PLT_CtrlPointListener() {}
+
+ virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device) = 0;
+ virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device) = 0;
+ virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata) = 0;
+ virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars) = 0;
+};
+
+typedef NPT_List<PLT_CtrlPointListener*> PLT_CtrlPointListenerList;
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPoint class
++---------------------------------------------------------------------*/
+class PLT_CtrlPoint : public PLT_SsdpPacketListener,
+ public PLT_SsdpSearchResponseListener
+{
+public:
+ PLT_CtrlPoint(const char* search_criteria = "upnp:rootdevice"); // pass NULL to prevent repeated automatic search
+
+ // delegation
+ NPT_Result AddListener(PLT_CtrlPointListener* listener);
+ NPT_Result RemoveListener(PLT_CtrlPointListener* listener);
+
+ // discovery
+ void IgnoreUUID(const char* uuid);
+ NPT_Result InspectDevice(const char* location,
+ const char* uuid,
+ NPT_Timeout leasetime = PLT_Constants::GetInstance().m_DefaultDeviceLease);
+ NPT_Result Search(const NPT_HttpUrl& url = NPT_HttpUrl("239.255.255.250", 1900, "*"),
+ const char* target = "upnp:rootdevice",
+ NPT_Cardinal mx = 5,
+ NPT_Timeout frequency = 50000); // pass 0 for one time only
+ NPT_Result Discover(const NPT_HttpUrl& url = NPT_HttpUrl("239.255.255.250", 1900, "*"),
+ const char* target = "ssdp:all",
+ NPT_Cardinal mx = 5,
+ NPT_Timeout frequency = 50000); // pass 0 for one time only
+
+ // actions
+ NPT_Result FindActionDesc(PLT_DeviceDataReference& device,
+ const char* service_type,
+ const char* action_name,
+ PLT_ActionDesc*& action_desc);
+ NPT_Result CreateAction(PLT_DeviceDataReference& device,
+ const char* service_type,
+ const char* action_name,
+ PLT_ActionReference& action);
+ NPT_Result InvokeAction(PLT_ActionReference& action, void* userdata = NULL);
+
+ // events
+ NPT_Result Subscribe(PLT_Service* service,
+ bool cancel = false,
+ void* userdata = NULL);
+
+ // NPT_HttpRequestHandler methods
+ virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+ // PLT_SsdpSearchResponseListener methods
+ virtual NPT_Result ProcessSsdpSearchResponse(NPT_Result res,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+ // PLT_SsdpPacketListener method
+ virtual NPT_Result OnSsdpPacket(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context);
+
+protected:
+ virtual ~PLT_CtrlPoint();
+
+ NPT_Result Start(PLT_SsdpListenTask* task);
+ NPT_Result Stop(PLT_SsdpListenTask* task);
+
+ NPT_Result ProcessSsdpNotify(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context);
+ NPT_Result ProcessSsdpMessage(NPT_HttpMessage* message,
+ const NPT_HttpRequestContext& context,
+ NPT_String& uuid);
+ NPT_Result ProcessGetDescriptionResponse(NPT_Result res,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response,
+ PLT_DeviceDataReference& root_device);
+ NPT_Result ProcessGetSCPDResponse(NPT_Result res,
+ PLT_CtrlPointGetSCPDRequest* request,
+ NPT_HttpResponse* response,
+ PLT_DeviceDataReference& root_device);
+ NPT_Result ProcessActionResponse(NPT_Result res,
+ NPT_HttpResponse* response,
+ PLT_ActionReference& action,
+ void* userdata);
+ NPT_Result ProcessSubscribeResponse(NPT_Result res,
+ NPT_HttpResponse* response,
+ PLT_Service* service,
+ void* userdata);
+ NPT_Result ProcessHttpNotify(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+private:
+ // methods
+ NPT_Result RenewSubscribers();
+ NPT_Result RenewSubscriber(PLT_EventSubscriber& subscriber);
+ NPT_Result DoHouseKeeping();
+ NPT_Result FetchDeviceSCPDs(PLT_HttpClientSocketTask& task,
+ PLT_DeviceDataReference& device,
+ NPT_Cardinal level);
+ NPT_Result FindDevice(const char* uuid, PLT_DeviceDataReference& device, bool return_root = false);
+ NPT_Result AddDevice(PLT_DeviceDataReference& data);
+ NPT_Result NotifyDeviceReady(PLT_DeviceDataReference& data);
+ NPT_Result RemoveDevice(PLT_DeviceDataReference& data);
+ NPT_Result NotifyDeviceRemoved(PLT_DeviceDataReference& data);
+ NPT_Result CleanupDevice(PLT_DeviceDataReference& data);
+
+ NPT_Result ParseFault(PLT_ActionReference& action, NPT_XmlElementNode* fault);
+ PLT_SsdpSearchTask* CreateSearchTask(const NPT_HttpUrl& url,
+ const char* target,
+ NPT_Cardinal mx,
+ NPT_Timeout frequency,
+ const NPT_IpAddress& address);
+
+private:
+ friend class NPT_Reference<PLT_CtrlPoint>;
+ friend class PLT_UPnP;
+ friend class PLT_UPnP_CtrlPointStartIterator;
+ friend class PLT_UPnP_CtrlPointStopIterator;
+ friend class PLT_EventSubscriberRemoverIterator;
+ friend class PLT_CtrlPointGetDescriptionTask;
+ friend class PLT_CtrlPointGetSCPDTask;
+ friend class PLT_CtrlPointInvokeActionTask;
+ friend class PLT_CtrlPointHouseKeepingTask;
+ friend class PLT_CtrlPointSubscribeEventTask;
+
+ NPT_List<NPT_String> m_UUIDsToIgnore;
+ NPT_Lock<PLT_CtrlPointListenerList> m_ListenerList;
+ PLT_HttpServer* m_EventHttpServer;
+ NPT_HttpRequestHandler* m_EventHttpServerHandler;
+ PLT_TaskManager m_TaskManager;
+ NPT_Lock<NPT_List<PLT_DeviceDataReference> > m_Devices;
+ NPT_Lock<NPT_List<PLT_EventSubscriber*> > m_Subscribers;
+ NPT_String m_SearchCriteria;
+};
+
+typedef NPT_Reference<PLT_CtrlPoint> PLT_CtrlPointReference;
+
+#endif /* _PLT_CONTROL_POINT_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Control Point Tasks
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_CONTROL_POINT_TASK_H_
+#define _PLT_CONTROL_POINT_TASK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttpClientTask.h"
+#include "PltDatagramStream.h"
+#include "PltDeviceData.h"
+#include "PltCtrlPoint.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_Action;
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointGetDescriptionTask class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointGetDescriptionTask : public PLT_HttpClientSocketTask
+{
+public:
+ PLT_CtrlPointGetDescriptionTask(const NPT_HttpUrl& url,
+ PLT_CtrlPoint* ctrl_point,
+ PLT_DeviceDataReference& root_device);
+ virtual ~PLT_CtrlPointGetDescriptionTask();
+
+protected:
+ // PLT_HttpClientSocketTask methods
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+protected:
+ PLT_CtrlPoint* m_CtrlPoint;
+ PLT_DeviceDataReference m_RootDevice;
+};
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointGetSCPDRequest class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointGetSCPDRequest : public NPT_HttpRequest
+{
+public:
+ PLT_CtrlPointGetSCPDRequest(const char* url,
+ const char* method,
+ const char* protocol) :
+ NPT_HttpRequest(url, method, protocol) {}
+ ~PLT_CtrlPointGetSCPDRequest() {}
+
+ // members
+ PLT_Service* m_Service;
+};
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointGetSCPDTask class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointGetSCPDTask : public PLT_HttpClientSocketTask
+{
+public:
+ PLT_CtrlPointGetSCPDTask(PLT_CtrlPoint* ctrl_point,
+ PLT_DeviceDataReference& root_device);
+ virtual ~PLT_CtrlPointGetSCPDTask();
+
+protected:
+ // PLT_HttpClientSocketTask methods
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+protected:
+ PLT_CtrlPoint* m_CtrlPoint;
+ PLT_DeviceDataReference m_RootDevice;
+};
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointInvokeActionTask class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointInvokeActionTask : public PLT_HttpClientSocketTask
+{
+public:
+ PLT_CtrlPointInvokeActionTask(NPT_HttpRequest* request,
+ PLT_CtrlPoint* ctrl_point,
+ PLT_ActionReference& action,
+ void* userdata);
+ virtual ~PLT_CtrlPointInvokeActionTask();
+
+protected:
+ // PLT_HttpClientSocketTask methods
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+protected:
+ PLT_CtrlPoint* m_CtrlPoint;
+ PLT_ActionReference m_Action;
+ void* m_Userdata;
+};
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointHouseKeepingTask class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointHouseKeepingTask : public PLT_ThreadTask
+{
+public:
+ PLT_CtrlPointHouseKeepingTask(PLT_CtrlPoint* ctrl_point,
+ NPT_TimeInterval timer = NPT_TimeInterval(5, 0));
+
+protected:
+ ~PLT_CtrlPointHouseKeepingTask() {}
+
+ // PLT_ThreadTask methods
+ virtual void DoRun();
+
+protected:
+ PLT_CtrlPoint* m_CtrlPoint;
+ NPT_TimeInterval m_Timer;
+};
+
+/*----------------------------------------------------------------------
+| PLT_CtrlPointSubscribeEventTask class
++---------------------------------------------------------------------*/
+class PLT_CtrlPointSubscribeEventTask : public PLT_HttpClientSocketTask
+{
+public:
+ PLT_CtrlPointSubscribeEventTask(NPT_HttpRequest* request,
+ PLT_CtrlPoint* ctrl_point,
+ PLT_DeviceDataReference &device,
+ PLT_Service* service,
+ void* userdata = NULL);
+ virtual ~PLT_CtrlPointSubscribeEventTask();
+
+protected:
+ // PLT_HttpClientSocketTask methods
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+protected:
+ PLT_CtrlPoint* m_CtrlPoint;
+ PLT_Service* m_Service;
+ PLT_DeviceDataReference m_Device; // force to keep a reference to device owning m_Service
+ void* m_Userdata;
+};
+
+#endif /* _PLT_CONTROL_POINT_TASK_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Datagram Stream
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_DATAGRAM_H_
+#define _PLT_DATAGRAM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| PLT_InputDatagramStream
++---------------------------------------------------------------------*/
+class PLT_InputDatagramStream : public NPT_InputStream
+{
+public:
+ // methods
+ PLT_InputDatagramStream(NPT_UdpSocket* socket);
+ virtual ~PLT_InputDatagramStream();
+
+ NPT_Result GetInfo(NPT_SocketInfo& info);
+
+ // NPT_InputStream methods
+ NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = 0);
+
+ NPT_Result Seek(NPT_Position offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
+ NPT_Result Skip(NPT_Size offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
+ NPT_Result Tell(NPT_Position& offset){ NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
+ NPT_Result GetSize(NPT_LargeSize& size) { NPT_COMPILER_UNUSED(size); return NPT_FAILURE; }
+ NPT_Result GetAvailable(NPT_LargeSize& available) { NPT_COMPILER_UNUSED(available); return NPT_FAILURE; }
+
+protected:
+ NPT_UdpSocket* m_Socket;
+ NPT_SocketInfo m_Info;
+};
+
+typedef NPT_Reference<PLT_InputDatagramStream> PLT_InputDatagramStreamReference;
+
+/*----------------------------------------------------------------------
+| PLT_OutputDatagramStream
++---------------------------------------------------------------------*/
+class PLT_OutputDatagramStream : public NPT_OutputStream
+{
+public:
+ // methods
+ PLT_OutputDatagramStream(NPT_UdpSocket* socket,
+ NPT_Size size = 4096,
+ const NPT_SocketAddress* address = NULL);
+ virtual ~PLT_OutputDatagramStream();
+
+ // NPT_OutputStream methods
+ NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL);
+ NPT_Result Flush();
+
+ NPT_Result Seek(NPT_Position offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
+ NPT_Result Tell(NPT_Position& offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
+
+protected:
+ NPT_UdpSocket* m_Socket;
+ NPT_DataBuffer m_Buffer;
+ NPT_SocketAddress* m_Address;
+};
+
+typedef NPT_Reference<PLT_OutputDatagramStream> PLT_OutputDatagramStreamReference;
+
+#endif /* _PLT_DATAGRAM_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Device Data
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_DEVICE_DATA_H_
+#define _PLT_DEVICE_DATA_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltConstants.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_Service;
+class PLT_DeviceData;
+
+typedef NPT_Reference<PLT_DeviceData> PLT_DeviceDataReference;
+typedef NPT_List<PLT_DeviceDataReference> PLT_DeviceDataReferenceList;
+
+/*----------------------------------------------------------------------
+| PLT_DeviceIcon class
++---------------------------------------------------------------------*/
+class PLT_DeviceIcon
+{
+public:
+ PLT_DeviceIcon(const char* mimetype = "",
+ NPT_Int32 width = 0,
+ NPT_Int32 height = 0,
+ NPT_Int32 depth = 0,
+ const char* urlpath = "") :
+ m_MimeType(mimetype),
+ m_Width(width),
+ m_Height(height),
+ m_Depth(depth),
+ m_UrlPath(urlpath) {}
+ virtual ~PLT_DeviceIcon() {}
+
+ NPT_String m_MimeType;
+ NPT_Int32 m_Width;
+ NPT_Int32 m_Height;
+ NPT_Int32 m_Depth;
+ NPT_String m_UrlPath;
+};
+
+/*----------------------------------------------------------------------
+| PLT_DeviceData class
++---------------------------------------------------------------------*/
+class PLT_DeviceData
+{
+public:
+ PLT_DeviceData(
+ NPT_HttpUrl description_url = NPT_HttpUrl(NULL, 0, "/"),
+ const char* uuid = "",
+ NPT_TimeInterval lease_time = PLT_Constants::GetInstance().m_DefaultDeviceLease,
+ const char* device_type = "",
+ const char* friendly_name = "");
+
+ /* Getters */
+ virtual NPT_Result GetDescription(NPT_String& desc);
+ virtual NPT_String GetDescriptionUrl(const char* bind_addr = NULL);
+ virtual NPT_HttpUrl GetURLBase();
+ virtual NPT_HttpUrl NormalizeURL(const NPT_String& url);
+ virtual NPT_Result GetDescription(NPT_XmlElementNode* parent, NPT_XmlElementNode** device = NULL);
+ virtual NPT_String GetIconUrl(const char* mimetype = NULL, NPT_Int32 maxsize = 0, NPT_Int32 maxdepth = 0);
+
+ const NPT_TimeInterval& GetLeaseTime() const { return m_LeaseTime; }
+ const NPT_String& GetUUID() const { return m_UUID; }
+ const NPT_String& GetFriendlyName() const { return m_FriendlyName; }
+ const NPT_String& GetType() const { return m_DeviceType; }
+ const NPT_String& GetModelDescription() const { return m_ModelDescription; }
+ const NPT_String& GetParentUUID() const { return m_ParentUUID; }
+ bool IsRoot() { return m_ParentUUID.IsEmpty(); }
+
+ const NPT_Array<PLT_Service*>& GetServices() const { return m_Services; }
+ const NPT_Array<PLT_DeviceDataReference>& GetEmbeddedDevices() const { return m_EmbeddedDevices; }
+
+ NPT_Result FindEmbeddedDevice(const char* uuid, PLT_DeviceDataReference& device);
+ NPT_Result FindEmbeddedDeviceByType(const char* type, PLT_DeviceDataReference& device);
+ NPT_Result FindServiceById(const char* id, PLT_Service*& service);
+ NPT_Result FindServiceByType(const char* type, PLT_Service*& service);
+ NPT_Result FindServiceBySCPDURL(const char* url, PLT_Service*& service);
+ NPT_Result FindServiceByControlURL(const char* url, PLT_Service*& service, bool recursive = false);
+ NPT_Result FindServiceByEventSubURL(const char* url, PLT_Service*& service, bool recursive = false);
+
+ /* called by PLT_Device subclasses */
+ NPT_Result AddEmbeddedDevice(PLT_DeviceDataReference& device);
+ NPT_Result RemoveEmbeddedDevice(PLT_DeviceDataReference& device);
+ NPT_Result AddService(PLT_Service* service);
+
+ operator const char* ();
+
+protected:
+ virtual ~PLT_DeviceData();
+ virtual void Cleanup();
+ virtual NPT_Result OnAddExtraInfo(NPT_XmlElementNode* /*device_node*/) { return NPT_SUCCESS; }
+
+private:
+ /* called by PLT_CtrlPoint when new device is discovered */
+ NPT_Result SetURLBase(NPT_HttpUrl& url_base);
+ NPT_TimeStamp GetLeaseTimeLastUpdate();
+ NPT_Result SetLeaseTime(NPT_TimeInterval lease_time);
+ NPT_Result SetDescription(const char* szDescription,
+ const NPT_IpAddress& local_iface_ip);
+ NPT_Result SetDescriptionDevice(NPT_XmlElementNode* device_node);
+
+public:
+ NPT_String m_Manufacturer;
+ NPT_String m_ManufacturerURL;
+ NPT_String m_ModelDescription;
+ NPT_String m_ModelName;
+ NPT_String m_ModelNumber;
+ NPT_String m_ModelURL;
+ NPT_String m_SerialNumber;
+ NPT_String m_UPC;
+ NPT_String m_PresentationURL;
+ NPT_String m_DlnaDoc;
+ NPT_String m_DlnaCap;
+ NPT_String m_AggregationFlags;
+
+protected:
+ friend class NPT_Reference<PLT_DeviceData>;
+ friend class PLT_CtrlPoint;
+ friend class PLT_DeviceReadyIterator;
+ friend class PLT_DeviceHost;
+
+ //members
+ NPT_String m_ParentUUID;
+ NPT_String m_UUID;
+ NPT_HttpUrl m_URLDescription;
+ NPT_HttpUrl m_URLBase;
+ NPT_String m_DeviceType;
+ NPT_String m_FriendlyName;
+ NPT_TimeInterval m_LeaseTime;
+ NPT_TimeStamp m_LeaseTimeLastUpdate;
+ NPT_Array<PLT_Service*> m_Services;
+ NPT_Array<PLT_DeviceDataReference> m_EmbeddedDevices;
+ NPT_Array<PLT_DeviceIcon> m_Icons;
+
+ /* IP address of interface used when retrieving device description.
+ We need the info for the control point subscription callback */
+ NPT_IpAddress m_LocalIfaceIp;
+ NPT_String m_Representation;
+};
+
+/*----------------------------------------------------------------------
+| PLT_DeviceDataFinder
++---------------------------------------------------------------------*/
+class PLT_DeviceDataFinder
+{
+public:
+ // methods
+ PLT_DeviceDataFinder(const char* uuid) : m_UUID(uuid) {}
+ virtual ~PLT_DeviceDataFinder() {}
+
+ bool operator()(const PLT_DeviceDataReference& data) const {
+ return data->GetUUID().Compare(m_UUID, true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_UUID;
+};
+
+/*----------------------------------------------------------------------
+| PLT_DeviceDataFinderByType
++---------------------------------------------------------------------*/
+class PLT_DeviceDataFinderByType
+{
+public:
+ // methods
+ PLT_DeviceDataFinderByType(const char* type) : m_Type(type) {}
+ virtual ~PLT_DeviceDataFinderByType() {}
+
+ bool operator()(const PLT_DeviceDataReference& data) const {
+ return data->GetType().Compare(m_Type, true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_Type;
+};
+
+#endif /* _PLT_DEVICE_DATA_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Device Host
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_DEVICE_HOST_H_
+#define _PLT_DEVICE_HOST_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltDeviceData.h"
+#include "PltHttpServerListener.h"
+#include "PltSsdpListener.h"
+#include "PltTaskManager.h"
+#include "PltAction.h"
+#include "PltHttp.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_HttpServer;
+class PLT_HttpServerHandler;
+class PLT_SsdpDeviceAnnounceTask;
+class PLT_SsdpListenTask;
+
+/*----------------------------------------------------------------------
+| PLT_DeviceHost class
++---------------------------------------------------------------------*/
+class PLT_DeviceHost : public PLT_DeviceData,
+ public PLT_SsdpPacketListener
+{
+public:
+ PLT_DeviceHost(const char* description_path = "/",
+ const char* uuid = "",
+ const char* device_type = "",
+ const char* friendly_name = "",
+ bool show_ip = false,
+ NPT_UInt16 port = 0,
+ bool port_rebind = false);
+
+ // public methods
+ virtual void SetBroadcast(bool broadcast) { m_Broadcast = broadcast; }
+ virtual NPT_UInt16 GetPort() { return m_Port; };
+
+ // NPT_HttpRequestHandler forward for control/event requests
+ virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+ // PLT_SsdpDeviceAnnounceTask & PLT_SsdpDeviceAnnounceUnicastTask
+ virtual NPT_Result Announce(PLT_DeviceData* device,
+ NPT_HttpRequest& request,
+ NPT_UdpSocket& socket,
+ bool byebye);
+
+ virtual NPT_Result Announce(NPT_HttpRequest& request,
+ NPT_UdpSocket& socket,
+ bool byebye) {
+ return Announce(this, request, socket, byebye);
+ }
+
+ // PLT_SsdpPacketListener method
+ virtual NPT_Result OnSsdpPacket(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context);
+
+ // PLT_SsdpDeviceSearchListenTask
+ virtual NPT_Result ProcessSsdpSearchRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context);
+
+ // PLT_SsdpDeviceSearchResponseTask
+ virtual NPT_Result SendSsdpSearchResponse(PLT_DeviceData* device,
+ NPT_HttpResponse& response,
+ NPT_UdpSocket& socket,
+ const char* st,
+ const NPT_SocketAddress* addr = NULL);
+ virtual NPT_Result SendSsdpSearchResponse(NPT_HttpResponse& response,
+ NPT_UdpSocket& socket,
+ const char* ST,
+ const NPT_SocketAddress* addr = NULL) {
+ return SendSsdpSearchResponse(this, response, socket, ST, addr);
+ }
+
+protected:
+ virtual ~PLT_DeviceHost();
+
+ // pure methods
+ virtual NPT_Result SetupServices(PLT_DeviceData& data) = 0;
+
+ // setup methods
+ virtual NPT_Result SetupIcons();
+ virtual NPT_Result SetupDevice();
+
+ // overridable methods
+ virtual NPT_Result AddIcon(const PLT_DeviceIcon& icon,
+ const char* filepath);
+ virtual NPT_Result AddIcon(const PLT_DeviceIcon& icon,
+ const void* data,
+ NPT_Size size,
+ bool copy = true);
+ virtual NPT_Result Start(PLT_SsdpListenTask* task);
+ virtual NPT_Result Stop(PLT_SsdpListenTask* task);
+ virtual NPT_Result SetupServiceSCPDHandler(PLT_Service* service);
+ virtual NPT_Result OnAction(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+ virtual NPT_Result ProcessHttpGetRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+ virtual NPT_Result ProcessHttpPostRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+ virtual NPT_Result ProcessHttpSubscriberRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+protected:
+ friend class PLT_UPnP;
+ friend class PLT_UPnP_DeviceStartIterator;
+ friend class PLT_UPnP_DeviceStopIterator;
+ friend class PLT_Service;
+ friend class NPT_Reference<PLT_DeviceHost>;
+
+private:
+ PLT_TaskManager m_TaskManager;
+ PLT_HttpServer* m_HttpServer;
+ bool m_Broadcast;
+ NPT_UInt16 m_Port;
+ bool m_PortRebind;
+ NPT_List<NPT_HttpRequestHandler*> m_RequestHandlers;
+};
+
+typedef NPT_Reference<PLT_DeviceHost> PLT_DeviceHostReference;
+
+#endif /* _PLT_DEVICE_HOST_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - DIDL handling
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_DIDL_H_
+#define _PLT_DIDL_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltMediaItem.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define PLT_FILTER_MASK_ALL 0xFFFFFFFF
+
+#define PLT_FILTER_MASK_CREATOR 0x00000001
+#define PLT_FILTER_MASK_ARTIST 0x00000002
+#define PLT_FILTER_MASK_ALBUM 0x00000004
+#define PLT_FILTER_MASK_GENRE 0x00000008
+#define PLT_FILTER_MASK_ALBUMARTURI 0x00000010
+#define PLT_FILTER_MASK_DESCRIPTION 0x00000020
+#define PLT_FILTER_MASK_SEARCHABLE 0x00000040
+#define PLT_FILTER_MASK_CHILDCOUNT 0x00000080
+#define PLT_FILTER_MASK_ORIGINALTRACK 0x00000100
+#define PLT_FILTER_MASK_ACTOR 0x00000200
+#define PLT_FILTER_MASK_AUTHOR 0x00000400
+#define PLT_FILTER_MASK_DATE 0x00000800
+
+#define PLT_FILTER_MASK_RES 0x00010000
+#define PLT_FILTER_MASK_RES_DURATION 0x00020000
+#define PLT_FILTER_MASK_RES_SIZE 0x00040000
+#define PLT_FILTER_MASK_RES_PROTECTION 0x00080000
+#define PLT_FILTER_MASK_RES_RESOLUTION 0x00100000
+#define PLT_FILTER_MASK_RES_BITRATE 0x00200000
+#define PLT_FILTER_MASK_RES_BITSPERSAMPLE 0x00400000
+#define PLT_FILTER_MASK_RES_NRAUDIOCHANNELS 0x00800000
+#define PLT_FILTER_MASK_RES_SAMPLEFREQUENCY 0x01000000
+
+#define PLT_FILTER_MASK_TOC 0x02000000
+
+#define PLT_FILTER_FIELD_CREATOR "dc:creator"
+#define PLT_FILTER_FIELD_DATE "dc:date"
+#define PLT_FILTER_FIELD_ARTIST "upnp:artist"
+#define PLT_FILTER_FIELD_ACTOR "upnp:actor"
+#define PLT_FILTER_FIELD_AUTHOR "upnp:author"
+#define PLT_FILTER_FIELD_ALBUM "upnp:album"
+#define PLT_FILTER_FIELD_GENRE "upnp:genre"
+#define PLT_FILTER_FIELD_ALBUMARTURI "upnp:albumArtURI"
+#define PLT_FILTER_FIELD_DESCRIPTION "upnp:longDescription"
+#define PLT_FILTER_FIELD_ORIGINALTRACK "upnp:originalTrackNumber"
+#define PLT_FILTER_FIELD_SEARCHABLE "@searchable"
+#define PLT_FILTER_FIELD_CHILDCOUNT "@childcount"
+#define PLT_FILTER_FIELD_CONTAINER_CHILDCOUNT "container@childCount"
+#define PLT_FILTER_FIELD_CONTAINER_SEARCHABLE "container@searchable"
+
+#define PLT_FILTER_FIELD_RES "res"
+#define PLT_FILTER_FIELD_RES_DURATION "res@duration"
+#define PLT_FILTER_FIELD_RES_SIZE "res@size"
+#define PLT_FILTER_FIELD_RES_PROTECTION "res@protection"
+#define PLT_FILTER_FIELD_RES_RESOLUTION "res@resolution"
+#define PLT_FILTER_FIELD_RES_BITRATE "res@bitrate"
+#define PLT_FILTER_FIELD_RES_BITSPERSAMPLE "res@bitsPerSample"
+#define PLT_FILTER_FIELD_RES_NRAUDIOCHANNELS "res@nrAudioChannels"
+#define PLT_FILTER_FIELD_RES_SAMPLEFREQUENCY "res@sampleFrequency"
+
+extern const char* didl_header;
+extern const char* didl_footer;
+extern const char* didl_namespace_dc;
+extern const char* didl_namespace_upnp;
+
+/*----------------------------------------------------------------------
+| PLT_Didl class
++---------------------------------------------------------------------*/
+class PLT_Didl
+{
+public:
+ static NPT_Result ToDidl(PLT_MediaObject& object,
+ NPT_String filter,
+ NPT_String& didl);
+ static NPT_Result FromDidl(const char* didl,
+ PLT_MediaObjectListReference& objects);
+
+ static void AppendXmlEscape(NPT_String& out, const char* in);
+ static void AppendXmlUnEscape(NPT_String& out, const char* in);
+ static NPT_Result ParseTimeStamp(NPT_String timestamp, NPT_UInt32& seconds);
+ static void FormatTimeStamp(NPT_String& out, NPT_UInt32 seconds);
+
+ static NPT_Result ParseTimeStamp(NPT_String in, NPT_TimeStamp& timestamp) {
+ NPT_UInt32 seconds;
+ NPT_Result res = ParseTimeStamp(in, seconds);
+ timestamp = NPT_TimeStamp(seconds, 0);
+ return res;
+ }
+
+ static NPT_UInt32 ConvertFilterToMask(NPT_String filter);
+};
+
+#endif /* _PLT_DIDL_H_ */
--- /dev/null
+/*****************************************************************
+|
+||
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_DOWNLOADER_H_
+#define _PLT_DOWNLOADER_H_
+
+/*----------------------------------------------------------------------
+| Includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttpClientTask.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_Downloader;
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef PLT_HttpClientTask<PLT_Downloader> PLT_HttpDownloadTask;
+
+typedef enum {
+ PLT_DOWNLOADER_IDLE,
+ PLT_DOWNLOADER_STARTED,
+ PLT_DOWNLOADER_DOWNLOADING,
+ PLT_DOWNLOADER_ERROR,
+ PLT_DOWNLOADER_SUCCESS
+} Plt_DowloaderState;
+
+/*----------------------------------------------------------------------
+| PLT_Downloader class
++---------------------------------------------------------------------*/
+class PLT_Downloader
+{
+public:
+ PLT_Downloader(PLT_TaskManager* task_manager,
+ const char* url,
+ NPT_OutputStreamReference& output);
+ virtual ~PLT_Downloader();
+
+ NPT_Result Start();
+ NPT_Result Stop();
+ Plt_DowloaderState GetState() { return m_State; }
+
+ // PLT_HttpClientTask method
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+
+private:
+ // members
+ NPT_String m_URL;
+ NPT_OutputStreamReference m_Output;
+ PLT_TaskManager* m_TaskManager;
+ PLT_HttpDownloadTask* m_Task;
+ Plt_DowloaderState m_State;
+};
+
+#endif /* _PLT_DOWNLOADER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Event
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_EVENT_H_
+#define _PLT_EVENT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttpClientTask.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_StateVariable;
+class PLT_DeviceData;
+class PLT_Service;
+class PLT_TaskManager;
+class PLT_CtrlPoint;
+
+/*----------------------------------------------------------------------
+| PLT_EventSubscriber class
++---------------------------------------------------------------------*/
+class PLT_EventSubscriber
+{
+public:
+ PLT_EventSubscriber(PLT_TaskManager* task_manager,
+ PLT_Service* service,
+ const char* sid,
+ int timeout = -1);
+ ~PLT_EventSubscriber();
+
+ PLT_Service* GetService();
+ NPT_Ordinal GetEventKey();
+ NPT_Result SetEventKey(NPT_Ordinal value);
+ NPT_SocketAddress GetLocalIf();
+ NPT_Result SetLocalIf(NPT_SocketAddress value);
+ NPT_TimeStamp GetExpirationTime();
+ NPT_Result SetTimeout(NPT_Cardinal timeout);
+ const NPT_String& GetSID() const { return m_SID; }
+ NPT_Result FindCallbackURL(const char* callback_url);
+ NPT_Result AddCallbackURL(const char* callback_url);
+ NPT_Result Notify(NPT_List<PLT_StateVariable*>& vars);
+
+protected:
+ //members
+ PLT_TaskManager* m_TaskManager;
+ PLT_Service* m_Service;
+ NPT_Ordinal m_EventKey;
+ PLT_HttpClientSocketTask* m_SubscriberTask;
+ NPT_String m_SID;
+ NPT_SocketAddress m_LocalIf;
+ NPT_Array<NPT_String> m_CallbackURLs;
+ NPT_TimeStamp m_ExpirationTime;
+};
+
+/*----------------------------------------------------------------------
+| PLT_EventSubscriberFinderBySID
++---------------------------------------------------------------------*/
+class PLT_EventSubscriberFinderBySID
+{
+public:
+ // methods
+ PLT_EventSubscriberFinderBySID(const char* sid) : m_SID(sid) {}
+
+ bool operator()(PLT_EventSubscriber* const & sub) const {
+ return m_SID.Compare(sub->GetSID(), true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_SID;
+};
+
+/*----------------------------------------------------------------------
+| PLT_EventSubscriberFinderByCallbackURL
++---------------------------------------------------------------------*/
+class PLT_EventSubscriberFinderByCallbackURL
+{
+public:
+ // methods
+ PLT_EventSubscriberFinderByCallbackURL(const char* callback_url) :
+ m_CallbackURL(callback_url) {}
+
+ bool operator()(PLT_EventSubscriber* const & sub) const {
+ return NPT_SUCCEEDED(sub->FindCallbackURL(m_CallbackURL));
+ }
+
+private:
+ // members
+ NPT_String m_CallbackURL;
+};
+
+/*----------------------------------------------------------------------
+| PLT_EventSubscriberFinderByService
++---------------------------------------------------------------------*/
+class PLT_EventSubscriberFinderByService
+{
+public:
+ // methods
+ PLT_EventSubscriberFinderByService(PLT_Service* service) : m_Service(service) {}
+ virtual ~PLT_EventSubscriberFinderByService() {}
+ bool operator()(PLT_EventSubscriber* const & eventSub) const;
+
+private:
+ // members
+ PLT_Service* m_Service;
+};
+
+#endif /* _PLT_EVENT_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - File Media Server
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_FILE_MEDIA_SERVER_H_
+#define _PLT_FILE_MEDIA_SERVER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltMediaServer.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define MAX_PATH_LENGTH 1024
+#define ALBUMART_QUERY "aa"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_MetadataHandler;
+
+/*----------------------------------------------------------------------
+| PLT_FileMediaServer class
++---------------------------------------------------------------------*/
+class PLT_FileMediaServer : public PLT_MediaServer
+{
+public:
+ // class methods
+ static NPT_String BuildSafeResourceUri(const NPT_HttpUrl& base_uri,
+ const char* host,
+ const char* file_path);
+
+ // constructor
+ PLT_FileMediaServer(const char* path,
+ const char* friendly_name,
+ bool show_ip = false,
+ const char* uuid = NULL,
+ NPT_UInt16 port = 0,
+ bool port_rebind = false);
+
+ // overridable
+ virtual NPT_Result AddMetadataHandler(PLT_MetadataHandler* handler);
+ virtual NPT_Result ExtractResourcePath(const NPT_HttpUrl& url, NPT_String& file_path);
+ virtual NPT_String BuildResourceUri(const NPT_HttpUrl& base_uri, const char* host, const char* file_path);
+
+protected:
+ virtual ~PLT_FileMediaServer();
+
+ // overridable
+ virtual NPT_Result ProcessFileRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+ // PLT_DeviceHost methods
+ virtual NPT_Result SetupDevice();
+ virtual NPT_Result ProcessHttpGetRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+ virtual NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+ // PLT_MediaServer methods
+ virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action,
+ const char* object_id,
+ const char* filter,
+ NPT_UInt32 starting_index,
+ NPT_UInt32 requested_count,
+ const NPT_List<NPT_String>& sort_criteria,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action,
+ const char* object_id,
+ const char* filter,
+ NPT_UInt32 starting_index,
+ NPT_UInt32 requested_count,
+ const NPT_List<NPT_String>& sort_criteria,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnSearchContainer(PLT_ActionReference& action,
+ const char* object_id,
+ const char* search_criteria,
+ const char* filter,
+ NPT_UInt32 starting_index,
+ NPT_UInt32 requested_count,
+ const NPT_List<NPT_String>& sort_criteria,
+ const PLT_HttpRequestContext& context);
+
+ virtual NPT_Result ServeFile(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response,
+ const NPT_String& file_path);
+ virtual NPT_Result OnAlbumArtRequest(NPT_HttpResponse& response,
+ NPT_String file_path);
+ virtual NPT_Result GetFilePath(const char* object_id, NPT_String& filepath);
+ virtual bool ProcessFile(const NPT_String&) { return true;}
+ virtual PLT_MediaObject* BuildFromFilePath(const NPT_String& filepath,
+ const PLT_HttpRequestContext& context,
+ bool with_count = true,
+ bool keep_extension_in_title = false);
+
+public:
+ NPT_UInt16 m_FileServerPort;
+
+protected:
+ friend class PLT_MediaItem;
+
+ NPT_String m_Path;
+ NPT_HttpUrl m_FileBaseUri;
+ NPT_HttpUrl m_AlbumArtBaseUri;
+ NPT_List<PLT_MetadataHandler*> m_MetadataHandlers;
+ bool m_FilterUnknownOut;
+};
+
+#endif /* _PLT_FILE_MEDIA_SERVER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - HTTP Helper
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_HTTP_H_
+#define _PLT_HTTP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| PLT_HttpHelper
++---------------------------------------------------------------------*/
+class PLT_HttpHelper {
+ public:
+ static bool IsConnectionKeepAlive(NPT_HttpMessage& message);
+ static bool IsBodyStreamSeekable(NPT_HttpMessage& message);
+
+ static NPT_Result ToLog(NPT_LoggerReference logger, int level, NPT_HttpRequest* request);
+ static NPT_Result ToLog(NPT_LoggerReference logger, int level, NPT_HttpResponse* response);
+
+ static NPT_Result GetContentType(NPT_HttpMessage& message, NPT_String& type);
+ static void SetContentType(NPT_HttpMessage& message, const char* type);
+ static NPT_Result GetContentLength(NPT_HttpMessage& message, NPT_LargeSize& len);
+ static void SetContentLength(NPT_HttpMessage& message, NPT_LargeSize len);
+
+ static NPT_Result GetHost(NPT_HttpRequest& request, NPT_String& value);
+ static void SetHost(NPT_HttpRequest& request, const char* host);
+ static NPT_Result GetRange(NPT_HttpRequest& request, NPT_Position& start, NPT_Position& end);
+ static void SetRange(NPT_HttpRequest& request, NPT_Position start, NPT_Position end = (NPT_Position)-1);
+
+ static NPT_Result GetContentRange(NPT_HttpResponse& response, NPT_Position& start, NPT_Position& end, NPT_LargeSize& length);
+ static NPT_Result SetContentRange(NPT_HttpResponse& response, NPT_Position start, NPT_Position end, NPT_LargeSize length);
+
+ static NPT_Result SetBody(NPT_HttpMessage& message, NPT_String& body);
+ static NPT_Result SetBody(NPT_HttpMessage& message, const char* body, NPT_Size len);
+ static NPT_Result SetBody(NPT_HttpMessage& message, NPT_InputStreamReference& stream, NPT_LargeSize len = 0);
+
+
+ static NPT_Result GetBody(NPT_HttpMessage& message, NPT_String& body);
+ static NPT_Result ParseBody(NPT_HttpMessage& message, NPT_XmlElementNode*& xml);
+
+ static NPT_Result Connect(NPT_Socket& connection,
+ NPT_HttpRequest& request,
+ NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
+ static void SetBasicAuthorization(NPT_HttpRequest& request, const char* login, const char* password);
+};
+
+/*----------------------------------------------------------------------
+| PLT_HttpRequestContext
++---------------------------------------------------------------------*/
+class PLT_HttpRequestContext : public NPT_HttpRequestContext {
+public:
+ // constructors and destructor
+ PLT_HttpRequestContext(NPT_HttpRequest& request) :
+ m_Request(request) {}
+ PLT_HttpRequestContext(NPT_HttpRequest& request, const NPT_HttpRequestContext& context) :
+ NPT_HttpRequestContext(&context.GetLocalAddress(), &context.GetRemoteAddress()),
+ m_Request(request) {}
+ virtual ~PLT_HttpRequestContext() {}
+
+ NPT_HttpRequest& GetRequest() const { return m_Request; }
+
+private:
+ NPT_HttpRequest& m_Request;
+};
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#if defined(NPT_CONFIG_ENABLE_LOGGING)
+#define PLT_LOG_HTTP_MESSAGE_L(_logger, _level, _msg) \
+ PLT_HttpHelper::ToLog((_logger), (_level), (_msg))
+#define PLT_LOG_HTTP_MESSAGE(_level, _msg) \
+ PLT_HttpHelper::ToLog((_NPT_LocalLogger), (_level), (_msg))
+
+#else /* NPT_CONFIG_ENABLE_LOGGING */
+#define PLT_LOG_HTTP_MESSAGE_L(_logger, _level, _msg)
+#define PLT_LOG_HTTP_MESSAGE(_level, _msg)
+#endif /* NPT_CONFIG_ENABLE_LOGGING */
+
+/*----------------------------------------------------------------------
+| PLT_HttpRequestHandler
++---------------------------------------------------------------------*/
+template <class T>
+class PLT_HttpRequestHandler : public NPT_HttpRequestHandler
+{
+public:
+ PLT_HttpRequestHandler<T>(T* data) : m_Data(data) {}
+ virtual ~PLT_HttpRequestHandler<T>() {}
+
+ // NPT_HttpRequestHandler methods
+ NPT_Result SetupResponse(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response) {
+ return m_Data->ProcessHttpRequest(request, context, response);
+ }
+
+private:
+ T* m_Data;
+};
+
+
+#endif /* _PLT_HTTP_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - HTTP Client Tasks
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_HTTP_CLIENT_TASK_H_
+#define _PLT_HTTP_CLIENT_TASK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttp.h"
+#include "PltThreadTask.h"
+
+/*----------------------------------------------------------------------
+| PLT_HttpTcpConnector
++---------------------------------------------------------------------*/
+class PLT_HttpTcpConnector : public NPT_HttpClient::Connector
+{
+public:
+ PLT_HttpTcpConnector();
+ virtual ~PLT_HttpTcpConnector();
+ virtual NPT_Result Connect(const char* hostname,
+ NPT_UInt16 port,
+ NPT_Timeout connection_timeout,
+ NPT_Timeout io_timeout,
+ NPT_Timeout name_resolver_timeout,
+ NPT_InputStreamReference& input_stream,
+ NPT_OutputStreamReference& output_stream);
+
+public:
+ void GetInfo(NPT_SocketInfo& info) { info = m_SocketInfo;}
+ void Abort() { if (!m_Socket.IsNull()) m_Socket->Disconnect(); }
+
+private:
+ NPT_String m_HostName;
+ NPT_UInt16 m_Port;
+ NPT_InputStreamReference m_InputStream;
+ NPT_OutputStreamReference m_OutputStream;
+ NPT_SocketInfo m_SocketInfo;
+ NPT_Reference<NPT_Socket> m_Socket;
+};
+
+/*----------------------------------------------------------------------
+| PLT_HttpClientSocketTask class
++---------------------------------------------------------------------*/
+class PLT_HttpClientSocketTask : public PLT_ThreadTask
+{
+friend class PLT_ThreadTask;
+
+public:
+ PLT_HttpClientSocketTask(NPT_HttpRequest* request = NULL,
+ bool wait_forever = false);
+
+ virtual NPT_Result AddRequest(NPT_HttpRequest* request);
+
+protected:
+ virtual ~PLT_HttpClientSocketTask();
+
+protected:
+ virtual NPT_Result SetConnector(PLT_HttpTcpConnector* connector);
+
+ // PLT_ThreadTask methods
+ virtual void DoAbort();
+ virtual void DoRun();
+
+ virtual NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+private:
+ NPT_Result GetNextRequest(NPT_HttpRequest*& request, NPT_Timeout timeout);
+
+protected:
+ NPT_HttpClient m_Client;
+ bool m_WaitForever;
+ NPT_Queue<NPT_HttpRequest> m_Requests;
+ NPT_Mutex m_ConnectorLock;
+ PLT_HttpTcpConnector* m_Connector;
+};
+
+/*----------------------------------------------------------------------
+| PLT_HttpClientTask class
++---------------------------------------------------------------------*/
+template <class T>
+class PLT_HttpClientTask : public PLT_HttpClientSocketTask
+{
+public:
+ PLT_HttpClientTask<T>(const NPT_HttpUrl& url, T* data) :
+ PLT_HttpClientSocketTask(new NPT_HttpRequest(url, "GET", NPT_HTTP_PROTOCOL_1_1)),
+ m_Data(data) {}
+ protected:
+ virtual ~PLT_HttpClientTask<T>() {}
+
+protected:
+ // PLT_HttpClientSocketTask method
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response) {
+ return m_Data->ProcessResponse(res, request, context, response);
+ }
+
+protected:
+ T* m_Data;
+};
+
+/*----------------------------------------------------------------------
+| PLT_FileHttpClientTask class
++---------------------------------------------------------------------*/
+class PLT_FileHttpClientTask : public PLT_HttpClientSocketTask
+{
+public:
+ PLT_FileHttpClientTask(const NPT_HttpUrl& url) :
+ PLT_HttpClientSocketTask(new NPT_HttpRequest(url, "GET", NPT_HTTP_PROTOCOL_1_1)) {}
+
+protected:
+ virtual ~PLT_FileHttpClientTask() {}
+
+protected:
+ // PLT_HttpClientSocketTask method
+ NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+};
+
+#endif /* _PLT_HTTP_CLIENT_TASK_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - HTTP Server
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_HTTP_SERVER_H_
+#define _PLT_HTTP_SERVER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttpServerListener.h"
+#include "PltHttpServerTask.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_HttpServerStartIterator;
+
+/*----------------------------------------------------------------------
+| PLT_HttpServer class
++---------------------------------------------------------------------*/
+class PLT_HttpServer : public PLT_HttpServerListener,
+ public NPT_HttpServer
+{
+ friend class PLT_HttpServerTask<class PLT_HttpServer>;
+ friend class PLT_HttpServerStartIterator;
+
+public:
+ PLT_HttpServer(unsigned int port = 0,
+ bool port_rebind = false,
+ NPT_Cardinal max_clients = 0,
+ bool reuse_address = false);
+ virtual ~PLT_HttpServer();
+
+ // PLT_HttpServerListener method
+ virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse*& response,
+ bool& headers_only);
+
+ virtual NPT_Result Start();
+ virtual NPT_Result Stop();
+ virtual unsigned int GetPort() { return m_Port; }
+
+private:
+ PLT_TaskManager* m_TaskManager;
+ unsigned int m_Port;
+ bool m_PortRebind;
+ bool m_ReuseAddress;
+ PLT_HttpServerListenTask* m_HttpListenTask;
+};
+
+/*----------------------------------------------------------------------
+| PLT_FileServer class
++---------------------------------------------------------------------*/
+class PLT_FileServer
+{
+public:
+ // class methods
+ static NPT_Result ServeFile(NPT_HttpResponse& response,
+ NPT_String file_path,
+ NPT_Position start = (NPT_Position)-1,
+ NPT_Position end = (NPT_Position)-1,
+ bool request_is_head = false);
+ static const char* GetMimeType(const NPT_String& filename);
+};
+
+#endif /* _PLT_HTTP_SERVER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - HTTP Server Listener
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+#ifndef _PLT_HTTP_SERVER_LISTENER_H_
+#define _PLT_HTTP_SERVER_LISTENER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| PLT_HttpServerListener Interface
++---------------------------------------------------------------------*/
+class PLT_HttpServerListener
+{
+ public:
+ virtual ~PLT_HttpServerListener() {}
+
+ virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse*& response,
+ bool& headers_only) = 0;
+};
+
+#endif /* _PLT_HTTP_SERVER_LISTENER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - HTTP Server Tasks
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_HTTP_SERVER_TASK_H_
+#define _PLT_HTTP_SERVER_TASK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttp.h"
+#include "PltDatagramStream.h"
+#include "PltThreadTask.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+template <class T> class PLT_HttpListenTask;
+class PLT_HttpServerListener;
+typedef PLT_HttpListenTask<PLT_HttpServerListener> PLT_HttpServerListenTask;
+
+/*----------------------------------------------------------------------
+| PLT_HttpServerSocketTask class
++---------------------------------------------------------------------*/
+class PLT_HttpServerSocketTask : public PLT_ThreadTask
+{
+ friend class PLT_ThreadTask;
+
+public:
+ PLT_HttpServerSocketTask(NPT_Socket* socket, bool stay_alive_forever = false);
+
+protected:
+ virtual ~PLT_HttpServerSocketTask();
+
+protected:
+ // Request callback handler
+ virtual NPT_Result ProcessRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse*& response,
+ bool& headers_only) = 0;
+
+ // overridables
+ virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream);
+ virtual NPT_Result GetInfo(NPT_SocketInfo& info);
+
+ // PLT_ThreadTask methods
+ virtual void DoAbort() { m_Socket->Disconnect(); }
+ virtual void DoRun();
+
+private:
+ virtual NPT_Result Read(NPT_BufferedInputStreamReference& buffered_input_stream,
+ NPT_HttpRequest*& request,
+ NPT_HttpRequestContext* context = NULL);
+ virtual NPT_Result Write(NPT_HttpResponse* response,
+ bool& keep_alive,
+ bool headers_only = false);
+
+protected:
+ NPT_Socket* m_Socket;
+ bool m_StayAliveForever;
+};
+
+/*----------------------------------------------------------------------
+| PLT_HttpServerTask class
++---------------------------------------------------------------------*/
+template <class T>
+class PLT_HttpServerTask : public PLT_HttpServerSocketTask
+{
+public:
+ PLT_HttpServerTask<T>(T* data,
+ NPT_Socket* socket,
+ bool keep_alive = false) :
+ PLT_HttpServerSocketTask(socket, keep_alive), m_Data(data) {}
+
+protected:
+ virtual ~PLT_HttpServerTask<T>() {}
+
+protected:
+ NPT_Result ProcessRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse*& response,
+ bool& headers_only) {
+ return m_Data->ProcessHttpRequest(request, context, response, headers_only);
+ }
+
+protected:
+ T* m_Data;
+};
+
+/*----------------------------------------------------------------------
+| PLT_HttpListenTask class
++---------------------------------------------------------------------*/
+template <class T>
+class PLT_HttpListenTask : public PLT_ThreadTask
+{
+public:
+ PLT_HttpListenTask<T>(T* data, NPT_TcpServerSocket* socket, bool cleanup_socket = true) :
+ m_Data(data), m_Socket(socket), m_CleanupSocket(cleanup_socket) {}
+
+protected:
+ virtual ~PLT_HttpListenTask<T>() {
+ if (m_CleanupSocket) delete m_Socket;
+ }
+
+protected:
+ // PLT_ThreadTask methods
+ virtual void DoAbort() { m_Socket->Disconnect(); }
+ virtual void DoRun() {
+ while (!IsAborting(0)) {
+ NPT_Socket* client = NULL;
+ NPT_Result result = m_Socket->WaitForNewClient(client, 5000);
+ if (NPT_FAILED(result) && result != NPT_ERROR_TIMEOUT) {
+ if (client) delete client;
+ //NPT_LOG_WARNING_2("PLT_HttpListenTask exiting with %d (%s)", result, NPT_ResultText(result));
+ break;
+ }
+
+ if (NPT_SUCCEEDED(result)) {
+ PLT_ThreadTask* task = new PLT_HttpServerTask<T>(m_Data, client);
+ if (NPT_FAILED(m_TaskManager->StartTask(task))) {
+ task->Kill();
+ }
+ }
+ }
+ }
+
+protected:
+ T* m_Data;
+ NPT_TcpServerSocket* m_Socket;
+ bool m_CleanupSocket;
+};
+
+#endif /* _PLT_HTTP_SERVER_TASK_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Leaks
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_LEAKS_H_
+#define _PLT_LEAKS_H_
+
+/*----------------------------------------------------------------------
+| functions
++---------------------------------------------------------------------*/
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+void PLT_Leak_Enable(void);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* _PLT_LEAKS_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Browser (Media Server Control Point)
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_BROWSER_H_
+#define _PLT_MEDIA_BROWSER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltCtrlPoint.h"
+#include "PltMediaItem.h"
+
+/*----------------------------------------------------------------------
+| PLT_BrowseInfo
++---------------------------------------------------------------------*/
+struct PLT_BrowseInfo {
+ NPT_String object_id;
+ PLT_MediaObjectListReference items;
+ NPT_UInt32 nr;
+ NPT_UInt32 tm;
+ NPT_UInt32 uid;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaBrowserDelegate class
++---------------------------------------------------------------------*/
+class PLT_MediaBrowserDelegate
+{
+public:
+ virtual ~PLT_MediaBrowserDelegate() {}
+
+ virtual bool OnMSAdded(PLT_DeviceDataReference& /* device */) { return true; }
+ virtual void OnMSRemoved(PLT_DeviceDataReference& /* device */) {}
+ virtual void OnMSStateVariablesChanged(
+ PLT_Service* /*service*/,
+ NPT_List<PLT_StateVariable*>* /*vars*/) {}
+
+ // ContentDirectory
+ virtual void OnBrowseResult(
+ NPT_Result /*res*/,
+ PLT_DeviceDataReference& /*device*/,
+ PLT_BrowseInfo* /*info*/,
+ void* /*userdata*/) {}
+
+ virtual void OnSearchResult(
+ NPT_Result /*res*/,
+ PLT_DeviceDataReference& /*device*/,
+ PLT_BrowseInfo* /*info*/,
+ void* /*userdata*/) {}
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaBrowser class
++---------------------------------------------------------------------*/
+class PLT_MediaBrowser : public PLT_CtrlPointListener
+{
+public:
+ PLT_MediaBrowser(PLT_CtrlPointReference& ctrl_point,
+ PLT_MediaBrowserDelegate* delegate = NULL);
+ virtual ~PLT_MediaBrowser();
+
+ // ContentDirectory service
+ virtual NPT_Result Browse(PLT_DeviceDataReference& device,
+ const char* object_id,
+ NPT_UInt32 start_index,
+ NPT_UInt32 count = 30, // DLNA recommendations
+ bool browse_metadata = false,
+ const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
+ const char* sort_criteria = "",
+ void* userdata = NULL);
+
+ virtual NPT_Result Search(PLT_DeviceDataReference& device,
+ const char* container_id,
+ const char* search_criteria,
+ NPT_UInt32 start_index,
+ NPT_UInt32 count = 30, // DLNA recommendations
+ const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
+ void* userdata = NULL);
+ //BBMOD END
+
+ // methods
+ virtual const NPT_Lock<PLT_DeviceDataReferenceList>& GetMediaServers() { return m_MediaServers; }
+ virtual NPT_Result FindServer(const char* uuid, PLT_DeviceDataReference& device);
+ virtual void SetDelegate(PLT_MediaBrowserDelegate* delegate) { m_Delegate = delegate; }
+
+protected:
+ // PLT_CtrlPointListener methods
+ virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
+ virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
+ virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata);
+ virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars);
+
+ // ContentDirectory service responses
+ virtual NPT_Result OnBrowseResponse(NPT_Result res,
+ PLT_DeviceDataReference& device,
+ PLT_ActionReference& action,
+ void* userdata);
+
+ virtual NPT_Result OnSearchResponse(NPT_Result res,
+ PLT_DeviceDataReference& device,
+ PLT_ActionReference& action,
+ void* userdata);
+
+protected:
+ PLT_CtrlPointReference m_CtrlPoint;
+ PLT_MediaBrowserDelegate* m_Delegate;
+ NPT_Lock<PLT_DeviceDataReferenceList> m_MediaServers;
+};
+
+#endif /* _PLT_MEDIA_BROWSER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Browser Listener
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_BROWSER_LISTENER_H_
+#define _PLT_MEDIA_BROWSER_LISTENER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltMediaItem.h"
+#include "PltDeviceData.h"
+
+/*----------------------------------------------------------------------
+| PLT_BrowseInfo
++---------------------------------------------------------------------*/
+class PLT_BrowseInfo {
+public:
+ PLT_BrowseInfo() : nr(0), tm(0), uid(0) {}
+
+ NPT_String object_id;
+ PLT_MediaObjectListReference items;
+ NPT_UInt32 nr;
+ NPT_UInt32 tm;
+ NPT_UInt32 uid;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaBrowserListener class
++---------------------------------------------------------------------*/
+class PLT_MediaBrowserListener
+{
+public:
+ virtual ~PLT_MediaBrowserListener() {}
+
+ virtual void OnMSAddedRemoved(
+ PLT_DeviceDataReference& /*device*/,
+ int /*added*/) {}
+
+ virtual void OnMSStateVariablesChanged(
+ PLT_Service* /*service*/,
+ NPT_List<PLT_StateVariable*>* /*vars*/) {}
+
+ virtual void OnMSBrowseResult(
+ NPT_Result /*res*/,
+ PLT_DeviceDataReference& /*device*/,
+ PLT_BrowseInfo* /*info*/,
+ void* /*userdata*/) {}
+};
+
+#endif /* _PLT_MEDIA_BROWSER_LISTENER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Cache
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_CACHE_H_
+#define _PLT_MEDIA_CACHE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltMediaItem.h"
+#include "PltDeviceData.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------
+| typedefs
++---------------------------------------------------------------------*/
+typedef NPT_Map<NPT_String, PLT_MediaObjectListReference>::Entry PLT_MediaCacheEntry;
+
+/*----------------------------------------------------------------------
+| PLT_MediaCache class
++---------------------------------------------------------------------*/
+class PLT_MediaCache
+{
+public:
+ PLT_MediaCache();
+ virtual ~PLT_MediaCache();
+
+ NPT_Result Put(const char* device_uuid, const char* item_id, PLT_MediaObjectListReference& list);
+ NPT_Result Get(const char* device_uuid, const char* item_id, PLT_MediaObjectListReference& list);
+ NPT_Result Clear(const char* device_uuid, const char* item_id);
+ NPT_Result Clear(const char* device_uuid = NULL);
+
+private:
+ NPT_String GenerateKey(const char* device_uuid, const char* item_id);
+
+private:
+ NPT_Mutex m_Mutex;
+ NPT_Map<NPT_String, PLT_MediaObjectListReference> m_Items;
+};
+
+#endif /* _PLT_MEDIA_CACHE_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Connect Device
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_CONNECT_H_
+#define _PLT_MEDIA_CONNECT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltFileMediaServer.h"
+
+/*----------------------------------------------------------------------
+| PLT_MediaConnectInfo
++---------------------------------------------------------------------*/
+class PLT_MediaConnectInfo
+{
+public:
+ PLT_MediaConnectInfo(bool authorized = false) :
+ m_Authorized(authorized), m_Validated(false) {}
+
+ bool m_Authorized;
+ bool m_Validated;
+ NPT_String m_UDN;
+};
+
+/*----------------------------------------------------------------------
+| defines
++---------------------------------------------------------------------*/
+typedef NPT_Map<NPT_String, PLT_MediaConnectInfo> PLT_MediaConnectDeviceInfoMap;
+typedef NPT_Map<NPT_String, PLT_MediaConnectInfo>::Entry PLT_MediaConnectDeviceInfoMapEntry;
+typedef NPT_Map<NPT_String, NPT_String> PLT_UDNtoMACMap;
+typedef NPT_Map<NPT_String, NPT_String>::Entry PLT_UDNtoMACMapEntry;
+
+/*----------------------------------------------------------------------
+| PLT_MediaConnect
++---------------------------------------------------------------------*/
+class PLT_MediaConnect : public PLT_FileMediaServer
+{
+public:
+ PLT_MediaConnect(const char* path,
+ const char* friendly_name,
+ bool show_ip = false,
+ const char* udn = NULL,
+ NPT_UInt16 port = 0,
+ bool port_rebind = false);
+
+ NPT_Result Authorize(PLT_MediaConnectInfo* info, bool state);
+ NPT_Result Validate(PLT_MediaConnectInfo* info, bool state);
+
+protected:
+ virtual ~PLT_MediaConnect();
+
+
+ // PLT_DeviceHost methods
+ virtual NPT_Result SetupServices(PLT_DeviceData& data);
+ virtual NPT_Result OnAction(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse& response);
+
+ // PLT_FileMediaServer methods
+ virtual NPT_Result GetFilePath(const char* object_id, NPT_String& filepath);
+
+ // X_MS_MediaReceiverRegistrar
+ virtual NPT_Result OnIsAuthorized(PLT_ActionReference& action,
+ PLT_MediaConnectInfo* mediaConnectInfo);
+ virtual NPT_Result OnRegisterDevice(PLT_ActionReference& action,
+ PLT_MediaConnectInfo* mediaConnectInfo);
+ virtual NPT_Result OnIsValidated(PLT_ActionReference& action,
+ PLT_MediaConnectInfo* mediaConnectInfo);
+
+private:
+ NPT_Result LookUpMediaConnectInfo(NPT_String deviceID,
+ PLT_MediaConnectInfo*& mediaConnectInfo);
+
+protected:
+ PLT_MediaConnectDeviceInfoMap m_MediaConnectDeviceInfoMap;
+ PLT_UDNtoMACMap m_MediaConnectUDNMap;
+
+private:
+ PLT_Service* m_RegistrarService;
+};
+
+#endif /* _PLT_MEDIA_CONNECT_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Controller (Media Renderer Control Point)
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_CONTROLLER_H_
+#define _PLT_MEDIA_CONTROLLER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltCtrlPoint.h"
+#include "PltMediaItem.h"
+
+/*----------------------------------------------------------------------
+| Defines
++---------------------------------------------------------------------*/
+typedef NPT_List<NPT_String> PLT_StringList;
+
+struct PLT_DeviceCapabilities {
+ PLT_StringList play_media;
+ PLT_StringList rec_media;
+ PLT_StringList rec_quality_modes;
+};
+
+struct PLT_MediaInfo {
+ NPT_UInt32 num_tracks;
+ NPT_TimeStamp media_duration;
+ NPT_String cur_uri;
+ NPT_String cur_metadata;
+ NPT_String next_uri;
+ NPT_String next_metadata;
+ NPT_String play_medium;
+ NPT_String rec_medium;
+ NPT_String write_status;
+};
+
+struct PLT_PositionInfo {
+ NPT_UInt32 track;
+ NPT_TimeStamp track_duration;
+ NPT_String track_metadata;
+ NPT_String track_uri;
+ NPT_TimeStamp rel_time;
+ NPT_TimeStamp abs_time;
+ NPT_Int32 rel_count;
+ NPT_Int32 abs_count;
+};
+
+struct PLT_TransportInfo {
+ NPT_String cur_transport_state;
+ NPT_String cur_transport_status;
+ NPT_String cur_speed;
+};
+
+struct PLT_TransportSettings {
+ NPT_String play_mode;
+ NPT_String rec_quality_mode;
+};
+
+struct PLT_ConnectionInfo {
+ NPT_UInt32 rcs_id;
+ NPT_UInt32 avtransport_id;
+ NPT_String protocol_info;
+ NPT_String peer_connection_mgr;
+ NPT_UInt32 peer_connection_id;
+ NPT_String direction;
+ NPT_String status;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaControllerDelegate class
++---------------------------------------------------------------------*/
+class PLT_MediaControllerDelegate
+{
+public:
+ virtual ~PLT_MediaControllerDelegate() {}
+
+ virtual bool OnMRAdded(PLT_DeviceDataReference& /* device */) { return true; }
+ virtual void OnMRRemoved(PLT_DeviceDataReference& /* device */) {}
+ virtual void OnMRStateVariablesChanged(PLT_Service* /* service */,
+ NPT_List<PLT_StateVariable*>* /* vars */) {}
+
+ // AVTransport
+ virtual void OnGetCurrentTransportActionsResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_StringList* /* actions */,
+ void* /* userdata */) {}
+
+ virtual void OnGetDeviceCapabilitiesResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_DeviceCapabilities* /* capabilities */,
+ void* /* userdata */) {}
+
+ virtual void OnGetMediaInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_MediaInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetPositionInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_PositionInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetTransportInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_TransportInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetTransportSettingsResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_TransportSettings* /* settings */,
+ void* /* userdata */) {}
+
+ virtual void OnNextResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnPauseResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnPlayResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnPreviousResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnSeekResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnSetAVTransportURIResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnSetPlayModeResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnStopResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ // ConnectionManager
+ virtual void OnGetCurrentConnectionIDsResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_StringList* /* ids */,
+ void* /* userdata */) {}
+
+ virtual void OnGetCurrentConnectionInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_ConnectionInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetProtocolInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_StringList* /* sources */,
+ PLT_StringList* /* sinks */,
+ void* /* userdata */) {}
+
+ // RenderingControl
+ virtual void OnSetMuteResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnGetMuteResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ const char* /* channel */,
+ bool /* mute */,
+ void* /* userdata */) {}
+
+ virtual void OnSetVolumeResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnGetVolumeResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ const char* /* channel */,
+ NPT_UInt32 /* volume */,
+ void* /* userdata */) {}
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaController class
++---------------------------------------------------------------------*/
+class PLT_MediaController : public PLT_CtrlPointListener
+{
+public:
+ PLT_MediaController(PLT_CtrlPointReference& ctrl_point,
+ PLT_MediaControllerDelegate* delegate = NULL);
+ virtual ~PLT_MediaController();
+
+ // public methods
+ virtual void SetDelegate(PLT_MediaControllerDelegate* delegate) {
+ m_Delegate = delegate;
+ }
+
+ // PLT_CtrlPointListener methods
+ virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
+ virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
+ virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata);
+ virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars);
+
+ // AVTransport
+ NPT_Result GetCurrentTransportActions(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result GetDeviceCapabilities(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result GetMediaInfo(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result GetPositionInfo(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result GetTransportInfo(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result GetTransportSettings(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result Next(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result Pause(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result Play(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, NPT_String speed, void* userdata);
+ NPT_Result Previous(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+ NPT_Result Seek(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, NPT_String unit, NPT_String target, void* userdata);
+ NPT_Result SetAVTransportURI(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* uri, const char* metadata, void* userdata);
+ NPT_Result SetPlayMode(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, NPT_String new_play_mode, void* userdata);
+ NPT_Result Stop(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
+
+ // ConnectionManager
+ NPT_Result GetCurrentConnectionIDs(PLT_DeviceDataReference& device, void* userdata);
+ NPT_Result GetCurrentConnectionInfo(PLT_DeviceDataReference& device, NPT_UInt32 connection_id, void* userdata);
+ NPT_Result GetProtocolInfo(PLT_DeviceDataReference& device, void* userdata);
+
+ // RenderingControl
+ NPT_Result SetMute(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, bool mute, void* userdata);
+ NPT_Result GetMute(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, void* userdata);
+ NPT_Result SetVolume(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, int volume, void* userdata);
+ NPT_Result GetVolume(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, void* userdata);
+
+ // methods
+ virtual NPT_Result FindRenderer(const char* uuid, PLT_DeviceDataReference& device);
+ virtual NPT_Result GetProtocolInfoSink(PLT_DeviceDataReference& device, NPT_List<NPT_String>& sinks);
+ virtual NPT_Result FindMatchingProtocolInfo(NPT_List<NPT_String>& sinks,
+ const char* protocol_info);
+ virtual NPT_Result FindBestResource(PLT_DeviceDataReference& device, PLT_MediaObject& item, NPT_Cardinal& resource_index);
+
+private:
+ NPT_Result InvokeActionWithInstance(PLT_ActionReference& action,
+ NPT_UInt32 instance_id,
+ void* userdata = NULL);
+
+ NPT_Result OnGetCurrentTransportActionsResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetDeviceCapabilitiesResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetMediaInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetPositionInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetTransportInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetTransportSettingsResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+
+ NPT_Result OnGetCurrentConnectionIDsResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetCurrentConnectionInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetProtocolInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+
+ NPT_Result OnGetMuteResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+ NPT_Result OnGetVolumeResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
+
+public:
+ static void ParseCSV(const char* csv, PLT_StringList& values) {
+ const char* start = csv;
+ const char* p = start;
+
+ // look for the , character
+ while (*p) {
+ if (*p == ',') {
+ NPT_String val(start, (int)(p-start));
+ val.Trim(' ');
+ values.Add(val);
+ start = p + 1;
+ }
+ p++;
+ }
+
+ // last one
+ NPT_String last(start, (int)(p-start));
+ last.Trim(' ');
+ if (last.GetLength()) {
+ values.Add(last);
+ }
+ }
+
+private:
+ PLT_CtrlPointReference m_CtrlPoint;
+ PLT_MediaControllerDelegate* m_Delegate;
+ NPT_Lock<PLT_DeviceDataReferenceList> m_MediaRenderers;
+};
+
+#endif /* _PLT_MEDIA_CONTROLLER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Controller Listener
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_CONTROLLER_LISTENER_H_
+#define _PLT_MEDIA_CONTROLLER_LISTENER_H_
+
+/*----------------------------------------------------------------------
+| Defines
++---------------------------------------------------------------------*/
+typedef NPT_List<NPT_String> PLT_StringList;
+
+struct PLT_DeviceCapabilities {
+ PLT_StringList play_media;
+ PLT_StringList rec_media;
+ PLT_StringList rec_quality_modes;
+};
+
+struct PLT_MediaInfo {
+ NPT_UInt32 num_tracks;
+ NPT_TimeStamp media_duration;
+ NPT_String cur_uri;
+ NPT_String cur_metadata;
+ NPT_String next_uri;
+ NPT_String next_metadata;
+ NPT_String play_medium;
+ NPT_String rec_medium;
+ NPT_String write_status;
+};
+
+struct PLT_PositionInfo {
+ NPT_UInt32 track;
+ NPT_TimeStamp track_duration;
+ NPT_String track_metadata;
+ NPT_String track_uri;
+ NPT_TimeStamp rel_time;
+ NPT_TimeStamp abs_time;
+ NPT_Int32 rel_count;
+ NPT_Int32 abs_count;
+};
+
+struct PLT_TransportInfo {
+ NPT_String cur_transport_state;
+ NPT_String cur_transport_status;
+ NPT_String cur_speed;
+};
+
+struct PLT_TransportSettings {
+ NPT_String play_mode;
+ NPT_String rec_quality_mode;
+};
+
+struct PLT_ConnectionInfo {
+ NPT_UInt32 rcs_id;
+ NPT_UInt32 avtransport_id;
+ NPT_String protocol_info;
+ NPT_String peer_connection_mgr;
+ NPT_UInt32 peer_connection_id;
+ NPT_String direction;
+ NPT_String status;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaControllerListener class
++---------------------------------------------------------------------*/
+class PLT_MediaControllerListener
+{
+public:
+ virtual ~PLT_MediaControllerListener() {}
+
+ virtual void OnMRAddedRemoved(PLT_DeviceDataReference& /* device */,
+ int /* added */) {}
+ virtual void OnMRStateVariablesChanged(PLT_Service* /* service */,
+ NPT_List<PLT_StateVariable*>* /* vars */) {}
+
+ // AVTransport
+ virtual void OnGetCurrentTransportActionsResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_StringList* /* actions */,
+ void* /* userdata */) {}
+
+ virtual void OnGetDeviceCapabilitiesResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_DeviceCapabilities* /* capabilities */,
+ void* /* userdata */) {}
+
+ virtual void OnGetMediaInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_MediaInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetPositionInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_PositionInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetTransportInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_TransportInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetTransportSettingsResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_TransportSettings* /* settings */,
+ void* /* userdata */) {}
+
+ virtual void OnNextResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnPauseResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnPlayResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnPreviousResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnSeekResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnSetAVTransportURIResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnSetPlayModeResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ virtual void OnStopResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ void* /* userdata */) {}
+
+ // ConnectionManager
+ virtual void OnGetCurrentConnectionIDsResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_StringList* /* ids */,
+ void* /* userdata */) {}
+
+ virtual void OnGetCurrentConnectionInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_ConnectionInfo* /* info */,
+ void* /* userdata */) {}
+
+ virtual void OnGetProtocolInfoResult(
+ NPT_Result /* res */,
+ PLT_DeviceDataReference& /* device */,
+ PLT_StringList* /* sources */,
+ PLT_StringList* /* sinks */,
+ void* /* userdata */) {}
+};
+
+#endif /* _PLT_MEDIA_CONTROLLER_LISTENER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Item
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_ITEM_H_
+#define _PLT_MEDIA_ITEM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltHttp.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_MediaServer;
+
+/*----------------------------------------------------------------------
+| typedefs
++---------------------------------------------------------------------*/
+typedef struct {
+ NPT_String type;
+ NPT_String friendly_name;
+} PLT_ObjectClass;
+
+typedef struct {
+ NPT_String type;
+ NPT_String friendly_name;
+ bool include_derived;
+} PLT_SearchClass;
+
+typedef struct {
+ NPT_String name;
+ NPT_String role;
+} PLT_PersonRole;
+
+class PLT_PersonRoles : public NPT_List<PLT_PersonRole>
+{
+public:
+ NPT_Result Add(const NPT_String& name, const NPT_String& role = "");
+ NPT_Result ToDidl(NPT_String& didl, const NPT_String& tag);
+ NPT_Result FromDidl(const NPT_Array<NPT_XmlElementNode*>& nodes);
+};
+
+typedef struct {
+ NPT_String allowed_use; // (CSV)
+ NPT_String validity_start;
+ NPT_String validity_end;
+ NPT_String remaining_time;
+ NPT_String usage_info;
+ NPT_String rights_info_uri;
+ NPT_String content_info_uri;
+} PLT_Constraint;
+
+typedef struct {
+ PLT_PersonRoles artists;
+ PLT_PersonRoles actors;
+ PLT_PersonRoles authors;
+ NPT_String producer;
+ NPT_String director;
+ NPT_String publisher;
+ NPT_String contributor; // should match m_Creator (dc:creator)
+} PLT_PeopleInfo;
+
+typedef struct {
+ NPT_List<NPT_String> genre;
+ NPT_String album;
+ NPT_String playlist; // dc:title of the playlist item the content belongs too
+} PLT_AffiliationInfo;
+
+typedef struct {
+ NPT_String description;
+ NPT_String long_description;
+ NPT_String icon_uri;
+ NPT_String region;
+ NPT_String rating;
+ NPT_String rights;
+ NPT_String date;
+ NPT_String language;
+} PLT_Description;
+
+typedef struct {
+ NPT_String album_art_uri;
+ NPT_String album_art_uri_dlna_profile;
+ NPT_String artist_discography_uri;
+ NPT_String lyrics_uri;
+ NPT_List<NPT_String> relation; // dc:relation
+} PLT_ExtraInfo;
+
+typedef struct {
+ NPT_UInt32 dvdregioncode;
+ NPT_UInt32 original_track_number;
+ NPT_String toc;
+ NPT_String user_annotation;
+} PLT_MiscInfo;
+
+typedef struct {
+ int total;
+ int used;
+ int free;
+ int max_partition;
+ NPT_String medium;
+} PLT_StorageInfo;
+
+/*----------------------------------------------------------------------
+| PLT_ProtocolInfo class
++---------------------------------------------------------------------*/
+class PLT_ProtocolInfo
+{
+public:
+ class FieldEntry {
+ public:
+ FieldEntry(const char* key, const char* value) :
+ m_Key(key), m_Value(value) {}
+ NPT_String m_Key;
+ NPT_String m_Value;
+ };
+
+ PLT_ProtocolInfo();
+ PLT_ProtocolInfo(const char* protocol_info);
+ PLT_ProtocolInfo(const char* protocol,
+ const char* mask,
+ const char* content_type,
+ const char* extra);
+ const NPT_String& GetProtocol() const { return m_Protocol; }
+ const NPT_String& GetMask() const { return m_Mask; }
+ const NPT_String& GetContentType() const { return m_ContentType; }
+ const NPT_String& GetExtra() const { return m_Extra; }
+
+ const NPT_String& GetDLNA_PN() const { return m_DLNA_PN; }
+
+ bool IsValid() { return m_Valid; }
+ NPT_String ToString() const;
+
+ bool Match(const PLT_ProtocolInfo& other) const;
+
+private:
+ NPT_Result ValidateField(const char* val,
+ const char* valid_chars,
+ NPT_Cardinal num_chars = 0); // 0 means variable number of chars
+ NPT_Result ParseExtra(NPT_List<FieldEntry>& entries);
+ NPT_Result ValidateExtra();
+
+private:
+ NPT_String m_Protocol;
+ NPT_String m_Mask;
+ NPT_String m_ContentType;
+ NPT_String m_Extra;
+
+ NPT_String m_DLNA_PN;
+ NPT_String m_DLNA_OP;
+ NPT_String m_DLNA_PS;
+ NPT_String m_DLNA_CI;
+ NPT_String m_DLNA_FLAGS;
+ NPT_String m_DLNA_MAXSP;
+
+ NPT_List<FieldEntry> m_DLNA_OTHER;
+ bool m_Valid;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaItemResource class
++---------------------------------------------------------------------*/
+class PLT_MediaItemResource
+{
+public:
+ PLT_MediaItemResource();
+ ~PLT_MediaItemResource() {}
+
+ NPT_String m_Uri;
+ PLT_ProtocolInfo m_ProtocolInfo;
+ NPT_UInt32 m_Duration; /* seconds */
+ NPT_LargeSize m_Size;
+ NPT_String m_Protection;
+ NPT_UInt32 m_Bitrate; /* bytes/seconds */
+ NPT_UInt32 m_BitsPerSample;
+ NPT_UInt32 m_SampleFrequency;
+ NPT_UInt32 m_NbAudioChannels;
+ NPT_String m_Resolution;
+ NPT_UInt32 m_ColorDepth;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaObject class
++---------------------------------------------------------------------*/
+class PLT_MediaObject
+{
+public:
+ PLT_MediaObject() {}
+ virtual ~PLT_MediaObject() {}
+
+ bool IsContainer() { return m_ObjectClass.type.StartsWith("object.container"); }
+
+ static const char* GetMimeType(const NPT_String& filename,
+ const PLT_HttpRequestContext* context = NULL);
+ static const char* GetMimeTypeFromExtension(const NPT_String& extension,
+ const PLT_HttpRequestContext* context = NULL);
+ static NPT_String GetProtocolInfo(const char* filename,
+ bool with_dlna_extension = true,
+ const PLT_HttpRequestContext* context = NULL);
+ static NPT_String GetMimeTypeFromProtocolInfo(const char* protocol_info);
+ static const char* GetUPnPClass(const char* filename,
+ const PLT_HttpRequestContext* context = NULL);
+ static const char* GetDlnaExtension(const char* mime_type,
+ const PLT_HttpRequestContext* context = NULL);
+
+ virtual NPT_Result Reset();
+ virtual NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
+ virtual NPT_Result FromDidl(NPT_XmlElementNode* entry);
+
+public:
+ /* common properties */
+ PLT_ObjectClass m_ObjectClass;
+ NPT_String m_ObjectID;
+ NPT_String m_ParentID;
+
+ /* metadata */
+ NPT_String m_Title;
+ NPT_String m_Creator;
+ NPT_String m_Date;
+ PLT_PeopleInfo m_People;
+ PLT_AffiliationInfo m_Affiliation;
+ PLT_Description m_Description;
+
+ /* properties */
+ bool m_Restricted;
+
+ /* extras */
+ PLT_ExtraInfo m_ExtraInfo;
+
+ /* miscellaneous info */
+ PLT_MiscInfo m_MiscInfo;
+
+ /* resources related */
+ NPT_Array<PLT_MediaItemResource> m_Resources;
+
+ /* original DIDL for Control Points to pass to a renderer when invoking SetAVTransportURI */
+ NPT_String m_Didl;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaItem class
++---------------------------------------------------------------------*/
+class PLT_MediaItem : public PLT_MediaObject
+{
+public:
+ PLT_MediaItem();
+ virtual ~PLT_MediaItem();
+
+ // PLT_MediaObject methods
+ NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
+ NPT_Result FromDidl(NPT_XmlElementNode* entry);
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaContainer class
++---------------------------------------------------------------------*/
+class PLT_MediaContainer : public PLT_MediaObject
+{
+public:
+ PLT_MediaContainer();
+ virtual ~PLT_MediaContainer();
+
+ // PLT_MediaObject methods
+ NPT_Result Reset();
+ NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
+ NPT_Result FromDidl(NPT_XmlElementNode* entry);
+
+public:
+ NPT_List<PLT_SearchClass> m_SearchClasses;
+
+ /* properties */
+ bool m_Searchable;
+
+ /* container info related */
+ NPT_Int32 m_ChildrenCount;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaObjectList class
++---------------------------------------------------------------------*/
+class PLT_MediaObjectList : public NPT_List<PLT_MediaObject*>
+{
+public:
+ PLT_MediaObjectList();
+
+protected:
+ virtual ~PLT_MediaObjectList(void);
+ friend class NPT_Reference<PLT_MediaObjectList>;
+};
+
+typedef NPT_Reference<PLT_MediaObjectList> PLT_MediaObjectListReference;
+typedef NPT_Reference<PLT_MediaObject> PLT_MediaObjectReference;
+
+
+#endif /* _PLT_MEDIA_ITEM_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Playlist
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_PLAYLIST_H_
+#define _PLT_MEDIA_PLAYLIST_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltMediaItem.h"
+
+/*----------------------------------------------------------------------
+| typedefs
++---------------------------------------------------------------------*/
+typedef NPT_List<PLT_MediaItem*> PLT_MediaItemList;
+typedef NPT_Reference<PLT_MediaItemList> PLT_MediaItemListReference;
+
+/*----------------------------------------------------------------------
+| PLT_MediaPlaylist class
++---------------------------------------------------------------------*/
+class PLT_MediaPlaylist
+{
+public:
+ PLT_MediaPlaylist();
+ ~PLT_MediaPlaylist(void);
+
+ NPT_Result Clear();
+ NPT_Result Queue(PLT_MediaItem* item);
+ NPT_Result Queue(PLT_MediaItemList* list);
+ template <typename X>
+ NPT_Result Apply(const X& function) {
+ return m_List->Apply(function);
+ }
+
+private:
+ PLT_MediaItemListReference m_List;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaItemQueueIterator class
++---------------------------------------------------------------------*/
+class PLT_MediaItemQueueIterator
+{
+public:
+ PLT_MediaItemQueueIterator(PLT_MediaPlaylist* playlist) : m_Playlist(playlist) {}
+ NPT_Result operator()(PLT_MediaItem*& item) const {
+ return m_Playlist->Queue(item);
+ }
+
+private:
+ PLT_MediaPlaylist* m_Playlist;
+};
+
+#endif /* _PLT_MEDIA_PLAYLIST_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Renderer Device
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_RENDERER_H_
+#define _PLT_MEDIA_RENDERER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltDeviceHost.h"
+
+/*----------------------------------------------------------------------
+| PLT_MediaRenderer class
++---------------------------------------------------------------------*/
+class PLT_MediaRendererInterface
+{
+public:
+ virtual ~PLT_MediaRendererInterface() {}
+
+ // ConnectionManager
+ virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action) = 0;
+
+ // AVTransport
+ virtual NPT_Result OnNext(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnPause(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnPlay(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnPrevious(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnSeek(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnStop(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnSetAVTransportURI(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnSetPlayMode(PLT_ActionReference& action) = 0;
+
+ // RenderingControl
+ virtual NPT_Result OnSetVolume(PLT_ActionReference& action) = 0;
+ virtual NPT_Result OnSetMute(PLT_ActionReference& action) = 0;
+};
+
+/*----------------------------------------------------------------------
+| PLT_MediaRenderer class
++---------------------------------------------------------------------*/
+class PLT_MediaRenderer : public PLT_DeviceHost,
+ public PLT_MediaRendererInterface
+{
+public:
+ PLT_MediaRenderer(const char* friendly_name,
+ bool show_ip = false,
+ const char* uuid = NULL,
+ unsigned int port = 0,
+ bool port_rebind = false);
+
+ // PLT_DeviceHost methods
+ virtual NPT_Result SetupServices(PLT_DeviceData& data);
+ virtual NPT_Result OnAction(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+
+protected:
+ virtual ~PLT_MediaRenderer();
+
+ // PLT_MediaRendererInterface methods
+ // ConnectionManager
+ virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action);
+
+ // AVTransport
+ virtual NPT_Result OnNext(PLT_ActionReference& action);
+ virtual NPT_Result OnPause(PLT_ActionReference& action);
+ virtual NPT_Result OnPlay(PLT_ActionReference& action);
+ virtual NPT_Result OnPrevious(PLT_ActionReference& action);
+ virtual NPT_Result OnSeek(PLT_ActionReference& action);
+ virtual NPT_Result OnStop(PLT_ActionReference& action);
+ virtual NPT_Result OnSetAVTransportURI(PLT_ActionReference& action);
+ virtual NPT_Result OnSetPlayMode(PLT_ActionReference& action);
+
+ // RenderingControl
+ virtual NPT_Result OnSetVolume(PLT_ActionReference& action);
+ virtual NPT_Result OnSetVolumeDB(PLT_ActionReference &action);
+ virtual NPT_Result OnGetVolumeDBRange(PLT_ActionReference &action);
+ virtual NPT_Result OnSetMute(PLT_ActionReference& action);
+};
+
+#endif /* _PLT_MEDIA_RENDERER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - AV Media Server Device
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_MEDIA_SERVER_H_
+#define _PLT_MEDIA_SERVER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltDeviceHost.h"
+#include "PltMediaItem.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define MAX_PATH_LENGTH 1024
+
+/* BrowseFlags */
+enum BrowseFlags {
+ BROWSEMETADATA,
+ BROWSEDIRECTCHILDREN
+};
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+extern const char* BrowseFlagsStr[];
+class PLT_HttpFileServerHandler;
+
+/*----------------------------------------------------------------------
+| PLT_MediaServer class
++---------------------------------------------------------------------*/
+class PLT_MediaServer : public PLT_DeviceHost
+{
+public:
+ PLT_MediaServer(const char* friendly_name,
+ bool show_ip = false,
+ const char* uuid = NULL,
+ NPT_UInt16 port = 0,
+ bool port_rebind = false);
+ virtual ~PLT_MediaServer();
+
+ // PLT_DeviceHost methods
+ virtual NPT_Result SetupServices(PLT_DeviceData& data);
+ virtual NPT_Result OnAction(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+
+ // class methods
+ static NPT_Result GetBrowseFlag(const char* str, BrowseFlags& flag);
+
+protected:
+ // ConnectionManager
+ virtual NPT_Result OnGetCurrentConnectionIDs(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnGetProtocolInfo(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+
+ // ContentDirectory
+ virtual NPT_Result OnGetSortCapabilities(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnGetSearchCapabilities(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnGetSystemUpdateID(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnBrowse(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnSearch(PLT_ActionReference& action,
+ const PLT_HttpRequestContext& context);
+
+ // overridable methods
+ virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action,
+ const char* object_id,
+ const char* filter,
+ NPT_UInt32 starting_index,
+ NPT_UInt32 requested_count,
+ const NPT_List<NPT_String>& sort_criteria,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action,
+ const char* object_id,
+ const char* filter,
+ NPT_UInt32 starting_index,
+ NPT_UInt32 requested_count,
+ const NPT_List<NPT_String>& sort_criteria,
+ const PLT_HttpRequestContext& context);
+ virtual NPT_Result OnSearchContainer(PLT_ActionReference& action,
+ const char* container_id,
+ const char* search_criteria,
+ const char* filter,
+ NPT_UInt32 starting_index,
+ NPT_UInt32 requested_count,
+ const NPT_List<NPT_String>& sort_criteria,
+ const PLT_HttpRequestContext& context);
+
+ // methods
+ virtual NPT_Result ParseSort(const NPT_String& sort, NPT_List<NPT_String>& list);
+};
+
+#endif /* _PLT_MEDIA_SERVER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Metadata Handler
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_METADATA_HANDLER_H_
+#define _PLT_METADATA_HANDLER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| PLT_MetadataHandler class
++---------------------------------------------------------------------*/
+class PLT_MetadataHandler
+{
+public:
+ virtual ~PLT_MetadataHandler() {}
+
+ // metadata overridables
+ virtual bool HandleExtension(const char* extension) = 0;
+ virtual NPT_Result Load(NPT_InputStream& stream,
+ NPT_TimeInterval sleeptime = NPT_TimeInterval(0, 10000),
+ NPT_TimeInterval timeout = NPT_TimeInterval(30, 0)) = 0;
+ virtual NPT_Result Save(NPT_OutputStream& stream,
+ NPT_TimeInterval sleeptime = NPT_TimeInterval(0, 10000),
+ NPT_TimeInterval timeout = NPT_TimeInterval(30, 0)) = 0;
+
+ virtual const char* GetLicenseData(NPT_String& licenseData) = 0;
+ virtual NPT_Result GetCoverArtData(char*& caData, int& len) = 0;
+ virtual const char* GetContentID(NPT_String& value) = 0;
+ virtual const char* GetTitle(NPT_String& value) = 0;
+ virtual const char* GetDescription(NPT_String& value) = 0;
+ virtual NPT_Result GetDuration(NPT_UInt32& seconds) = 0;
+ virtual const char* GetProtection(NPT_String& protection) = 0;
+ virtual NPT_Result GetYear(NPT_Size& year) = 0;
+
+ // helper functions
+ virtual NPT_Result Load(const char* filename);
+ virtual NPT_Result Save(const char* filename);
+};
+
+/*----------------------------------------------------------------------
+| PLT_MetadataHandlerFinder
++---------------------------------------------------------------------*/
+class PLT_MetadataHandlerFinder
+{
+public:
+ // methods
+ PLT_MetadataHandlerFinder(const char* extension) : m_Extension(extension) {}
+ bool operator()(PLT_MetadataHandler* const & handler) const {
+ return handler->HandleExtension(m_Extension) ? true : false;
+ }
+
+private:
+ // members
+ NPT_String m_Extension;
+};
+
+#endif /* _PLT_METADATA_HANDLER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Ring buffer stream
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_RING_BUFFER_STREAM_H_
+#define _PLT_RING_BUFFER_STREAM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptStreams.h"
+#include "NptRingBuffer.h"
+#include "NptThreads.h"
+
+/*----------------------------------------------------------------------
+| PLT_RingBufferStream class
++---------------------------------------------------------------------*/
+class PLT_RingBufferStream : public NPT_DelegatingInputStream,
+ public NPT_DelegatingOutputStream
+{
+public:
+ PLT_RingBufferStream(NPT_Size buffer_size = 4096, bool blocking = true);
+ PLT_RingBufferStream(NPT_RingBufferReference& buffer, bool blocking = true);
+ virtual ~PLT_RingBufferStream();
+
+ void SetEos() {m_Eos = true;}
+
+ // NPT_InputStream methods
+ NPT_Result Read(void* buffer,
+ NPT_Size bytes_to_read,
+ NPT_Size* bytes_read = NULL);
+ NPT_Result GetSize(NPT_LargeSize& size) {
+ NPT_AutoLock autoLock(m_Lock);
+ size = m_TotalBytesWritten;
+ return NPT_SUCCESS;
+ }
+ NPT_Result GetAvailable(NPT_LargeSize& available) {
+ NPT_AutoLock autoLock(m_Lock);
+ available = m_RingBuffer->GetAvailable();
+ return NPT_SUCCESS;
+ }
+
+ // NPT_OutputStream methods
+ NPT_Result Write(const void* buffer,
+ NPT_Size bytes_to_write,
+ NPT_Size* bytes_written = NULL);
+ NPT_Result Flush();
+ NPT_Result Close() { m_RingBuffer->Close(); return NPT_SUCCESS; }
+
+protected:
+ // NPT_DelegatingInputStream methods
+ NPT_Result InputSeek(NPT_Position offset) {
+ NPT_COMPILER_UNUSED(offset);
+ return NPT_FAILURE;
+ }
+ NPT_Result InputTell(NPT_Position& offset) {
+ NPT_AutoLock autoLock(m_Lock);
+ offset = m_TotalBytesRead;
+ return NPT_SUCCESS;
+ }
+
+ // NPT_DelegatingOutputStream methods
+ NPT_Result OutputSeek(NPT_Position offset) {
+ NPT_COMPILER_UNUSED(offset);
+ return NPT_FAILURE;
+ }
+ NPT_Result OutputTell(NPT_Position& offset) {
+ NPT_AutoLock autoLock(m_Lock);
+ offset = m_TotalBytesWritten;
+ return NPT_SUCCESS;
+ }
+
+private:
+ NPT_RingBufferReference m_RingBuffer;
+ NPT_Offset m_TotalBytesRead;
+ NPT_Offset m_TotalBytesWritten;
+ NPT_Mutex m_Lock;
+ bool m_Eos;
+ bool m_Blocking;
+};
+
+typedef NPT_Reference<PLT_RingBufferStream> PLT_RingBufferStreamReference;
+
+#endif // _PLT_RING_BUFFER_STREAM_H_
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Service
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_SERVICE_H_
+#define _PLT_SERVICE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltEvent.h"
+#include "PltArgument.h"
+#include "PltStateVariable.h"
+#include "PltAction.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_DeviceData;
+
+/*----------------------------------------------------------------------
+| PLT_Service class
++---------------------------------------------------------------------*/
+class PLT_Service
+{
+public:
+ // methods
+ PLT_Service(PLT_DeviceData* device,
+ const char* type = NULL,
+ const char* id = NULL,
+ const char* last_change_namespace = NULL);
+ ~PLT_Service();
+
+ // class methods
+ NPT_Result InitURLs(const char* service_name, const char* device_uuid);
+ bool IsInitted() {
+ return (m_ActionDescs.GetItemCount() > 0);
+ }
+ NPT_Result PauseEventing(bool paused = true);
+
+ // static methods
+ static bool IsTrue(const NPT_String& value) {
+ if (value.Compare("1", true) &&
+ value.Compare("true", true) &&
+ value.Compare("yes", true)) {
+ return false;
+ }
+ return true;
+ }
+
+ // accessor methods
+ NPT_String GetSCPDURL(bool absolute = false);
+ NPT_String GetControlURL(bool absolute = false);
+ NPT_String GetEventSubURL(bool absolute = false);
+ const NPT_String& GetServiceID() const { return m_ServiceID; }
+ const NPT_String& GetServiceType() const { return m_ServiceType; }
+ PLT_DeviceData* GetDevice() { return m_Device; }
+ NPT_Result ForceVersion(NPT_Cardinal version);
+
+ // XML
+ NPT_Result GetSCPDXML(NPT_String& xml);
+ NPT_Result SetSCPDXML(const char* xml);
+ NPT_Result GetDescription(NPT_XmlElementNode* parent, NPT_XmlElementNode** service = NULL);
+
+ // State Variables
+ NPT_Result SetStateVariable(const char* name, const char* value);
+ NPT_Result SetStateVariableRate(const char* name, NPT_TimeInterval rate);
+ NPT_Result SetStateVariableExtraAttribute(const char* name,
+ const char* key,
+ const char* value);
+ NPT_Result IncStateVariable(const char* name);
+ PLT_StateVariable* FindStateVariable(const char* name);
+ NPT_Result GetStateVariableValue(const char* name, NPT_String& value);
+ bool IsSubscribable();
+
+ // Actions
+ PLT_ActionDesc* FindActionDesc(const char* name);
+
+private:
+ void Cleanup();
+ NPT_Result AddChanged(PLT_StateVariable* var);
+ NPT_Result UpdateLastChange(NPT_List<PLT_StateVariable*>& vars);
+ NPT_Result NotifyChanged();
+
+
+ /*----------------------------------------------------------------------
+ | PLT_ServiceEventTask
+ +---------------------------------------------------------------------*/
+ class PLT_ServiceEventTask : public PLT_ThreadTask
+ {
+ public:
+ PLT_ServiceEventTask(PLT_Service* service) : m_Service(service) {}
+
+ void DoRun() {
+ while (!IsAborting(100)) m_Service->NotifyChanged();
+ }
+
+ private:
+ PLT_Service* m_Service;
+ };
+
+ // Events
+ NPT_Result ProcessNewSubscription(
+ PLT_TaskManager* task_manager,
+ const NPT_SocketAddress& addr,
+ const NPT_String& callback_urls,
+ int timeout,
+ NPT_HttpResponse& response);
+
+ NPT_Result ProcessRenewSubscription(
+ const NPT_SocketAddress& addr,
+ const NPT_String& sid,
+ int timeout,
+ NPT_HttpResponse& response);
+
+ NPT_Result ProcessCancelSubscription(
+ const NPT_SocketAddress& addr,
+ const NPT_String& sid,
+ NPT_HttpResponse& response);
+
+
+protected:
+ friend class PLT_StateVariable; // so that we can call AddChanged from StateVariable
+ friend class PLT_DeviceHost;
+ friend class PLT_DeviceData;
+
+ //members
+ PLT_DeviceData* m_Device;
+ NPT_String m_ServiceType;
+ NPT_String m_ServiceID;
+ NPT_String m_SCPDURL;
+ NPT_String m_ControlURL;
+ NPT_String m_EventSubURL;
+
+ PLT_ServiceEventTask* m_EventTask;
+ NPT_Array<PLT_ActionDesc*> m_ActionDescs;
+ NPT_List<PLT_StateVariable*> m_StateVars;
+ NPT_Mutex m_Lock;
+ NPT_List<PLT_StateVariable*> m_StateVarsChanged;
+ NPT_List<PLT_StateVariable*> m_StateVarsToPublish;
+ NPT_List<PLT_EventSubscriber*> m_Subscribers;
+ bool m_EventingPaused;
+ NPT_String m_LastChangeNamespace;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ServiceSCPDURLFinder
++---------------------------------------------------------------------*/
+class PLT_ServiceSCPDURLFinder
+{
+public:
+ // methods
+ PLT_ServiceSCPDURLFinder(const char* url) : m_URL(url) {}
+ virtual ~PLT_ServiceSCPDURLFinder() {}
+ bool operator()(PLT_Service* const & service) const;
+
+private:
+ // members
+ NPT_String m_URL;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ServiceControlURLFinder
++---------------------------------------------------------------------*/
+class PLT_ServiceControlURLFinder
+{
+public:
+ // methods
+ PLT_ServiceControlURLFinder(const char* url) : m_URL(url) {}
+ virtual ~PLT_ServiceControlURLFinder() {}
+ bool operator()(PLT_Service* const & service) const;
+
+private:
+ // members
+ NPT_String m_URL;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ServiceEventSubURLFinder
++---------------------------------------------------------------------*/
+class PLT_ServiceEventSubURLFinder
+{
+public:
+ // methods
+ PLT_ServiceEventSubURLFinder(const char* url) : m_URL(url) {}
+ virtual ~PLT_ServiceEventSubURLFinder() {}
+ bool operator()(PLT_Service* const & service) const;
+
+private:
+ // members
+ NPT_String m_URL;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ServiceIDFinder
++---------------------------------------------------------------------*/
+class PLT_ServiceIDFinder
+{
+public:
+ // methods
+ PLT_ServiceIDFinder(const char* id) : m_Id(id) {}
+ virtual ~PLT_ServiceIDFinder() {}
+ bool operator()(PLT_Service* const & service) const;
+
+private:
+ // members
+ NPT_String m_Id;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ServiceTypeFinder
++---------------------------------------------------------------------*/
+class PLT_ServiceTypeFinder
+{
+public:
+ // methods
+ PLT_ServiceTypeFinder(const char* type) : m_Type(type) {}
+ virtual ~PLT_ServiceTypeFinder() {}
+ bool operator()(PLT_Service* const & service) const;
+
+private:
+ // members
+ NPT_String m_Type;
+};
+
+/*----------------------------------------------------------------------
+| PLT_LastChangeXMLIterator
++---------------------------------------------------------------------*/
+class PLT_LastChangeXMLIterator
+{
+public:
+ // methods
+ PLT_LastChangeXMLIterator(NPT_XmlElementNode* node) : m_Node(node) {}
+ virtual ~PLT_LastChangeXMLIterator() {}
+
+ NPT_Result operator()(PLT_StateVariable* const & var) const;
+
+private:
+ NPT_XmlElementNode* m_Node;
+};
+
+#endif /* _PLT_SERVICE_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - SSDP
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_SSDP_H_
+#define _PLT_SSDP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltSsdpListener.h"
+#include "PltThreadTask.h"
+#include "PltHttpServerTask.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_DeviceHost;
+
+/*----------------------------------------------------------------------
+| PLT_SsdpSender class
++---------------------------------------------------------------------*/
+class PLT_SsdpSender
+{
+public:
+ static NPT_Result SendSsdp(NPT_HttpRequest& request,
+ const char* usn,
+ const char* nt,
+ NPT_UdpSocket& socket,
+ bool notify,
+ const NPT_SocketAddress* addr = NULL);
+
+ static NPT_Result SendSsdp(NPT_HttpResponse& response,
+ const char* usn,
+ const char* nt,
+ NPT_UdpSocket& socket,
+ bool notify,
+ const NPT_SocketAddress* addr = NULL);
+
+private:
+ static NPT_Result FormatPacket(NPT_HttpMessage& message,
+ const char* usn,
+ const char* nt,
+ NPT_UdpSocket& socket,
+ bool notify);
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpDeviceSearchResponseInterfaceIterator class
++---------------------------------------------------------------------*/
+class PLT_SsdpDeviceSearchResponseInterfaceIterator
+{
+public:
+ PLT_SsdpDeviceSearchResponseInterfaceIterator(PLT_DeviceHost* device,
+ NPT_SocketAddress remote_addr,
+ const char* st) :
+ m_Device(device), m_RemoteAddr(remote_addr), m_ST(st) {}
+ virtual ~PLT_SsdpDeviceSearchResponseInterfaceIterator() {}
+
+ NPT_Result operator()(NPT_NetworkInterface*& if_addr) const;
+
+private:
+ PLT_DeviceHost* m_Device;
+ NPT_SocketAddress m_RemoteAddr;
+ NPT_String m_ST;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpDeviceSearchResponseTask class
++---------------------------------------------------------------------*/
+class PLT_SsdpDeviceSearchResponseTask : public PLT_ThreadTask
+{
+public:
+ PLT_SsdpDeviceSearchResponseTask(PLT_DeviceHost* device,
+ NPT_SocketAddress remote_addr,
+ const char* st) :
+ m_Device(device), m_RemoteAddr(remote_addr), m_ST(st) {}
+
+protected:
+ virtual ~PLT_SsdpDeviceSearchResponseTask() {}
+
+ // PLT_ThreadTask methods
+ virtual void DoRun();
+
+protected:
+ PLT_DeviceHost* m_Device;
+ NPT_SocketAddress m_RemoteAddr;
+ NPT_String m_ST;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpAnnounceInterfaceIterator class
++---------------------------------------------------------------------*/
+class PLT_SsdpAnnounceInterfaceIterator
+{
+public:
+ PLT_SsdpAnnounceInterfaceIterator(PLT_DeviceHost* device, bool is_byebye = false, bool broadcast = false) :
+ m_Device(device), m_IsByeBye(is_byebye), m_Broadcast(broadcast) {}
+
+ NPT_Result operator()(NPT_NetworkInterface*& if_addr) const;
+
+private:
+ PLT_DeviceHost* m_Device;
+ bool m_IsByeBye;
+ bool m_Broadcast;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpInitMulticastIterator class
++---------------------------------------------------------------------*/
+class PLT_SsdpInitMulticastIterator
+{
+public:
+ PLT_SsdpInitMulticastIterator(NPT_UdpMulticastSocket* socket) :
+ m_Socket(socket) {}
+
+ NPT_Result operator()(NPT_IpAddress& if_addr) const {
+ NPT_IpAddress addr;
+ addr.ResolveName("239.255.255.250");
+ return m_Socket->JoinGroup(addr, if_addr);
+ }
+
+private:
+ NPT_UdpMulticastSocket* m_Socket;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpDeviceAnnounceTask class
++---------------------------------------------------------------------*/
+class PLT_SsdpDeviceAnnounceTask : public PLT_ThreadTask
+{
+public:
+ PLT_SsdpDeviceAnnounceTask(PLT_DeviceHost* device,
+ NPT_TimeInterval repeat,
+ bool is_byebye_first = false,
+ bool broadcast = false) :
+ m_Device(device),
+ m_Repeat(repeat), m_IsByeByeFirst(is_byebye_first),
+ m_IsBroadcast(broadcast) {}
+
+protected:
+ virtual ~PLT_SsdpDeviceAnnounceTask() {}
+
+ // PLT_ThreadTask methods
+ virtual void DoRun();
+
+protected:
+ PLT_DeviceHost* m_Device;
+ NPT_TimeInterval m_Repeat;
+ bool m_IsByeByeFirst;
+ bool m_IsBroadcast;
+};
+
+/*----------------------------------------------------------------------
+| PLT_NetworkInterfaceAddressSearchIterator class
++---------------------------------------------------------------------*/
+class PLT_NetworkInterfaceAddressSearchIterator
+{
+public:
+ PLT_NetworkInterfaceAddressSearchIterator(NPT_String ip) : m_Ip(ip) {}
+ virtual ~PLT_NetworkInterfaceAddressSearchIterator() {}
+
+ NPT_Result operator()(NPT_NetworkInterface*& addr) const {
+ NPT_List<NPT_NetworkInterfaceAddress>::Iterator niaddr = addr->GetAddresses().GetFirstItem();
+ if (!niaddr) return NPT_FAILURE;
+
+ return (m_Ip.Compare((*niaddr).GetPrimaryAddress().ToString(), true) == 0) ? NPT_SUCCESS : NPT_FAILURE;
+ }
+
+private:
+ NPT_String m_Ip;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpPacketListenerIterator class
++---------------------------------------------------------------------*/
+class PLT_SsdpPacketListenerIterator
+{
+public:
+ PLT_SsdpPacketListenerIterator(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context) :
+ m_Request(request), m_Context(context) {}
+
+ NPT_Result operator()(PLT_SsdpPacketListener*& listener) const {
+ return listener->OnSsdpPacket(m_Request, m_Context);
+ }
+
+private:
+ NPT_HttpRequest& m_Request;
+ const NPT_HttpRequestContext& m_Context;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpListenTask class
++---------------------------------------------------------------------*/
+class PLT_SsdpListenTask : public PLT_HttpServerSocketTask
+{
+public:
+ PLT_SsdpListenTask(NPT_Socket* socket,
+ bool multicast = true,
+ bool join_hard = false) :
+ PLT_HttpServerSocketTask(socket, true),
+ m_Multicast(multicast), m_JoinHard(join_hard) {}
+
+ NPT_Result AddListener(PLT_SsdpPacketListener* listener) {
+ NPT_AutoLock lock(m_Mutex);
+ m_Listeners.Add(listener);
+ return NPT_SUCCESS;
+ }
+
+ NPT_Result RemoveListener(PLT_SsdpPacketListener* listener) {
+ NPT_AutoLock lock(m_Mutex);
+ m_Listeners.Remove(listener);
+ return NPT_SUCCESS;
+ }
+
+protected:
+ virtual ~PLT_SsdpListenTask() {}
+
+ // PLT_ThreadTask methods
+ virtual void DoInit();
+
+ // PLT_HttpServerSocketTask methods
+ NPT_Result GetInputStream(NPT_InputStreamReference& stream);
+ NPT_Result GetInfo(NPT_SocketInfo& info);
+ NPT_Result ProcessRequest(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse*& response,
+ bool& headers_only);
+
+protected:
+ PLT_InputDatagramStreamReference m_Datagram;
+ bool m_Multicast;
+ bool m_JoinHard;
+ NPT_List<PLT_SsdpPacketListener*> m_Listeners;
+ NPT_Mutex m_Mutex;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpSearchTask class
++---------------------------------------------------------------------*/
+class PLT_SsdpSearchTask : public PLT_ThreadTask
+{
+public:
+ PLT_SsdpSearchTask(NPT_UdpSocket* socket,
+ PLT_SsdpSearchResponseListener* listener,
+ NPT_HttpRequest* request,
+ NPT_Timeout frequency); // pass 0 for one time
+
+protected:
+ virtual ~PLT_SsdpSearchTask();
+
+ // PLT_ThreadTask methods
+ virtual void DoAbort();
+ virtual void DoRun();
+
+ virtual NPT_Result ProcessResponse(NPT_Result res,
+ NPT_HttpRequest* request,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response);
+
+private:
+ PLT_SsdpSearchResponseListener* m_Listener;
+ NPT_HttpRequest* m_Request;
+ NPT_Timeout m_Timeout;
+ bool m_Repeat;
+ NPT_UdpSocket* m_Socket;
+};
+
+#endif /* _PLT_SSDP_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - SSDP Listener
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_SSDP_LISTENER_H_
+#define _PLT_SSDP_LISTENER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| PLT_SsdpPacketListener class
++---------------------------------------------------------------------*/
+class PLT_SsdpPacketListener
+{
+public:
+ virtual ~PLT_SsdpPacketListener() {}
+ virtual NPT_Result OnSsdpPacket(NPT_HttpRequest& request,
+ const NPT_HttpRequestContext& context) = 0;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SsdpSearchResponseListener class
++---------------------------------------------------------------------*/
+class PLT_SsdpSearchResponseListener
+{
+public:
+ virtual ~PLT_SsdpSearchResponseListener() {}
+ virtual NPT_Result ProcessSsdpSearchResponse(NPT_Result res,
+ const NPT_HttpRequestContext& context,
+ NPT_HttpResponse* response) = 0;
+};
+
+#endif /* _PLT_SSDP_LISTENER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Service State Variable
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_STATE_VARIABLE_H_
+#define _PLT_STATE_VARIABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_Argument;
+class PLT_Service;
+
+/*----------------------------------------------------------------------
+| NPT_AllowedValueRange class
++---------------------------------------------------------------------*/
+typedef struct {
+ NPT_Int32 min_value;
+ NPT_Int32 max_value;
+ NPT_Int32 step;
+} NPT_AllowedValueRange;
+
+/*----------------------------------------------------------------------
+| PLT_StateVariable class
++---------------------------------------------------------------------*/
+class PLT_StateVariable
+{
+public:
+ PLT_StateVariable(PLT_Service* service);
+ ~PLT_StateVariable();
+
+ NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
+ PLT_Service* GetService();
+ bool IsSendingEvents(bool indirectly = false);
+ void DisableIndirectEventing();
+ NPT_Result SetRate(NPT_TimeInterval rate);
+ NPT_Result SetValue(const char* value);
+ NPT_Result ValidateValue(const char* value);
+ NPT_Result Serialize(NPT_XmlElementNode& node);
+ NPT_Result SetExtraAttribute(const char* name, const char* value);
+
+ const NPT_String& GetName() const { return m_Name; }
+ const NPT_String& GetValue() const { return m_Value; }
+ const NPT_String& GetDataType() const { return m_DataType; }
+ const NPT_AllowedValueRange* GetAllowedValueRange() const { return m_AllowedValueRange; }
+
+ static PLT_StateVariable* Find(NPT_List<PLT_StateVariable*>& vars,
+ const char* name);
+
+protected:
+ bool IsReadyToPublish();
+
+protected:
+ friend class PLT_Service;
+
+ //members
+ PLT_Service* m_Service;
+ NPT_AllowedValueRange* m_AllowedValueRange;
+ NPT_String m_Name;
+ NPT_String m_DataType;
+ NPT_String m_DefaultValue;
+ bool m_IsSendingEvents;
+ bool m_IsSendingEventsIndirectly;
+ NPT_TimeInterval m_Rate;
+ NPT_TimeStamp m_LastEvent;
+ NPT_Array<NPT_String*> m_AllowedValues;
+ NPT_String m_Value;
+
+ NPT_Map<NPT_String,NPT_String> m_ExtraAttributes;
+};
+
+/*----------------------------------------------------------------------
+| PLT_StateVariableNameFinder
++---------------------------------------------------------------------*/
+class PLT_StateVariableNameFinder
+{
+public:
+ // methods
+ PLT_StateVariableNameFinder(const char* name) : m_Name(name) {}
+ virtual ~PLT_StateVariableNameFinder() {}
+
+ bool operator()(const PLT_StateVariable* const & state_variable) const {
+ return state_variable->GetName().Compare(m_Name, true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_Name;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ListStateVariableNameFinder
++---------------------------------------------------------------------*/
+class PLT_ListStateVariableNameFinder
+{
+public:
+ // methods
+ PLT_ListStateVariableNameFinder(const char* name) : m_Name(name) {}
+ virtual ~PLT_ListStateVariableNameFinder() {}
+
+ bool operator()(const PLT_StateVariable* const & state_variable) const {
+ return state_variable->GetName().Compare(m_Name, true) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_Name;
+};
+
+#endif /* _PLT_STATE_VARIABLE_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Stream Pump
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_STREAM_PUMP_H_
+#define _PLT_STREAM_PUMP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptStreams.h"
+#include "NptRingBuffer.h"
+
+/*----------------------------------------------------------------------
+| PLT_PipeInputStream
++---------------------------------------------------------------------*/
+class PLT_PipeInputStream
+{
+public:
+ // constructor and destructor
+ virtual ~PLT_PipeInputStream() {};
+
+ // methods
+ virtual NPT_Result Receive(NPT_InputStream& stream, NPT_Size max_bytes_to_read, NPT_Size* bytes_read = 0) = 0;
+};
+
+typedef NPT_Reference<PLT_PipeInputStream> PLT_PipeInputStreamReference;
+
+/*----------------------------------------------------------------------
+| PLT_PipeOutputStream
++---------------------------------------------------------------------*/
+class PLT_PipeOutputStream
+{
+public:
+ // constructor and destructor
+ virtual ~PLT_PipeOutputStream() {};
+
+ // methods
+ virtual NPT_Result Transmit(NPT_OutputStream& stream) = 0;
+};
+
+typedef NPT_Reference<PLT_PipeOutputStream> PLT_PipeOutputStreamReference;
+
+/*----------------------------------------------------------------------
+| PLT_StreamPump class
++---------------------------------------------------------------------*/
+class PLT_StreamPump
+{
+public:
+ virtual ~PLT_StreamPump();
+
+protected:
+ // methods
+ PLT_StreamPump(NPT_Size size = 65535);
+ NPT_Result PullData(NPT_InputStream& input, NPT_Size max_bytes_to_read);
+ NPT_Result PushData(NPT_OutputStream& output, NPT_Size& bytes_written);
+
+ // members
+ NPT_RingBuffer* m_RingBuffer;
+ NPT_Offset m_TotalBytesRead;
+ NPT_Offset m_TotalBytesWritten;
+};
+
+/*----------------------------------------------------------------------
+| PLT_PipeInputStreamPump class
++---------------------------------------------------------------------*/
+class PLT_PipeInputStreamPump : public PLT_StreamPump,
+ public PLT_PipeInputStream
+{
+public:
+ PLT_PipeInputStreamPump(NPT_OutputStreamReference& output, NPT_Size size = 65535);
+ virtual ~PLT_PipeInputStreamPump();
+
+ NPT_Result Receive(NPT_InputStream& input, NPT_Size max_bytes_to_read, NPT_Size* bytes_read);
+
+protected:
+ NPT_OutputStreamReference m_Output;
+ NPT_Result m_LastRes;
+};
+
+/*----------------------------------------------------------------------
+| PLT_PipeInputStreamPump class
++---------------------------------------------------------------------*/
+class PLT_PipeOutputStreamPump : public PLT_StreamPump,
+ public PLT_PipeOutputStream
+{
+public:
+ PLT_PipeOutputStreamPump(NPT_InputStreamReference& input,
+ NPT_Size size = 65535,
+ NPT_Size max_bytes_to_read = 0);
+ virtual ~PLT_PipeOutputStreamPump();
+
+ NPT_Result Transmit(NPT_OutputStream& output);
+
+protected:
+ NPT_InputStreamReference m_Input;
+ NPT_Size m_MaxBytesToRead;
+ NPT_Result m_LastRes;
+};
+
+
+#endif // _PLT_STREAM_PUMP_H_
--- /dev/null
+/* DO NOT EDIT. This file was automatically generated by GenSvnVersionHeader.py */
+#define PLT_SVN_VERSION 498
+#define PLT_SVN_VERSION_STRING "498"
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Synchronous Media Browser
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_SYNC_MEDIA_BROWSER_
+#define _PLT_SYNC_MEDIA_BROWSER_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltCtrlPoint.h"
+#include "PltMediaBrowser.h"
+#include "PltMediaCache.h"
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef NPT_Map<NPT_String, PLT_DeviceDataReference> PLT_DeviceMap;
+typedef NPT_Map<NPT_String, PLT_DeviceDataReference>::Entry PLT_DeviceMapEntry;
+
+typedef struct PLT_BrowseData {
+ NPT_SharedVariable shared_var;
+ NPT_Result res;
+ PLT_BrowseInfo info;
+} PLT_BrowseData;
+
+typedef NPT_Reference<PLT_BrowseData> PLT_BrowseDataReference;
+
+/*----------------------------------------------------------------------
+| PLT_MediaContainerListener
++---------------------------------------------------------------------*/
+class PLT_MediaContainerChangesListener
+{
+public:
+ virtual ~PLT_MediaContainerChangesListener() {}
+ virtual void OnContainerChanged(PLT_DeviceDataReference& device,
+ const char* item_id,
+ const char* update_id) = 0;
+};
+
+/*----------------------------------------------------------------------
+| PLT_SyncMediaBrowser
++---------------------------------------------------------------------*/
+class PLT_SyncMediaBrowser : public PLT_MediaBrowser,
+ public PLT_MediaBrowserDelegate
+{
+public:
+ PLT_SyncMediaBrowser(PLT_CtrlPointReference& ctrlPoint,
+ bool use_cache = false,
+ PLT_MediaContainerChangesListener* listener = NULL);
+ virtual ~PLT_SyncMediaBrowser();
+
+ // PLT_MediaBrowser methods
+ virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
+ virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
+
+ // PLT_MediaBrowserDelegate methods
+ virtual void OnMSStateVariablesChanged(PLT_Service* service,
+ NPT_List<PLT_StateVariable*>* vars);
+ virtual void OnBrowseResult(NPT_Result res,
+ PLT_DeviceDataReference& device,
+ PLT_BrowseInfo* info,
+ void* userdata);
+
+ // methods
+ void SetContainerListener(PLT_MediaContainerChangesListener* listener) {
+ m_ContainerListener = listener;
+ }
+ NPT_Result BrowseSync(PLT_DeviceDataReference& device,
+ const char* id,
+ PLT_MediaObjectListReference& list,
+ bool metadata = false,
+ NPT_Int32 start = 0,
+ NPT_Cardinal max_results = 0); // 0 means all
+
+ const NPT_Lock<PLT_DeviceMap>& GetMediaServersMap() const { return m_MediaServers; }
+ bool IsCached(const char* uuid, const char* object_id);
+
+protected:
+ NPT_Result BrowseSync(PLT_BrowseDataReference& browse_data,
+ PLT_DeviceDataReference& device,
+ const char* object_id,
+ NPT_Int32 index,
+ NPT_Int32 count,
+ bool browse_metadata = false,
+ const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
+ const char* sort = "");
+private:
+ NPT_Result Find(const char* ip, PLT_DeviceDataReference& device);
+ NPT_Result WaitForResponse(NPT_SharedVariable& shared_var);
+
+private:
+ NPT_Lock<PLT_DeviceMap> m_MediaServers;
+ PLT_MediaContainerChangesListener* m_ContainerListener;
+ bool m_UseCache;
+ PLT_MediaCache m_Cache;
+};
+
+/*----------------------------------------------------------------------
+| PLT_DeviceMapFinderByIp
++---------------------------------------------------------------------*/
+class PLT_DeviceMapFinderByIp
+{
+public:
+ // methods
+ PLT_DeviceMapFinderByIp(const char* ip) : m_IP(ip) {}
+
+ bool operator()(const PLT_DeviceMapEntry* const& entry) const {
+ PLT_DeviceDataReference device = entry->GetValue();
+ return (device->GetURLBase().GetHost() == m_IP);
+ }
+
+private:
+ // members
+ NPT_String m_IP;
+};
+
+/*----------------------------------------------------------------------
+| PLT_DeviceFinderByUUID
++---------------------------------------------------------------------*/
+class PLT_DeviceMapFinderByUUID
+{
+public:
+ // methods
+ PLT_DeviceMapFinderByUUID(const char* uuid) : m_UUID(uuid) {}
+
+ bool operator()(const PLT_DeviceMapEntry* const& entry) const {
+ PLT_DeviceDataReference device = entry->GetValue();
+ return device->GetUUID() == m_UUID;
+ }
+
+private:
+ // members
+ NPT_String m_UUID;
+};
+
+#endif /* _PLT_SYNC_MEDIA_BROWSER_ */
+
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Task Manager
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_TASKMANAGER_H_
+#define _PLT_TASKMANAGER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class PLT_ThreadTask;
+
+/*----------------------------------------------------------------------
+| PLT_TaskManager class
++---------------------------------------------------------------------*/
+class PLT_TaskManager
+{
+ friend class PLT_ThreadTask;
+ friend class PLT_ThreadTaskCallback;
+
+public:
+ PLT_TaskManager(NPT_Cardinal max_items = 0);
+ virtual ~PLT_TaskManager();
+
+ // tasks related methods
+ virtual NPT_Result StartTask(PLT_ThreadTask* task,
+ NPT_TimeInterval* delay = NULL,
+ bool auto_destroy = true);
+
+ // methods
+ NPT_Result StopAllTasks();
+
+private:
+ // called by PLT_ThreadTaskCallback
+ NPT_Mutex& GetCallbackLock() { return m_CallbackLock; }
+
+ // called by PLT_ThreadTask
+ NPT_Result AddTask(PLT_ThreadTask* task);
+ NPT_Result RemoveTask(PLT_ThreadTask* task);
+
+private:
+ NPT_List<PLT_ThreadTask*> m_Tasks;
+ NPT_Mutex m_TasksLock;
+ NPT_Mutex m_CallbackLock;
+ NPT_Queue<int>* m_Queue;
+};
+
+#endif /* _PLT_TASKMANAGER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Thread Tasks
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_THREADTASK_H_
+#define _PLT_THREADTASK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+#include "PltTaskManager.h"
+
+/*----------------------------------------------------------------------
+| PLT_ThreadTask class
++---------------------------------------------------------------------*/
+class PLT_ThreadTask : public NPT_Runnable
+{
+public:
+ friend class PLT_TaskManager;
+
+ PLT_ThreadTask();
+
+ NPT_Result Kill();
+
+ virtual bool IsAborting(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
+ return NPT_SUCCEEDED(m_Abort.WaitUntilEquals(1, timeout));
+ }
+
+protected:
+ NPT_Result Start(PLT_TaskManager* task_manager = NULL,
+ NPT_TimeInterval* delay = NULL,
+ bool auto_destroy = true);
+ NPT_Result Stop(bool blocking = true);
+
+ // overridable
+ virtual void DoAbort() {}
+ virtual void DoRun() {}
+ virtual void DoInit() {}
+
+ // the task manager will destroy the task when finished
+ // if m_AutoDestroy is set otherwise use Kill
+ virtual ~PLT_ThreadTask();
+
+private:
+ // NPT_Thread methods
+ void Run();
+
+protected:
+ // members
+ PLT_TaskManager* m_TaskManager;
+
+private:
+ // members
+ NPT_SharedVariable m_Abort;
+ NPT_Thread* m_Thread;
+ bool m_AutoDestroy;
+ NPT_TimeInterval m_Delay;
+};
+
+/*----------------------------------------------------------------------
+| PLT_ThreadTaskCallback class
++---------------------------------------------------------------------*/
+class PLT_ThreadTaskCallback
+{
+public:
+ PLT_ThreadTaskCallback(NPT_Mutex& lock) : m_Lock(lock) {}
+ virtual ~PLT_ThreadTaskCallback() {};
+
+ NPT_Result Callback();
+
+protected:
+ virtual NPT_Result DoCallback() = 0;
+
+protected:
+ NPT_Mutex& m_Lock;
+};
+
+#endif /* _PLT_THREADTASK_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Time
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_TIME_H_
+#define _PLT_TIME_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "NptTypes.h"
+#include "NptTime.h"
+
+/*----------------------------------------------------------------------
+| PLT_Time
++---------------------------------------------------------------------*/
+class PLT_Time
+{
+public:
+ // methods
+ static NPT_Result GetTimeStampFromDate(const NPT_Date& date,
+ NPT_TimeStamp& timestamp);
+
+ /* helper functions */
+ static NPT_Result SetDateTimeZone(NPT_Date& date, NPT_TimeZone tz);
+};
+
+#endif // _NPT_TIME_H_
--- /dev/null
+/*****************************************************************
+|
+| Platinum - UPnP Engine
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_UPNP_H_
+#define _PLT_UPNP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltTaskManager.h"
+#include "PltCtrlPoint.h"
+#include "PltDeviceHost.h"
+#include "PltUPnPHelper.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define PLT_DLNA_SSDP_DELAY 0.02f
+
+/*----------------------------------------------------------------------
+| forward definitions
++---------------------------------------------------------------------*/
+class PLT_SsdpListenTask;
+
+/*----------------------------------------------------------------------
+| PLT_UPnP class
++---------------------------------------------------------------------*/
+class PLT_UPnP
+{
+public:
+ PLT_UPnP(NPT_UInt32 ssdp_port = 1900, bool multicast = true);
+ ~PLT_UPnP();
+
+ NPT_Result AddDevice(PLT_DeviceHostReference& device);
+ NPT_Result AddCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
+
+ NPT_Result RemoveDevice(PLT_DeviceHostReference& device);
+ NPT_Result RemoveCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
+
+ NPT_Result Start();
+ NPT_Result Stop();
+
+ void SetIgnoreLocalUUIDs(bool ignore) { m_IgnoreLocalUUIDs = ignore; }
+
+private:
+ // members
+ NPT_Mutex m_Lock;
+ NPT_List<PLT_DeviceHostReference> m_Devices;
+ NPT_List<PLT_CtrlPointReference> m_CtrlPoints;
+ PLT_TaskManager m_TaskManager;
+
+ // since we can only have one socket listening on port 1900,
+ // we create it in here and we will attach every control points
+ // and devices to it when they're added
+ bool m_Started;
+ NPT_UInt32 m_Port;
+ bool m_Multicast;
+ PLT_SsdpListenTask* m_SsdpListenTask;
+ bool m_IgnoreLocalUUIDs;
+};
+
+#endif /* _PLT_UPNP_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - UPnP Helper
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_UPNP_HELPER_H_
+#define _PLT_UPNP_HELPER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+
+/*----------------------------------------------------------------------
+| NPT_StringFinder
++---------------------------------------------------------------------*/
+class NPT_StringFinder
+{
+public:
+ // methods
+ NPT_StringFinder(const char* value) : m_Value(value) {}
+ virtual ~NPT_StringFinder() {}
+ bool operator()(const NPT_String* const & value) const {
+ return value->Compare(m_Value) ? false : true;
+ }
+ bool operator()(const NPT_String& value) const {
+ return value.Compare(m_Value) ? false : true;
+ }
+
+private:
+ // members
+ NPT_String m_Value;
+};
+
+/*----------------------------------------------------------------------
+| PLT_UPnPMessageHelper class
++---------------------------------------------------------------------*/
+class PLT_UPnPMessageHelper
+{
+public:
+ // methods
+ static const NPT_String* GetST(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("ST");
+ }
+ static NPT_Result SetST(NPT_HttpMessage& message,
+ const char* st) {
+ return message.GetHeaders().SetHeader("ST", st);
+ }
+ static const NPT_String* GetNT(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("NT");
+ }
+ static NPT_Result SetNT(NPT_HttpMessage& message,
+ const char* nt) {
+ return message.GetHeaders().SetHeader("NT", nt);
+ }
+ static const NPT_String* GetNTS(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("NTS");
+ }
+ static NPT_Result SetNTS(NPT_HttpMessage& message,
+ const char* nts) {
+ return message.GetHeaders().SetHeader("NTS", nts);
+ }
+ static const NPT_String* GetMAN(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("MAN");
+ }
+ static NPT_Result SetMAN(NPT_HttpMessage& message,
+ const char* man) {
+ return message.GetHeaders().SetHeader("MAN", man);
+ }
+ static const NPT_String* GetLocation(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("LOCATION");
+ }
+ static NPT_Result SetLocation(NPT_HttpMessage& message,
+ const char* location) {
+ return message.GetHeaders().SetHeader("LOCATION", location);
+ }
+ static const NPT_String* GetServer(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_SERVER);
+ }
+ static NPT_Result SetServer(NPT_HttpMessage& message,
+ const char* server,
+ bool replace = true) {
+ return message.GetHeaders().SetHeader(
+ NPT_HTTP_HEADER_SERVER,
+ server,
+ replace);
+ }
+ static const NPT_String* GetUSN(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("USN");
+ }
+ static NPT_Result SetUSN(NPT_HttpMessage& message,
+ const char* usn) {
+ return message.GetHeaders().SetHeader("USN", usn);
+ }
+ static const NPT_String* GetCallbacks(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("CALLBACK");
+ }
+ static NPT_Result SetCallbacks(NPT_HttpMessage& message,
+ const char* callbacks) {
+ return message.GetHeaders().SetHeader("CALLBACK", callbacks);
+ }
+ static const NPT_String* GetSID(NPT_HttpMessage& message) {
+ return message.GetHeaders().GetHeaderValue("SID");
+ }
+ static NPT_Result SetSID(NPT_HttpMessage& message,
+ const char* sid) {
+ return message.GetHeaders().SetHeader("SID", sid);
+ }
+ static NPT_Result GetLeaseTime(NPT_HttpMessage& message,
+ NPT_Timeout& value) {
+ value = 0;
+ const NPT_String* cc =
+ message.GetHeaders().GetHeaderValue("CACHE-CONTROL");
+ NPT_CHECK_POINTER(cc);
+ return ExtractLeaseTime(*cc, value);
+ }
+ static NPT_Result SetLeaseTime(NPT_HttpMessage& message,
+ const NPT_Timeout lease) {
+ return message.GetHeaders().SetHeader(
+ "CACHE-CONTROL",
+ "max-age="+NPT_String::FromInteger(lease));
+ }
+ static NPT_Result GetTimeOut(NPT_HttpMessage& message,
+ NPT_Int32& value) {
+ value = 0;
+ const NPT_String* timeout =
+ message.GetHeaders().GetHeaderValue("TIMEOUT");
+ NPT_CHECK_POINTER(timeout);
+ return ExtractTimeOut(*timeout, value);
+ }
+ static NPT_Result SetTimeOut(NPT_HttpMessage& message,
+ const NPT_Int32 timeout) {
+ if (timeout >= 0) {
+ return message.GetHeaders().SetHeader(
+ "TIMEOUT",
+ "Second-"+NPT_String::FromInteger(timeout));
+ } else {
+ return message.GetHeaders().SetHeader(
+ "TIMEOUT", "Second-infinite");
+ }
+ }
+ static NPT_Result GetMX(NPT_HttpMessage& message,
+ NPT_UInt32& value) {
+ value = 0;
+ const NPT_String* mx =
+ message.GetHeaders().GetHeaderValue("MX");
+ NPT_CHECK_POINTER(mx);
+ return NPT_ParseInteger32(*mx, value);
+ }
+ static NPT_Result SetMX(NPT_HttpMessage& message,
+ const NPT_UInt32 mx) {
+ return message.GetHeaders().SetHeader(
+ "MX",
+ NPT_String::FromInteger(mx));
+ }
+ static NPT_Result GetSeq(NPT_HttpMessage& message,
+ NPT_UInt32& value) {
+ value = 0;
+ const NPT_String* seq =
+ message.GetHeaders().GetHeaderValue("SEQ");
+ NPT_CHECK_POINTER(seq);
+ return NPT_ParseInteger32(*seq, value);
+ }
+ static NPT_Result SetSeq(NPT_HttpMessage& message,
+ const NPT_UInt32 seq) {
+ return message.GetHeaders().SetHeader(
+ "SEQ",
+ NPT_String::FromInteger(seq));
+ }
+ static const char* GenerateUUID(int count,
+ NPT_String& uuid) {
+ uuid = "";
+ for (int i=0;i<(count<100?count:100);i++) {
+ int random = NPT_System::GetRandomInteger();
+ uuid += (char)((random % 25) + 66);
+ }
+ return uuid;
+ }
+ static const char* GenerateGUID(NPT_String& guid) {
+ guid = "";
+ for (int i=0;i<32;i++) {
+ char nibble = (char)(NPT_System::GetRandomInteger() % 16);
+ guid += (nibble < 10) ? ('0' + nibble) : ('a' + (nibble-10));
+ if (i == 7 || i == 11 || i == 15 || i == 19) {
+ guid += '-';
+ }
+ }
+ return guid;
+ }
+ static NPT_Result ExtractLeaseTime(const char* cache_control,
+ NPT_Timeout& lease) {
+ int value;
+ if (cache_control &&
+ sscanf(cache_control, "max-age=%d", &value) == 1) {
+ lease = value;
+ return NPT_SUCCESS;
+ }
+ return NPT_FAILURE;
+ }
+ static NPT_Result ExtractTimeOut(const char* timeout,
+ NPT_Int32& len) {
+ NPT_String temp = timeout;
+ if (temp.CompareN("Second-", 7, true)) {
+ return NPT_ERROR_INVALID_FORMAT;
+ }
+
+ if (temp.Compare("Second-infinite", true) == 0) {
+ len = NPT_TIMEOUT_INFINITE;
+ return NPT_SUCCESS;
+ }
+ return temp.SubString(7).ToInteger(len);
+ }
+ static NPT_Result GetIPAddresses(NPT_List<NPT_IpAddress>& ips,
+ bool with_localhost = false) {
+ NPT_List<NPT_NetworkInterface*> if_list;
+ NPT_CHECK(NPT_NetworkInterface::GetNetworkInterfaces(if_list));
+
+ NPT_List<NPT_NetworkInterface*>::Iterator iface =
+ if_list.GetFirstItem();
+ while (iface) {
+ NPT_IpAddress ip =
+ (*(*iface)->GetAddresses().GetFirstItem()).GetPrimaryAddress();
+ if (ip.ToString().Compare("0.0.0.0") && ip.ToString().Compare("127.0.0.1")) {
+ ips.Add(ip);
+ }
+ ++iface;
+ }
+
+ if (ips.GetItemCount() == 0 || with_localhost) {
+ NPT_IpAddress localhost;
+ localhost.Parse("127.0.0.1");
+ ips.Add(localhost);
+ }
+
+ if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result GetNetworkInterfaces(NPT_List<NPT_NetworkInterface*>& if_list,
+ bool with_localhost = false) {
+ NPT_CHECK(_GetNetworkInterfaces(if_list, false));
+
+ // if no valid interfaces or if requested, add localhost capable interface
+ if (if_list.GetItemCount() == 0 || with_localhost) {
+ NPT_CHECK(_GetNetworkInterfaces(if_list, true));
+ }
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result GetMACAddresses(NPT_List<NPT_String>& addresses) {
+ NPT_List<NPT_NetworkInterface*> if_list;
+ NPT_CHECK(NPT_NetworkInterface::GetNetworkInterfaces(if_list));
+
+ NPT_List<NPT_NetworkInterface*>::Iterator iface = if_list.GetFirstItem();
+ while (iface) {
+ NPT_String ip = (*(*iface)->GetAddresses().GetFirstItem()).GetPrimaryAddress().ToString();
+ if (ip.Compare("0.0.0.0") && ip.Compare("127.0.0.1")) {
+ addresses.Add((*iface)->GetMacAddress().ToString());
+ }
+ ++iface;
+ }
+
+ if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
+ return NPT_SUCCESS;
+ }
+
+
+ static bool IsLocalNetworkAddress(const NPT_IpAddress& address) {
+ if(address.ToString() == "127.0.0.1") return true;
+
+ NPT_List<NPT_NetworkInterface*> if_list;
+ NPT_NetworkInterface::GetNetworkInterfaces(if_list);
+
+ NPT_List<NPT_NetworkInterface*>::Iterator iface = if_list.GetFirstItem();
+ while (iface) {
+ if((*iface)->IsAddressInNetwork(address)) return true;
+ ++iface;
+ }
+
+ if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
+ return false;
+ }
+
+private:
+
+ static NPT_Result _GetNetworkInterfaces(NPT_List<NPT_NetworkInterface*>& if_list,
+ bool only_localhost = false) {
+ NPT_List<NPT_NetworkInterface*> _if_list;
+ NPT_CHECK(NPT_NetworkInterface::GetNetworkInterfaces(_if_list));
+
+ NPT_NetworkInterface* iface;
+ while (NPT_SUCCEEDED(_if_list.PopHead(iface))) {
+ NPT_String ip =
+ iface->GetAddresses().GetFirstItem()->GetPrimaryAddress().ToString();
+ if (ip.Compare("0.0.0.0") &&
+ ((!only_localhost && ip.Compare("127.0.0.1")) ||
+ (only_localhost && !ip.Compare("127.0.0.1")))) {
+ if_list.Add(iface);
+
+ // add localhost only once
+ if (only_localhost) break;
+ } else {
+ delete iface;
+ }
+ }
+
+ // cleanup any remaining items in list if we breaked early
+ _if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
+ return NPT_SUCCESS;
+ }
+};
+
+#endif /* _PLT_UPNP_HELPER_H_ */
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Version Info
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_VERSION_H_
+#define _PLT_VERSION_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "PltSvnVersion.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define PLT_PLATINUM_SDK_VERSION 0x00050400
+#define PLT_PLATINUM_SDK_VERSION_STRING "0.5.4.0"
+
+#endif // _PLT_VERSION_H_
--- /dev/null
+/*****************************************************************
+|
+| Platinum - Xml Helper
+|
+| Copyright (c) 2004-2008, Plutinosoft, LLC.
+| All rights reserved.
+| http://www.plutinosoft.com
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of the GNU General Public License
+| as published by the Free Software Foundation; either version 2
+| of the License, or (at your option) any later version.
+|
+| OEMs, ISVs, VARs and other distributors that combine and
+| distribute commercially licensed software with Platinum software
+| and do not wish to distribute the source code for the commercially
+| licensed software under version 2, or (at your option) any later
+| version, of the GNU General Public License (the "GPL") must enter
+| into a commercial license agreement with Plutinosoft, LLC.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; see the file LICENSE.txt. If not, write to
+| the Free Software Foundation, Inc.,
+| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+| http://www.gnu.org/licenses/gpl-2.0.html
+|
+****************************************************************/
+
+#ifndef _PLT_XML_HELPER_H_
+#define _PLT_XML_HELPER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Neptune.h"
+/*----------------------------------------------------------------------
+| PLT_XmlAttributeFinder
++---------------------------------------------------------------------*/
+class PLT_XmlAttributeFinder
+{
+public:
+ // if 'namespc' is NULL, we're looking for ANY namespace
+ // if 'namespc' is '\0', we're looking for NO namespace
+ // if 'namespc' is non-empty, look for that SPECIFIC namespace
+ PLT_XmlAttributeFinder(const NPT_XmlElementNode& element,
+ const char* name,
+ const char* namespc) :
+ m_Element(element), m_Name(name), m_Namespace(namespc) {}
+
+ bool operator()(const NPT_XmlAttribute* const & attribute) const {
+ if (attribute->GetName() == m_Name) {
+ if (m_Namespace) {
+ const NPT_String& prefix = attribute->GetPrefix();
+ if (m_Namespace[0] == '\0') {
+ // match if the attribute has NO namespace
+ return prefix.IsEmpty();
+ } else {
+ // match if the attribute has the SPECIFIC namespace
+ // we're looking for
+ const NPT_String* namespc = m_Element.GetNamespaceUri(prefix);
+ return namespc && *namespc == m_Namespace;
+ }
+ } else {
+ // ANY namespace will match
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+
+private:
+ const NPT_XmlElementNode& m_Element;
+ const char* m_Name;
+ const char* m_Namespace;
+};
+
+/*----------------------------------------------------------------------
+| PLT_XmlHelper
++---------------------------------------------------------------------*/
+class PLT_XmlHelper
+{
+public:
+
+ // static methods
+ static NPT_Result GetChildText(NPT_XmlElementNode* node,
+ const char* tag,
+ NPT_String& value,
+ const char* namespc = "") {
+ value = "";
+
+ if (!node) return NPT_FAILURE;
+
+ // special case "" means we look for the same namespace as the parent
+ if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
+
+ NPT_XmlElementNode* child = node->GetChild(tag, namespc);
+ if (!child) return NPT_FAILURE;
+
+ const NPT_String* text = child->GetText();
+ value = text?*text:"";
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result RemoveAttribute(NPT_XmlElementNode* node,
+ const char* name,
+ const char* namespc = "") {
+ if (!node) return NPT_FAILURE;
+
+ // special case "" means we look for the same namespace as the parent
+ if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
+
+ NPT_List<NPT_XmlAttribute*>::Iterator attribute;
+ attribute = node->GetAttributes().Find(PLT_XmlAttributeFinder(*node, name, namespc));
+ if (!attribute) return NPT_FAILURE;
+
+ delete *attribute;
+ NPT_CHECK(node->GetAttributes().Erase(attribute));
+
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result GetAttribute(NPT_XmlElementNode* node,
+ const char* name,
+ NPT_XmlAttribute*& attr,
+ const char* namespc = "") {
+ attr = NULL;
+
+ if (!node) return NPT_FAILURE;
+
+ // special case "" means we look for the same namespace as the parent
+ if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
+
+ NPT_List<NPT_XmlAttribute*>::Iterator attribute;
+ attribute = node->GetAttributes().Find(PLT_XmlAttributeFinder(*node, name, namespc));
+ if (!attribute) return NPT_FAILURE;
+
+ attr = (*attribute);
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result GetAttribute(NPT_XmlElementNode* node,
+ const char* name,
+ NPT_String& value,
+ const char* namespc = "") {
+ value = "";
+
+ NPT_XmlAttribute* attribute = NULL;
+ NPT_CHECK(GetAttribute(node, name, attribute, namespc));
+ if (!attribute) return NPT_FAILURE;
+
+ value = attribute->GetValue();
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result SetAttribute(NPT_XmlElementNode* node,
+ const char* name,
+ NPT_String& value,
+ const char* namespc = "") {
+ NPT_XmlAttribute* attribute = NULL;
+ NPT_CHECK(GetAttribute(node, name, attribute, namespc));
+ if (!attribute) return NPT_FAILURE;
+
+ attribute->SetValue(value);
+ return NPT_SUCCESS;
+ }
+
+ static NPT_Result AddChildText(NPT_XmlElementNode* node,
+ const char* tag,
+ const char* text,
+ const char* prefix = NULL) {
+ if (!node) return NPT_FAILURE;
+ NPT_XmlElementNode* child = new NPT_XmlElementNode(prefix, tag);
+ child->AddText(text);
+ return node->AddChild(child);
+ }
+
+ static bool IsMatch(const NPT_XmlNode* const & node, const char* tag, const char* namespc_mapped) {
+ // if m_Namespace is NULL, we're looking for ANY namespace
+ // if m_Namespace is '\0', we're looking for NO namespace
+ // if m_Namespace is non-empty, look for that SPECIFIC namespace
+
+ const NPT_XmlElementNode* element = node->AsElementNode();
+ // is tag the same (case sensitive)?
+ if (element && element->GetTag() == tag) {
+ if (namespc_mapped) {
+ // look for a SPECIFIC namespace or NO namespace
+ const NPT_String* namespc = element->GetNamespace();
+ if (namespc) {
+ // the element has a namespace, match if it is equal to
+ // what we're looking for
+ return *namespc == namespc_mapped;
+ } else {
+ // the element does not have a namespace, match if we're
+ // looking for NO namespace
+ return namespc_mapped[0] == '\0';
+ }
+ } else {
+ // ANY namespace will match
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static NPT_Result GetChildren(NPT_XmlElementNode* node,
+ NPT_Array<NPT_XmlElementNode*>& children,
+ const char* tag,
+ const char* namespc = "") {
+ if (!node) return NPT_FAILURE;
+
+ // special case "" means we look for the same namespace as the parent
+ if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
+
+ const char* namespc_mapped = (namespc==NULL)?"":(namespc[0]=='*' && namespc[1]=='\0')?NULL:namespc;
+
+ // get all children first
+ NPT_List<NPT_XmlNode*>& allchildren = node->GetChildren();
+
+ // iterate through children and add only elements with matching tag
+ NPT_List<NPT_XmlNode*>::Iterator child = allchildren.GetFirstItem();
+ while (child) {
+ if (IsMatch(*child, tag, namespc_mapped)) {
+ children.Add((*child)->AsElementNode());
+ }
+ ++child;
+ }
+ return NPT_SUCCESS;
+ }
+
+ static NPT_XmlElementNode* GetChild(NPT_XmlElementNode* node,
+ const char* tag,
+ const char* namespc = "") {
+ if (!node) return NULL;
+
+ // special case "" means we look for the same namespace as the parent
+ if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
+
+ return node->GetChild(tag, namespc);
+ }
+
+ static NPT_Result GetChild(NPT_XmlElementNode* parent,
+ NPT_XmlElementNode*& child,
+ NPT_Ordinal n = 0) {
+ if (!parent) return NPT_FAILURE;
+
+ // reset child
+ child = NULL;
+
+ // get all children first
+ NPT_List<NPT_XmlNode*>::Iterator children = parent->GetChildren().GetFirstItem();
+ while (children) {
+ if ((*children)->AsElementNode() && n-- == 0) {
+ child = (*children)->AsElementNode();
+ return NPT_SUCCESS;
+ }
+ children++;
+ }
+
+ return NPT_FAILURE;
+ }
+
+ static NPT_Result Serialize(NPT_XmlNode& node, NPT_String& xml, bool add_header = true) {
+ NPT_XmlWriter writer(0);
+ NPT_StringOutputStreamReference stream(new NPT_StringOutputStream(&xml));
+ NPT_CHECK(writer.Serialize(node, *stream, add_header));
+ return NPT_SUCCESS;
+ }
+
+ static NPT_String Serialize(NPT_XmlNode& node, bool add_header = true) {
+ NPT_XmlWriter writer(0);
+ NPT_String xml;
+ NPT_StringOutputStreamReference stream(new NPT_StringOutputStream(&xml));
+ if (NPT_FAILED(writer.Serialize(node, *stream, add_header))) {
+ NPT_Debug("Failed to serialize xml node");
+ return "";
+ }
+
+ return xml;
+ }
+private:
+ // members
+};
+
+#endif // _PLT_XML_HELPER_H_
+
+
+
+
+
+
+
+
+
--- /dev/null
+@echo off \r
+set OLDDIR=%CD%\r
+cd /d %~dp0\r
+REM ============================================\r
+echo *** Generating a Windows GPAC installer ***\r
+REM ============================================\r
+\r
+\r
+echo:\r
+REM ============================================\r
+echo Check NSIS is in your PATH\r
+REM ============================================\r
+\r
+set NSIS_EXEC="%PROGRAMFILES%\NSIS\makensis.exe"\r
+if not exist "%PROGRAMFILES%\NSIS\makensis.exe" echo NSIS couldn't be found at default location %NSIS_EXEC%\r
+if not exist "%PROGRAMFILES%\NSIS\makensis.exe" goto Abort\r
+echo Found NSIS at default location %NSIS_EXEC%\r
+\r
+\r
+echo:\r
+REM ============================================\r
+echo Retrieving version/revision information\r
+REM ============================================\r
+if not exist include/gpac/version.h echo version couldn't be found - check include/gpac/version.h exists\r
+if not exist include/gpac/version.h goto Abort\r
+\r
+REM execute svnversion and check if the result if found within version.h\r
+for /f "delims=" %%i in ('svnversion.exe') do Set VarRevisionSVN=%%i\r
+REM 'M', 'S', 'P', ':' are special 'svnversion' results\r
+for /f "delims=" %%i in ('echo %VarRevisionSVN% ^| findstr /i /r M^"') do goto RevisionAbort\r
+for /f "delims=" %%i in ('echo %VarRevisionSVN% ^| findstr /i /r S^"') do goto RevisionAbort\r
+for /f "delims=" %%i in ('echo %VarRevisionSVN% ^| findstr /i /r P^"') do goto RevisionAbort\r
+for /f "delims=" %%i in ('echo %VarRevisionSVN% ^| findstr /i /r :^"') do goto RevisionAbort\r
+for /f "delims=" %%i in ('type include\gpac\version.h ^| findstr /i /r "%VarRevisionSVN%"') do Set VarRevisionBuild=%%i\r
+echo VarRevisionBuild = %VarRevisionBuild%\r
+echo VarRevisionSVN = %VarRevisionSVN%\r
+if !"%VarRevisionBuild%"==!"%VarRevisionSVN%" echo local revision and last build revision are not congruent - please consider rebuilding before generating an installer\r
+if !"%VarRevisionBuild%"==!"%VarRevisionSVN%" goto Abort\r
+REM echo version found: %VarRevisionSVN%\r
+\r
+move bin\win32\release\nsis_install\default.out bin\win32\release\nsis_install\default.out_\r
+echo Name "GPAC Framework ${GPAC_VERSION} revision %VarRevisionSVN%" > bin\win32\release\nsis_install\default.out\r
+echo OutFile "GPAC.Framework.Setup-${GPAC_VERSION}-rev%VarRevisionSVN%.exe" >> bin\win32\release\nsis_install\default.out\r
+\r
+\r
+echo:\r
+REM ============================================\r
+echo Executing NSIS\r
+REM ============================================\r
+call %NSIS_EXEC% bin\win32\release\nsis_install\gpac_installer.nsi\r
+\r
+\r
+echo:\r
+REM ============================================\r
+echo Removing temporary files\r
+REM ============================================\r
+move bin\win32\release\nsis_install\default.out_ bin\win32\release\nsis_install\default.out\r
+\r
+\r
+echo:\r
+REM ============================================\r
+echo Windows GPAC installer generated - goodbye!\r
+REM ============================================\r
+REM LeaveBatchSuccess\r
+set VarRevisionSVN=\r
+set VarRevisionBuild=\r
+cd /d %OLDDIR%\r
+exit/b 0\r
+\r
+:RevisionAbort\r
+echo SVN revision "%VarRevisionSVN%" is not a simple number, you may have local modification (please check 'svnrevision' flags meaning or execute the NSIS script manually)\r
+\r
+:Abort\r
+echo:\r
+echo *** ABORTING: CHECK ERROR MESSAGES ABOVE ***\r
+\r
+REM LeaveBatchError \r
+set VarRevisionSVN=\r
+set VarRevisionBuild=\r
+cd /d %OLDDIR%\r
+exit/b 1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48.000000px"
+ height="48.000000px"
+ id="svg53383"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/categories"
+ sodipodi:docname="applications-system.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective31" />
+ <linearGradient
+ id="linearGradient3264">
+ <stop
+ style="stop-color:#c9c9c9;stop-opacity:1;"
+ offset="0"
+ id="stop3266" />
+ <stop
+ id="stop3276"
+ offset="0.25"
+ style="stop-color:#f8f8f8;stop-opacity:1;" />
+ <stop
+ id="stop3272"
+ offset="0.5"
+ style="stop-color:#e2e2e2;stop-opacity:1;" />
+ <stop
+ style="stop-color:#b0b0b0;stop-opacity:1;"
+ offset="0.75"
+ id="stop3274" />
+ <stop
+ style="stop-color:#c9c9c9;stop-opacity:1;"
+ offset="1"
+ id="stop3268" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3264"
+ id="linearGradient3281"
+ gradientUnits="userSpaceOnUse"
+ x1="14.462892"
+ y1="12.284524"
+ x2="34.534348"
+ y2="39.684914"
+ gradientTransform="matrix(1.241935,0,0,1.241935,-5.027508,-7.208988)" />
+ <linearGradient
+ id="linearGradient2300">
+ <stop
+ id="stop2302"
+ offset="0.0000000"
+ style="stop-color:#000000;stop-opacity:0.32673267;" />
+ <stop
+ id="stop2304"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="aigrd1"
+ gradientUnits="userSpaceOnUse"
+ x1="99.7773"
+ y1="15.4238"
+ x2="153.0005"
+ y2="248.6311">
+ <stop
+ offset="0"
+ style="stop-color:#184375"
+ id="stop53300" />
+ <stop
+ offset="1"
+ style="stop-color:#C8BDDC"
+ id="stop53302" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#aigrd1"
+ id="linearGradient53551"
+ gradientUnits="userSpaceOnUse"
+ x1="99.7773"
+ y1="15.4238"
+ x2="153.0005"
+ y2="248.6311"
+ gradientTransform="matrix(0.200685,0.000000,0.000000,0.200685,-0.585758,-1.050787)" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ r="11.689870"
+ fy="72.568001"
+ fx="14.287618"
+ cy="68.872971"
+ cx="14.287618"
+ gradientTransform="matrix(1.399258,-2.234445e-7,8.196178e-8,0.513264,4.365074,4.839285)"
+ id="radialGradient2308"
+ xlink:href="#linearGradient2300"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3264"
+ id="linearGradient3760"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.241935,0,0,1.241935,-5.027508,-7.208988)"
+ x1="14.462892"
+ y1="12.284524"
+ x2="34.534348"
+ y2="39.684914" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#aigrd1"
+ id="linearGradient3773"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.200685,0,0,0.200685,-54.33576,-1.050787)"
+ x1="99.7773"
+ y1="15.4238"
+ x2="153.0005"
+ y2="248.6311" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:showpageshadow="false"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.11764706"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6568542"
+ inkscape:cx="43.652227"
+ inkscape:cy="21.164787"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="872"
+ inkscape:window-height="697"
+ inkscape:window-x="562"
+ inkscape:window-y="151" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>System Applications</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz/</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>system</rdf:li>
+ <rdf:li>applications</rdf:li>
+ <rdf:li>group</rdf:li>
+ <rdf:li>category</rdf:li>
+ <rdf:li>admin</rdf:li>
+ <rdf:li>root</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="shadow"
+ id="layer2"
+ inkscape:groupmode="layer">
+ <path
+ transform="matrix(1.186380,0.000000,0.000000,1.186380,-4.539687,-7.794678)"
+ d="M 44.285715 38.714287 A 19.928572 9.8372450 0 1 1 4.4285717,38.714287 A 19.928572 9.8372450 0 1 1 44.285715 38.714287 z"
+ sodipodi:ry="9.8372450"
+ sodipodi:rx="19.928572"
+ sodipodi:cy="38.714287"
+ sodipodi:cx="24.357143"
+ id="path1538"
+ style="color:#000000;fill:url(#radialGradient2308);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:0.50000042;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ </g>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ style="opacity:1;color:#000000;fill:url(#linearGradient3773);fill-opacity:1;fill-rule:nonzero;stroke:#3f4561;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 22.699525,0.94746963 C 22.22635,0.97984519 21.766437,1.0531317 21.301673,1.1063165 L 21.269903,1.1063165 L 20.157975,7.1742671 C 18.345621,7.5870046 16.640562,8.2874574 15.106644,9.2392765 L 10.118853,5.6493371 C 8.770521,6.6961412 7.543552,7.9170049 6.465374,9.2392765 L 9.928236,14.290607 C 8.876814,15.89739 8.086153,17.732094 7.640841,19.659632 C 7.640765,19.668743 7.640779,19.689813 7.640841,19.691401 L 1.60466,20.644482 C 1.494303,21.545851 1.445813,22.477386 1.445813,23.408418 C 1.445813,24.170171 1.466846,24.921747 1.541121,25.664043 L 7.577303,26.744202 C 8.0066,28.840363 8.822112,30.797987 9.960006,32.526228 L 6.370066,37.450482 C 7.398201,38.726866 8.585171,39.888962 9.864698,40.913343 L 14.947798,37.418712 C 16.724273,38.551956 18.707343,39.346604 20.856901,39.737877 L 21.809983,45.742288 C 22.487237,45.803935 23.181758,45.805827 23.874992,45.805827 C 24.853677,45.805826 25.788512,45.768738 26.734236,45.64698 L 27.877933,39.515491 C 29.91886,39.007587 31.836112,38.126493 33.501113,36.942172 L 38.393596,40.500342 C 39.662366,39.420897 40.822583,38.180154 41.824689,36.846863 L 38.266519,31.700225 C 39.230125,30.036028 39.897817,28.199859 40.23622,26.235892 L 46.240632,25.282811 C 46.29329,24.656221 46.30417,24.048546 46.30417,23.408418 C 46.30417,22.296018 46.174875,21.205317 46.018246,20.136172 L 39.918526,19.024244 C 39.440518,17.259164 38.656214,15.612364 37.662901,14.13176 L 41.25284,9.2075071 C 40.140075,7.8466524 38.870718,6.5895264 37.472284,5.5222596 L 32.293876,9.0804296 C 30.805549,8.200202 29.203897,7.5248159 27.464931,7.1424978 L 26.51185,1.1063165 C 25.644369,1.0042729 24.769749,0.94746963 23.874992,0.94746963 C 23.633166,0.94746964 23.384286,0.93986063 23.144296,0.94746963 C 23.027301,0.95117908 22.911525,0.94066346 22.794833,0.94746963 C 22.763228,0.94931296 22.73107,0.94531125 22.699525,0.94746963 z M 23.525529,16.387386 C 23.641592,16.381497 23.757473,16.387386 23.874992,16.387386 C 27.635598,16.387386 30.705408,19.457196 30.705408,23.217802 C 30.705409,26.978407 27.635597,30.016448 23.874992,30.016448 C 20.114387,30.016449 17.076346,26.978407 17.076346,23.217802 C 17.076347,19.574716 19.927558,16.569963 23.525529,16.387386 z "
+ id="path3243" />
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ sodipodi:type="arc"
+ style="opacity:0.64772728;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.62180054;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path3283"
+ sodipodi:cx="23.511301"
+ sodipodi:cy="23.781593"
+ sodipodi:rx="12.727922"
+ sodipodi:ry="12.727922"
+ d="M 36.239223 23.781593 A 12.727922 12.727922 0 1 1 10.783379,23.781593 A 12.727922 12.727922 0 1 1 36.239223 23.781593 z"
+ transform="matrix(0.616598,0,0,0.616598,9.38202,8.539674)" />
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ id="path3285"
+ d="M 21.995808,2.1484671 L 21.103024,8.0235243 C 19.404254,8.4103946 16.279442,9.5936035 14.841657,10.485771 L 10.091975,6.9406268 C 8.828145,7.9218257 8.741474,7.9883656 7.730867,9.2277688 L 11.165063,14.320988 C 10.179537,15.827071 8.995796,18.510982 8.570778,20.42893 C 8.570778,20.42893 2.552988,21.443355 2.552988,21.443355 C 2.449547,22.288234 2.49926,24.096528 2.56888,24.792303 L 8.317097,25.82782 C 8.71949,27.79261 10.225324,30.955232 11.291904,32.575161 L 7.656902,37.377719 C 8.620601,38.57411 8.813474,38.683589 10.01281,39.64377 L 14.873441,36.082733 C 16.538581,37.144954 19.84373,38.437109 21.858571,38.80386 L 22.656299,44.604952 C 23.291109,44.662736 25.044829,44.824827 25.931283,44.710701 L 26.824066,38.671821 C 28.737084,38.195749 32.042539,36.838896 33.603191,35.728798 L 38.458624,39.236958 C 39.647878,38.225166 39.658533,38.072709 40.597835,36.822978 L 36.999815,31.708667 C 37.90303,30.148767 39.070902,27.098068 39.388097,25.257187 L 45.279046,24.279744 C 45.328399,23.692424 45.330802,22.054578 45.18399,21.052439 L 39.182092,20.016922 C 38.73404,18.362463 37.196418,15.381153 36.265359,13.993342 L 40.080075,9.1907857 C 39.037052,7.915218 38.64924,7.7402002 37.338448,6.7398212 L 32.313994,10.337839 C 30.918941,9.5127782 28.137095,8.2550417 26.507114,7.8966842 L 25.619528,2.1484671 C 24.806414,2.0528187 22.460488,2.0952921 21.995808,2.1484671 z "
+ style="opacity:0.34659089;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.99999923;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc" />
+ <path
+ style="opacity:0.5;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 10.102903,6.2970655 C 8.7545689,7.3438694 8.1656464,7.9719226 7.0874684,9.2941942 L 10.489927,14.259153 C 9.4385072,15.857755 8.3316275,18.426114 8.1423859,19.987706 C 8.1423859,19.987706 2.0798859,21.0319 2.0798859,21.0319 C 2.0109129,21.595256 1.90625,22.884803 1.90625,22.884803 L 2.0830267,24.447303 C 2.5107567,24.535638 2.9231817,24.617818 3.3642767,24.666053 L 3.8642767,23.134803 C 4.2083177,23.163279 4.5439297,23.197303 4.8955267,23.197303 C 5.2467347,23.197303 5.6139847,23.163473 5.9580267,23.134803 L 6.4267767,24.666053 C 6.8680647,24.617818 7.3115487,24.535638 7.7392767,24.447303 L 7.7392767,22.884803 C 8.4250337,22.72518 9.0712777,22.497045 9.7080267,22.228553 L 10.645527,23.509803 C 11.047878,23.327709 11.421123,23.133984 11.801777,22.916053 L 11.301777,21.416053 C 11.89901,21.053803 12.463529,20.620706 12.989277,20.166053 L 14.270527,21.103553 C 14.596162,20.806973 14.91164,20.491691 15.208027,20.166053 L 14.270527,18.916053 C 14.725373,18.390305 15.127027,17.826171 15.489277,17.228553 L 16.989277,17.697303 C 17.207208,17.316456 17.432571,16.943209 17.614277,16.541053 L 16.333027,15.603553 C 16.601517,14.966804 16.798016,14.320561 16.958027,13.634803 L 18.551777,13.634803 C 18.640112,13.207076 18.691236,12.763591 18.739277,12.322303 L 17.239277,11.853553 C 17.268139,11.509705 17.301777,11.142456 17.301777,10.791053 C 17.301776,10.43965 17.267753,10.104039 17.239277,9.7598034 L 18.739277,9.2910534 C 18.69373,8.8711662 18.633686,8.4490548 18.551777,8.0410534 C 17.404349,8.4403544 15.999117,9.1941729 14.983265,9.8245243 L 10.102903,6.2970655 z "
+ id="path3767"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ sodipodi:nodetypes="cccccccccsccccccccccccccccccccsccccc" />
+ <path
+ style="opacity:0.5;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 37.236641,17.217754 C 36.85286,17.39913 36.490003,17.603509 36.123236,17.813295 L 36.692886,19.548136 C 35.995792,19.970436 35.338156,20.467825 34.725008,20.998151 L 33.249099,19.910639 C 32.869013,20.256538 32.507327,20.618223 32.161588,20.998151 L 33.249099,22.474059 C 32.718773,23.087371 32.221547,23.745002 31.799084,24.441937 L 31.255328,24.260685 C 31.207646,24.960968 31.018949,25.62217 30.737466,26.228563 L 30.841038,26.306242 C 30.527881,27.048922 30.27649,27.83664 30.090137,28.636624 L 28.614229,28.636624 C 28.477946,28.722076 28.343676,28.821684 28.199938,28.895555 C 28.121568,29.310822 28.065026,29.712881 28.018687,30.138426 L 29.77942,30.708074 C 29.746033,31.10935 29.727633,31.515269 29.727633,31.925052 C 29.727631,32.334993 29.746034,32.740753 29.77942,33.142029 L 28.018687,33.711677 C 28.074705,34.226432 28.148678,34.740347 28.251725,35.239372 L 30.090137,35.213479 C 30.218255,35.763466 30.393202,36.320918 30.582107,36.844746 C 31.327023,36.557466 32.05594,36.214561 32.731236,35.809021 C 32.319649,34.59298 32.083908,33.279913 32.083908,31.925052 C 32.083909,26.727119 35.376289,22.288397 39.981313,20.583861 L 38.893802,20.402608 C 38.671014,19.579946 38.382478,18.774017 38.013435,18.020441 C 38.002581,17.998277 37.99851,17.96486 37.987542,17.942761 L 37.935756,17.890975 L 37.236641,17.217754 z "
+ id="path3770"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+</svg>
--- /dev/null
+/*container for widgets*/\r
+widget_display = gw_new_container();\r
+widget_display.on_event = function(evt) \r
+{\r
+ if(!widget_display.children.length) return false;\r
+ return widget_display.children[widget_display.children.length-1].on_event(evt);\r
+}\r
+\r
+widget_tool_size = 18;\r
+widget_min_size = 5*widget_tool_size;\r
+widget_default_size = 100;\r
+\r
+\r
+function check_widget_display(width, height) \r
+{\r
+ var count = WidgetManager.num_widgets;\r
+ for (var i=0; i<count; i++) {\r
+ var x, y;\r
+ var wid = WidgetManager.get(i);\r
+ if (wid == null) continue;\r
+ if (!wid.visible) continue;\r
+ \r
+ x = wid.x;\r
+ y = wid.y;\r
+ if (x-wid.width/2 <= -width/2) x = wid.width/2-width/2;\r
+ else if (x+wid.width/2 >= width/2) x = width/2 - wid.width/2;\r
+ \r
+ if (y + wid.height/2 >= height/2) y = height/2 - wid.height/2;\r
+ else if (y - wid.height/2 <= - height/2) y = -height/2 + wid.height/2;\r
+\r
+ if (wid.widget_control) wid.widget_control.move(x, y);\r
+ }\r
+}\r
+\r
+function scan_directory(dir)\r
+{\r
+ var i, j, count, list, new_wid, uri;\r
+ list = gpac.enum_directory(dir, '.xml;.wgt;.mgt', 0);\r
+ for (i=0; i<list.length; i++) {\r
+ uri = list[i].path + list[i].name;\r
+ if (list[i].directory) {\r
+ scan_directory(uri);\r
+ } else {\r
+ count = WidgetManager.num_widgets;\r
+ for (j=0; j<count; j++) {\r
+ var wid = WidgetManager.get(j);\r
+ if (wid.url==uri) break;\r
+ }\r
+ if (j==count) {\r
+ new_wid = WidgetManager.open(uri, null);\r
+ if (new_wid!=null) {\r
+ widget_insert_icon(new_wid, 1);\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+widman_cfg_dlg = null; \r
+\r
+function open_widget_manager(extension)\r
+{\r
+ if (widman_cfg_dlg) return;\r
+ \r
+ widman_cfg_dlg = gw_new_window_full(null, true, 'Widget Manager', 'window'); \r
+ widman_cfg_dlg.area = gw_new_grid_container(widman_cfg_dlg);\r
+ var icon = gw_new_icon_button(widman_cfg_dlg.area, gwskin.images.add, 'Add widget', 'button');\r
+ icon.on_click = function() {\r
+ widman_cfg_dlg.close();\r
+ widman_cfg_dlg = null;\r
+ \r
+ var filebrowse = gw_new_file_open();\r
+ filebrowse.show_directory = true;\r
+ filebrowse.filter = '*.xml;*.wgt;*.mgt';\r
+ filebrowse.browse(WidgetManager.last_widget_dir); \r
+ \r
+ filebrowse.on_browse = function(value, directory) {\r
+ var new_wid = WidgetManager.open(value, null);\r
+ if (new_wid==null) return;\r
+ WidgetManager.last_widget_dir = directory;\r
+ widget_insert_icon(new_wid, 0);\r
+ dock.layout(dock.width, dock.height);\r
+ open_dock(true);\r
+ }\r
+ filebrowse.on_directory = function(directory) {\r
+ WidgetManager.last_widget_dir = directory;\r
+ scan_directory(directory);\r
+ }\r
+ filebrowse.set_size(320 , 240);\r
+ gpacui_show_window(filebrowse);\r
+ }\r
+ var icon = gw_new_icon_button(widman_cfg_dlg.area, gwskin.images.trash, 'Remove all widgets', 'button');\r
+ icon.on_click = function() {\r
+ while (1) {\r
+ var wid = WidgetManager.get(0);\r
+ if (wid==null) break;\r
+ widget_remove(wid);\r
+ }\r
+ widman_cfg_dlg.close();\r
+ widman_cfg_dlg = null;\r
+ dock.layout(dock.width, dock.height);\r
+ open_dock(true);\r
+ }\r
+ widman_cfg_dlg.on_close = function() {\r
+ widman_cfg_dlg = null;\r
+ }\r
+ widman_cfg_dlg.set_size(320 , 240);\r
+ gpacui_show_window(widman_cfg_dlg);\r
+}\r
+\r
+function widget_insert_icon(new_wid) {\r
+ var icon = gw_new_icon_button(dock, widget_get_icon(new_wid), new_wid.name, 'button');\r
+ new_wid.in_panel = true;\r
+ new_wid.visible = false;\r
+ new_wid.icon_dock = icon;\r
+ icon.on_click = on_widget_launch;\r
+ icon.widget = new_wid;\r
+}\r
+\r
+function collapsable_list(info_dlg, title)\r
+{\r
+ var info = gw_new_button(info_dlg.area, title, 'button');\r
+ var children = info_dlg.area.get_children();\r
+ \r
+ info.first_idx = children.length;\r
+ info.dlg = info_dlg;\r
+ info.displayed = true;\r
+ info.on_click = function() {\r
+ var children = this.dlg.area.get_children();\r
+ this.displayed = !this.displayed;\r
+ for (var i=this.first_idx; i<this.last_idx; i++) {\r
+ if (this.displayed) children[i].show();\r
+ else children[i].hide();\r
+ \r
+ if (typeof children[i].last_idx != 'undefined') {\r
+ if (!children[i].displayed) children[i].on_click();\r
+ }\r
+ }\r
+ this.dlg.area.layout_changed();\r
+ }\r
+ return info;\r
+}\r
+\r
+//widget information dialog\r
+function display_widget_info(wid)\r
+{\r
+ var i, j, k, info;\r
+ var y, txt, pref;\r
+\r
+ var info_dlg = gw_new_window_full(null, true, 'Widget ' + wid.name + ' Information', 'window', null);\r
+// info_dlg.area = gw_new_grid_container(info_dlg);\r
+ info_dlg.area = gw_new_listbox(info_dlg);\r
+ \r
+ var info = collapsable_list(info_dlg, 'Widget Metadata');\r
+ \r
+ gw_new_text(info_dlg.area, 'id: ' + wid.identifier + ' - shortname: '+wid.shortName + ' - name: '+wid.name, 'text');\r
+ gw_new_text(info_dlg.area, 'version: '+wid.version, 'text');\r
+ gw_new_text(info_dlg.area, 'content type: ' + wid.mainMimeType + ' - content encoding: '+wid.mainEncoding, 'text');\r
+ gw_new_text(info_dlg.area, 'default size: Width = ' + wid.defaultWidth + ' Height = '+wid.defaultHeight, 'text');\r
+ gw_new_text(info_dlg.area, 'license: '+wid.license, 'text');\r
+ gw_new_text(info_dlg.area, 'license ref: '+wid.licenseHref, 'text');\r
+ gw_new_text(info_dlg.area, 'description: '+wid.description, 'text');\r
+ gw_new_text(info_dlg.area, 'author name: '+wid.authorName + ' (mail: '+wid.authorEmail+')', 'text');\r
+ gw_new_text(info_dlg.area, 'author href: '+wid.authorHref, 'text');\r
+ gw_new_text(info_dlg.area, 'view modes: '+wid.viewmodes, 'text');\r
+ gw_new_text(info_dlg.area, 'UUID: '+wid.uuid, 'text');\r
+ gw_new_text(info_dlg.area, 'Discardable: '+wid.discardable, 'text');\r
+ gw_new_text(info_dlg.area, 'Muliple Instances: '+wid.discardable, 'text');\r
+ var icons = wid.icons;\r
+ for (j=0; j<icons.length; j++) {\r
+ gw_new_text(info_dlg.area, 'Icon #'+(j+1)+': ' + icons[j].src, 'text');\r
+ }\r
+ info.last_idx = info_dlg.area.get_children().length;\r
+ info.on_click();\r
+\r
+ info = collapsable_list(info_dlg, 'Widget Manager Info');\r
+\r
+ gw_new_text(info_dlg.area, 'nb instances: '+wid.num_instances + ' nb components: '+wid.num_components, 'text' );\r
+ gw_new_text(info_dlg.area, 'Permanently installed: '+wid.permanent + ' - is component: '+wid.is_component, 'text' );\r
+ if (wid.is_component) {\r
+ gw_new_text(info_dlg.area, 'parent widget name' + wid.parent.name, 'text');\r
+ }\r
+ if (wid.originating_device_ip) {\r
+ gw_new_text(info_dlg.area, 'Widget was pushed from device IP '+wid.originating_device_ip, 'text' );\r
+ }\r
+ gw_new_text(info_dlg.area, 'Section name in GPAC config file: '+wid.section, 'text' );\r
+ gw_new_text(info_dlg.area, 'UA Locale: ' + gpac.getOption('Systems', 'LanguageName') + ' ('+ gpac.getOption('Systems', 'Language2CC')+ ')', 'text' );\r
+ gw_new_text(info_dlg.area, 'widget src: ' + wid.url , 'text');\r
+ gw_new_text(info_dlg.area, 'config src: ' + wid.manifest , 'text');\r
+ gw_new_text(info_dlg.area, 'content src : '+wid.localizedSrc, 'text' );\r
+ info.last_idx = info_dlg.area.get_children().length;\r
+ info.on_click();\r
+\r
+ pref = wid.features;\r
+ if (pref.length) {\r
+ info = collapsable_list(info_dlg, 'Features');\r
+ for (j=0; j<pref.length; j++) {\r
+ gw_new_text(info_dlg.area, 'Feature #'+(j+1)+' name=\''+pref[j].name+'\' required=\''+pref[j].required+'\'', 'text');\r
+ }\r
+ info.last_idx = info_dlg.area.get_children().length;\r
+ info.on_click();\r
+ }\r
+\r
+ pref = wid.preferences;\r
+ if (pref.length) {\r
+ info = collapsable_list(info_dlg, 'Preferences');\r
+ for (j=0; j<pref.length; j++) {\r
+ var val = pref[j].value;\r
+ if (val=='') val = gpac.getOption(wid.section, pref[j].name);\r
+ gw_new_text(info_dlg.area, 'Preference #'+(j+1)+' name=\''+pref[j].name+'\' value=\''+val+'\' readOnly=\''+pref[j].readonly +'\'', 'text');\r
+ }\r
+ info.last_idx = info_dlg.area.get_children().length;\r
+ info.on_click();\r
+ }\r
+\r
+ info = collapsable_list(info_dlg, 'MPEG-U Migration Context');\r
+ txt=wid.get_context();\r
+ if (!txt) txt='';\r
+\r
+ while (1) {\r
+ var idx = txt.indexOf('\n', 0);\r
+ if (idx>0) {\r
+ gw_new_text(info_dlg.area, txt.substring(0, idx), 'text');\r
+ txt = txt.substring(idx+1, txt.length);\r
+ } else {\r
+ gw_new_text(info_dlg.area, txt, 'text');\r
+ break;\r
+ }\r
+ }\r
+ info.last_idx = info_dlg.area.get_children().length;\r
+ info.on_click();\r
+\r
+ if (wid.num_interfaces) {\r
+ info = collapsable_list(info_dlg, 'MPEG-U Interfaces', 'button');\r
+ var spacer = gw_new_text(info_dlg.area, '', 'text');\r
+ spacer.hide();\r
+ info.first_idx = info_dlg.area.get_children().length;\r
+ for (j=0; j<wid.num_interfaces; j++) {\r
+ var idx;\r
+ var ifce = wid.get_interface(j);\r
+ var item = collapsable_list(info_dlg, 'Interface #' + (j+1) + ' type: '+ifce.type);\r
+ item.sublist = true;\r
+ gw_new_text(info_dlg.area, 'Multiple Binding: '+ifce.multipleBinding + ' - Service provider: '+ ifce.serviceProvider + ' - bound: ' + wid.is_interface_bound(ifce) , 'text');\r
+ for (k=0; k<ifce.num_messages; k++) {\r
+ var string, l;\r
+ var msg = ifce.get_message(k);\r
+ string = ' Message #'+ (k+1) + ': ' + msg.name + '(';\r
+ for (l=0; l<msg.num_params; l++) {\r
+ par = msg.get_param(l);\r
+ string += (par.is_input ? 'in' : 'out') + ':' +par.name + ' ';\r
+ }\r
+ string += ')';\r
+ gw_new_text(info_dlg.area, string, 'text');\r
+ }\r
+ item.last_idx = info_dlg.area.get_children().length;\r
+ item.on_click();\r
+ item.hide();\r
+ }\r
+ info.last_idx = info_dlg.area.get_children().length;\r
+ info.on_click();\r
+ }\r
+\r
+ info_dlg.area.spread_h = true;\r
+ info_dlg.area.break_at_hidden = true;\r
+ \r
+ info_dlg.on_size = function(width, height) {\r
+ var i;\r
+ var children = this.area.get_children();\r
+ for (i=0; i<children.length; i++) {\r
+ if ((typeof children[i].first_idx != 'undefined') && (typeof children[i].sublist== 'undefined')) {\r
+ children[i].set_size( (width>200) ? 200 : width, 20);\r
+ } else {\r
+ children[i].set_size(width, 16);\r
+ }\r
+ }\r
+ }\r
+ \r
+ info_dlg.on_event = function(evt) {\r
+ if (this.area && this.area.on_event(evt)) return true;\r
+ return false;\r
+ }\r
+\r
+ info_dlg.set_size(320, 240);\r
+ gpacui_show_window(info_dlg);\r
+}\r
+\r
+\r
+//widget close function\r
+function widget_close(widget, force_remove)\r
+{\r
+ var is_comp = widget.is_component;\r
+\r
+ if (widget.visible) {\r
+ widget.visible = false;\r
+ WidgetManager.corein_message(widget, 'hide');\r
+ WidgetManager.corein_message(widget, 'deactivate');\r
+ widget.deactivate();\r
+ /*force disconnect of main resource - we do this because we are not sure when the widget_control will be destroyed due to JS GC*/\r
+ if (widget.widget_control) {\r
+ widget.widget_control.set_url('');\r
+ widget.widget_control.close();\r
+ }\r
+ }\r
+ if (!is_comp && (!widget.permanent || force_remove)) {\r
+ WidgetManager.unload(widget, force_remove ? true : false);\r
+ }\r
+}\r
+\r
+//widget remove function (close and unregister)\r
+function widget_remove(wid) {\r
+ if (typeof(wid.icon_dock) != 'undefined') {\r
+ wid.icon_dock.close();\r
+ wid.icon_dock = null;\r
+ } \r
+ widget_close(wid, 1);\r
+}\r
+\r
+function new_migrate_callback(widget) {\r
+ return function(renderer) {\r
+ WidgetManager.migrate_widget(renderer, widget);\r
+ widget_close(widget, 0);\r
+ }\r
+}\r
+\r
+function on_widget_load() \r
+{\r
+ WidgetManager.corein_message(this, 'activate');\r
+ WidgetManager.corein_message(this, 'show');\r
+ WidgetManager.corein_message(this, 'setSize', 'width', this.width, 'height', this.height, 'dpi', screen_dpi);\r
+}\r
+\r
+\r
+function new_widget_control(widget)\r
+{\r
+ var ctrl;\r
+ \r
+\r
+ var inline = gw_new_subscene(null);\r
+ ctrl = gw_new_window_full(widget_display, true, null, 'offscreen', inline);\r
+ ctrl.set_size(widget.width, widget.height);\r
+\r
+ ctrl.inline = inline;\r
+ ctrl.tools.spread_h = true;\r
+ \r
+ ctrl.component_bound = false;\r
+ ctrl.widget = widget;\r
+ widget.widget_control = ctrl; \r
+ widget.visible = true;\r
+ \r
+ ctrl.on_close = function() {\r
+ this.inline.url[0] = '';\r
+ this.widget.widget_control = null; \r
+ if (this.widget.discardable) widget_remove(this.widget);\r
+ else widget_close(this.widget, 0);\r
+ this.widget = null;\r
+ }\r
+\r
+ ctrl.tools.hide();\r
+ gw_object_set_dragable(ctrl);\r
+\r
+ gw_object_set_hitable(ctrl);\r
+ ctrl.controls_visible = false;\r
+\r
+ this.maximized = false;\r
+ ctrl.on_double_click = function() {\r
+ if (this.maximized) {\r
+ this.maximized = false;\r
+ this.move(this.widget.x, this.widget.y);\r
+ this.set_size(this.prev_width, this.prev_height);\r
+ } else {\r
+ this.maximized = true;\r
+ this.prev_width = this.widget.width;\r
+ this.prev_height = this.widget.height;\r
+ this.move(0, 0);\r
+ this.set_size(display_width, display_height);\r
+ } \r
+ this.controls_visible = false;\r
+ this.tools.hide();\r
+ }\r
+\r
+ ctrl.on_click = function() {\r
+ this.controls_visible = ! this.controls_visible;\r
+ if (this.controls_visible) this.tools.show();\r
+ else this.tools.hide();\r
+ }\r
+ /*push on top*/\r
+ ctrl.on_down = function(value) {\r
+ if (value) return;\r
+ if (this.widget==null) return;\r
+\r
+ //widget is a component, do not push on top but hide some controls\r
+ if (this.widget.is_component) {\r
+ if (this.component_bound) {\r
+ var chldren = this.tools.get_children();\r
+ children[0].hide(); //close\r
+ children[1].hide(); //remove\r
+ children[4].hide(); //resize\r
+ }\r
+ return;\r
+ }\r
+ //otherwise push widget on top\r
+ widget_display.push_to_top(this);\r
+ //and push components\r
+ comps = this.widget.components;\r
+ for (i=0; i<comps.length; i++) {\r
+ if (comps[i].widget_control && comps[i].widget_control.component_bound) {\r
+ widget_display.push_to_top(comps[i].widget_control);\r
+ }\r
+ }\r
+ }\r
+\r
+ ctrl._orig_move = ctrl.move;\r
+ ctrl.move = function(x, y) {\r
+ this.widget.x = x;\r
+ this.widget.y = y;\r
+ this._orig_move(x, y);\r
+ }\r
+\r
+ ctrl.on_drag = function(x, y) {\r
+ if (this.maximized) return;\r
+ this.move(x, y);\r
+ }\r
+ ctrl.on_event = function(evt) {\r
+ var x, y;\r
+ if (evt.type != GF_EVENT_KEYDOWN) return false;\r
+ if (!this.controls_visible) return false;\r
+\r
+ x = this.widget.x;\r
+ y = this.widget.y;\r
+ if (evt.keycode=='Up') y += 10;\r
+ else if (evt.keycode=='Down') y -= 10;\r
+ else if (evt.keycode=='Left') x -= 10;\r
+ else if (evt.keycode=='Right') x += 10;\r
+ else return false;\r
+ this.move(x, y);\r
+ return true;\r
+ }\r
+ \r
+ /*widget is not temporary*/\r
+ if (!widget.discardable && widget.icon_dock) {\r
+ var icon = ctrl.add_tool(gwskin.images.trash, gwskin.labels.trash);\r
+ icon.on_click = function() { widget_remove(this.dlg.widget); }; \r
+ }\r
+ \r
+ if (UPnP_Enabled) {\r
+ ctrl.remote = ctrl.add_tool(gwskin.images.remote_display, gwskin.labels.remote_display);\r
+ ctrl.remote.on_click = function() { \r
+ var dlg = select_remote_display('callback', new_migrate_callback(this.dlg.widget) ); \r
+ }; \r
+ \r
+ ctrl.show_remote = function(show) {\r
+ if (show) this.remote.show();\r
+ else this.remote.hide();\r
+ }\r
+ } \r
+\r
+ var icon = ctrl.add_tool(gwskin.images.information, gwskin.labels.information);\r
+ icon.on_click = function() { \r
+ display_widget_info(this.dlg.widget); \r
+ }; \r
+\r
+ var icon = ctrl.add_tool(gwskin.images.resize, gwskin.labels.resize);\r
+ gw_object_set_dragable(icon);\r
+ ctrl.prev_x=0;\r
+ ctrl.prev_y=0;\r
+ icon.begin_drag = function() {\r
+ this.dlg.prev_x=this.startx;\r
+ this.dlg.prev_y=this.starty;\r
+ }\r
+ icon.on_drag = function(valx, valy) {\r
+ var _dlg = this.dlg;\r
+ if (_dlg.widget.width + 2*(valx - _dlg.prev_x) < widget_min_size) return;\r
+ if (_dlg.widget.height + 2*(valy-_dlg.prev_y) < widget_min_size) return;\r
+\r
+ _dlg.widget.width += 2*(valx - _dlg.prev_x);\r
+ _dlg.prev_x = valx;\r
+ _dlg.widget.height += 2*(valy - _dlg.prev_y);\r
+ _dlg.prev_y = valy;\r
+ _dlg.set_size(_dlg.widget.width, _dlg.widget.height);\r
+ }\r
+ \r
+ ctrl.set_url = function(url) {\r
+ ctrl.inline.url[0] = url;\r
+ }\r
+ ctrl.predestroy = function() {\r
+ this.inline = null;\r
+ this.remote = null;\r
+ this.widget = null;\r
+ }\r
+ \r
+ ctrl.sub_w = 0;\r
+ ctrl.sub_h = 0;\r
+ ctrl.sub_x = 0;\r
+ ctrl.sub_y = 0;\r
+ ctrl.sub_vp_w = 0;\r
+ ctrl.sub_vp_h = 0;\r
+\r
+ ctrl.on_widget_vp_changed = function(evt) {\r
+ this.sub_vp_w = evt.width;\r
+ this.sub_vp_h = evt.height;\r
+ this.sub_vp_x = evt.offset_x;\r
+ this.sub_vp_y = evt.offset_y;\r
+ this.sub_w = evt.vp_width;\r
+ this.sub_h = evt.vp_height;\r
+ }\r
+ ctrl.inline.addEventListener('gpac_vp_changed', ctrl.on_widget_vp_changed, 0);\r
+ \r
+ ctrl.set_tool_size(widget_tool_size); \r
+ ctrl.set_size(widget.width, widget.height);\r
+ if (widget.x < -display_width/2) widget.x = 0;\r
+ else if (widget.x > display_width/2) widget.x = 0;\r
+ if (widget.y < -display_height/2) widget.y = 0;\r
+ else if (widget.y > display_height/2) widget.y = 0;\r
+ ctrl.move(widget.x, widget.y);\r
+\r
+ /*this will setup the scene graph for the widget in order to filter input and output communication pins*/\r
+ widget.activate(ctrl.inline);\r
+\r
+ ctrl.set_url(widget.main);\r
+\r
+ /*send notifications once the widget scene is loaded*/\r
+ widget.on_load = on_widget_load;\r
+\r
+ ctrl.show();\r
+ return ctrl;\r
+}\r
+\r
+function flash_window(wnd) {\r
+ wnd.time = gw_new_timer(true);\r
+ wnd.time.set_timeout(0.25, true);\r
+ wnd.time.ctrl = wnd;\r
+ wnd.time.on_fraction = function(val) {\r
+ var scale = (val<0.5) ? 1+val/2 : 1.5-val/2;\r
+ this.ctrl.scale.x = this.ctrl.scale.y = scale;\r
+ }\r
+ wnd.time.on_active = function (val) {\r
+ if (!val) {\r
+ this.ctrl.time = null;\r
+ this.ctrl = null;\r
+ }\r
+ }\r
+ wnd.time.stop(1);\r
+ wnd.time.start(0);\r
+}\r
+\r
+//widget launcher function\r
+function widget_launch(wid) {\r
+ var widg_ctrl;\r
+\r
+ //assign default size to the widget\r
+ if (wid.width == undefined) {\r
+ wid.width = wid.defaultWidth;\r
+ if (wid.width == 0) wid.width = widget_default_size;\r
+ }\r
+ if (wid.height == undefined) {\r
+ wid.height = wid.defaultHeight;\r
+ if (wid.height == 0) wid.height = widget_default_size;\r
+ }\r
+ if (wid.x== undefined) wid.x = 0;\r
+ if (wid.y== undefined) wid.y = 0;\r
+\r
+ widg_ctrl = new_widget_control(wid);\r
+}\r
+\r
+\r
+//starts a widget\r
+function on_widget_launch() {\r
+ if (this.widget.visible) {\r
+ var awid;\r
+ if (!this.widget.multipleInstances) return;\r
+ awid = WidgetManager.open(this.widget.manifest, null);\r
+ widget_launch(awid);\r
+ } else {\r
+ widget_launch(this.widget);\r
+ }\r
+ open_dock(false);\r
+}\r
+\r
+\r
+function widget_get_icon(widget)\r
+{\r
+ var icon = 'icons/image-missing.svg';\r
+ var preferredIconType = '.svg';\r
+\r
+ for (var i = 0; i < widget.icons.length; i++) {\r
+ icon = widget.icons[i].relocated_src;\r
+ if (widget.icons[i].relocated_src.indexOf(preferredIconType) > 0) {\r
+ break;\r
+ }\r
+ }\r
+ return icon;\r
+}\r
+\r
+function widget_insert(widget)\r
+{\r
+ /*insert the widget icon*/\r
+ if (widget.permanent && !widget.is_component)\r
+ widget_insert_icon(widget);\r
+\r
+ /*and load the widget - comment this line to disable auto load of widget*/\r
+ widget_launch(widget);\r
+}\r
+\r
+function __get_int(arg)\r
+{\r
+ return (typeof arg == 'string') ? parseInt(arg) : arg;\r
+}\r
+\r
+function widget_request_size(widget, args)\r
+{\r
+ if (args.length==2) {\r
+ w = __get_int(args[0]);\r
+ h = __get_int(args[1]);\r
+ widget.widget_control.set_size(w, h);\r
+ }\r
+}\r
+\r
+function widget_request_show(widget, args)\r
+{\r
+ widget.widget_control.show();\r
+}\r
+function widget_request_hide(widget, args)\r
+{\r
+ widget.widget_control.hide();\r
+}\r
+function widget_request_activate(widget, args)\r
+{\r
+ if (!widget.visible)\r
+ widget_launch(widget);\r
+}\r
+function widget_request_deactivate(widget, args)\r
+{\r
+ if (widget.visible)\r
+ widget_close(widget, 0);\r
+}\r
+\r
+function widget_request_attention(widget, args)\r
+{\r
+ if (widget.visible) {\r
+ widget_display.push_to_top(widget.widget_control);\r
+ flash_window(widget.widget_control);\r
+ }\r
+}\r
+\r
+function widget_request_notification(widget, args)\r
+{\r
+ var notif = gw_new_message(null, ''+widget.name+' Alert!', args[0]);\r
+// widget_display.push_to_top(notif);\r
+ gpacui_show_window(notif);\r
+ notif.set_size(240, 120);\r
+}\r
+\r
+function widget_refresh_components_layout(ctrl, send_resize, comp_target)\r
+{\r
+ var i;\r
+ var x, y, w, h, scale_x, scale_y;\r
+ var comps;\r
+\r
+ /*local to subscene transformation not known*/\r
+ if (!ctrl.sub_w) return;\r
+ if (!ctrl.sub_h) return;\r
+\r
+ comps = ctrl.widget.components;\r
+ for (i=0; i<comps.length; i++) {\r
+ var comp = comps[i];\r
+ if (!comp.widget_control || !comp.widget_control.component_bound) continue;\r
+\r
+ //compute scale from Widget Manager coord system to widget internal coordinate system\r
+ scale_x = ctrl.sub_vp_w / ctrl.sub_w;\r
+ scale_y = ctrl.sub_vp_h / ctrl.sub_h;\r
+\r
+ w = comp.widget_control.place_w * scale_x;\r
+ h = comp.widget_control.place_h * scale_y;\r
+\r
+ x = ctrl.translation.x - ctrl.widget.width/2 + ctrl.sub_vp_x + comp.widget_control.place_x * scale_x + w/2;\r
+ comp.widget_control.translation.x = x;\r
+\r
+ y = ctrl.widget.height/2 + ctrl.translation.y - h/2 - ctrl.sub_vp_y - comp.widget_control.place_y * scale_y;\r
+ comp.widget_control.translation.y = y;\r
+\r
+ if (send_resize || (comp_target==comp))\r
+ comp.widget_control.set_size(w, h);\r
+ }\r
+}\r
+\r
+function widget_place_component(widget, args)\r
+{\r
+ var comp = widget.get_component(args[0]);\r
+\r
+ if (comp==null) {\r
+ log(l_err, 'Component '+args[0]+' cannot be found in widget '+widget.name);\r
+ return;\r
+ }\r
+ comp.widget_control.place_x = __get_int(args[1]);\r
+ comp.widget_control.place_y = __get_int(args[2]);\r
+ comp.widget_control.place_w = __get_int(args[3]);\r
+ comp.widget_control.place_h = __get_int(args[4]);\r
+ comp.widget_control.place_z = __get_int(args[5]);\r
+ comp.widget_control.component_bound = true;\r
+ widget_refresh_components_layout(widget.widget_control, false, comp);\r
+}\r
+\r
+\r
+\r
+//\r
+// implementation of core:out install widget\r
+//\r
+function widget_request_install(wid, args)\r
+{\r
+ var wid_url = args[0];\r
+ /*locate widget with same URL*/\r
+ var j, count = WidgetManager.num_widgets;\r
+ for (j = 0; j < count; j++) {\r
+ var wid = WidgetManager.get(j);\r
+ if (wid.url == wid_url) {\r
+ if (!wid.in_panel) {\r
+ widget_insert_icon(wid);\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ /*not found, install new widget*/\r
+ if (j == count) {\r
+ var new_wid = WidgetManager.open(wid_url, null);\r
+ if (new_wid==null) return;\r
+ widget_insert_icon(new_wid);\r
+ }\r
+\r
+ var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");\r
+ if (ifce != null) {\r
+ wmjs_core_out_invoke_reply(coreOut.installWidgetMessage, ifce.get_message("installWidget"), wid, 1); // send return code 1 = success\r
+ }\r
+}\r
+function widget_migrate_component(wid, args)\r
+{\r
+ var comp = wid.get_component(args[0], true);\r
+ var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");\r
+\r
+ if (comp==null) {\r
+ log(l_err, 'Component '+args[0]+' cannot be found in widget '+wid.name);\r
+ if (ifce != null) {\r
+ wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 0);\r
+ }\r
+ return;\r
+ }\r
+ comp.widget_control = null;\r
+ if (args.length > 1 && args[1] != null) {\r
+ alert('Migrating component to ' + UPnP.GetMediaRenderer(parseInt(args[1])).Name);\r
+ WidgetManager.migrate_widget(UPnP.GetMediaRenderer(parseInt(args[1])), comp);\r
+ widget_close(comp);\r
+ } else {\r
+ var dlg = select_remote_display('callback', new_migrate_callback(comp) ); \r
+ }\r
+ if (ifce != null) {\r
+ wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 1); // send return code 1 = success\r
+ }\r
+}\r
+\r
+function widget_migration_targets(wid, args)\r
+{\r
+ var count = UPnP.MediaRenderersCount, codes = new Array(), names = new Array(), descriptions = new Array(), i, i;\r
+\r
+ for (i = 0; i < count; i++) {\r
+ var render = UPnP.GetMediaRenderer(i);\r
+ codes.push(""+i);\r
+ names.push(render.Name);\r
+ descriptions.push(render.HostName +" "+ render.UUID);\r
+ }\r
+ i = null;\r
+ var ifce_count = wid.num_interfaces, j;\r
+ for (j = 0; j < ifce_count; j++) {\r
+ var ifce = wid.get_interface(j);\r
+ if (ifce.type == "urn:mpeg:mpegu:schema:widgets:core:out:2010") {\r
+ i = ifce;\r
+ break;\r
+ }\r
+ }\r
+ if (i != null) {\r
+ wmjs_core_out_invoke_reply(coreOut.requestMigrationTargetsMessage, i.get_message("requestMigrationTargets"),\r
+ wid, codes, names, descriptions);\r
+ }\r
+}\r
+\r
+\r
+//\r
+// implementation of core:out activate temporary widget\r
+//\r
+function widget_activate_temporary_widget(wid, args) {\r
+ var w = WidgetManager.open(args[0], null);\r
+ if (w != null) widget_launch(w);\r
+ var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");\r
+ if (ifce != null) {\r
+ wmjs_core_out_invoke_reply(coreOut.activateTemporaryWidgetMessage, ifce.get_message("activateTemporaryWidget"),\r
+ wid, (w != null ? 1 : 0)); // send return code 1 = success\r
+ }\r
+}\r
+\r
+function setup_extension(extension)\r
+{ \r
+ var count, i;\r
+\r
+ /*WidgetManager module not present*/ \r
+ if (typeof(WidgetManager) == 'undefined') return 0;\r
+ \r
+ /*load MPEG-U*/ \r
+ Browser.loadScript('mpegu-core.js', true); \r
+ widget_manager_init();\r
+ \r
+ extension.icon = 'applications-system.svg';\r
+ extension.label = 'Widget Manager';\r
+ extension.desc = 'Configure Widgets';\r
+ extension.launch = open_widget_manager;\r
+ \r
+ extension.initialize = function(extension) {\r
+ WidgetManager.on_widget_remove = widget_remove;\r
+ WidgetManager.on_widget_add = widget_insert;\r
+ WidgetManager.coreOutSetSize = widget_request_size;\r
+ WidgetManager.coreOutShow = widget_request_show;\r
+ WidgetManager.coreOutHide = widget_request_hide;\r
+ WidgetManager.coreOutRequestActivate = widget_request_activate;\r
+ WidgetManager.coreOutRequestDeactivate = widget_request_deactivate;\r
+ WidgetManager.coreOutShowNotification = widget_request_notification;\r
+ WidgetManager.coreOutPlaceComponent = widget_place_component;\r
+ WidgetManager.coreOutGetAttention = widget_request_attention;\r
+ WidgetManager.coreOutInstallWidget = widget_request_install;\r
+ WidgetManager.coreOutMigrateComponent = widget_migrate_component;\r
+ WidgetManager.coreOutRequestMigrationTargets = widget_migration_targets;\r
+ WidgetManager.coreOutActivateTemporaryWidget = widget_activate_temporary_widget;\r
+\r
+\r
+ gpacui_show_window(widget_display);\r
+ \r
+ /*restore our widgets*/\r
+ count = WidgetManager.num_widgets;\r
+ for (i=0; i<count; i++) {\r
+ var wid = WidgetManager.get(i);\r
+ if (wid == null) continue;\r
+ wid.device = null;\r
+ wid.device_ip = null;\r
+\r
+ if (wid.in_panel == true) {\r
+ var icon = gpacui_insert_dock_icon(wid.name, widget_get_icon(wid));\r
+ icon.widget = wid;\r
+ icon.on_click = on_widget_launch;\r
+ wid.icon_dock = icon;\r
+ }\r
+\r
+ if (wid.visible) {\r
+ widget_launch(wid);\r
+ }\r
+ }\r
+ check_widget_display(display_width, display_height);\r
+ } \r
+\r
+ if (UPnP_Enabled) { \r
+ extension.on_upnp_add = function(name, uuid, is_add) {\r
+ var i, count;\r
+ var show = UPnP.MediaRenderersCount ? 1 : 0;\r
+ count = WidgetManager.num_widgets;\r
+ for (i=0; i<count; i++) {\r
+ wid = WidgetManager.get(i);\r
+ if (wid == null) continue;\r
+ if (!wid.widget_control) continue;\r
+ wid.widget_control.show_remote(show);\r
+ }\r
+ }\r
+ extension.on_media_open = function(url, src_ip) {\r
+ if (! WidgetManager.probe(url)) return 0;\r
+ var new_wid = WidgetManager.open(url, src_ip);\r
+ if (new_wid!=null) {\r
+ widget_insert(new_wid);\r
+ }\r
+ return 1;\r
+ }\r
+ }\r
+ extension.on_resize = check_widget_display;\r
+ \r
+ /*setup all widgets*/\r
+ return 1;\r
+}\r
+\r
]
[ "urn:inet:gpac:builtin:Untransform"]
+EXTERNPROTO OffscreenGroup [
+ exposedField MFNode children []
+ exposedField SFInt32 offscreen_mode 0
+ exposedField SFFloat opacity 1.0
+]
+[ "urn:inet:gpac:builtin:OffscreenGroup"]
+
#######################################################################################
DEF GPAC_UI OrderedGroup {
children [
- Background2D { backColor 1 1 1}
-
- DEF MovieControl MediaControl {
- loop TRUE
+ Background2D {}
+
+ DEF MovieControl MediaControl {}
+ DEF MovieSensor MediaSensor {
}
DEF Movie Transform2D {
children [
field SFNode ui_root USE UI_ROOT
field SFNode movie USE Movie
field SFNode movie_ctrl USE MovieControl
+ field SFNode movie_sensor USE MovieSensor
url "gui.js"
}
//
// Authors:
// Jean Le Feuvre, Telecom ParisTech
-// Jean-Claude Dufourd, Telecom ParisTech
//
/////////////////////////////////////////////////////////////////////////////////
+/*log function*/
+function log(lev, str) {
+ if (lev <= log_level) alert('[WM] ' + str);
+}
+
+/*log levels*/
+l_err = 0;
+l_war = 1;
+l_inf = 2;
+l_deb = 3;
+
+/*default log level*/
+log_level = l_inf;
+
+dictionary = null;
+top_wnd = null;
+controlled_renderer = null;
+movie_connected = false;
+UPnP_Enabled = false;
+browser_mode = false;
+upnp_renderers = null;
+current_url = '';
+player_control = null;
+
+all_extensions = [];
+
function new_extension()
{
var obj = new Object();
- obj.type = 'extension';
+ obj.built_in = false;
+ obj.upnp_add = function(name, uuid, is_add) {};
+ all_extensions.push(obj);
return obj;
}
+function on_movie_duration(value)
+{
+ if (value<0) value=0;
+ player_control.set_duration(value);
+ if (UPnP_Enabled) UPnP.MovieDuration = value;
+}
+
+function on_movie_active(value)
+{
+ if (!value) {
+ movie_ctrl.mediaStartTime = -1;
+ }
+}
+
+function on_movie_time(value)
+{
+ player_control.set_time(value);
+ if (UPnP_Enabled) UPnP.MovieTime = value;
+}
+
+
+in_drag = false;
+start_drag_x=start_drag_y=0;
+
+function filter_event(evt)
+{
+ if (top_wnd && top_wnd.on_event(evt) ) return true;
+
+ switch (evt.type) {
+ case GF_EVENT_MOUSEDOWN:
+ if (evt.picked) return false;
+ start_drag_x = evt.mouse_x;
+ start_drag_y = evt.mouse_y;
+ if (gpac.navigation!=GF_NAVIGATE_NONE) return false;
+ in_drag = true;
+ return true;
+ case GF_EVENT_MOUSEMOVE:
+ if (in_drag) {
+ gpac.move_window(evt.mouse_x - start_drag_x, evt.mouse_y - start_drag_y);
+ return true;
+ }
+ return false;
+ case GF_EVENT_MOUSEUP:
+ in_drag = false;
+ if (evt.picked) return false;
+ if ((start_drag_x == evt.mouse_x) && (start_drag_y == evt.mouse_y)) {
+/*
+ if (dock.visible) {
+ open_dock(false);
+ } else
+*/
+ {
+ open_dock(false);
+ if (player_control.visible) {
+ player_control.hide();
+ top_wnd = null;
+ } else {
+ player_control.show();
+ top_wnd = player_control;
+ }
+ }
+ }
+ return true;
+ case GF_EVENT_KEYUP:
+// alert(evt.keycode);
+ if (evt.keycode=='Home') {
+ open_dock(!dock.visible);
+ return true;
+ }
+ if (evt.keycode=='Up') {
+ if (dock.visible) return false;
+ if (player_control.visible) {
+ player_control.hide();
+ top_wnd = null;
+ } else {
+ player_control.show();
+ top_wnd = player_control;
+ }
+ return true;
+ }
+ return false;
+ case GF_EVENT_KEYDOWN:
+ if (evt.keycode=='Left') {
+ gpac.set_focus('previous');
+ return true;
+ }
+ else if (evt.keycode=='Right') {
+ gpac.set_focus('next');
+ return true;
+ }
+ return false;
+ case GF_EVENT_NAVIGATE_INFO:
+ //alert('Navigate to '+evt.target_url);
+ return true;
+ case GF_EVENT_NAVIGATE:
+ set_movie_url(evt.target_url);
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}
+
+
+function open_dock(show)
+{
+ if (show) {
+ dock.show();
+ player_control.hide();
+ top_wnd = dock;
+// uidisplay.hide();
+ } else {
+ dock.hide();
+ player_control.hide();
+ top_wnd = null;
+ if (uidisplay.children.length && typeof uidisplay.children[uidisplay.children.length-1].on_event != 'undefined') {
+ top_wnd = uidisplay.children[uidisplay.children.length-1];
+ }
+ }
+}
+
+function gpacui_insert_dock_icon(label, icon)
+{
+ if (0) {
+ var wnd = gw_new_window(dock, true, 'offscreen');
+ var icon = gw_new_icon_button(wnd, icon, label, 'osdbutton');
+ wnd.set_size(icon.width, icon.height);
+ wnd.show();
+ return icon;
+ } else {
+ var icon = gw_new_icon_button(dock, icon, label, 'osdbutton');
+ return icon;
+ }
+}
+
+
+function gpacui_show_window(obj)
+{
+ gw_add_child(uidisplay, obj);
+ if (!obj.width || !obj.height) {
+ obj.set_size(200, 200);
+ }
+ obj.show();
+ top_wnd = null;
+ if (uidisplay.children.length && typeof uidisplay.children[uidisplay.children.length-1].on_event != 'undefined') {
+ top_wnd = uidisplay.children[uidisplay.children.length-1];
+ }
+ layout();
+}
+
+
//Initialize the main UI script
function initialize() {
//var icon;
var i, count, wid;
+
gpac.caption = 'Osmo4';
+ current_time = 0;
+
+ min_width = 320;
+ min_height = 240;
+
+ /*load the UI lib*/
+ Browser.loadScript('gwlib.js', false);
+
+ browser_mode = gpac.getOption('Temp', 'BrowserMode');
+ if (browser_mode && (browser_mode=='yes')) {
+ browser_mode = true;
+ } else {
+ browser_mode = false;
+ }
+
+// gwskin.tooltip_callback = function(over, label) { alert('' + over ? label : ''); };
+
+ root.children[0].backColor = gwskin.back_color;
+
display_width = parseInt( gpac.getOption('General', 'LastWidth') );
display_height = parseInt( gpac.getOption('General', 'LastHeight') );
display_width = gpac.get_screen_width();
display_height = gpac.get_screen_height();
}
+ screen_dpi = gpac.get_horizontal_dpi();
- //request event listeners on the window - GPAC specific extensions !!!
+
+ dictionary = gw_new_container(root);
+ dictionary.hide();
+
+ //request event listeners on the window - GPAC specific BIFS extensions !!!
root.addEventListener('resize', on_resize, 0);
root.addEventListener('zoom', on_zoom, 0);
root.addEventListener('scroll', on_scroll, 0);
- widget_default_size = 200;
+
+ Browser.addRoute(movie_sensor, 'mediaDuration', movie_sensor, on_movie_duration);
+ Browser.addRoute(movie_sensor, 'mediaCurrentTime', movie_sensor, on_movie_time);
+ Browser.addRoute(movie_sensor, 'isActive', movie_sensor, on_movie_active);
+
scene_width = 0;
+
+ /*init UPnP*/
+ controlled_renderer = null;
+ UPnP_Enabled = eval("(typeof(UPnP) != 'undefined');");
+ if (UPnP_Enabled) {
+ UPnP.onMediaRendererAdd = onMediaRendererAdd;
+ UPnP.onMediaConnect = onMediaConnect;
+ UPnP.onMediaStop = onMediaStop;
+ UPnP.onMediaPause = onMediaPause;
+ UPnP.onMediaPlay = onMediaPlay;
+ UPnP.onMediaSeek = OnMediaSeek;
+ UPnP.onMigrate = OnMediaMigrate;
+ UPnP.onMediaTimeChanged = onMediaTimeChanged;
+ UPnP.onMediaDurationChanged = onMediaDurationChanged;
+ UPnP.BindRenderer();
+ UPnP.MovieURL = '';
+ UPnP.MovieDuration = 0.0;
+ UPnP.MovieTime = 0.0;
+ }
+
+ dock = gw_new_grid_container(ui_root);
+ dock.spread_h = true;
+ dock.hide();
+
+ player_control = new_player_control(ui_root);
+ player_control.hide();
+
+ uidisplay = gw_new_container();
+ uidisplay._name = 'Root Display';
+ gw_add_child(ui_root, uidisplay);
- icon_size = 48;
- dock_height = 48;
- info_height = 32;
- toggle_bar_height = 16;
- screen_dpi = gpac.get_horizontal_dpi();
-
- widget_remote_candidate = null;
- controlled_renderer = null;
- has_upnp = eval("(typeof(UPnP) != 'undefined');");
- if (has_upnp) {
- UPnP.onMediaRendererAdd = onMediaRendererAdd;
- UPnP.onMediaConnect = onMediaConnect;
- UPnP.onMediaStop = onMediaStop;
- UPnP.onMediaPause = onMediaPause;
- UPnP.onMediaPlay = onMediaPlay;
- UPnP.onMigrate = OnMediaMigrate;
- UPnP.BindRenderer();
- upnp_renders = null;
+ uidisplay.remove_child = function(child) {
+ this.removeChildren[0] = child;
+ top_wnd = null;
+ if (this.children.length && typeof this.children[this.children.length-1].on_event != 'undefined') {
+ top_wnd = this.children[this.children.length-1];
+ }
+ layout();
}
-
- /*setup dock*/
- widget_ui_visible = false;
-
- /*widget subtree*/
- widget_display = new SFNode('Transform2D');
- ui_root.children[0] = widget_display;
-
- /*widget manager page*/
- widget_ui = new SFNode('Layer2D');
- ui_root.children[1] = widget_ui;
-
- /*all other UI elements subtree*/
- dlg_display = new SFNode('Transform2D');
- ui_root.children[2] = dlg_display;
- infobar = text_label('', 'MIDDLE');
- ui_root.children[3] = infobar;
- /*our dock*/
- dock = new SFNode('Transform2D');
- ui_root.children[4] = dock;
-
+ /*init our internal extensions*/
+ var icon = gpacui_insert_dock_icon('Player', 'icons/applications-multimedia.svg');
+ icon.on_click = function () { dock.hide(); player_control.show(); };
- nb_widgets_on_screen = 0;
- first_visible_widget = 0;
- setup_icons();
-
- /*init the widget manager*/
- Browser.loadScript('mpegu-core.js', true);
- log_level = l_inf;
- widget_manager_init();
-
- if (typeof(WidgetManager) != 'undefined') {
- WidgetManager.on_widget_remove = widget_remove;
- WidgetManager.on_widget_add = widget_insert;
- WidgetManager.coreOutSetSize = widget_request_size;
- WidgetManager.coreOutShow = widget_request_show;
- WidgetManager.coreOutHide = widget_request_hide;
- WidgetManager.coreOutRequestActivate = widget_request_activate;
- WidgetManager.coreOutRequestDeactivate = widget_request_deactivate;
- WidgetManager.coreOutShowNotification = widget_request_notification;
- WidgetManager.coreOutPlaceComponent = widget_place_component;
- WidgetManager.coreOutGetAttention = widget_request_attention;
-
- WidgetManager.coreOutInstallWidget = widget_request_install;
- WidgetManager.coreOutMigrateComponent = widget_migrate_component;
- WidgetManager.coreOutRequestMigrationTargets = widget_migration_targets;
- WidgetManager.coreOutActivateTemporaryWidget = widget_activate_temporary_widget;
-
- /*restore our widgets*/
- widgets_init();
- }
+ if (UPnP_Enabled) {
+ icon = gpacui_insert_dock_icon('Control', 'icons/video-display.svg');
+ icon.on_click = function () { select_remote_display('select'); };
+ icon = gpacui_insert_dock_icon('Remote', 'icons/applications-internet.svg');
+ icon.on_click = function () { browse_remote_servers('select'); };
+ }
/*init all extensions*/
var list = gpac.enum_directory('extensions', '*', 0);
+
for (i=0; i<list.length; i++) {
- if (list[i].directory) {
+ if (!list[i].directory) continue;
var extension = new_extension();
- extension.path = gpac.current_path + 'extensions/' + list[i].name+'/';
- log(l_inf, 'Loading UI extension '+list[i].name);
- Browser.loadScript('extensions/'+list[i].name+'/init.js', true);
- setup_extension(extension);
+ extension.path = 'extensions/' + list[i].name+'/';
+
+ if (list[i].name.indexOf('.')==0) continue;
+
+ if ( Browser.loadScript('extensions/'+list[i].name+'/init.js', true) == false) continue;
+ if (!setup_extension(extension)) {
+ log(l_inf, 'UI extension '+list[i].name + ' is disabled');
+ continue;
+ }
+ log(l_inf, 'Loading UI extension '+list[i].name + ' icon '+ extension.path+extension.icon);
if (extension.icon && extension.launch) {
- var icon = icon_button(extension.path+extension.icon, extension.label, 0);
+ var icon = gpacui_insert_dock_icon(extension.label, extension.path+extension.icon);
icon.extension = extension;
- icon.button_click = function () { this.extension.launch(this.extension); }
- dock.children[dock.children.length] = icon;
+ icon.on_click = function () { dock.hide(); this.extension.launch(this.extension); }
}
- }
+ if (extension.initialize) extension.initialize(extension);
}
current_url = '';
//let's do the layout
layout();
-}
-
-
-function gpacui_add_icon(icon_url, label, callback)
-{
- var icon = icon_button(icon_url, label, 0);
- icon.button_click = callback;
- dock.children[dock.children.length] = icon;
-}
+ gpac.set_event_filter(filter_event);
-function gpacui_show_window(obj)
-{
- dlg_display.addChildren[0] = obj;
- layout();
-}
-function gpacui_hide_window(obj)
-{
- dlg_display.removeChildren[0] = obj;
- layout();
+ var url = gpac.getOption('Temp', 'GUIStartupFile');
+ if (url) {
+ if (url.indexOf('://')<0) set_movie_url('gpac://'+url);
+ else set_movie_url(url);
+ } else {
+ open_dock(true);
+ }
}
-
-function set_movie_url(url, set_local, set_remote)
-{
- if (set_remote && (controlled_renderer==null) ) set_local = true;
- if (set_local) {
+function set_movie_url(url)
+{
+ if ((url=='') || (url==current_url)) {
movie.children[0].url[0] = url;
movie_ctrl.url[0] = url;
- if (has_upnp) UPnP.SetCurrentURL(url);
- }
- if (set_remote && (controlled_renderer!=null) ) {
+ movie_sensor.url[0] = url;
+ if (UPnP_Enabled) UPnP.MovieURL = url;
+ movie_connected = (url=='') ? false : true;
+ root.children[0].set_bind = movie_connected ? FALSE : TRUE;
+ } else if (controlled_renderer==null) {
+ /*connect a new resource to the destination - if success, switch resources*/
+ var test_resource = new SFNode('Inline');
+
+ test_resource.callback_done = false;
+ test_resource.on_attached = function(evt) {
+
+ this.callback_done = true;
+ if (evt.error) {
+ var notif = gw_new_message(null, 'Error!', 'Failed to open\n'+this.url[0]+ '\nReason: '+gpac.error_string(evt.error) );
+ gpacui_show_window(notif);
+ } else {
+ current_url = this.url[0];
+
+ movie.children[0].url[0] = current_url;
+ movie_ctrl.url[0] = current_url;
+ movie_sensor.url[0] = current_url;
+ root.children[0].set_bind = FALSE;
+
+ if (!movie_connected) {
+ if (!gpac.fullscreen) {
+ var w, h;
+ w = evt.width;
+ if (w < min_width) w = min_width;
+ h = evt.height;
+ if (h < min_height) h = min_height;
+ gpac.set_size(w, h);
+ }
+ movie_connected = true;
+ gpac.set_3d(evt.type3d ? 1 : 0);
+ }
+ }
+ /*and destroy the resource node*/
+ this.url.length = 0;
+ gw_detach_child(this);
+ test_resource.removeEventListener('gpac_scene_attached', test_resource.on_attached, 0);
+ this.on_attached = null;
+ }
+ /*get notified when service loads or fails*/
+ test_resource.addEventListener('gpac_scene_attached', test_resource.on_attached, 0);
+
+ /*handle navigation between local files*/
+ if ((current_url.indexOf('gpac://')>=0) && (url.indexOf('://')<0)) {
+ test_resource.url[0] = "gpac://"+url;
+ } else {
+ test_resource.url[0] = url;
+ }
+ /*URL assignment may trigger synchronous replies*/
+ if (!test_resource.callback_done) {
+ gw_add_child(dictionary, test_resource);
+ }
+
+ return;
+
+ } else {
var uri = UPnP.ShareResource(url);
controlled_renderer.Open(uri);
}
current_url = url;
}
-
-function new_timeout(time)
+//performs layout on all contents
+function layout()
{
- var obj = new SFNode('TimeSensor');
-
- obj.cycleInterval = time;
- obj.start = function(when) {
- var t = this.getTime();
- this.startTime = when + this.getTime();
- }
- obj.stop = function(when) {
- this.stopTime = when + this.getTime();
- }
- obj.on_event = null;
- obj.event = function(val) {
- if (this.on_event) this.on_event(val);
- }
- Browser.addRoute(obj, 'fraction_changed', obj, obj.event);
- return obj;
+ var i, list, start_x;
+ player_control.set_size(display_width, player_control.height);
+
+ dock.set_size(display_width, display_height);
+// if (uidisplay.children.length) uidisplay.children[0].set_size(display_width, display_height);
}
-function rectangle()
-{
- var obj = new SFNode('Shape');
-
- obj.appearance = new SFNode('Appearance');
- obj.appearance.material = new SFNode('Material2D');
- obj.appearance.material.filled = TRUE;
- obj.appearance.material.emissiveColor = new SFColor(0.7, 0.7, 0.8);
- obj.appearance.material.lineProps = new SFNode('LineProperties');
- obj.appearance.material.lineProps.width = 2;
- obj.appearance.material.lineProps.lineColor = new SFColor(0, 0, 0);
-
- obj.geometry = new SFNode('Curve2D');
- obj.geometry.point = new SFNode('Coordinate2D');
- temp = obj.geometry.type;
- temp[0] = 7;
- temp[1] = 1;
- temp[2] = 7;
- temp[3] = 1;
- temp[4] = 7;
- temp[5] = 1;
- temp[6] = 7;
- temp[7] = 6;/*close*/
-
- obj.set_size = function(w, h) {
- var hw, hh, rx, ry;
- var temp;
- hw = w/2;
- hh = h/2;
-
- /*compute default rx/ry*/
- ry = rx = 10;
- if ( (2*rx>=hw) || (2*ry>=hh)) rx = ry = 6;
-
- temp = this.geometry.point.point;
- temp[0] = new SFVec2f(hw-rx, hh);
- temp[1] = new SFVec2f(hw, hh);/*bezier ctrl point*/
- temp[2] = new SFVec2f(hw, hh-ry);
- temp[3] = new SFVec2f(hw, -hh+ry);
- temp[4] = new SFVec2f(hw, -hh);/*bezier control point*/
- temp[5] = new SFVec2f(hw-rx, -hh);
- temp[6] = new SFVec2f(-hw+rx, -hh);
- temp[7] = new SFVec2f(-hw, -hh);/*bezier control point*/
- temp[8] = new SFVec2f(-hw, -hh+ry);
- temp[9] = new SFVec2f(-hw, hh-ry);
- temp[10] = new SFVec2f(-hw, hh);/*bezier control point*/
- temp[11] = new SFVec2f(-hw+rx, hh);
+//resize event callback
+function on_resize(evt) {
+ if ((display_width == evt.width) && (display_height == evt.height)) return;
+ if (evt.width <=100) {
+ gpac.set_size(100, display_height);
+ return;
}
- obj.set_color = function(r, g, b) {
- this.appearance.material.emissiveColor.r = r;
- this.appearance.material.emissiveColor.g = g;
- this.appearance.material.emissiveColor.b = b;
+ if (evt.height <=80) {
+ gpac.set_size(display_width, 40);
+ return;
}
- return obj;
-}
-function icon_button(url, label, no_back)
-{
- var obj = new SFNode('Transform2D');
- obj.visible = true;
- obj.children[0] = new SFNode('Transform2D');
- obj.children[0].scale.x = 0;
- obj.children[0].children[0] = rectangle();
-
- obj.children[1] = new SFNode('Layer2D');
- obj.children[1].size.x = icon_size;
- obj.children[1].size.y = icon_size;
- obj.children[1].children[0] = new SFNode('Inline');
- obj.children[1].children[0].url[0] = url;
-
- obj.touch = new SFNode('TouchSensor');
- obj.children[1].children[1] = obj.touch;
- obj.button_click = NULL;
- obj.down = false;
- obj.over = false;
- obj.on_active = function(value) {
- if (value) {
- this.down = true;
- } else {
- if (this.down && this.over && this.button_click) this.button_click();
- this.down = false;
- }
- };
- obj.button_over = on_icon_over;
- obj.on_over = function(value) {
- this.over = value;
- if (!no_back)
- this.children[0].scale.x = value ? 1 : 0;
- if (this.button_over) this.button_over(value);
- };
- Browser.addRoute(obj.touch, 'isOver', obj, obj.on_over);
- Browser.addRoute(obj.touch, 'isActive', obj, obj.on_active);
- obj.label = label;
- obj.hide = function() { this.scale.x = this.scale.y = 0; this.visible = false; };
- obj.show = function() { this.scale.x = this.scale.y = 1; this.visible = true; };
- obj.set_size = function(x, y) {
- this.children[0].children[0].set_size(x, y);
- this.children[1].size.x = x;
- this.children[1].size.y = y;
- };
- return obj;
-}
+ display_width = evt.width;
+ display_height = evt.height;
+ if (!gpac.fullscreen) {
+ gpac.setOption('General', 'LastWidth', ''+display_width);
+ gpac.setOption('General', 'LastHeight', ''+display_height);
+ }
+ layout();
-function text_label(label, justify)
-{
- var obj = new SFNode('Transform2D');
- obj.children[0] = new SFNode('Shape');
- obj.children[0].appearance = new SFNode('Appearance');
- obj.children[0].appearance.material = new SFNode('Material2D');
- obj.children[0].appearance.material.filled = TRUE;
- obj.children[0].appearance.material.emissiveColor = new SFColor(0, 0, 0);
- obj.children[0].geometry = new SFNode('Text');
- obj.children[0].geometry.string[0] = label;
- obj.children[0].geometry.fontStyle = new SFNode('FontStyle');
- obj.children[0].geometry.fontStyle.justify[0] = justify;
- obj.children[0].geometry.fontStyle.justify[1] = 'MIDDLE';
- obj.children[0].geometry.fontStyle.size = 20;
- obj.set_label = function(value) {
- this.children[0].geometry.string[0] = value;
- }
- return obj;
+ for (var i in all_extensions) {
+ if (typeof all_extensions[i].on_resize != 'undefined') {
+ all_extensions[i].on_resize(display_width, display_height);
+ }
+ }
}
-
-function text_rect(label)
-{
- var obj = new SFNode('Transform2D');
- obj.children[0] = rectangle();
- obj.children[0].set_color(0.7, 0.7, 0.8);
-
- obj.children[1] = new SFNode('Shape');
- obj.children[1].appearance = new SFNode('Appearance');
- obj.children[1].appearance.material = new SFNode('Material2D');
- obj.children[1].appearance.material.filled = TRUE;
- obj.children[1].appearance.material.emissiveColor = new SFColor(0, 0, 0);
- obj.children[1].geometry = new SFNode('Text');
- obj.children[1].geometry.string[0] = label;
- obj.children[1].geometry.fontStyle = new SFNode('FontStyle');
- obj.children[1].geometry.fontStyle.justify[0] = 'MIDDLE';
- obj.children[1].geometry.fontStyle.justify[1] = 'MIDDLE';
- obj.children[1].geometry.fontStyle.size = 20;
- obj.children[2] = new SFNode('TouchSensor');
-
- obj.set_size = function(w, h) {
- this.children[0].set_size(w, h);
- };
+//zoom event callback
+function on_zoom(evt) {
+ display_width = evt.width;
+ display_height = evt.height;
+ layout();
+}
+//scroll event callback
+function on_scroll(evt) {
+ layout();
+}
- obj.over = false;
- obj.on_over = function(value) {
- this.children[0].set_color(0.7, value ? 0.5 : 0.7, 0.8);
- this.over = value;
- };
- Browser.addRoute(obj.children[2], 'isOver', obj, obj.on_over);
+function new_player_control(container)
+{
+ var control_icon_size = gwskin.default_icon_size;
+ var small_control_icon_size;
+ var wnd = gw_new_window(container, true, 'osdwindow');
+ wnd.connected = false;
+ this.stoped_url = null;
- obj.down = false;
- obj.button_click = null;
- obj.on_active = function(value) {
- if (value) {
- this.down = true;
- } else {
- if (this.down && this.over && this.button_click) this.button_click();
- this.down = false;
- }
- };
- Browser.addRoute(obj.children[2], 'isActive', obj, obj.on_active);
+ small_control_icon_size = control_icon_size;
- return obj;
-}
+ wnd.set_corners(true, true, false, false);
-function new_slider(vertical)
-{
- var obj = new SFNode('Transform2D');
- obj.children[0] = new SFNode('Shape');
- obj.children[0].appearance = new SFNode('Appearance');
- obj.children[0].appearance.material = new SFNode('Material2D');
- obj.children[0].appearance.material.filled = TRUE;
- obj.children[0].appearance.texture = new SFNode('LinearGradient');
- obj.children[0].appearance.texture.endPoint.x = vertical ? 1 : 0;
- obj.children[0].appearance.texture.endPoint.y = vertical ? 0 : 1;
- obj.children[0].appearance.texture.key[0] = 0;
- obj.children[0].appearance.texture.key[1] = 0.5;
- obj.children[0].appearance.texture.key[2] = 1;
- obj.children[0].appearance.texture.keyValue[0] = new SFColor(0.4, 0.4, 0.6);
- obj.children[0].appearance.texture.keyValue[1] = new SFColor(0.4, 0.4, 1);
- obj.children[0].appearance.texture.keyValue[2] = new SFColor(0.4, 0.4, 0.6);
- obj.children[0].geometry = new SFNode('Rectangle');
-
- obj.children[1] = new SFNode('Transform2D');
- obj.children[1].children[0] = new SFNode('Shape');
- obj.children[1].children[0].appearance = new SFNode('Appearance');
- obj.children[1].children[0].appearance.material = new SFNode('Material2D');
- obj.children[1].children[0].appearance.material.filled = TRUE;
- obj.children[1].children[0].appearance.material.emissiveColor = new SFColor(0, 0, 1);
- obj.children[1].children[0].geometry = new SFNode('Circle');
+ /*first set of controls*/
+ wnd.infobar = gw_new_grid_container(wnd);
+ wnd.infobar.spread_h = true;
- obj.on_slide = function(value) { }
- obj.children[2] = new SFNode('PlaneSensor2D');
- obj.set_translation = function(value) {
- this.frac = 0.5 + (vertical ? value.y/this.height : value.x/this.width);
- this.children[1].translation = value;
- this.on_slide(this.min + (this.max-this.min) * this.frac);
+ /*add our controls in order*/
+ if (1) {
+ wnd.snd_low = gw_new_icon_button(wnd.infobar, 'icons/audio-volume-low.svg', 'Lower', 'icon');
+ wnd.snd_ctrl = gw_new_slider(wnd.infobar);
+ wnd.snd_low.add_icon('icons/audio-volume-muted.svg');
+ wnd.muted = 0;
+ wnd.snd_low.on_click = function() {
+ if (player_control.muted) {
+ gpac.volume = player_control.muted;
+ player_control.muted = 0;
+ this.switch_icon(0);
+ } else {
+ player_control.muted = gpac.volume ? gpac.volume : 1;
+ gpac.volume = 0;
+ this.switch_icon(1);
+ }
+ }
+ wnd.snd_ctrl.on_slide = function(value, type) {
+ if (player_control.muted) player_control.snd_low.on_click();
+ gpac.volume = value;
+ }
+ wnd.snd_low.set_size(small_control_icon_size, small_control_icon_size);
+ wnd.snd_ctrl.set_size(2*small_control_icon_size, 2, control_icon_size/3, control_icon_size/3);
+ wnd.snd_ctrl.set_value(gpac.volume);
+ } else {
+ wnd.snd_low = null;
+ wnd.snd_ctrl = null;
}
- Browser.addRoute(obj.children[2], 'translation_changed', obj, obj.set_translation);
-
- obj.set_value = function(value) {
- value -= this.min;
- if (value<0) value = 0;
- else if (value>this.max-this.min) value = this.max-this.min;
- if (this.max==this.min) value = 0;
- else value /= (this.max-this.min);
-
- value -= 0.5;
- value *= (vertical ? this.height : this.width);
+ if (0) {
+ wnd.rewind = gw_new_icon_button(wnd.infobar, 'icons/media-seek-backward.svg', 'Rewind', 'icon');
+ wnd.rewind.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.rewind = null;
+ }
+
+ if (1) {
+ wnd.stop = gw_new_icon_button(wnd.infobar, 'icons/media-playback-stop.svg', 'Stop', 'icon');
+ wnd.stop.on_click = function() {
+ player_control.stoped_url = ''+current_url;
+ if (controlled_renderer) controlled_renderer.Stop();
+ else {
+ set_movie_url('');
+ /*override movie_connected to avoid auto-resizing*/
+ movie_connected = true;
+ }
+
+ movie_ctrl.mediaStartTime = 0;
+ player_control.media_line.set_value(0);
+ player_control.play.switch_icon(1);
+ }
+ wnd.stop.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.stop = null;
+ }
- if (vertical) {
- this.children[1].translation.y = value;
- this.children[2].offset.y = value;
+ wnd.play = gw_new_icon_button(wnd.infobar, 'icons/media-playback-start.svg', 'Play', 'icon');
+ wnd.play.set_size(control_icon_size, control_icon_size);
+ wnd.play.state = 0;
+ wnd.play.add_icon('icons/media-playback-pause.svg');
+ wnd.play.on_click = function() {
+ if (!movie_connected && !controlled_renderer) return;
+ if (player_control.stoped_url) {
+ if (controlled_renderer) {
+ controlled_renderer.Play();
+ } else {
+ set_movie_url(player_control.stoped_url);
+ }
+ player_control.stoped_url = null;
+ this.state = 0;
+ movie_ctrl.mediaStartTime = -1;
+ } else if (movie_ctrl.mediaSpeed != 1) {
+ this.state = 0;
} else {
- this.children[1].translation.x = value;
- this.children[2].offset.x = value;
- }
+ this.state = this.state ? 0 : 1;
+ }
+ this.switch_icon(this.state);
+ if (this.state) {
+ if (controlled_renderer) controlled_renderer.Pause();
+ movie_ctrl.mediaSpeed = 0;
+ } else {
+ if (controlled_renderer) controlled_renderer.Play();
+ movie_ctrl.mediaSpeed = 1;
+ }
}
-
- obj.radius = 10;
- obj.vertical = vertical;
- obj.set_size = function(w, h) {
- var rad;
- this.children[0].geometry.size.x = w;
- this.children[0].geometry.size.y = h;
- rad = vertical ? w : h;
- rad/=1.33;
- this.children[1].children[0].geometry.radius = rad;
- this.children[2].maxPosition.x = this.vertical ? 0 : w/2;
- this.children[2].maxPosition.y = this.vertical ? h/2 : 0;
- this.children[2].minPosition.x = this.vertical ? 0 : -w/2;
- this.children[2].minPosition.y = this.vertical ? -h/2 : 0;
- this.width = w;
- this.height = h;
+ wnd.play.on_long_click = function () {
+ var cur_url = current_url;
+ set_movie_url('');
+ set_movie_url(cur_url);
}
- obj.min = 0;
- obj.max = 100;
- obj.set_size(vertical ? 10 : 200, vertical ? 200 : 10);
- return obj;
-}
+ wnd.media_line = gw_new_progress_bar(wnd.infobar, false, true);
+ wnd.media_line.on_slide = function(value, type) {
-function new_radio_button(label)
-{
- var obj = new SFNode('Transform2D');
- obj.children[0] = new SFNode('Shape');
- obj.children[0].appearance = new SFNode('Appearance');
- obj.children[0].appearance.material = new SFNode('Material2D');
- obj.children[0].appearance.material.filled = TRUE;
- obj.children[0].appearance.material.emissiveColor = new SFColor(1, 1, 1);
- obj.children[0].appearance.material.lineProps = new SFNode('LineProperties');
- obj.children[0].appearance.material.lineProps.lineColor = new SFColor(0, 0, 0);
- obj.children[0].appearance.material.lineProps.width = 1;
- obj.children[0].geometry = new SFNode('Circle');
-
- obj.children[1] = new SFNode('Shape');
- obj.children[1].appearance = new SFNode('Appearance');
- obj.children[1].appearance.material = new SFNode('Material2D');
- obj.children[1].appearance.material.filled = TRUE;
- obj.children[1].appearance.material.emissiveColor = new SFColor(0, 0, 0);
- obj.children[1].appearance.material.transparency = 1;
- obj.children[1].geometry = new SFNode('Circle');
-
- obj.children[2] = text_label(label, 'BEGIN');
-
- obj.children[3] = new SFNode ('TouchSensor');
-
- obj.on = false;
- obj.on_select = function(value) {}
- obj.on_active = function(value) {
- if (!value) return;
- this.on = !this.on;
- this.children[1].appearance.material.transparency = this.on ? 0 : 1;
- this.on_select(this.on);
- }
- Browser.addRoute(obj.children[3], 'isActive', obj, obj.on_active);
+ if (!movie_connected && !controlled_renderer) {
+ this.set_value(0);
+ return;
+ }
+ var duration = player_control.duration;
+ if (!duration) return;
+ var time = value*duration/100;
- obj.enable = function(value) {
- this.on = value;
- this.children[1].appearance.material.transparency = this.on ? 0 : 1;
- }
+ if (controlled_renderer) {
+ controlled_renderer.Seek(time);
+ return;
+ }
+ root.children[0].set_bind = FALSE;
+ switch (type) {
+ case 1:
+ movie_ctrl.mediaStartTime = time;
+ movie_ctrl.mediaSpeed = 0;
+ break;
+ case 2:
+ if (time!= movie_ctrl.mediaStartTime) movie_ctrl.mediaStartTime = time;
+ movie_ctrl.mediaSpeed = 1;
+ break;
+ default:
+ movie_ctrl.mediaStartTime = time;
+ break;
+ }
+ }
+
- obj.set_width = function(w, h) {
- var rad = w<h ? w : h;
- rad /= 2;
- this.children[0].geometry.radius = rad;
- this.children[1].geometry.radius = rad/2;
- this.children[2].translation.x = 2*rad;
+ wnd.time = gw_new_text(wnd.infobar, '00:00:00', 'osdwindow');
+ gw_object_set_hitable(wnd.time);
+ wnd.time.reversed = false;
+ wnd.time.on_down = function(val) {
+ if (!val) return;
+ this.reversed = !this.reversed;
+ player_control.set_time(player_control.current_time);
}
- obj.set_width(100, 10);
- return obj;
-}
-
-function new_widget_control(widget)
-{
- var obj = new SFNode('Transform2D');
-
- obj.children[0] = new SFNode('Transform2D');
+ wnd.time.set_size(control_icon_size, control_icon_size);
+ wnd.time.set_width(4*wnd.time.font_size() );
- obj.children[0].children[0] = rectangle();
-
- obj.children[0].children[1] = new SFNode('TouchSensor');
-
-
- obj.component_bound=false;
- obj.show_ctrl = true;
- obj.onClick = function(value) {
- if (!value) return;
- this.show_ctrl = !this.show_ctrl;
- if (this.show_ctrl) {
- var i, comps, idx;
- this.children[0].children[0].appearance.material.transparency = 0;
- this.children[1].scale.x = 1;
- this.children[3].scale.x = 1;
-
- for (i=0; i<widget_display.children.length; i++) {
- if (widget_display.children[i]==this) continue;
- if (widget_display.children[i].show_ctrl) {
- widget_display.children[i].onClick(true);
- }
- }
- //widget is a component, do not push on top but hide some controls
- if (widget.is_component) {
- if (this.component_bound) {
- this.children[1].children[0].hide(); //close
- this.children[1].children[1].hide(); //remove
- this.children[1].children[4].hide(); //resize
+ if (!browser_mode) {
+ wnd.forward = gw_new_icon_button(wnd.infobar, 'icons/media-seek-forward.svg', 'Forward', 'icon');
+ wnd.forward.on_click = function() {
+ if (movie_ctrl.mediaSpeed) {
+ movie_ctrl.mediaSpeed = 2*movie_ctrl.mediaSpeed;
}
- return;
}
- //otherwise push widget on top
- idx=0;
- widget_display.removeChildren[idx++] = this;
- widget_display.addChildren[idx++] = this;
- //and push components
- comps = widget.components;
- for (i=0; i<comps.length; i++) {
- if (comps[i].widget_control.component_bound) {
- widget_display.removeChildren[idx++] = comps[i].widget_control;
- widget_display.addChildren[idx++] = comps[i].widget_control;
- }
+ wnd.forward.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.forward = null;
+ }
+ if (1) {
+ wnd.view = gw_new_icon_button(wnd.infobar, 'icons/edit-find.svg', 'Navigation', 'icon');
+ wnd.view.on_click = function() {
+ select_navigation_type();
}
+ wnd.view.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.view = null;
+ }
- } else {
- this.children[0].children[0].appearance.material.transparency = 1;
- this.children[1].scale.x = 0;
- this.children[3].scale.x = 0;
- }
+ if (!browser_mode) {
+ wnd.open = gw_new_icon_button(wnd.infobar, 'icons/folder.svg', 'Open', 'icon');
+ wnd.open.on_click = function () { open_local_file(); }
+ wnd.open.on_long_click = function () { open_url(); }
+ wnd.open.set_size(small_control_icon_size, small_control_icon_size);
+ } else{
+ wnd.open = null;
}
- Browser.addRoute(obj.children[0].children[1], 'isActive', obj, obj.onClick);
- obj.children[1] = new SFNode('Transform2D');
- obj.children[1].children[0] = icon_button('icons/process-stop.svg', 'Close', 0);
- obj.children[1].children[0].button_click = function() {
- if (widget.discardable) widget_remove(widget);
- else widget_close(widget, 0);
+
+ if (!browser_mode) {
+ wnd.home = gw_new_icon_button(wnd.infobar, 'icons/go-home.svg', 'Home', 'icon');
+ wnd.home.on_click = function() { open_dock(true); }
+ wnd.home.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.home = null;
}
- obj.children[1].children[1] = icon_button('icons/user-trash.svg', 'Uninstall', 0);
- obj.children[1].children[1].button_click = function() { widget_remove(widget); }
- obj.children[1].children[2] = icon_button('icons/applications-internet.svg', 'Push to remote display', 0);
- obj.children[1].children[2].button_click = function() {
- if (has_upnp && UPnP.MediaRenderersCount) {
- widget_remote_candidate = widget;
- on_upnpopen(true, true);
- }
- }
-
- obj.children[1].children[3] = icon_button('icons/dialog-information.svg', 'Widget Information', 0);
- obj.children[1].children[3].button_click = function() {
- display_widget_info(widget);
+ if (UPnP_Enabled) {
+ wnd.remote = gw_new_icon_button(wnd.infobar, 'icons/video-display.svg', 'Select Display', 'icon');
+ wnd.remote.on_click = function () { select_remote_display('push'); }
+ wnd.remote.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.remote = null;
}
-
- obj.children[1].children[4] = icon_button('icons/media-record.svg', 'Resize', 1);
- obj.children[1].children[4].children[1].children[2] = new SFNode('PlaneSensor2D');
- obj.children[1].children[4].children[1].children[2].maxPosition = new SFVec2f(-1, -1);
-
- obj.prev_x=0;
- obj.prev_y=0;
- obj.onSize = function(value) {
- if (widget.width + 2*(value.x - this.prev_x)<0) return;
- if (widget.height + 2*(this.prev_y-value.y)<0) return;
-
- widget.width += 2*(value.x - this.prev_x);
- this.prev_x = value.x;
- widget.height += 2*(this.prev_y - value.y);
- this.prev_y = value.y;
- this.set_size(widget.width, widget.height);
+
+ if (1) {
+ wnd.fullscreen = gw_new_icon_button(wnd.infobar, 'icons/view-fullscreen.svg', 'Fullscreen', 'icon');
+ wnd.fullscreen.on_click = function() { gpac.fullscreen = !gpac.fullscreen; }
+ wnd.fullscreen.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.fullscreen = null;
}
- Browser.addRoute(obj.children[1].children[4].children[1].children[2], 'translation_changed', obj, obj.onSize);
- obj.children[2] = new SFNode('Layer2D');
- obj.inline = new SFNode('Inline');
- obj.children[2].children[0] = obj.inline;
-
-
- obj.children[3] = new SFNode('Transform2D');
- obj.children[3].children[0] = new SFNode('Shape');
- obj.children[3].children[0].appearance = new SFNode('Appearance');
- obj.children[3].children[0].appearance.material = new SFNode('Material2D');
- obj.children[3].children[0].appearance.material.filled = TRUE;
- obj.children[3].children[0].appearance.material.transparency = 0.5;
- obj.children[3].children[0].appearance.material.emissiveColor = new SFColor(0.6, 0.6, 0.6);
- obj.children[3].children[0].geometry = new SFNode('Rectangle');
- obj.children[3].children[0].geometry.size = new SFVec2f(50, 50);
- obj.children[3].children[1] = new SFNode('PlaneSensor2D');
- obj.children[3].children[1].maxPosition = new SFVec2f(-1, -1);
- obj.children[3].children[1].offset = new SFVec2f(widget.x, widget.y);
- obj.onMove = function(value) {
- if (this.maximized) return;
- this.translation = value;
- widget.x = value.x;
- widget.y = value.y;
- this.refresh_layout(false, null);
+ if (!browser_mode) {
+ wnd.exit = gw_new_icon_button(wnd.infobar, gwskin.images.cancel, gwskin.labels.close, 'icon');
+ wnd.exit.on_click = function() { gpac.exit(); }
+ wnd.exit.set_size(small_control_icon_size, small_control_icon_size);
+ } else {
+ wnd.exit = null;
}
- Browser.addRoute(obj.children[3].children[1], 'translation_changed', obj, obj.onMove);
-
- obj.children[3].children[2] = new SFNode('TouchSensor');
- obj.last_ts = 0;
- obj.onMaximize = function(value, timestamp) {
- if (!value) return;
- if (timestamp - this.last_ts < 0.5) {
- if (this.maximized) {
- this.maximized = false;
- this.translation.x = widget.x;
- this.translation.y = widget.y;
- this.set_size(this.prev_width, this.prev_height);
- } else {
- this.maximized = true;
- this.prev_width = widget.width;
- this.prev_height = widget.height;
- this.translation.x = 0;
- this.translation.y = -info_height;
- this.set_size(display_width, display_height - 2*info_height);
- }
+
+
+
+ wnd.layout = function(width, height) {
+ var min_w, full_w, time_w;
+ var control_icon_size = gwskin.default_icon_size;
+ this.move(0, Math.floor( (height-display_height)/2) );
+
+ width -= control_icon_size/2;
+ min_w = this.play.width + this.time.width;
+ if (this.open) min_w += this.open.width;
+ if (this.home) min_w += this.home.width;
+ if (this.exit) min_w += this.exit.width;
+ full_w = 0;
+ if (this.snd_low) full_w += this.snd_low.width;
+ if (this.snd_ctrl) full_w += this.snd_ctrl.width;
+ if (this.fullscreen) full_w += this.fullscreen.width;
+
+ if (this.view) {
+ this.view.hide();
+ if (movie_connected && (gpac.navigation_type!= GF_NAVIGATE_TYPE_NONE) ) {
+ full_w+= this.view.width;
+ }
}
- this.last_ts = timestamp;
- }
- Browser.addRoute(obj.children[3].children[2], 'isActive', obj, obj.onMaximize);
-
- obj.set_size = function(w, h) {
- var i, x, s;
- s = 24;
- this.children[2].size.x = w;
- this.children[2].size.y = h;
- this.children[1].children[0].translation.y = this.children[1].children[1].translation.y = this.children[1].children[2].translation.y = this.children[1].children[3].translation.y = this.children[1].children[4].translation.y = h/2 + s/2;
-
- this.children[0].children[0].set_size(w+s, h+s);
- this.children[3].children[0].geometry.size.x = w;
- this.children[3].children[0].geometry.size.y = h;
-
- this.children[1].children[0].set_size(s, s);
- this.children[1].children[1].set_size(s, s);
- this.children[1].children[2].set_size(s, s);
- this.children[1].children[3].set_size(s, s);
- this.children[1].children[4].set_size(s, s);
- this.children[1].children[0].translation.x = -w/2;
- this.children[1].children[1].translation.x = -w/4;
- this.children[1].children[2].translation.x = 0;
- this.children[1].children[3].translation.x = w/4;
- this.children[1].children[4].translation.x = w/2;
-
- //set widget input params
- widget.width = w;
- widget.height = h;
- widget.set_input('width', w);
- widget.set_input('height', h);
- this.refresh_layout(true, null);
- //call core:in
- WidgetManager.corein_message(widget, 'setSize', 'width', w, 'height', w, 'dpi', screen_dpi);
- }
- obj.refresh_layout = function(send_resize, comp_target) {
- var i;
- var x, y, w, h, scale_x, scale_y;
- var comps;
-
- /*local to subscene transformation not known*/
- if (!this.sub_w) return;
- if (!this.sub_h) return;
-
- comps = widget.components;
- for (i=0; i<comps.length; i++) {
- var comp = comps[i];
- if (!comp.widget_control.component_bound) continue;
-
- //compute scale from Widget Manager coord system to widget internal coordinate system
- scale_x = this.sub_vp_w / this.sub_w;
- scale_y = this.sub_vp_h / this.sub_h;
-
- w = comp.widget_control.place_w * scale_x;
- h = comp.widget_control.place_h * scale_y;
-
- x = this.translation.x - widget.width/2 + this.sub_vp_x + comp.widget_control.place_x * scale_x + w/2;
- comp.widget_control.translation.x = x;
-
- y = widget.height/2 + this.translation.y - h/2 - this.sub_vp_y - comp.widget_control.place_y * scale_y;
- comp.widget_control.translation.y = y;
+ if (this.duration) {
+ if (this.rewind) full_w+= this.rewind.width;
+ if (this.forward) full_w+= this.forward.width;
+ }
+ if (this.stop) full_w+= this.stop.width;
- if (send_resize || (comp_target==comp))
- comp.widget_control.set_size(w, h);
+ if (this.remote && UPnP.MediaRenderersCount && (current_url!='')) {
+ full_w += this.remote.width;
}
- }
+ time_w = this.media_line.visible ? 2*control_icon_size : 0;
+ if (min_w + full_w + time_w < width) {
+ if (this.media_line.visible)
+ this.media_line.set_size(width - min_w - full_w - control_icon_size/3, control_icon_size/3);
- obj.hide = function() {
- this.scale.x = 0;
- WidgetManager.corein_message(widget, 'hide');
- }
- obj.show = function() {
- this.scale.x = 1;
- WidgetManager.corein_message(widget, 'show');
- }
-
- obj.show_remote = function () {
- if (WidgetManager.upnp && UPnP.MediaRenderersCount) {
- this.children[1].children[2].show();
+ if (this.snd_low) this.snd_low.show();
+ if (this.snd_ctrl) this.snd_ctrl.show();
+ if (this.duration) {
+ if (this.rewind) this.rewind.show();
+ if (this.forward) this.forward.show();
+ }
+ if (this.stop) this.stop.show();
+ if (wnd.fullscreen) wnd.fullscreen.show();
+
+ if (this.remote) {
+ if (UPnP.MediaRenderersCount && (current_url!='')) {
+ this.remote.show();
+ } else {
+ this.remote.hide();
+ }
+ }
+
+ if (this.view && movie_connected && (gpac.navigation_type!= GF_NAVIGATE_TYPE_NONE) ) {
+ this.view.show();
+ }
} else {
- this.children[1].children[2].hide();
- }
- }
- obj.show_remove = function(show) {
- if (show) this.children[1].children[1].show();
- else this.children[1].children[1].hide();
+ if (this.media_line.visible)
+ this.media_line.set_size(width - min_w - 5, control_icon_size/3);
+
+ if (this.snd_low) this.snd_low.hide();
+ if (this.snd_ctrl) this.snd_ctrl.hide();
+ if (this.rewind) this.rewind.hide();
+ if (this.stop) this.stop.hide();
+ if (this.forward) this.forward.hide();
+ if (this.fullscreen) this.fullscreen.hide();
+ if (this.remote) this.remote.hide();
+ }
+ width += control_icon_size/2;
+ this.infobar.set_size(width, height);
}
- obj.flash = function() {
- var time = new_timeout(0.25);
- time.loop = true;
- time.ctrl = this;
- time.on_event = function(val) {
- var scale = (val<0.5) ? 1+val : 2-val;
- this.ctrl.scale.x = this.ctrl.scale.y = scale;
+ wnd.current_time = 0;
+ wnd.duration = 0;
+ wnd.set_duration = function(value) {
+ this.duration = value;
+ wnd.time.show();
+ wnd.media_line.show();
+ if (wnd.rewind) wnd.rewind.show();
+ if (wnd.stop) wnd.stop.show();
+ if (wnd.forward) wnd.forward.show();
+ if (!value) {
+ wnd.time.hide();
+ wnd.media_line.hide();
+ if (wnd.rewind) wnd.rewind.hide();
+ if (wnd.stop) wnd.stop.hide();
+ if (wnd.forward) wnd.forward.hide();
+ wnd.time.set_size(0, control_icon_size);
+ wnd.time.set_width(0);
+ } else if (value<3600) {
+ wnd.time.set_size(control_icon_size/2, control_icon_size);
+ wnd.time.set_width(3*wnd.time.font_size() );
+ } else {
+ wnd.time.set_size(control_icon_size, control_icon_size);
+ wnd.time.set_width(4*wnd.time.font_size() );
}
- time.stop(1);
- time.start(0);
+ this.layout(this.width, this.height);
+ }
+ wnd.set_time = function(value) {
+ var h, m, s, str;
+ if (!this.duration) return;
+ this.current_time = value;
+ if (this.duration) {
+ this.media_line.set_value(100*value / this.duration);
+ }
+ str='';
+ if (this.time.reversed) {
+ value = this.duration-value;
+ str='-';
+ }
+ h = Math.floor(value/3600);
+ value -= h*3600;
+ m = Math.floor(value / 60);
+ value -= m*60;
+ s = Math.floor(value);
+ if (h) {
+ if (h<10) str += '0';
+ str += h + ':';
+ }
+ if (m<10) str += '0';
+ str += m + ':';
+ if (s<10) str += '0';
+ str += s;
+ this.time.set_label(str);
}
- obj.maximized = false;
- obj.show_remote();
- obj.onClick(true);
- return obj;
+ wnd.on_event = function(evt) {
+ if (this.infobar.on_event(evt)) return true;
+ return false;
+ }
+
+ gw_object_set_hitable(wnd);
+ wnd.set_size(200, control_icon_size);
+ wnd.set_duration(0);
+ wnd.set_time(0);
+ return wnd;
}
-function on_icon_over(value)
+function open_local_file()
{
- infobar.set_label(value ? this.label : '');
-}
+ var filebrowse = gw_new_file_open();
+ filebrowse.filter = '*';
+ filebrowse.browse(gpac.last_working_directory);
+
+ filebrowse.on_browse = function(value, directory) {
+ if (directory) gpac.last_working_directory = directory;
+ set_movie_url(value);
+ open_dock(false);
+ }
-function display_widget_info(wid)
-{
- var info_dlg = new SFNode('Transform2D');
- var i, j, k, info;
- var y, txt, pref;
-
- infobar.set_label('Widget ' + wid.name + ' Information');
-
- info = text_rect('Close');
- info_dlg.children[0] = info;
- info.button_click = function() {
- dlg_display.children.length = 0;
- widget_display.scale.x = 1;
- infobar.set_label('');
- layout();
- }
-
- info = text_rect('Widget Metadata');
- info_dlg.children[info_dlg.children.length] = info;
- info.visible = false;
- info.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- i=3;
- info.children[i++] = text_label('id: ' + wid.identifier + ' - shortname: '+wid.shortName + ' - name: '+wid.name, 'BEGIN');
- info.children[i++] = text_label('version: '+wid.version, 'BEGIN');
- info.children[i++] = text_label('content type: ' + wid.mainMimeType + ' - content encoding: '+wid.mainEncoding, 'BEGIN');
- info.children[i++] = text_label('default size: Width = ' + wid.defaultWidth + ' Height = '+wid.defaultHeight, 'BEGIN');
- info.children[i++] = text_label('license: '+wid.license, 'BEGIN');
- info.children[i++] = text_label('license ref: '+wid.licenseHref, 'BEGIN');
- info.children[i++] = text_label('description: '+wid.description, 'BEGIN');
- info.children[i++] = text_label('author name: '+wid.authorName + ' (mail: '+wid.authorEmail+')', 'BEGIN');
- info.children[i++] = text_label('author href: '+wid.authorHref, 'BEGIN');
- info.children[i++] = text_label('view modes: '+wid.viewmodes, 'BEGIN');
- info.children[i++] = text_label('UUID: '+wid.uuid, 'BEGIN');
- info.children[i++] = text_label('Discardable: '+wid.discardable, 'BEGIN');
- info.children[i++] = text_label('Muliple Instances: '+wid.discardable, 'BEGIN');
- var icons = wid.icons;
- for (j=0; j<icons.length; j++) {
- info.children[i++] = text_label('icon #'+(j+1)+': ' + icons[j].src, 'BEGIN');
- }
-
- info = text_rect('Widget Manager Info');
- info_dlg.children[info_dlg.children.length] = info;
- info.visible = false;
- info.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- i=3;
- info.children[i++] = text_label('nb instances: '+wid.num_instances + ' nb components: '+wid.num_components, 'BEGIN' );
- info.children[i++] = text_label('Permanently installed: '+wid.permanent + ' - is component: '+wid.is_component, 'BEGIN' );
- if (wid.is_component) {
- info.children[i++] = text_label('parent widget name' + wid.parent.name, 'BEGIN');
- }
- if (wid.originating_device_ip) {
- info.children[i++] = text_label('Widget was pushed from device IP '+wid.originating_device_ip, 'BEGIN' );
- }
- info.children[i++] = text_label('Section name in GPAC config file: '+wid.section, 'BEGIN' );
- info.children[i++] = text_label('UA Locale: ' + gpac.getOption('Systems', 'LanguageName') + ' ('+ gpac.getOption('Systems', 'Language2CC')+ ')', 'BEGIN' );
- info.children[i++] = text_label('widget src: ' + wid.url , 'BEGIN');
- info.children[i++] = text_label('config src: ' + wid.manifest , 'BEGIN');
- info.children[i++] = text_label('content src : '+wid.localizedSrc, 'BEGIN' );
-
- pref = wid.features;
- info = text_rect('Features (' + pref.length + ')' );
- info_dlg.children[info_dlg.children.length] = info;
- info.visible = false;
- info.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- i=3;
- for (j=0; j<pref.length; j++) {
- info.children[i++] = text_label('Feature #'+(j+1)+' name=\''+pref[j].name+'\' required=\''+pref[j].required+'\'', 'BEGIN');
- }
-
-
- pref = wid.preferences;
- info = text_rect('Preferences ('+pref.length+')');
- info_dlg.children[info_dlg.children.length] = info;
- info.visible = false;
- info.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- i=3;
- for (j=0; j<pref.length; j++) {
- var val = pref[j].value;
- if (val=='') val = gpac.getOption(wid.section, pref[j].name);
- info.children[i++] = text_label('Preference #'+(j+1)+' name=\''+pref[j].name+'\' value=\''+val+'\' readOnly=\''+pref[j].readonly +'\'', 'BEGIN');
- }
-
- info = text_rect('Migration Context', 'BEGIN');
- info_dlg.children[info_dlg.children.length] = info;
- info.visible = false;
- info.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- i=3;
- txt=wid.get_context();
- while (1) {
- var idx = txt.indexOf('\n', 0);
- if (idx>0) {
- info.children[i++] = text_label(txt.substring(0, idx), 'BEGIN');
- txt = txt.substring(idx+1, txt.length);
- } else {
- info.children[i++] = text_label(txt, 'BEGIN');
- break;
- }
- }
-
- info_dlg.ifce_idx = info_dlg.children.length;
- info = text_rect('Interfaces (count: ' + wid.num_interfaces + ' - bound: ' + wid.num_bound_interfaces+')', 'BEGIN');
- info_dlg.children[info_dlg.ifce_idx] = info;
- info.visible = false;
- info.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- i=3;
- for (j=0; j<wid.num_interfaces; j++) {
- var idx;
- var ifce = wid.get_interface(j);
- var item = text_rect('Interface #' + (j+1) + ' type: '+ifce.type);
- info.children[i++] = item;
- item.visible = false;
- item.button_click = function() {
- this.visible = !this.visible;
- layout();
- }
- idx=3;
- item.children[idx++] = text_label('Multiple Binding: '+ifce.multipleBinding + ' - Service provider: '+ ifce.serviceProvider + ' - bound: ' + wid.is_interface_bound(ifce) , 'BEGIN');
- for (k=0; k<ifce.num_messages; k++) {
- var string, l;
- var msg = ifce.get_message(k);
- string = ' Message #'+ (k+1) + ': ' + msg.name + '(';
- for (l=0; l<msg.num_params; l++) {
- par = msg.get_param(l);
- string += (par.is_input ? 'in' : 'out') + ':' +par.name + ' ';
- }
- string += ')';
- item.children[idx++] = text_label(string, 'BEGIN');
- }
- }
-
- info_dlg.set_size = function(w, h) {
- var i, j, y, dy;
- y = h/2 - 20;
-
- for (i=0; i<this.children.length; i++) {
- var item = this.children[i];
- item.translation.x = 0;
- item.translation.y = y;
- item.set_size(w, 20);
- y -= 20;
- if (!i) continue;
-
- dy = 0;
- for (j=3; j<item.children.length; j++) {
- if (item.visible) {
- item.children[j].scale.x = 1;
- dy -= 20;
- item.children[j].translation.y = dy;
- if (i<this.ifce_idx) {
- item.children[j].translation.x = -w/2+10;
- } else {
- item.children[j].set_size(w-20, 20);
- var ddy=0;
- var k, sitem;
- sitem = item.children[j];
- for (k=3; k<sitem.children.length; k++) {
- if (item.children[j].visible) {
- sitem.children[k].scale.x = 1;
- sitem.children[k].translation.x = -w/2+10;
- ddy -= 20;
- sitem.children[k].translation.y = ddy;
- } else {
- sitem.children[k].scale.x = 0;
- }
- }
- dy+=ddy;
- }
- } else {
- item.children[j].scale.x = 0;
- }
- }
- y += dy;
- }
- }
-
- dlg_display.children[0] = info_dlg;
- widget_display.scale.x = 0;
- layout();
-}
-
-
-function widget_insert(widget)
-{
- /*insert the widget icon*/
- if (widget.permanent && !widget.is_component)
- insert_widget_icon(widget, 0);
-
- /*and load the widget - comment this line to disable auto load of widget*/
- widget_launch(widget);
-}
+ filebrowse.set_size(display_width, display_height);
+ gpacui_show_window(filebrowse);
-function setup_icons()
-{
- var icon;
-
- //File open
- icon = icon_button('icons/applications-multimedia.svg', 'Open', 0);
- icon.button_click = on_fileopen;
- dock.children[dock.children.length] = icon;
+ set_movie_url('');
+// filebrowse.set_alpha(0.8);
- //Widget Manager Icon
- icon = icon_button('icons/applications-system.svg', 'Widgets', 0);
- icon.button_click = function () {
- widget_ui_visible = !widget_ui_visible;
- layout();
- }
- dock.children[dock.children.length] = icon;
-
- //Widgets add Icon
- icon = icon_button('icons/list-add.svg', 'Add Widgets', 0);
- icon.button_click = function () {
- widget_browse();
- }
- widget_ui.children[widget_ui.children.length] = icon;
-
- icon = icon_button('icons/user-trash.svg', 'Remove all widgets', 0);
- icon.button_click = function () {
- while (1) {
- var wid = WidgetManager.get(0);
- if (wid==null) break;
- widget_close(wid, 1);
- }
- widget_ui.children.length = widget_ui.nb_tools;
- layout();
- }
- widget_ui.children[widget_ui.children.length] = icon;
-
- widget_ui.prev = icon_button('icons/go-previous.svg', 'Previous Widgets', 0);
- widget_ui.prev.button_click = function () { widget_ui_layout(-1); };
- widget_ui.children[widget_ui.children.length] = widget_ui.prev;
-
- widget_ui.next = icon_button('icons/go-next.svg', 'Next Widgets', 0);
- widget_ui.next.button_click = function () { widget_ui_layout(1); };
- widget_ui.children[widget_ui.children.length] = widget_ui.next;
-
- widget_ui.nb_tools = widget_ui.children.length;
-
- //push to display
- upnp_icon = null;
- if (has_upnp) {
- icon = icon_button('icons/video-display.svg', 'Select Display', 0);
- icon.button_click = function () {
- widget_remote_candidate = null;
- on_upnpopen(false, false);
- }
- upnp_icon = icon;
- upnp_icon.hide();
- dock.children[dock.children.length] = icon;
- }
-
- //exit Icon
- icon = icon_button('icons/emblem-unreadable.svg', 'Exit', 0);
- icon.button_click = function() { gpac.exit(); };
- dock.children[dock.children.length] = icon;
}
+urldlg = null;
-
-/*dock layout*/
-function dock_layout() {
- var i;
-
- dock.translation.y = (dock_height - display_height)/2;
- infobar.translation.y = display_height/2 - info_height/2;
-
- num_in_dock = dock.children.length;
- tot_len = num_in_dock*icon_size;
-
- if (tot_len>display_width) {
- start_x = (icon_size-display_width)/2;
- } else {
- start_x = (icon_size-tot_len)/2;
- }
- /*translate / size all items in the dock*/
- for (i=0;i<num_in_dock; i++) {
- if (dock.children[i].visible) {
- dock.children[i].set_size(icon_size, icon_size);
- dock.children[i].translation.x = start_x;
- start_x += icon_size;
- }
- }
-}
-
-function widget_ui_layout(dir)
+function open_url()
{
- var count, i, height, start_x, start_y, spread_x, nb_wid_h, nb_wid_v, nb_wid;
-
- if (!widget_ui_visible) {
- widget_ui.size.x = 0;
- widget_ui.size.y = 0;
- return;
- }
+ if (urldlg) return;
+ urldlg = gw_new_window(null, true, 'window');
- widget_ui.size.x = display_width;
- widget_ui.size.y = display_height;
+ urldlg.sizer = gw_new_grid_container(urldlg);
- start_x = (icon_size-display_width)/2;
- start_y = (display_height-icon_size/2)/2 - info_height;
-
- for (i=0; i<widget_ui.nb_tools; i++) {
- wid = widget_ui.children[i];
- wid.set_size(icon_size/2, icon_size/2);
- wid.translation.x = start_x;
- wid.translation.y = start_y;
- start_x += icon_size/2;
+ urldlg.icon = gw_new_icon_button(urldlg.sizer, gwskin.images.cancel, gwskin.labels.close, 'icon');
+ urldlg.icon.set_size(gwskin.default_icon_size, gwskin.default_icon_size);
+ urldlg.icon.on_click = function() {
+ urldlg.close();
+ urldlg = null;
}
- start_x = (icon_size-display_width)/2;
- start_y -= icon_size;
-
+ urldlg.label = gw_new_text(urldlg.sizer, 'URL', 'window');
+ urldlg.label.set_size(gwskin.default_icon_size, gwskin.default_icon_size);
+ urldlg.label.set_width(gwskin.default_icon_size);
- count = widget_ui.children.length - widget_ui.nb_tools;
- if (first_visible_widget<0) first_visible_widget=0;
-
- for (i=0; i<count; i++) {
- var wid = widget_ui.children[widget_ui.nb_tools+i];
- wid.hide();
- }
-
- nb_wid_h = Math.floor(display_width / icon_size);
- if (!nb_wid_h) nb_wid_h=1;
-
- height = display_height-dock_height-icon_size-icon_size/2;
- nb_wid_v = Math.floor(height / icon_size);
- if (!nb_wid_v) nb_wid_v=1;
-
- spread_x = (display_width / nb_wid_h) - icon_size;
- start_x += spread_x/2;
-
- nb_wid = (nb_wid_h*nb_wid_v);
- if (dir<0) {
- first_visible_widget -= nb_wid;
- if (first_visible_widget < 0) {
- first_visible_widget = 0;
- }
- }
- else if (dir>0) {
- first_visible_widget += nb_wid;
- }
-
- if (first_visible_widget) widget_ui.prev.show();
- else widget_ui.prev.hide();
-
- if (first_visible_widget+nb_wid < count) widget_ui.next.show();
- else widget_ui.next.hide();
+ urldlg.edit = gw_new_text_edit(urldlg.sizer, '');
- for (i=0; i<count; i++) {
- var wid;
- if (i+first_visible_widget >= count) {
- break;
- }
- wid = widget_ui.children[i +first_visible_widget+widget_ui.nb_tools];
- wid.show();
- wid.set_size(icon_size, icon_size);
- wid.translation.x = start_x;
- wid.translation.y = start_y;
- start_x += icon_size + spread_x;
- if (start_x + icon_size / 2 >= display_width/2) {
- start_x = (icon_size-display_width)/2 + spread_x/2;
- start_y -= icon_size;
- }
- nb_widgets_on_screen = i+1;
- if (start_y - icon_size < (dock_height-display_height)/2) {
- i++;
- break;
- }
- }
+ urldlg.edit.on_text = function(value) {
+ if (value != '') set_movie_url(value);
+ urldlg.close();
+ urldlg = null;
+ }
+ urldlg.layout = function(width, height) {
+ var w = width - this.icon.width - this.label.width-5;
+ this.edit.set_size(w, 4*gwskin.default_icon_size/5);
+ this.sizer.set_size(width, height);
+ }
+ urldlg.close = function() {
+ this.label = null;
+ this.icon = null;
+ this.edit = null;
+ this.sizer = null;
+ this.hide(this._on_wnd_close);
+ }
+ gpacui_show_window(urldlg);
+ urldlg.set_size(display_width, gwskin.default_icon_size);
}
-//performs layout on all contents
-function layout() {
- var i, list, start_x;
-
- gpac.setOption('General', 'LastWidth', ''+display_width);
- gpac.setOption('General', 'LastHeight', ''+display_height);
+function onMediaRendererAdd(name, uuid, is_add)
+{
+ if (upnp_renderers) upnp_renderers.browse('');
+ if (!is_add && controlled_renderer && (name==controlled_renderer.Name) ) controlled_renderer = null;
- if (dlg_display.children.length) {
- widget_display.scale.x = 0;
- widget_ui_visible = false;
- }
- //layout all icons in the dock
- dock_layout();
- widget_ui_layout(0);
+ /*redo player control*/
+ player_control.layout(player_control.width, player_control.height);
- if (dlg_display.children.length) {
- list = dlg_display.children;
- for (i=0; i<list.length; i++) {
- var dlg = list[i];
- if (typeof (dlg.set_size) != 'undefined') dlg.set_size(display_width, display_height-icon_size-info_height);
- dlg.translation.y = (icon_size-info_height)/2;
- }
- }
- else if (widget_ui_visible) {
- widget_display.scale.x = 0;
- } else {
- widget_display.scale.x = 1;
- list = widget_display.children;
- for (i=0; i<list.length; i++) {
- var widctrl = list[i];
- if (widctrl.maximized) {
- widctrl.translation.y = - info_height;
- widctrl.set_size(display_width, display_height - 2*info_height);
- }
- }
+ for (var i in all_extensions) {
+ if (typeof all_extensions[i].on_upnp_add != 'undefined') all_extensions[i].on_upnp_add(name, uuid, is_add);
}
}
-//resize event callback
-function on_resize(evt) {
- display_width = evt.width;
- display_height = evt.height;
- layout();
-}
-//zoom event callback
-function on_zoom(evt) {
- display_width = evt.width;
- display_height = evt.height;
- layout();
-}
-//scroll event callback
-function on_scroll(evt) {
- layout();
-}
-
-//starts a widget
-function on_widget_launch() {
- if (this.widget.visible) {
- var awid;
- if (!this.widget.multipleInstances) return;
- awid = WidgetManager.open(this.widget.manifest, null);
- widget_launch(awid);
- } else {
- widget_launch(this.widget);
- }
-}
-
-function widget_get_icon(widget)
+function onMediaConnect(url, src_ip)
{
- var icon = 'icons/image-missing.svg';
- var preferredIconType = '.svg';
-
- for (var i = 0; i < widget.icons.length; i++) {
- icon = widget.icons[i].relocated_src;
- if (widget.icons[i].relocated_src.indexOf(preferredIconType) > 0) {
- break;
- }
+ for (var i in all_extensions) {
+ if (typeof all_extensions[i].on_media_open != 'undefined') {
+ if (all_extensions[i].on_media_open(url, src_ip)>0) return;
+ }
}
- return icon;
-}
-//initialize GPAC widget manager and load all widgets
-function widgets_init() {
-
- count = WidgetManager.num_widgets;
- for (i=0; i<count; i++) {
- wid = WidgetManager.get(i);
- if (wid == null) continue;
- wid.device = null;
- wid.device_ip = null;
- if (wid.in_panel == true) {
- icon = icon_button(widget_get_icon(wid), wid.name, 0);
- icon.tooltip = wid.name;
- icon.widget = wid;
- icon.button_click = on_widget_launch;
-
- wid.icon_dock = icon;
- widget_ui.children[widget_ui.children.length] = wid.icon_dock;
- }
- if (wid.visible) {
- widget_launch(wid);
- }
- }
+ {
+ log(l_inf, 'DLNA URL connect ' + url);
+ movie_ctrl.mediaStartTime = -1;
+ set_movie_url(url);
+ }
}
-function on_widget_size(value) {
- //remember variables
- this.width = value.x;
- this.height = value.y;
- //and set widget input params
- this.set_input('width', value.x);
- this.set_input('height', value.y);
-}
-
-function on_widget_move(value) {
- this.x = value.x;
- this.y = value.y;
-}
-
-//widget close function
-function widget_close(widget, force_remove)
+function onMediaStop()
{
- var is_comp = widget.is_component;
- if (widget.visible) {
- widget.visible = false;
- WidgetManager.corein_message(widget, 'hide');
- WidgetManager.corein_message(widget, 'deactivate');
- widget.deactivate();
- widget.scene_container.removeChildren[0] = widget.widget_control;
- /*force disconnect of main resource - we do this because we are not sure when the widget_control will be destroyed due to JS GC*/
- widget.widget_control.inline.url.length = 0;
- }
- if (!is_comp && (!widget.permanent || force_remove)) {
- WidgetManager.unload(widget, force_remove ? true : false);
- }
+ log(l_inf, 'DLNA Media Stop');
+ movie_ctrl.mediaStartTime = 0;
+ movie_ctrl.mediaSpeed = 0;
}
-
-function on_widget_close(value) {
- widget_close(this, 0);
+function onMediaPause()
+{
+ log(l_inf, 'DLNA Media pause');
+ movie_ctrl.mediaSpeed = 0;
+ movie_ctrl.mediaStartTime = -1;
}
-
-//widget remove function (close and unregister)
-function widget_remove(wid) {
- if (typeof(wid.icon_dock) != 'undefined')
- widget_ui.removeChildren[0] = wid.icon_dock;
- widget_close(wid, 0);
- layout();
+function onMediaPlay()
+{
+ log(l_inf, 'DLNA Media Play');
+ movie_ctrl.mediaSpeed = 1;
}
-function on_widget_control(value)
+function OnMediaSeek(time)
{
- var i, count;
- if (!value) return;
- count = this.scene_container.children.length;
- for (i=0; i<count; i++) {
- if (this.scene_container.children[i] == this.widget_control) {
- this.scene_container.removeChildren[0] = this.widget_control;
- this.scene_container.children[this.scene_container.children.length] = this.widget_control;
- return;
- }
- }
+ log(l_inf, 'DLNA Media Seek to '+time);
+ movie_ctrl.mediaStartTime = time;
}
-//widget launcher function
-function widget_launch(wid) {
- var widg_ctrl;
-
- //assign default size to the widget
- if (wid.width == undefined) {
- wid.width = wid.defaultWidth;
- if (wid.width == 0) wid.width = widget_default_size;
- }
- if (wid.height == undefined) {
- wid.height = wid.defaultHeight;
- if (wid.height == 0) wid.height = widget_default_size;
- }
- if (wid.x== undefined) wid.x = 0;
- if (wid.y== undefined) wid.y = 0;
-
- widg_ctrl = new_widget_control(wid);
- widg_ctrl.component_bound = false;
-
- wid.visible = true;
-
- widg_ctrl.set_size(wid.width, wid.height);
- widg_ctrl.translation.x = wid.x;
- widg_ctrl.translation.y = wid.y;
-
- wid.widget_control = widg_ctrl;
- wid.scene_container = widget_display;
-
- widg_ctrl.show_remove( (!wid.discardable && wid.icon_dock) ? 1 : 0);
-
- widg_ctrl.sub_width = 0;
- widg_ctrl.sub_height = 0;
- widg_ctrl.sub_x = 0;
- widg_ctrl.sub_y = 0;
- widg_ctrl.sub_vp_w = 0;
- widg_ctrl.sub_vp_h = 0;
-
- widg_ctrl.inline.addEventListener('gpac_vp_changed',
- function(evt) {
- widg_ctrl.sub_vp_w = evt.width;
- widg_ctrl.sub_vp_h = evt.height;
- widg_ctrl.sub_vp_x = evt.offset_x;
- widg_ctrl.sub_vp_y = evt.offset_y;
- widg_ctrl.sub_w = evt.vp_width;
- widg_ctrl.sub_h = evt.vp_height;
- widg_ctrl.refresh_layout(true, null);
- },
- 0);
-
- /*this will setup the scene graph for the widget in order to filter input and output communication pins*/
- wid.activate(widg_ctrl.inline);
-
- widg_ctrl.inline.url[0] = wid.main;
- widget_display.addChildren[0] = widg_ctrl;
-
- /*send notifications once the widget scene is loaded*/
- wid.on_load = function () {
- WidgetManager.corein_message(this, 'activate');
- WidgetManager.corein_message(this, 'show');
- WidgetManager.corein_message(this, 'setSize', 'width', 50, 'height', 50, 'dpi', 96);
- };
-
- if (widget_ui_visible) {
- widget_ui_visible = 0;
- layout();
- }
+function OnMediaMigrate() {
+ log(l_inf, 'Migration Request received');
+ var str = gpac.migrate_url(movie.children[0].url[0]);
+ set_movie_url('');
+ return str;
}
-
-function widget_request_size(widget, args)
-{
- if (args.length==2) {
- w = (typeof args[0] == 'string') ? parseInt(args[0]) : args[0];
- h = (typeof args[1] == 'string') ? parseInt(args[1]) : args[1];
- widget.widget_control.set_size(w, h);
- }
-}
-function widget_request_show(widget, args)
-{
- widget.widget_control.show();
-}
-function widget_request_hide(widget, args)
-{
- widget.widget_control.hide();
-}
-function widget_request_activate(widget, args)
+function onMediaTimeChanged(render_idx, time)
{
- if (!widget.visible)
- widget_launch(widget);
-}
-function widget_request_deactivate(widget, args)
-{
- if (widget.visible)
- widget_close(widget, 0);
+ if (!controlled_renderer) return;
+ if (UPnP.GetMediaRenderer(render_idx).Name==controlled_renderer.Name) {
+ player_control.set_time(time);
+ }
}
-function widget_request_attention(widget, args)
+function onMediaDurationChanged(render_idx, time)
{
- if (widget.visible) {
- widget_display.removeChildren[0] = widget.widget_control;
- widget_display.addChildren[0] = widget.widget_control;
- widget.widget_control.flash();
+ if (!controlled_renderer) return;
+ if (UPnP.GetMediaRenderer(render_idx).Name==controlled_renderer.Name) {
+ player_control.set_duration(time);
}
}
-function widget_request_notification(widget, args)
-{
- var notif = text_rect('');
- notif.children[1].geometry.string[0] = 'Notification from widget';
- notif.children[1].geometry.string[1] = ' '+widget.name;
- notif.children[1].geometry.string[2] = ' ';
- notif.children[1].geometry.string[3] = args[0];
- dlg_display.children[0] = notif;
- notif.set_size(320, 240);
- notif.button_click = function() {
- dlg_display.removeChildren[0] = this;
- }
-}
-function widget_place_component(widget, args)
-{
- var comp = widget.get_component(args[0]);
-
- if (comp==null) {
- log(l_err, 'Component '+args[0]+' cannot be found in widget '+widget.name);
- return;
- }
- comp.widget_control.place_x = args[1];
- comp.widget_control.place_y = args[2];
- comp.widget_control.place_w = args[3];
- comp.widget_control.place_h = args[4];
- comp.widget_control.place_z = args[5];
- comp.widget_control.component_bound = true;
- widget.widget_control.refresh_layout(false, comp);
-}
+function select_remote_display(action_type, callback)
+{
+ if (upnp_renderers) return;
+ upnp_renderers = gw_new_file_open();
+ upnp_renderers.set_label('Select Remote Display');
+ upnp_renderers.action_type = action_type;
+ if (arguments.length<2) callback=null;
+ upnp_renderers.callback = callback;
-//
-// implementation of core:out install widget
-//
-function widget_request_install(wid, args)
-{
- var wid_url = args[0];
- /*locate widget with same URL*/
- var j, count = WidgetManager.num_widgets;
- for (j = 0; j < count; j++) {
- var wid = WidgetManager.get(j);
- if (wid.url == wid_url) {
- if (!wid.in_panel) {
- insert_widget_icon(wid, 0);
- }
- break;
- }
- }
- /*not found, install new widget*/
- if (j == count) {
- var new_wid = WidgetManager.open(wid_url, null);
- if (new_wid==null) return;
- insert_widget_icon(new_wid, 0);
- }
+ upnp_renderers.on_close = function() {
+ upnp_renderers = null;
+ }
+ /*override browse function*/
+ upnp_renderers._on_upnp_click = function() {
+ var renderer = (this.render_idx<0) ? null : UPnP.GetMediaRenderer(this.render_idx);
+ var act_type = upnp_renderers.action_type;
- var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
- if (ifce != null) {
- wmjs_core_out_invoke_reply(coreOut.installWidgetMessage, ifce.get_message("installWidget"), wid, 1); // send return code 1 = success
- }
-}
-function widget_migrate_component(wid, args)
-{
- alert('Fetching component '+args[0]);
- var comp = wid.get_component(args[0], true);
- var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-
- if (comp==null) {
- log(l_err, 'Component '+args[0]+' cannot be found in widget '+wid.name);
- if (ifce != null) {
- wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 0);
- }
- return;
- }
- if (args.length > 1 && args[1] != null) {
- alert('Migrating component to ' + UPnP.GetMediaRenderer(parseInt(args[1])).Name);
- WidgetManager.migrate_widget(UPnP.GetMediaRenderer(parseInt(args[1])), comp);
- widget_close(comp);
- } else {
- widget_remote_candidate = wid;
- on_upnpopen(false, false);
- }
- if (ifce != null) {
- wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 1); // send return code 1 = success
+ if (act_type=='callback') {
+ if (upnp_renderers.callback) upnp_renderers.callback(renderer);
+ upnp_renderers.callback = null;
+ upnp_renderers.close();
+ upnp_renderers = null;
+ return;
}
-}
-function widget_migration_targets(wid, args)
-{
- var count = UPnP.MediaRenderersCount, codes = new Array(), names = new Array(), descriptions = new Array(), i;
+ upnp_renderers.close();
+ upnp_renderers = null;
- for (i = 0; i < count; i++) {
- var render = UPnP.GetMediaRenderer(i);
- codes.push(""+i);
- names.push(render.Name);
- descriptions.push(render.HostName +" "+ render.UUID);
- }
- i = null;
- var ifce_count = wid.num_interfaces, j;
- for (j = 0; j < ifce_count; j++) {
- var ifce = wid.get_interface(j);
- if (ifce.type == "urn:mpeg:mpegu:schema:widgets:core:out:2010") {
- i = ifce;
- break;
- }
- }
- if (i != null) {
- wmjs_core_out_invoke_reply(coreOut.requestMigrationTargetsMessage, i.get_message("requestMigrationTargets"),
- wid, codes, names, descriptions);
- }
-}
-
-
-//
-// implementation of core:out activate temporary widget
-//
-function widget_activate_temporary_widget(wid, args) {
- var w = WidgetManager.open(args[0], null);
- if (w != null) widget_launch(w);
- var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
- if (ifce != null) {
- wmjs_core_out_invoke_reply(coreOut.activateTemporaryWidgetMessage, ifce.get_message("activateTemporaryWidget"),
- wid, (w != null ? 1 : 0)); // send return code 1 = success
+ if (act_type=='select') {
+ controlled_renderer = renderer;
+ return;
}
-}
+ if ((current_url.indexOf('://') < 0) || (current_url.indexOf('file://') >= 0) ) {
+ if (! UPnP.MediaServerEnabled) {
+ log(l_err, 'GPAC Media Server is disabled - Cannot share '+current_url);
+ return;
+ }
+ uri = UPnP.ShareResource(current_url);
+ log(l_inf, 'Sharing '+current_url+' to renderer '+renderer.Name + ' as resource '+uri);
+ renderer.Open(uri);
+ renderer.Seek(current_time);
+ } else if (gpac.getOption('Network', 'MobileIPEnabled')=='yes') {
+ uri = gpac.migrate_url(movie.children[0].url[0]);
+ log(l_inf, 'Migrating '+current_url+' to renderer '+renderer.Name + ' as Mobile IP resource '+uri);
+ renderer.Open(uri);
+ } else {
+ log(l_inf, 'Migrating '+current_url+' to renderer '+renderer.Name);
+ renderer.Open(current_url);
+ renderer.Seek(current_time);
+ }
+ set_movie_url('');
+ player_control.show();
+ };
-
-function insert_widget_icon(new_wid, no_layout) {
- var icon;
- icon = icon_button(widget_get_icon(new_wid), new_wid.name, 0);
- icon.tooltip = new_wid.name;
- new_wid.in_panel = true;
- new_wid.visible = false;
- new_wid.icon_dock = icon;
- icon.button_click = on_widget_launch;
- icon.widget = new_wid;
- widget_ui.addChildren[0] = new_wid.icon_dock;
- if (!no_layout) layout();
+ upnp_renderers._browse = function(dir, up) {
+ var w, h, i, y;
+ this.area.reset_children();
+
+ if (this.action_type=='select') {
+ var item = gw_new_icon_button(this.area, controlled_renderer ? 'icons/applications-internet.svg' : 'icons/preferences-desktop-remote-desktop.svg', 'Local Display', 'button');
+ item.set_size(item.width, item.height);
+ item.render_idx = -1;
+ item.on_click = this._on_upnp_click;
+ }
+ for (i=0; i<UPnP.MediaRenderersCount; i++) {
+ var render = UPnP.GetMediaRenderer(i);
+ var icon = 'icons/applications-internet.svg';
+ if ((this.action_type=='select') && controlled_renderer && (controlled_renderer.Name==render.Name)) icon = 'icons/preferences-desktop-remote-desktop.svg';
+ var item = gw_new_icon_button(this.area, icon, render.Name, 'button');
+ item.set_size(item.width, item.height);
+ item.render_idx = i;
+ item.on_click = this._on_upnp_click;
+ }
+ this.layout(this.width, this.height);
+ }
+ upnp_renderers.browse('');
+ upnp_renderers.go_up.hide();
+ upnp_renderers.set_size(display_width, display_height);
+ gpacui_show_window(upnp_renderers);
}
-function scan_directory(dir)
-{
- var i, j, count, list, new_wid, uri;
- list = gpac.enum_directory(dir, '.xml;.wgt;.mgt', 0);
- for (i=0; i<list.length; i++) {
- uri = list[i].path + list[i].name;
- if (list[i].directory) {
- scan_directory(uri);
- } else {
- count = WidgetManager.num_widgets;
- for (j=0; j<count; j++) {
- var wid = WidgetManager.get(j);
- if (wid.url==uri) break;
- }
- if (j==count) {
- new_wid = WidgetManager.open(uri, null);
- if (new_wid!=null) {
- insert_widget_icon(new_wid, 1);
- }
- }
- }
- }
-}
-function new_file_browse(init_directory, label, filter, show_scan, show_upnp)
+remote_servers = null;
+function browse_remote_servers()
{
- var filebrowse = new SFNode('Transform2D');
- filebrowse.list = new Array();
- infobar.set_label(label);
- dlg_display.children[0] = filebrowse;
-
- filebrowse.upnp = null;
- filebrowse.upnp_mode = false;
-
- filebrowse.children[0] = icon_button('icons/emblem-unreadable.svg', 'Close', 0);
- filebrowse.children[0].button_click = function() {
- dlg_display.children.length = 0;
- widget_display.scale.x = 1;
- layout();
- }
-
- filebrowse.children[1] = icon_button('icons/go-previous.svg', 'Previous', 0);
- filebrowse.children[1].filebrowse = filebrowse;
- filebrowse.children[1].button_click = function () { this.filebrowse.layout(0) };
-
- filebrowse.children[2] = icon_button('icons/go-next.svg', 'Next', 0);
- filebrowse.children[2].filebrowse = filebrowse;
- filebrowse.children[2].button_click = function () { this.filebrowse.layout(1) };
-
- filebrowse.icon_up = icon_button('icons/go-up.svg', 'Up', 0);
- filebrowse.icon_up.filebrowse = filebrowse;
- filebrowse.icon_up.button_click = function () { this.filebrowse.browse(true) };
- filebrowse.children[3] = filebrowse.icon_up;
-
- if (show_scan) {
- filebrowse.on_dir_scan = null;
- filebrowse.children[4] = icon_button('icons/folder.svg', 'Scan Directory', 0);
- filebrowse.children[4].filebrowse = filebrowse;
- filebrowse.children[4].button_click = function () {
- if (this.filebrowse.on_dir_scan) this.filebrowse.on_dir_scan(this.filebrowse.directory);
-
- dlg_display.children.length = 0;
- widget_display.scale.x = 0;
- widget_ui_visible = true;
- layout();
- }
- }
-
- if (show_upnp && has_upnp) {
- filebrowse.upnp = icon_button('icons/applications-internet.svg', 'Network Servers', 0);
- filebrowse.upnp.filebrowse = filebrowse;
- filebrowse.children[filebrowse.children.length] = filebrowse.upnp;
- filebrowse.server_uuid = null;
- filebrowse.upnp.button_click = function() {
- if (this.filebrowse.upnp_mode) {
- this.label = 'Network Servers';
- this.filebrowse.upnp_mode = false;
- this.filebrowse.directory = init_directory;
- this.filebrowse.browse(false);
- } else {
- this.label = 'Local Drive';
- this.filebrowse.upnp_mode = true;
- this.filebrowse.browse(true);
- }
- }
+ if (remote_servers) return;
+ remote_servers = gw_new_file_open();
+ remote_servers.set_label('Browse Remote Servers');
- filebrowse.upnp_get_server_list = function() {
- var count, server, item;
- this.directory = null;
- this.children[3].hide();
- this.server_uuid = null;
- count = UPnP.MediaServersCount;
- this.list.length = 0;
- for (i=0; i<count; i++) {
- server = UPnP.GetMediaServer(i);
- item = new Object();
- item.name = server.Name;
- item.directory = true;
- item.is_server = true;
- item.path = server.UUID;
- this.list[i] = item;
- }
- };
- filebrowse.server_uuid = null;
- }
-
- filebrowse.label = text_label('', 'BEGIN');
- filebrowse.set_label = function(label) {
- this.label.set_label(label);
- }
- filebrowse.children[filebrowse.children.length] = filebrowse.label;
- filebrowse.nb_tools = filebrowse.children.length;
+
+ remote_servers.icon_server = gw_load_resource( 'icons/applications-internet.svg' );
+ remote_servers.icon_folder = gw_load_resource( gwskin.images.folder );
+ remote_servers.icon_file = gw_load_resource( gwskin.images.mime_generic );
- filebrowse.browse = function(go_up) {
- if (this.upnp_mode) {
- var item;
- var server = null;
- if (this.server_uuid) server = UPnP.GetMediaServer(this.server_uuid);
- if (!server || (go_up && !server.HasParentDirectory())) {
- this.upnp_get_server_list();
- this.icon_up.hide();
- this.set_label('Media Servers');
- this.first = 0;
- this.layout(0);
- return;
- }
- if (go_up) this.directory = '..';
-
- this.icon_up.show();
- server.Browse(this.directory, filter);
- this.list.length = 0;
- for (i=0; i<server.FilesCount; i++) {
- var file = server.GetFile(i);
- item = new Object();
- item.directory = file.Directory ? true : false;
- item.name = file.Name;
- item.path = file.ObjectID;
- item.is_server = false;
- if (!item.directory) {
- item.resource_uri = file.ResourceURI;
- }
- this.list[i] = item;
- }
- if (this.directory) this.set_label(this.directory);
- else this.set_label(server.Name);
- this.first = 0;
- this.layout(0);
- return;
+ /*override browse function*/
+ remote_servers.server = null;
+ remote_servers._on_server_click = function() {
+ if (this.is_server) {
+ remote_servers.server = UPnP.GetMediaServer(this.server_idx);
+ remote_servers._browse('0', false);
+ return;
}
-
- if (this.directory == '')
- this.icon_up.hide();
- else
- this.icon_up.show();
-
- this.list = gpac.enum_directory(this.directory, filter, go_up);
- if (this.list.length) {
- this.directory = this.list[0].path;
- this.set_label(this.directory);
- } else {
- this.set_label('');
+ if (this.directory) {
+ remote_servers._browse(this.path, false);
+ return;
}
- this.first = 0;
- this.layout(0);
+ //alert('Opening file '+this.resource_uri);
+ set_movie_url(this.resource_uri);
+ remote_servers.close();
+ remote_servers = null;
}
- filebrowse.on_browse = null;
- filebrowse.layout = function(type) {
+ remote_servers._browse = function(dir, up) {
var w, h, i, y;
- this.children.length = this.nb_tools;
-
- if (this.upnp != null) {
- if (UPnP.MediaServersCount) {
- this.upnp.show();
- } else {
- this.upnp.hide();
- }
- }
-
- this.children[1].hide();
- this.children[2].hide();
+ this.area.reset_children();
- if (type==0) {
- this.first -= this.nb_items;
- if (this.first<0) this.first = 0;
- }
- else if (type) {
- this.first += this.nb_items;
- if (this.first + this.nb_items > this.list.length) this.first = this.list.length - this.nb_items;
- }
- if (this.first) this.children[1].show();
- if (this.first+this.nb_items < this.list.length) this.children[2].show();
-
- for (i=0; i<this.nb_items; i++) {
- var item;
- if (i+this.first>=this.list.length) break;
- item = text_rect(this.list[i+this.first].name);
- item.path = this.list[i+this.first].path;
- item.name = this.list[i+this.first].name;
- item.directory = this.list[i+this.first].directory;
- item.filebrowse = this;
- if (this.upnp_mode) {
- item.is_server = this.list[i+this.first].is_server;
- item.resource_uri = this.list[i+this.first].resource_uri;
- item.button_click = function() {
- if (this.directory) {
- if (this.is_server) {
- this.filebrowse.server_uuid = this.path;
- } else {
- this.filebrowse.directory = this.path;
- }
- this.filebrowse.browse(false);
- } else {
- dlg_display.children.length = 0;
- if (this.filebrowse.on_browse) {
- this.filebrowse.on_browse(this.resource_uri, null);
- }
- }
- };
- } else {
- item.button_click = function() {
- if (this.directory) {
- this.filebrowse.directory = this.path + this.name;
- this.filebrowse.browse(false);
- } else {
- dlg_display.children.length = 0;
- if (this.filebrowse.on_browse) {
- this.filebrowse.on_browse(this.path + this.name, this.filebrowse.directory);
- }
- }
- };
+ //alert('Browsing dir '+dir+' on server '+ (this.server ? this.server.Name : 'null') );
+ if (!this.server || (up && !this.server.HasParentDirectory())) dir='';
+ this.directory = dir;
+
+ if (dir=='') {
+ for (i=0; i<UPnP.MediaServersCount; i++) {
+ var server = UPnP.GetMediaServer(i);
+ var item = gw_new_icon_button(this.area, this.icon_server, server.Name, 'button');
+ item.set_size(item.width, item.height);
+ item.server_idx = i;
+ item.directory = true;
+ item.is_server = true;
+ item.on_click = this._on_server_click;
+ }
+ } else {
+ if (up) dir = '..';
+ this.server.Browse(dir, this.filter);
+ //alert('Nb Files '+this.server.FilesCount);
+ this.directory = this.server.Name;
+
+ for (var i=0; i<this.server.FilesCount; i++) {
+ var file = this.server.GetFile(i);
+ if (file.Directory) {
+ var item = gw_new_icon_button(this.area, this.icon_folder, file.Name, 'button');
+ item.directory = true;
+ item.path = file.ObjectID;
+ item.is_server = false;
+ item.on_click = this._on_server_click;
+ } else {
+ for (var j=0; j<file.ResourceCount; j++) {
+ var item = gw_new_icon_button(this.area, this.icon_file, file.Name, 'button');
+ item.directory = false;
+ item.resource_uri = file.GetResourceURI(j);
+ var protoInfo = item.resource_uri.split(":");
+ item.name += ' ('+protoInfo[0]+')';
+ item.path = file.ObjectID;
+ item.is_server = false;
+ item.on_click = this._on_server_click;
+ }
+ }
+ }
}
- this.children[this.nb_tools+i] = item;
- }
- this.set_size(this.width, this.height);
- }
-
-
- filebrowse.set_size = function(w, h) {
- var i, x, y, isize, nbi;
- isize = 24;
- if (w>display_width - isize) w = display_width - isize;
-
- this.width = w;
- this.height = h;
-
- i = 1;
- while ((i+1)*isize <= h - isize) i++;
+ //alert('Done Browsing, refreshing layout');
- if (i != this.nb_items) {
- this.nb_items = i;
- this.layout(0);
- return;
- }
- x = -w/2 + isize/2;
- y = h/2 - isize/2;
-
- for (i=0;i<this.nb_tools;i++) {
- if (this.nb_tools>i+1) {
- this.children[i].set_size(isize, isize);
- }
- this.children[i].translation.x = x;
- this.children[i].translation.y = y;
- x += isize;
- }
- y-=isize;
- while (i<this.children.length) {
- this.children[i].set_size(w, isize);
- this.children[i].translation.x = 0;
- this.children[i].translation.y = y;
- y-=isize;
- i++;
- }
- }
- filebrowse.nb_items = 0;
- filebrowse.directory = init_directory;
- return filebrowse;
-}
-
-function widget_browse()
-{
- filebrowse = new_file_browse(WidgetManager.last_widget_dir, 'Select widget', '*.xml;*.wgt;*.mgt', true, false);
- filebrowse.on_dir_scan = function(directory) {
- scan_directory(directory);
- WidgetManager.last_widget_dir = directory;
- }
- filebrowse.on_browse = function(value, directory) {
- widget_display.scale.x = 1;
- widget_ui_visible = true;
- layout();
- var new_wid = WidgetManager.open(value, null);
- if (new_wid==null) return;
-
- WidgetManager.last_widget_dir = directory;
- insert_widget_icon(new_wid, 0);
- }
-
- filebrowse.browse(0);
- widget_display.scale.x = 0;
- layout();
-
-}
-
-//fileOpen function
-function on_fileopen()
-{
- filebrowse = new_file_browse(gpac.last_working_directory, 'Select file', '*', false, true);
- filebrowse.on_browse = function(value, directory) {
- if (directory) gpac.last_working_directory = directory;
- set_movie_url(value, false, true);
- }
+ if (this.directory == '') this.go_up.hide();
+ else this.go_up.show();
- filebrowse.browse(0);
- widget_display.scale.x = 0;
- layout();
-}
-
-function onMediaRendererAdd(name, uuid, is_add)
-{
- var i, count;
-
- count = WidgetManager.num_widgets;
- for (i=0; i<count; i++) {
- wid = WidgetManager.get(i);
- if (wid == null) continue;
- if (!wid.widget_control) continue;
- wid.widget_control.show_remote();
+ this.layout(this.width, this.height);
}
+
+ remote_servers.predestroy = function() {
+ this.server = null;
+ this.scan_dir = null;
+ this.go_up = null;
+ gw_unload_resource(this.icon_server);
+ gw_unload_resource(this.icon_folder);
+ gw_unload_resource(this.icon_file);
+ remote_servers = null;
+ }
+
+ remote_servers.browse('');
+ remote_servers.set_size(display_width, display_height);
+ gpacui_show_window(remote_servers);
+}
- if (UPnP.MediaRenderersCount) upnp_icon.show();
- else upnp_icon.hide();
- dock_layout();
+nav_sel_wnd = null;
- if (upnp_renders) upnp_renders.refresh();
- if (!is_add && controlled_renderer && (name==controlled_renderer.Name) ) controlled_renderer = null;
+function make_select_item(container, text, type, current_type)
+{
+ if (current_type==type) text = '* ' + text+ ' *';
+ var info = gw_new_button(container, text, 'osdwindow');
+ info.on_click = function() { nav_sel_wnd.select(type); };
+ info.set_size(120, 20);
+ return info;
}
-function on_upnpopen(push_mode, remote_only)
+function select_navigation_type()
{
- upnp_renders = new SFNode('Transform2D');
- upnp_renders.nb_items = 0;
- upnp_renders.refresh = function () {
- var i, count, render, item, start_y, w, str;
- this.children.length = 0;
- count = UPnP.MediaRenderersCount;
- if (count+1>this.nb_items) count = this.nb_items-1;
-
- item = text_rect('Close');
- item.button_click = function() {
- dlg_display.children.length = 0;
- upnp_renders=null;
- widget_display.scale.x = 1;
- infobar.set_label('');
- }
- this.children[this.children.length] = item;
-
- if (!remote_only) {
- str = (controlled_renderer==null) ? '+ ' : '';
- str += 'Local Renderer';
- item = text_rect(str);
- item.button_click = function() {
- dlg_display.children.length = 0;
- upnp_renders=null;
- widget_display.scale.x = 1;
- infobar.set_label('');
- controlled_renderer = null;
- }
- this.children[this.children.length] = item;
- }
-
- for (i=0; i<count; i++) {
- render = UPnP.GetMediaRenderer(i);
- str = (controlled_renderer && controlled_renderer.Name==render.Name) ? '+ ' : '';
- str +=render.Name;
- item = text_rect(str);
- item.render = render;
-
- item.button_click = function() {
- dlg_display.children.length = 0;
- upnp_renders=null;
- widget_display.scale.x = 1;
- infobar.set_label('');
-
- if (widget_remote_candidate) {
- WidgetManager.migrate_widget(this.render, widget_remote_candidate);
- widget_close(widget_remote_candidate, 0);
- widget_remote_candidate = null;
- } else {
- controlled_renderer = this.render;
- if (current_url != "") {
- uri = UPnP.ShareResource(current_url);
- log(l_inf, 'sharing '+current_url+' to renderer '+item.render.Name + ' as resource '+uri);
- item.render.Open(uri);
- set_movie_url('', true, false);
- }
- }
- }
- this.children[this.children.length] = item;
- }
- this.set_size(this.width, this.height);
+ var nb_items = 0;
+ var type = gpac.navigation;
+ if (nav_sel_wnd) return;
+ nav_sel_wnd = gw_new_window(null, true, 'osdwindow');
+ nav_sel_wnd.area = gw_new_grid_container(nav_sel_wnd);
+ nav_sel_wnd.layout = function(width, height) {
+ this.area.set_size(width, height);
}
-
- upnp_renders.set_size = function (w, h) {
- var i, count, start_y, w;
-
- this.width = w<300 ? w : 300;
- this.height = h;
-
- i = 1;
- while ((i+1)*icon_size <= h - icon_size) i++;
- if (i != this.nb_items) {
- this.nb_items = i;
- this.refresh();
- return;
- }
- count = this.children.length;
- start_y = this.height/2 - icon_size - 4;
- for (i=0; i<count; i++) {
- this.children[i].set_size(this.width, icon_size);
- this.children[i].translation.y = start_y;
- start_y-=icon_size+2;
+ nav_sel_wnd.select = function(type) {
+ this.area = null;
+ this.close();
+ nav_sel_wnd = null;
+ if (type=='reset') {
+ gpac.navigation_type = 0;
+ } else {
+ gpac.navigation = type;
}
}
- infobar.set_label('Select remote display');
- dlg_display.children[0] = upnp_renders;
- widget_display.scale.x = 0;
- layout();
-}
-
-
-function onMediaConnect(url, src_ip)
-{
- if (WidgetManager.probe(url)) {
- var new_wid = WidgetManager.open(url, src_ip);
- if (new_wid==null) {
- return;
+ var info = gw_new_button(nav_sel_wnd.area, 'Reset', 'button');
+ info.on_click = function() {
+ nav_sel_wnd.select('reset');
+ };
+ info.set_size(120, 20);
+ nb_items = 1;
+
+
+ var info = make_select_item(nav_sel_wnd.area, 'None', GF_NAVIGATE_NONE, type);
+ make_select_item(nav_sel_wnd.area, 'Slide', GF_NAVIGATE_SLIDE, type);
+ make_select_item(nav_sel_wnd.area, 'Examine', GF_NAVIGATE_EXAMINE, type);
+ nb_items += 3;
+
+ if (gpac.navigation_type==GF_NAVIGATE_TYPE_3D) {
+ make_select_item(nav_sel_wnd.area, 'Walk', GF_NAVIGATE_WALK, type);
+ make_select_item(nav_sel_wnd.area, 'Fly', GF_NAVIGATE_FLY, type);
+ make_select_item(nav_sel_wnd.area, 'Pan', GF_NAVIGATE_PAN, type);
+ make_select_item(nav_sel_wnd.area, 'Game', GF_NAVIGATE_GAME, type);
+ make_select_item(nav_sel_wnd.area, 'Orbit', GF_NAVIGATE_ORBIT, type);
+ make_select_item(nav_sel_wnd.area, 'VR', GF_NAVIGATE_VR, type);
+ nb_items += 6;
+ }
+ nav_sel_wnd.on_event = function(evt) {
+ if (this.area && this.area.on_event(evt)) return true;
+ return false;
}
- widget_insert(new_wid);
- } else {
- log(l_inf, 'DLNA URL connect ' + url);
- movie_ctrl.mediaStartTime = -1;
- set_movie_url(url, true, false);
- }
-}
-function onMediaStop()
-{
- log(l_inf, 'DLNA Media Stop');
- movie_ctrl.mediaStartTime = 0;
- movie_ctrl.mediaSpeed = 0;
-}
-function onMediaPause()
-{
- log(l_inf, 'DLNA Media pause');
- movie_ctrl.mediaSpeed = 0;
- movie_ctrl.mediaStartTime = -1;
-}
-function onMediaPlay()
-{
- log(l_inf, 'DLNA Media Play');
- movie_ctrl.mediaStartTime = -1;
- movie_ctrl.mediaSpeed = 1;
-}
+ gpacui_show_window(nav_sel_wnd);
+ nav_sel_wnd.set_size(120, nb_items*info.height);
+ nav_sel_wnd.show();
-function OnMediaMigrate() {
- log(l_inf, 'InterMedia Migration Request received');
- var str = gpac.migrate_url(movie.children[0].url[0]);
- set_movie_url('', true, false);
- return str;
}
--- /dev/null
+#######################################################################################
+# Hardcoded PROTO node which displays object without taking into account user transforms
+#######################################################################################
+EXTERNPROTO Untransform [
+ exposedField MFNode children []
+]
+[ "urn:inet:gpac:builtin:Untransform"]
+
+
+
+#######################################################################################
+# Main Scene
+#######################################################################################
+
+DEF GPAC_UI OrderedGroup {
+ children [
+ Background2D { backColor 1 1 1}
+
+ DEF MovieControl MediaControl {}
+ DEF MovieSensor MediaSensor {}
+ DEF Movie Transform2D {
+ children [
+ Inline { url ""}
+ ]
+ }
+
+ DEF UI_ROOT Untransform {
+ children [
+ ]
+ }
+
+ DEF GUIScript Script {
+ field SFNode root USE GPAC_UI
+ field SFNode ui_root USE UI_ROOT
+ field SFNode movie USE Movie
+ field SFNode movie_ctrl USE MovieControl
+ field SFNode movie_sensor USE MovieSensor
+
+ url "gui_old.js"
+ }
+ ]
+}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Authors:
+// Jean Le Feuvre, Telecom ParisTech
+// Jean-Claude Dufourd, Telecom ParisTech
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+function new_extension()
+{
+ var obj = new Object();
+ obj.type = 'extension';
+ return obj;
+}
+
+function on_movie_duration(value)
+{
+ UPnP.MovieDuration = value;
+}
+
+function on_movie_time(value)
+{
+ UPnP.MovieTime = value;
+ current_time = value;
+}
+
+//function filter_event(evt)
+//{
+// alert('event');
+//}
+
+//Initialize the main UI script
+function initialize() {
+ //var icon;
+ var i, count, wid;
+
+ gpac.caption = 'Osmo4';
+ current_time = 0;
+
+ display_width = parseInt( gpac.getOption('General', 'LastWidth') );
+ display_height = parseInt( gpac.getOption('General', 'LastHeight') );
+
+ if (!gpac.fullscreen && display_width && display_height) {
+ gpac.set_size(display_width, display_height);
+ } else {
+ display_width = gpac.get_screen_width();
+ display_height = gpac.get_screen_height();
+ }
+
+ //request event listeners on the window - GPAC specific BIFS extensions !!!
+ root.addEventListener('resize', on_resize, 0);
+ root.addEventListener('zoom', on_zoom, 0);
+ root.addEventListener('scroll', on_scroll, 0);
+
+ Browser.addRoute(movie_sensor, 'mediaDuration', movie_sensor, on_movie_duration);
+ Browser.addRoute(movie_sensor, 'mediaCurrentTime', movie_sensor, on_movie_time);
+ // gpac.set_event_filter(filter_event);
+
+ widget_default_size = 200;
+ scene_width = 0;
+
+ icon_size = 48;
+ dock_height = 48;
+ info_height = 32;
+ toggle_bar_height = 16;
+ screen_dpi = gpac.get_horizontal_dpi();
+
+ widget_remote_candidate = null;
+ controlled_renderer = null;
+ has_upnp = eval("(typeof(UPnP) != 'undefined');");
+ if (has_upnp) {
+ UPnP.onMediaRendererAdd = onMediaRendererAdd;
+ UPnP.onMediaConnect = onMediaConnect;
+ UPnP.onMediaStop = onMediaStop;
+ UPnP.onMediaPause = onMediaPause;
+ UPnP.onMediaPlay = onMediaPlay;
+ UPnP.onMediaSeek = OnMediaSeek;
+ UPnP.onMigrate = OnMediaMigrate;
+ UPnP.BindRenderer();
+ upnp_renders = null;
+ UPnP.MovieURL = '';
+ UPnP.MovieDuration = 0.0;
+ UPnP.MovieTime = 0.0;
+ }
+
+ /*setup dock*/
+ widget_ui_visible = false;
+
+ /*widget subtree*/
+ widget_display = new SFNode('Transform2D');
+ ui_root.children[0] = widget_display;
+
+ /*widget manager page*/
+ widget_ui = new SFNode('Layer2D');
+ ui_root.children[1] = widget_ui;
+
+ /*all other UI elements subtree*/
+ dlg_display = new SFNode('Transform2D');
+ ui_root.children[2] = dlg_display;
+
+ infobar = text_label('', 'MIDDLE');
+ ui_root.children[3] = infobar;
+
+ /*our dock*/
+ dock = new SFNode('Transform2D');
+ ui_root.children[4] = dock;
+
+
+ nb_widgets_on_screen = 0;
+ first_visible_widget = 0;
+ setup_icons();
+
+ /*init the widget manager*/
+ Browser.loadScript('mpegu-core.js', true);
+ log_level = l_inf;
+ widget_manager_init();
+
+ if (typeof(WidgetManager) != 'undefined') {
+ WidgetManager.on_widget_remove = widget_remove;
+ WidgetManager.on_widget_add = widget_insert;
+ WidgetManager.coreOutSetSize = widget_request_size;
+ WidgetManager.coreOutShow = widget_request_show;
+ WidgetManager.coreOutHide = widget_request_hide;
+ WidgetManager.coreOutRequestActivate = widget_request_activate;
+ WidgetManager.coreOutRequestDeactivate = widget_request_deactivate;
+ WidgetManager.coreOutShowNotification = widget_request_notification;
+ WidgetManager.coreOutPlaceComponent = widget_place_component;
+ WidgetManager.coreOutGetAttention = widget_request_attention;
+
+ WidgetManager.coreOutInstallWidget = widget_request_install;
+ WidgetManager.coreOutMigrateComponent = widget_migrate_component;
+ WidgetManager.coreOutRequestMigrationTargets = widget_migration_targets;
+ WidgetManager.coreOutActivateTemporaryWidget = widget_activate_temporary_widget;
+
+ /*restore our widgets*/
+ widgets_init();
+ }
+
+
+ /*init all extensions*/
+ var list = gpac.enum_directory('extensions', '*', 0);
+ for (i=0; i<list.length; i++) {
+ if (list[i].directory) {
+ var extension = new_extension();
+ extension.path = gpac.current_path + 'extensions/' + list[i].name+'/';
+ log(l_inf, 'Loading UI extension '+list[i].name);
+ Browser.loadScript('extensions/'+list[i].name+'/init.js', true);
+ setup_extension(extension);
+
+ if (extension.icon && extension.launch) {
+ var icon = icon_button(extension.path+extension.icon, extension.label, 0);
+ icon.extension = extension;
+ icon.button_click = function () { this.extension.launch(this.extension); }
+ dock.children[dock.children.length] = icon;
+ }
+ }
+ }
+
+ current_url = '';
+ //let's do the layout
+ layout();
+
+ // set_movie_url("rtsp://localhost/video.mp4", 1, 0);
+}
+
+
+function gpacui_add_icon(icon_url, label, callback)
+{
+ var icon = icon_button(icon_url, label, 0);
+ icon.button_click = callback;
+ dock.children[dock.children.length] = icon;
+}
+
+function gpacui_show_window(obj)
+{
+ dlg_display.addChildren[0] = obj;
+ layout();
+}
+function gpacui_hide_window(obj)
+{
+ dlg_display.removeChildren[0] = obj;
+ layout();
+}
+
+
+
+function set_movie_url(url, set_local, set_remote)
+{
+ if (set_remote && (controlled_renderer==null) ) set_local = true;
+ if (set_local) {
+ movie.children[0].url[0] = url;
+ movie_ctrl.url[0] = url;
+ movie_sensor.url[0] = url;
+ if (has_upnp) UPnP.MovieURL = url;
+ }
+ if (set_remote && (controlled_renderer!=null) ) {
+ var uri = UPnP.ShareResource(url);
+ controlled_renderer.Open(uri);
+ }
+ current_url = url;
+}
+
+
+function new_timeout(time)
+{
+ var obj = new SFNode('TimeSensor');
+
+ obj.cycleInterval = time;
+ obj.start = function(when) {
+ var t = this.getTime();
+ this.startTime = when + this.getTime();
+ }
+ obj.stop = function(when) {
+ this.stopTime = when + this.getTime();
+ }
+ obj.on_event = null;
+ obj.event = function(val) {
+ if (this.on_event) this.on_event(val);
+ }
+ Browser.addRoute(obj, 'fraction_changed', obj, obj.event);
+ return obj;
+}
+
+function rectangle()
+{
+ var obj = new SFNode('Shape');
+
+ obj.appearance = new SFNode('Appearance');
+ obj.appearance.material = new SFNode('Material2D');
+ obj.appearance.material.filled = TRUE;
+ obj.appearance.material.emissiveColor = new SFColor(0.7, 0.7, 0.8);
+ obj.appearance.material.lineProps = new SFNode('LineProperties');
+ obj.appearance.material.lineProps.width = 2;
+ obj.appearance.material.lineProps.lineColor = new SFColor(0, 0, 0);
+
+ obj.geometry = new SFNode('Curve2D');
+ obj.geometry.point = new SFNode('Coordinate2D');
+ temp = obj.geometry.type;
+ temp[0] = 7;
+ temp[1] = 1;
+ temp[2] = 7;
+ temp[3] = 1;
+ temp[4] = 7;
+ temp[5] = 1;
+ temp[6] = 7;
+ temp[7] = 6;/*close*/
+
+ obj.set_size = function(w, h) {
+ var hw, hh, rx, ry;
+ var temp;
+ hw = w/2;
+ hh = h/2;
+
+ /*compute default rx/ry*/
+ ry = rx = 10;
+ if ( (2*rx>=hw) || (2*ry>=hh)) rx = ry = 6;
+
+ temp = this.geometry.point.point;
+ temp[0] = new SFVec2f(hw-rx, hh);
+ temp[1] = new SFVec2f(hw, hh);/*bezier ctrl point*/
+ temp[2] = new SFVec2f(hw, hh-ry);
+ temp[3] = new SFVec2f(hw, -hh+ry);
+ temp[4] = new SFVec2f(hw, -hh);/*bezier control point*/
+ temp[5] = new SFVec2f(hw-rx, -hh);
+ temp[6] = new SFVec2f(-hw+rx, -hh);
+ temp[7] = new SFVec2f(-hw, -hh);/*bezier control point*/
+ temp[8] = new SFVec2f(-hw, -hh+ry);
+ temp[9] = new SFVec2f(-hw, hh-ry);
+ temp[10] = new SFVec2f(-hw, hh);/*bezier control point*/
+ temp[11] = new SFVec2f(-hw+rx, hh);
+ }
+ obj.set_color = function(r, g, b) {
+ this.appearance.material.emissiveColor.r = r;
+ this.appearance.material.emissiveColor.g = g;
+ this.appearance.material.emissiveColor.b = b;
+ }
+ return obj;
+}
+
+function icon_button(url, label, no_back)
+{
+ var obj = new SFNode('Transform2D');
+ obj.visible = true;
+ obj.children[0] = new SFNode('Transform2D');
+ obj.children[0].scale.x = 0;
+ obj.children[0].children[0] = rectangle();
+
+ obj.children[1] = new SFNode('Layer2D');
+ obj.children[1].size.x = icon_size;
+ obj.children[1].size.y = icon_size;
+ obj.children[1].children[0] = new SFNode('Inline');
+ obj.children[1].children[0].url[0] = url;
+
+ obj.touch = new SFNode('TouchSensor');
+ obj.children[1].children[1] = obj.touch;
+ obj.button_click = NULL;
+ obj.down = false;
+ obj.over = false;
+ obj.on_active = function(value) {
+ if (value) {
+ this.down = true;
+ } else {
+ if (this.down && this.over && this.button_click) this.button_click();
+ this.down = false;
+ }
+ };
+ obj.button_over = on_icon_over;
+ obj.on_over = function(value) {
+ this.over = value;
+ if (!no_back)
+ this.children[0].scale.x = value ? 1 : 0;
+ if (this.button_over) this.button_over(value);
+ };
+ Browser.addRoute(obj.touch, 'isOver', obj, obj.on_over);
+ Browser.addRoute(obj.touch, 'isActive', obj, obj.on_active);
+ obj.label = label;
+ obj.hide = function() { this.scale.x = this.scale.y = 0; this.visible = false; };
+ obj.show = function() { this.scale.x = this.scale.y = 1; this.visible = true; };
+ obj.set_size = function(x, y) {
+ this.children[0].children[0].set_size(x, y);
+ this.children[1].size.x = x;
+ this.children[1].size.y = y;
+ };
+ return obj;
+}
+
+function text_label(label, justify)
+{
+ var obj = new SFNode('Transform2D');
+ obj.children[0] = new SFNode('Shape');
+ obj.children[0].appearance = new SFNode('Appearance');
+ obj.children[0].appearance.material = new SFNode('Material2D');
+ obj.children[0].appearance.material.filled = TRUE;
+ obj.children[0].appearance.material.emissiveColor = new SFColor(0, 0, 0);
+ obj.children[0].geometry = new SFNode('Text');
+ obj.children[0].geometry.string[0] = label;
+ obj.children[0].geometry.fontStyle = new SFNode('FontStyle');
+ obj.children[0].geometry.fontStyle.justify[0] = justify;
+ obj.children[0].geometry.fontStyle.justify[1] = 'MIDDLE';
+ obj.children[0].geometry.fontStyle.size = 20;
+ obj.set_label = function(value) {
+ this.children[0].geometry.string[0] = value;
+ }
+ return obj;
+}
+
+
+function text_rect(label)
+{
+ var obj = new SFNode('Transform2D');
+ obj.children[0] = rectangle();
+ obj.children[0].set_color(0.7, 0.7, 0.8);
+
+ obj.children[1] = new SFNode('Shape');
+ obj.children[1].appearance = new SFNode('Appearance');
+ obj.children[1].appearance.material = new SFNode('Material2D');
+ obj.children[1].appearance.material.filled = TRUE;
+ obj.children[1].appearance.material.emissiveColor = new SFColor(0, 0, 0);
+ obj.children[1].geometry = new SFNode('Text');
+ obj.children[1].geometry.string[0] = label;
+ obj.children[1].geometry.fontStyle = new SFNode('FontStyle');
+ obj.children[1].geometry.fontStyle.justify[0] = 'MIDDLE';
+ obj.children[1].geometry.fontStyle.justify[1] = 'MIDDLE';
+ obj.children[1].geometry.fontStyle.size = 20;
+ obj.children[2] = new SFNode('TouchSensor');
+
+ obj.set_size = function(w, h) {
+ this.children[0].set_size(w, h);
+ };
+
+
+ obj.over = false;
+ obj.on_over = function(value) {
+ this.children[0].set_color(0.7, value ? 0.5 : 0.7, 0.8);
+ this.over = value;
+ };
+ Browser.addRoute(obj.children[2], 'isOver', obj, obj.on_over);
+
+ obj.down = false;
+ obj.button_click = null;
+ obj.on_active = function(value) {
+ if (value) {
+ this.down = true;
+ } else {
+ if (this.down && this.over && this.button_click) this.button_click();
+ this.down = false;
+ }
+ };
+ Browser.addRoute(obj.children[2], 'isActive', obj, obj.on_active);
+
+ return obj;
+}
+
+function new_slider(vertical)
+{
+ var obj = new SFNode('Transform2D');
+ obj.children[0] = new SFNode('Shape');
+ obj.children[0].appearance = new SFNode('Appearance');
+ obj.children[0].appearance.material = new SFNode('Material2D');
+ obj.children[0].appearance.material.filled = TRUE;
+ obj.children[0].appearance.texture = new SFNode('LinearGradient');
+ obj.children[0].appearance.texture.endPoint.x = vertical ? 1 : 0;
+ obj.children[0].appearance.texture.endPoint.y = vertical ? 0 : 1;
+ obj.children[0].appearance.texture.key[0] = 0;
+ obj.children[0].appearance.texture.key[1] = 0.5;
+ obj.children[0].appearance.texture.key[2] = 1;
+ obj.children[0].appearance.texture.keyValue[0] = new SFColor(0.4, 0.4, 0.6);
+ obj.children[0].appearance.texture.keyValue[1] = new SFColor(0.4, 0.4, 1);
+ obj.children[0].appearance.texture.keyValue[2] = new SFColor(0.4, 0.4, 0.6);
+ obj.children[0].geometry = new SFNode('Rectangle');
+
+ obj.children[1] = new SFNode('Transform2D');
+ obj.children[1].children[0] = new SFNode('Shape');
+ obj.children[1].children[0].appearance = new SFNode('Appearance');
+ obj.children[1].children[0].appearance.material = new SFNode('Material2D');
+ obj.children[1].children[0].appearance.material.filled = TRUE;
+ obj.children[1].children[0].appearance.material.emissiveColor = new SFColor(0, 0, 1);
+ obj.children[1].children[0].geometry = new SFNode('Circle');
+
+ obj.on_slide = function(value) { }
+ obj.children[2] = new SFNode('PlaneSensor2D');
+ obj.set_translation = function(value) {
+ this.frac = 0.5 + (vertical ? value.y/this.height : value.x/this.width);
+ this.children[1].translation = value;
+ this.on_slide(this.min + (this.max-this.min) * this.frac);
+ }
+ Browser.addRoute(obj.children[2], 'translation_changed', obj, obj.set_translation);
+
+
+ obj.set_value = function(value) {
+ value -= this.min;
+ if (value<0) value = 0;
+ else if (value>this.max-this.min) value = this.max-this.min;
+ if (this.max==this.min) value = 0;
+ else value /= (this.max-this.min);
+
+ value -= 0.5;
+ value *= (vertical ? this.height : this.width);
+
+ if (vertical) {
+ this.children[1].translation.y = value;
+ this.children[2].offset.y = value;
+ } else {
+ this.children[1].translation.x = value;
+ this.children[2].offset.x = value;
+ }
+ }
+
+ obj.radius = 10;
+ obj.vertical = vertical;
+ obj.set_size = function(w, h) {
+ var rad;
+ this.children[0].geometry.size.x = w;
+ this.children[0].geometry.size.y = h;
+ rad = vertical ? w : h;
+ rad/=1.33;
+ this.children[1].children[0].geometry.radius = rad;
+ this.children[2].maxPosition.x = this.vertical ? 0 : w/2;
+ this.children[2].maxPosition.y = this.vertical ? h/2 : 0;
+ this.children[2].minPosition.x = this.vertical ? 0 : -w/2;
+ this.children[2].minPosition.y = this.vertical ? -h/2 : 0;
+ this.width = w;
+ this.height = h;
+ }
+ obj.min = 0;
+ obj.max = 100;
+
+ obj.set_size(vertical ? 10 : 200, vertical ? 200 : 10);
+ return obj;
+}
+
+function new_radio_button(label)
+{
+ var obj = new SFNode('Transform2D');
+ obj.children[0] = new SFNode('Shape');
+ obj.children[0].appearance = new SFNode('Appearance');
+ obj.children[0].appearance.material = new SFNode('Material2D');
+ obj.children[0].appearance.material.filled = TRUE;
+ obj.children[0].appearance.material.emissiveColor = new SFColor(1, 1, 1);
+ obj.children[0].appearance.material.lineProps = new SFNode('LineProperties');
+ obj.children[0].appearance.material.lineProps.lineColor = new SFColor(0, 0, 0);
+ obj.children[0].appearance.material.lineProps.width = 1;
+ obj.children[0].geometry = new SFNode('Circle');
+
+ obj.children[1] = new SFNode('Shape');
+ obj.children[1].appearance = new SFNode('Appearance');
+ obj.children[1].appearance.material = new SFNode('Material2D');
+ obj.children[1].appearance.material.filled = TRUE;
+ obj.children[1].appearance.material.emissiveColor = new SFColor(0, 0, 0);
+ obj.children[1].appearance.material.transparency = 1;
+ obj.children[1].geometry = new SFNode('Circle');
+
+ obj.children[2] = text_label(label, 'BEGIN');
+
+ obj.children[3] = new SFNode ('TouchSensor');
+
+ obj.on = false;
+ obj.on_select = function(value) {}
+ obj.on_active = function(value) {
+ if (!value) return;
+ this.on = !this.on;
+ this.children[1].appearance.material.transparency = this.on ? 0 : 1;
+ this.on_select(this.on);
+ }
+ Browser.addRoute(obj.children[3], 'isActive', obj, obj.on_active);
+
+ obj.enable = function(value) {
+ this.on = value;
+ this.children[1].appearance.material.transparency = this.on ? 0 : 1;
+ }
+
+ obj.set_width = function(w, h) {
+ var rad = w<h ? w : h;
+ rad /= 2;
+ this.children[0].geometry.radius = rad;
+ this.children[1].geometry.radius = rad/2;
+ this.children[2].translation.x = 2*rad;
+ }
+ obj.set_width(100, 10);
+ return obj;
+}
+
+function new_widget_control(widget)
+{
+ var obj = new SFNode('Transform2D');
+
+ obj.children[0] = new SFNode('Transform2D');
+
+ obj.children[0].children[0] = rectangle();
+
+ obj.children[0].children[1] = new SFNode('TouchSensor');
+
+ obj.widget = widget;
+ obj.component_bound=false;
+ obj.show_ctrl = true;
+ obj.onClick = function(value) {
+ if (!value) return;
+ this.show_ctrl = !this.show_ctrl;
+ if (this.show_ctrl) {
+ var i, comps, idx;
+ this.children[0].children[0].appearance.material.transparency = 0;
+ this.children[1].scale.x = 1;
+ this.children[3].scale.x = 1;
+
+ for (i=0; i<widget_display.children.length; i++) {
+ if (widget_display.children[i]==this) continue;
+ if (widget_display.children[i].show_ctrl) {
+ widget_display.children[i].onClick(true);
+ }
+ }
+ //widget is a component, do not push on top but hide some controls
+ if (this.widget.is_component) {
+ if (this.component_bound) {
+ this.children[1].children[0].hide(); //close
+ this.children[1].children[1].hide(); //remove
+ this.children[1].children[4].hide(); //resize
+ }
+ return;
+ }
+ //otherwise push widget on top
+ idx=0;
+ widget_display.removeChildren[idx++] = this;
+ widget_display.addChildren[idx++] = this;
+ //and push components
+ comps = this.widget.components;
+ for (i=0; i<comps.length; i++) {
+ if (comps[i].widget_control && comps[i].widget_control.component_bound) {
+ widget_display.removeChildren[idx++] = comps[i].widget_control;
+ widget_display.addChildren[idx++] = comps[i].widget_control;
+ }
+ }
+
+ } else {
+ this.children[0].children[0].appearance.material.transparency = 1;
+ this.children[1].scale.x = 0;
+ this.children[3].scale.x = 0;
+ }
+ }
+ Browser.addRoute(obj.children[0].children[1], 'isActive', obj, obj.onClick);
+
+ obj.children[1] = new SFNode('Transform2D');
+ obj.children[1].children[0] = icon_button('icons/process-stop.svg', 'Close', 0);
+ obj.children[1].children[0].widget = widget;
+ obj.children[1].children[0].button_click = function() {
+ if (this.widget.discardable) widget_remove(this.widget);
+ else widget_close(this.widget, 0);
+ }
+
+ obj.children[1].children[1] = icon_button('icons/user-trash.svg', 'Uninstall', 0);
+ obj.children[1].children[1].widget = widget;
+ obj.children[1].children[1].button_click = function() { widget_remove(this.widget); }
+
+ obj.children[1].children[2] = icon_button('icons/applications-internet.svg', 'Push to remote display', 0);
+ obj.children[1].children[2].widget = widget;
+ obj.children[1].children[2].button_click = function() {
+ if (has_upnp && UPnP.MediaRenderersCount) {
+ widget_remote_candidate = this.widget;
+ on_upnpopen(true, true);
+ }
+ }
+
+ obj.children[1].children[3] = icon_button('icons/dialog-information.svg', 'Widget Information', 0);
+ obj.children[1].children[3].widget = widget;
+ obj.children[1].children[3].button_click = function() {
+ display_widget_info(this.widget);
+ }
+
+ obj.children[1].children[4] = icon_button('icons/media-record.svg', 'Resize', 1);
+ obj.children[1].children[4].children[1].children[2] = new SFNode('PlaneSensor2D');
+ obj.children[1].children[4].children[1].children[2].maxPosition = new SFVec2f(-1, -1);
+
+ obj.prev_x=0;
+ obj.prev_y=0;
+ obj.onSize = function(value) {
+ if (this.widget.width + 2*(value.x - this.prev_x)<0) return;
+ if (this.widget.height + 2*(this.prev_y-value.y)<0) return;
+
+ this.widget.width += 2*(value.x - this.prev_x);
+ this.prev_x = value.x;
+ this.widget.height += 2*(this.prev_y - value.y);
+ this.prev_y = value.y;
+ this.set_size(this.widget.width, this.widget.height);
+ }
+ Browser.addRoute(obj.children[1].children[4].children[1].children[2], 'translation_changed', obj, obj.onSize);
+
+ obj.children[2] = new SFNode('Layer2D');
+ obj.inline = new SFNode('Inline');
+ obj.children[2].children[0] = obj.inline;
+
+
+ obj.children[3] = new SFNode('Transform2D');
+ obj.children[3].children[0] = new SFNode('Shape');
+ obj.children[3].children[0].appearance = new SFNode('Appearance');
+ obj.children[3].children[0].appearance.material = new SFNode('Material2D');
+ obj.children[3].children[0].appearance.material.filled = TRUE;
+ obj.children[3].children[0].appearance.material.transparency = 0.5;
+ obj.children[3].children[0].appearance.material.emissiveColor = new SFColor(0.6, 0.6, 0.6);
+ obj.children[3].children[0].geometry = new SFNode('Rectangle');
+ obj.children[3].children[0].geometry.size = new SFVec2f(50, 50);
+ obj.children[3].children[1] = new SFNode('PlaneSensor2D');
+ obj.children[3].children[1].maxPosition = new SFVec2f(-1, -1);
+ obj.children[3].children[1].offset = new SFVec2f(widget.x, widget.y);
+ obj.onMove = function(value) {
+ if (this.maximized) return;
+ this.translation = value;
+ this.widget.x = value.x;
+ this.widget.y = value.y;
+ this.refresh_layout(false, null);
+ }
+ Browser.addRoute(obj.children[3].children[1], 'translation_changed', obj, obj.onMove);
+
+ obj.children[3].children[2] = new SFNode('TouchSensor');
+ obj.last_ts = 0;
+ obj.onMaximize = function(value, timestamp) {
+ if (!value) return;
+ if (timestamp - this.last_ts < 0.5) {
+ if (this.maximized) {
+ this.maximized = false;
+ this.translation.x = this.widget.x;
+ this.translation.y = this.widget.y;
+ this.set_size(this.prev_width, this.prev_height);
+ } else {
+ this.maximized = true;
+ this.prev_width = this.widget.width;
+ this.prev_height = this.widget.height;
+ this.translation.x = 0;
+ this.translation.y = -info_height;
+ this.set_size(display_width, display_height - 2*info_height);
+ }
+ }
+ this.last_ts = timestamp;
+ }
+ Browser.addRoute(obj.children[3].children[2], 'isActive', obj, obj.onMaximize);
+
+ obj.set_size = function(w, h) {
+ var i, x, s;
+ s = 24;
+ this.children[2].size.x = w;
+ this.children[2].size.y = h;
+
+ this.children[1].children[0].translation.y = this.children[1].children[1].translation.y = this.children[1].children[2].translation.y = this.children[1].children[3].translation.y = this.children[1].children[4].translation.y = h/2 + s/2;
+
+ this.children[0].children[0].set_size(w+s, h+s);
+ this.children[3].children[0].geometry.size.x = w;
+ this.children[3].children[0].geometry.size.y = h;
+
+ this.children[1].children[0].set_size(s, s);
+ this.children[1].children[1].set_size(s, s);
+ this.children[1].children[2].set_size(s, s);
+ this.children[1].children[3].set_size(s, s);
+ this.children[1].children[4].set_size(s, s);
+ this.children[1].children[0].translation.x = -w/2;
+ this.children[1].children[1].translation.x = -w/4;
+ this.children[1].children[2].translation.x = 0;
+ this.children[1].children[3].translation.x = w/4;
+ this.children[1].children[4].translation.x = w/2;
+
+ //set widget input params
+ widget.width = w;
+ widget.height = h;
+ widget.set_input('width', w);
+ widget.set_input('height', h);
+ this.refresh_layout(true, null);
+ //call core:in
+ WidgetManager.corein_message(widget, 'setSize', 'width', w, 'height', w, 'dpi', screen_dpi);
+ }
+ obj.refresh_layout = function(send_resize, comp_target) {
+ var i;
+ var x, y, w, h, scale_x, scale_y;
+ var comps;
+
+ /*local to subscene transformation not known*/
+ if (!this.sub_w) return;
+ if (!this.sub_h) return;
+
+ comps = this.widget.components;
+ for (i=0; i<comps.length; i++) {
+ var comp = comps[i];
+ if (!comp.widget_control || !comp.widget_control.component_bound) continue;
+
+ //compute scale from Widget Manager coord system to widget internal coordinate system
+ scale_x = this.sub_vp_w / this.sub_w;
+ scale_y = this.sub_vp_h / this.sub_h;
+
+ w = comp.widget_control.place_w * scale_x;
+ h = comp.widget_control.place_h * scale_y;
+
+ x = this.translation.x - this.widget.width/2 + this.sub_vp_x + comp.widget_control.place_x * scale_x + w/2;
+ comp.widget_control.translation.x = x;
+
+ y = this.widget.height/2 + this.translation.y - h/2 - this.sub_vp_y - comp.widget_control.place_y * scale_y;
+ comp.widget_control.translation.y = y;
+
+ if (send_resize || (comp_target==comp))
+ comp.widget_control.set_size(w, h);
+ }
+ }
+
+ obj.hide = function() {
+ this.scale.x = 0;
+ WidgetManager.corein_message(this.widget, 'hide');
+ }
+ obj.show = function() {
+ this.scale.x = 1;
+ WidgetManager.corein_message(this.widget, 'show');
+ }
+
+ obj.show_remote = function () {
+ if (WidgetManager.upnp && UPnP.MediaRenderersCount) {
+ this.children[1].children[2].show();
+ } else {
+ this.children[1].children[2].hide();
+ }
+ }
+ obj.show_remove = function(show) {
+ if (show) this.children[1].children[1].show();
+ else this.children[1].children[1].hide();
+ }
+
+ obj.flash = function() {
+ var time = new_timeout(0.25);
+ time.loop = true;
+ time.ctrl = this;
+ time.on_event = function(val) {
+ var scale = (val<0.5) ? 1+val : 2-val;
+ this.ctrl.scale.x = this.ctrl.scale.y = scale;
+ }
+ time.stop(1);
+ time.start(0);
+ }
+ obj.maximized = false;
+ obj.show_remote();
+ obj.onClick(true);
+ return obj;
+}
+
+
+
+function on_icon_over(value)
+{
+ infobar.set_label(value ? this.label : '');
+}
+
+function display_widget_info(wid)
+{
+ var info_dlg = new SFNode('Transform2D');
+ var i, j, k, info;
+ var y, txt, pref;
+
+ infobar.set_label('Widget ' + wid.name + ' Information');
+
+ info = text_rect('Close');
+ info_dlg.children[0] = info;
+ info.button_click = function() {
+ dlg_display.children.length = 0;
+ widget_display.scale.x = 1;
+ infobar.set_label('');
+ layout();
+ }
+
+ info = text_rect('Widget Metadata');
+ info_dlg.children[info_dlg.children.length] = info;
+ info.visible = false;
+ info.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ i=3;
+ info.children[i++] = text_label('id: ' + wid.identifier + ' - shortname: '+wid.shortName + ' - name: '+wid.name, 'BEGIN');
+ info.children[i++] = text_label('version: '+wid.version, 'BEGIN');
+ info.children[i++] = text_label('content type: ' + wid.mainMimeType + ' - content encoding: '+wid.mainEncoding, 'BEGIN');
+ info.children[i++] = text_label('default size: Width = ' + wid.defaultWidth + ' Height = '+wid.defaultHeight, 'BEGIN');
+ info.children[i++] = text_label('license: '+wid.license, 'BEGIN');
+ info.children[i++] = text_label('license ref: '+wid.licenseHref, 'BEGIN');
+ info.children[i++] = text_label('description: '+wid.description, 'BEGIN');
+ info.children[i++] = text_label('author name: '+wid.authorName + ' (mail: '+wid.authorEmail+')', 'BEGIN');
+ info.children[i++] = text_label('author href: '+wid.authorHref, 'BEGIN');
+ info.children[i++] = text_label('view modes: '+wid.viewmodes, 'BEGIN');
+ info.children[i++] = text_label('UUID: '+wid.uuid, 'BEGIN');
+ info.children[i++] = text_label('Discardable: '+wid.discardable, 'BEGIN');
+ info.children[i++] = text_label('Muliple Instances: '+wid.discardable, 'BEGIN');
+ var icons = wid.icons;
+ for (j=0; j<icons.length; j++) {
+ info.children[i++] = text_label('icon #'+(j+1)+': ' + icons[j].src, 'BEGIN');
+ }
+
+ info = text_rect('Widget Manager Info');
+ info_dlg.children[info_dlg.children.length] = info;
+ info.visible = false;
+ info.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ i=3;
+ info.children[i++] = text_label('nb instances: '+wid.num_instances + ' nb components: '+wid.num_components, 'BEGIN' );
+ info.children[i++] = text_label('Permanently installed: '+wid.permanent + ' - is component: '+wid.is_component, 'BEGIN' );
+ if (wid.is_component) {
+ info.children[i++] = text_label('parent widget name' + wid.parent.name, 'BEGIN');
+ }
+ if (wid.originating_device_ip) {
+ info.children[i++] = text_label('Widget was pushed from device IP '+wid.originating_device_ip, 'BEGIN' );
+ }
+ info.children[i++] = text_label('Section name in GPAC config file: '+wid.section, 'BEGIN' );
+ info.children[i++] = text_label('UA Locale: ' + gpac.getOption('Systems', 'LanguageName') + ' ('+ gpac.getOption('Systems', 'Language2CC')+ ')', 'BEGIN' );
+ info.children[i++] = text_label('widget src: ' + wid.url , 'BEGIN');
+ info.children[i++] = text_label('config src: ' + wid.manifest , 'BEGIN');
+ info.children[i++] = text_label('content src : '+wid.localizedSrc, 'BEGIN' );
+
+ pref = wid.features;
+ info = text_rect('Features (' + pref.length + ')' );
+ info_dlg.children[info_dlg.children.length] = info;
+ info.visible = false;
+ info.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ i=3;
+ for (j=0; j<pref.length; j++) {
+ info.children[i++] = text_label('Feature #'+(j+1)+' name=\''+pref[j].name+'\' required=\''+pref[j].required+'\'', 'BEGIN');
+ }
+
+
+ pref = wid.preferences;
+ info = text_rect('Preferences ('+pref.length+')');
+ info_dlg.children[info_dlg.children.length] = info;
+ info.visible = false;
+ info.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ i=3;
+ for (j=0; j<pref.length; j++) {
+ var val = pref[j].value;
+ if (val=='') val = gpac.getOption(wid.section, pref[j].name);
+ info.children[i++] = text_label('Preference #'+(j+1)+' name=\''+pref[j].name+'\' value=\''+val+'\' readOnly=\''+pref[j].readonly +'\'', 'BEGIN');
+ }
+
+ info = text_rect('Migration Context', 'BEGIN');
+ info_dlg.children[info_dlg.children.length] = info;
+ info.visible = false;
+ info.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ i=3;
+ txt=wid.get_context();
+ while (1) {
+ var idx = txt.indexOf('\n', 0);
+ if (idx>0) {
+ info.children[i++] = text_label(txt.substring(0, idx), 'BEGIN');
+ txt = txt.substring(idx+1, txt.length);
+ } else {
+ info.children[i++] = text_label(txt, 'BEGIN');
+ break;
+ }
+ }
+
+ info_dlg.ifce_idx = info_dlg.children.length;
+ info = text_rect('Interfaces (count: ' + wid.num_interfaces + ' - bound: ' + wid.num_bound_interfaces+')', 'BEGIN');
+ info_dlg.children[info_dlg.ifce_idx] = info;
+ info.visible = false;
+ info.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ i=3;
+ for (j=0; j<wid.num_interfaces; j++) {
+ var idx;
+ var ifce = wid.get_interface(j);
+ var item = text_rect('Interface #' + (j+1) + ' type: '+ifce.type);
+ info.children[i++] = item;
+ item.visible = false;
+ item.button_click = function() {
+ this.visible = !this.visible;
+ layout();
+ }
+ idx=3;
+ item.children[idx++] = text_label('Multiple Binding: '+ifce.multipleBinding + ' - Service provider: '+ ifce.serviceProvider + ' - bound: ' + wid.is_interface_bound(ifce) , 'BEGIN');
+ for (k=0; k<ifce.num_messages; k++) {
+ var string, l;
+ var msg = ifce.get_message(k);
+ string = ' Message #'+ (k+1) + ': ' + msg.name + '(';
+ for (l=0; l<msg.num_params; l++) {
+ par = msg.get_param(l);
+ string += (par.is_input ? 'in' : 'out') + ':' +par.name + ' ';
+ }
+ string += ')';
+ item.children[idx++] = text_label(string, 'BEGIN');
+ }
+ }
+
+ info_dlg.set_size = function(w, h) {
+ var i, j, y, dy;
+ y = h/2 - 20;
+
+ for (i=0; i<this.children.length; i++) {
+ var item = this.children[i];
+ item.translation.x = 0;
+ item.translation.y = y;
+ item.set_size(w, 20);
+ y -= 20;
+ if (!i) continue;
+
+ dy = 0;
+ for (j=3; j<item.children.length; j++) {
+ if (item.visible) {
+ item.children[j].scale.x = 1;
+ dy -= 20;
+ item.children[j].translation.y = dy;
+ if (i<this.ifce_idx) {
+ item.children[j].translation.x = -w/2+10;
+ } else {
+ item.children[j].set_size(w-20, 20);
+ var ddy=0;
+ var k, sitem;
+ sitem = item.children[j];
+ for (k=3; k<sitem.children.length; k++) {
+ if (item.children[j].visible) {
+ sitem.children[k].scale.x = 1;
+ sitem.children[k].translation.x = -w/2+10;
+ ddy -= 20;
+ sitem.children[k].translation.y = ddy;
+ } else {
+ sitem.children[k].scale.x = 0;
+ }
+ }
+ dy+=ddy;
+ }
+ } else {
+ item.children[j].scale.x = 0;
+ }
+ }
+ y += dy;
+ }
+ }
+
+ dlg_display.children[0] = info_dlg;
+ widget_display.scale.x = 0;
+ layout();
+}
+
+
+function widget_insert(widget)
+{
+ /*insert the widget icon*/
+ if (widget.permanent && !widget.is_component)
+ insert_widget_icon(widget, 0);
+
+ /*and load the widget - comment this line to disable auto load of widget*/
+ widget_launch(widget);
+}
+
+function setup_icons()
+{
+ var icon;
+
+ //File open
+ icon = icon_button('icons/applications-multimedia.svg', 'Open', 0);
+ icon.button_click = on_fileopen;
+ dock.children[dock.children.length] = icon;
+
+ //Widget Manager Icon
+ icon = icon_button('icons/applications-system.svg', 'Widgets', 0);
+ icon.button_click = function () {
+ widget_ui_visible = !widget_ui_visible;
+ layout();
+ }
+ dock.children[dock.children.length] = icon;
+
+ //Widgets add Icon
+ icon = icon_button('icons/list-add.svg', 'Add Widgets', 0);
+ icon.button_click = function () {
+ widget_browse();
+ }
+ widget_ui.children[widget_ui.children.length] = icon;
+
+ icon = icon_button('icons/user-trash.svg', 'Remove all widgets', 0);
+ icon.button_click = function () {
+ while (1) {
+ var wid = WidgetManager.get(0);
+ if (wid==null) break;
+ widget_close(wid, 1);
+ }
+ widget_ui.children.length = widget_ui.nb_tools;
+ layout();
+ }
+ widget_ui.children[widget_ui.children.length] = icon;
+
+ widget_ui.prev = icon_button('icons/go-previous.svg', 'Previous Widgets', 0);
+ widget_ui.prev.button_click = function () { widget_ui_layout(-1); };
+ widget_ui.children[widget_ui.children.length] = widget_ui.prev;
+
+ widget_ui.next = icon_button('icons/go-next.svg', 'Next Widgets', 0);
+ widget_ui.next.button_click = function () { widget_ui_layout(1); };
+ widget_ui.children[widget_ui.children.length] = widget_ui.next;
+
+ widget_ui.nb_tools = widget_ui.children.length;
+
+ //push to display
+ upnp_icon = null;
+ if (has_upnp) {
+ icon = icon_button('icons/video-display.svg', 'Select Display', 0);
+ icon.button_click = function () {
+ widget_remote_candidate = null;
+ on_upnpopen(false, false);
+ }
+ upnp_icon = icon;
+ upnp_icon.hide();
+ dock.children[dock.children.length] = icon;
+ }
+
+ //exit Icon
+ icon = icon_button('icons/emblem-unreadable.svg', 'Exit', 0);
+ icon.button_click = function() { gpac.exit(); };
+ dock.children[dock.children.length] = icon;
+}
+
+
+
+/*dock layout*/
+function dock_layout() {
+ var i;
+
+ dock.translation.y = (dock_height - display_height)/2;
+ infobar.translation.y = display_height/2 - info_height/2;
+
+ num_in_dock = dock.children.length;
+ tot_len = num_in_dock*icon_size;
+
+ if (tot_len>display_width) {
+ start_x = (icon_size-display_width)/2;
+ } else {
+ start_x = (icon_size-tot_len)/2;
+ }
+ /*translate / size all items in the dock*/
+ for (i=0;i<num_in_dock; i++) {
+ if (dock.children[i].visible) {
+ dock.children[i].set_size(icon_size, icon_size);
+ dock.children[i].translation.x = start_x;
+ start_x += icon_size;
+ }
+ }
+}
+
+function widget_ui_layout(dir)
+{
+ var count, i, height, start_x, start_y, spread_x, nb_wid_h, nb_wid_v, nb_wid;
+
+ if (!widget_ui_visible) {
+ widget_ui.size.x = 0;
+ widget_ui.size.y = 0;
+ return;
+ }
+
+ widget_ui.size.x = display_width;
+ widget_ui.size.y = display_height;
+
+ start_x = (icon_size-display_width)/2;
+ start_y = (display_height-icon_size/2)/2 - info_height;
+
+ for (i=0; i<widget_ui.nb_tools; i++) {
+ wid = widget_ui.children[i];
+ wid.set_size(icon_size/2, icon_size/2);
+ wid.translation.x = start_x;
+ wid.translation.y = start_y;
+ start_x += icon_size/2;
+ }
+ start_x = (icon_size-display_width)/2;
+ start_y -= icon_size;
+
+
+ count = widget_ui.children.length - widget_ui.nb_tools;
+ if (first_visible_widget<0) first_visible_widget=0;
+
+ for (i=0; i<count; i++) {
+ var wid = widget_ui.children[widget_ui.nb_tools+i];
+ wid.hide();
+ }
+
+ nb_wid_h = Math.floor(display_width / icon_size);
+ if (!nb_wid_h) nb_wid_h=1;
+
+ height = display_height-dock_height-icon_size-icon_size/2;
+ nb_wid_v = Math.floor(height / icon_size);
+ if (!nb_wid_v) nb_wid_v=1;
+
+ spread_x = (display_width / nb_wid_h) - icon_size;
+ start_x += spread_x/2;
+
+ nb_wid = (nb_wid_h*nb_wid_v);
+ if (dir<0) {
+ first_visible_widget -= nb_wid;
+ if (first_visible_widget < 0) {
+ first_visible_widget = 0;
+ }
+ }
+ else if (dir>0) {
+ first_visible_widget += nb_wid;
+ }
+
+ if (first_visible_widget) widget_ui.prev.show();
+ else widget_ui.prev.hide();
+
+ if (first_visible_widget+nb_wid < count) widget_ui.next.show();
+ else widget_ui.next.hide();
+
+ for (i=0; i<count; i++) {
+ var wid;
+ if (i+first_visible_widget >= count) {
+ break;
+ }
+ wid = widget_ui.children[i +first_visible_widget+widget_ui.nb_tools];
+ wid.show();
+ wid.set_size(icon_size, icon_size);
+ wid.translation.x = start_x;
+ wid.translation.y = start_y;
+ start_x += icon_size + spread_x;
+ if (start_x + icon_size / 2 >= display_width/2) {
+ start_x = (icon_size-display_width)/2 + spread_x/2;
+ start_y -= icon_size;
+ }
+ nb_widgets_on_screen = i+1;
+ if (start_y - icon_size < (dock_height-display_height)/2) {
+ i++;
+ break;
+ }
+ }
+}
+
+//performs layout on all contents
+function layout() {
+ var i, list, start_x;
+
+ gpac.setOption('General', 'LastWidth', ''+display_width);
+ gpac.setOption('General', 'LastHeight', ''+display_height);
+
+ if (dlg_display.children.length) {
+ widget_display.scale.x = 0;
+ widget_ui_visible = false;
+ }
+ //layout all icons in the dock
+ dock_layout();
+ widget_ui_layout(0);
+
+ if (dlg_display.children.length) {
+ list = dlg_display.children;
+ for (i=0; i<list.length; i++) {
+ var dlg = list[i];
+ if (typeof (dlg.set_size) != 'undefined') dlg.set_size(display_width, display_height-icon_size-info_height);
+ dlg.translation.y = (icon_size-info_height)/2;
+ }
+ }
+ else if (widget_ui_visible) {
+ widget_display.scale.x = 0;
+ } else {
+ widget_display.scale.x = 1;
+ list = widget_display.children;
+ for (i=0; i<list.length; i++) {
+ var widctrl = list[i];
+ if (widctrl.maximized) {
+ widctrl.translation.y = - info_height;
+ widctrl.set_size(display_width, display_height - 2*info_height);
+ }
+ }
+ }
+}
+
+//resize event callback
+function on_resize(evt) {
+ display_width = evt.width;
+ display_height = evt.height;
+ layout();
+}
+//zoom event callback
+function on_zoom(evt) {
+ display_width = evt.width;
+ display_height = evt.height;
+ layout();
+}
+//scroll event callback
+function on_scroll(evt) {
+ layout();
+}
+
+//starts a widget
+function on_widget_launch() {
+ if (this.widget.visible) {
+ var awid;
+ if (!this.widget.multipleInstances) return;
+ awid = WidgetManager.open(this.widget.manifest, null);
+ widget_launch(awid);
+ } else {
+ widget_launch(this.widget);
+ }
+}
+
+function widget_get_icon(widget)
+{
+ var icon = 'icons/image-missing.svg';
+ var preferredIconType = '.svg';
+
+ for (var i = 0; i < widget.icons.length; i++) {
+ icon = widget.icons[i].relocated_src;
+ if (widget.icons[i].relocated_src.indexOf(preferredIconType) > 0) {
+ break;
+ }
+ }
+ return icon;
+}
+
+//initialize GPAC widget manager and load all widgets
+function widgets_init() {
+
+ count = WidgetManager.num_widgets;
+ for (i=0; i<count; i++) {
+ wid = WidgetManager.get(i);
+ if (wid == null) continue;
+ wid.device = null;
+ wid.device_ip = null;
+ if (wid.in_panel == true) {
+ icon = icon_button(widget_get_icon(wid), wid.name, 0);
+ icon.tooltip = wid.name;
+ icon.widget = wid;
+ icon.button_click = on_widget_launch;
+
+ wid.icon_dock = icon;
+ widget_ui.children[widget_ui.children.length] = wid.icon_dock;
+ }
+ if (wid.visible) {
+ widget_launch(wid);
+ }
+ }
+}
+
+function on_widget_size(value) {
+ //remember variables
+ this.width = value.x;
+ this.height = value.y;
+ //and set widget input params
+ this.set_input('width', value.x);
+ this.set_input('height', value.y);
+}
+
+function on_widget_move(value) {
+ this.x = value.x;
+ this.y = value.y;
+}
+
+//widget close function
+function widget_close(widget, force_remove)
+{
+ var is_comp = widget.is_component;
+ alert('closing widget '+widget.name + ' visible '+widget.visible);
+ if (widget.visible) {
+ widget.visible = false;
+ WidgetManager.corein_message(widget, 'hide');
+ WidgetManager.corein_message(widget, 'deactivate');
+ widget.deactivate();
+ /*force disconnect of main resource - we do this because we are not sure when the widget_control will be destroyed due to JS GC*/
+ if (widget.widget_control) {
+ widget.widget_control.inline.url[0] = "";
+ widget.widget_control.inline.url.length = 0;
+ widget.scene_container.removeChildren[0] = widget.widget_control;
+ alert('new url '+widget.widget_control.inline.url);
+ }
+ }
+ if (!is_comp && (!widget.permanent || force_remove)) {
+ WidgetManager.unload(widget, force_remove ? true : false);
+ }
+ alert('widget closed');
+}
+
+function on_widget_close(value) {
+ widget_close(this, 0);
+}
+
+//widget remove function (close and unregister)
+function widget_remove(wid) {
+ if (typeof(wid.icon_dock) != 'undefined')
+ widget_ui.removeChildren[0] = wid.icon_dock;
+ widget_close(wid, 0);
+ layout();
+}
+
+function on_widget_control(value)
+{
+ var i, count;
+ if (!value) return;
+ count = this.scene_container.children.length;
+ for (i=0; i<count; i++) {
+ if (this.scene_container.children[i] == this.widget_control) {
+ this.scene_container.removeChildren[0] = this.widget_control;
+ this.scene_container.children[this.scene_container.children.length] = this.widget_control;
+ return;
+ }
+ }
+}
+
+//widget launcher function
+function widget_launch(wid) {
+ var widg_ctrl;
+
+ //assign default size to the widget
+ if (wid.width == undefined) {
+ wid.width = wid.defaultWidth;
+ if (wid.width == 0) wid.width = widget_default_size;
+ }
+ if (wid.height == undefined) {
+ wid.height = wid.defaultHeight;
+ if (wid.height == 0) wid.height = widget_default_size;
+ }
+ if (wid.x== undefined) wid.x = 0;
+ if (wid.y== undefined) wid.y = 0;
+
+ widg_ctrl = new_widget_control(wid);
+ widg_ctrl.component_bound = false;
+
+ wid.visible = true;
+
+ widg_ctrl.set_size(wid.width, wid.height);
+ widg_ctrl.translation.x = wid.x;
+ widg_ctrl.translation.y = wid.y;
+
+ wid.widget_control = widg_ctrl;
+ wid.scene_container = widget_display;
+
+ widg_ctrl.show_remove( (!wid.discardable && wid.icon_dock) ? 1 : 0);
+
+ widg_ctrl.sub_width = 0;
+ widg_ctrl.sub_height = 0;
+ widg_ctrl.sub_x = 0;
+ widg_ctrl.sub_y = 0;
+ widg_ctrl.sub_vp_w = 0;
+ widg_ctrl.sub_vp_h = 0;
+
+ widg_ctrl.inline.addEventListener('gpac_vp_changed',
+ function(evt) {
+ widg_ctrl.sub_vp_w = evt.width;
+ widg_ctrl.sub_vp_h = evt.height;
+ widg_ctrl.sub_vp_x = evt.offset_x;
+ widg_ctrl.sub_vp_y = evt.offset_y;
+ widg_ctrl.sub_w = evt.vp_width;
+ widg_ctrl.sub_h = evt.vp_height;
+ widg_ctrl.refresh_layout(true, null);
+ },
+ 0);
+
+ /*this will setup the scene graph for the widget in order to filter input and output communication pins*/
+ wid.activate(widg_ctrl.inline);
+
+ widg_ctrl.inline.url[0] = wid.main;
+ widget_display.addChildren[0] = widg_ctrl;
+
+ /*send notifications once the widget scene is loaded*/
+ wid.on_load = function () {
+ WidgetManager.corein_message(this, 'activate');
+ WidgetManager.corein_message(this, 'show');
+ WidgetManager.corein_message(this, 'setSize', 'width', 50, 'height', 50, 'dpi', 96);
+ };
+
+ if (widget_ui_visible) {
+ widget_ui_visible = 0;
+ layout();
+ }
+}
+
+
+function widget_request_size(widget, args)
+{
+ if (args.length==2) {
+ w = (typeof args[0] == 'string') ? parseInt(args[0]) : args[0];
+ h = (typeof args[1] == 'string') ? parseInt(args[1]) : args[1];
+ widget.widget_control.set_size(w, h);
+ }
+}
+function widget_request_show(widget, args)
+{
+ widget.widget_control.show();
+}
+function widget_request_hide(widget, args)
+{
+ widget.widget_control.hide();
+}
+function widget_request_activate(widget, args)
+{
+ if (!widget.visible)
+ widget_launch(widget);
+}
+function widget_request_deactivate(widget, args)
+{
+ if (widget.visible)
+ widget_close(widget, 0);
+}
+
+function widget_request_attention(widget, args)
+{
+ if (widget.visible) {
+ widget_display.removeChildren[0] = widget.widget_control;
+ widget_display.addChildren[0] = widget.widget_control;
+ widget.widget_control.flash();
+ }
+}
+
+function widget_request_notification(widget, args)
+{
+ var notif = text_rect('');
+ notif.children[1].geometry.string[0] = 'Notification from widget';
+ notif.children[1].geometry.string[1] = ' '+widget.name;
+ notif.children[1].geometry.string[2] = ' ';
+ notif.children[1].geometry.string[3] = args[0];
+ dlg_display.children[0] = notif;
+ notif.set_size(320, 240);
+ notif.button_click = function() {
+ dlg_display.removeChildren[0] = this;
+ }
+}
+
+function widget_place_component(widget, args)
+{
+ var comp = widget.get_component(args[0]);
+
+ if (comp==null) {
+ log(l_err, 'Component '+args[0]+' cannot be found in widget '+widget.name);
+ return;
+ }
+ comp.widget_control.place_x = args[1];
+ comp.widget_control.place_y = args[2];
+ comp.widget_control.place_w = args[3];
+ comp.widget_control.place_h = args[4];
+ comp.widget_control.place_z = args[5];
+ comp.widget_control.component_bound = true;
+ widget.widget_control.refresh_layout(false, comp);
+}
+
+//
+// implementation of core:out install widget
+//
+function widget_request_install(wid, args)
+{
+ var wid_url = args[0];
+ /*locate widget with same URL*/
+ var j, count = WidgetManager.num_widgets;
+ for (j = 0; j < count; j++) {
+ var wid = WidgetManager.get(j);
+ if (wid.url == wid_url) {
+ if (!wid.in_panel) {
+ insert_widget_icon(wid, 0);
+ }
+ break;
+ }
+ }
+ /*not found, install new widget*/
+ if (j == count) {
+ var new_wid = WidgetManager.open(wid_url, null);
+ if (new_wid==null) return;
+ insert_widget_icon(new_wid, 0);
+ }
+
+ var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+ if (ifce != null) {
+ wmjs_core_out_invoke_reply(coreOut.installWidgetMessage, ifce.get_message("installWidget"), wid, 1); // send return code 1 = success
+ }
+}
+function widget_migrate_component(wid, args)
+{
+ alert('Fetching for migration component '+args[0]);
+ var comp = wid.get_component(args[0], true);
+ var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+
+ if (comp==null) {
+ log(l_err, 'Component '+args[0]+' cannot be found in widget '+wid.name);
+ if (ifce != null) {
+ wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 0);
+ }
+ return;
+ }
+ comp.widget_control = null;
+ if (args.length > 1 && args[1] != null) {
+ alert('Migrating component to ' + UPnP.GetMediaRenderer(parseInt(args[1])).Name);
+ WidgetManager.migrate_widget(UPnP.GetMediaRenderer(parseInt(args[1])), comp);
+ widget_close(comp);
+ } else {
+ widget_remote_candidate = comp;
+ on_upnpopen(false, false);
+ }
+ if (ifce != null) {
+ wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 1); // send return code 1 = success
+ }
+}
+
+function widget_migration_targets(wid, args)
+{
+ var count = UPnP.MediaRenderersCount, codes = new Array(), names = new Array(), descriptions = new Array(), i;
+
+ for (i = 0; i < count; i++) {
+ var render = UPnP.GetMediaRenderer(i);
+ codes.push(""+i);
+ names.push(render.Name);
+ descriptions.push(render.HostName +" "+ render.UUID);
+ }
+ i = null;
+ var ifce_count = wid.num_interfaces, j;
+ for (j = 0; j < ifce_count; j++) {
+ var ifce = wid.get_interface(j);
+ if (ifce.type == "urn:mpeg:mpegu:schema:widgets:core:out:2010") {
+ i = ifce;
+ break;
+ }
+ }
+ if (i != null) {
+ wmjs_core_out_invoke_reply(coreOut.requestMigrationTargetsMessage, i.get_message("requestMigrationTargets"),
+ wid, codes, names, descriptions);
+ }
+}
+
+
+//
+// implementation of core:out activate temporary widget
+//
+function widget_activate_temporary_widget(wid, args) {
+ var w = WidgetManager.open(args[0], null);
+ if (w != null) widget_launch(w);
+ var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+ if (ifce != null) {
+ wmjs_core_out_invoke_reply(coreOut.activateTemporaryWidgetMessage, ifce.get_message("activateTemporaryWidget"),
+ wid, (w != null ? 1 : 0)); // send return code 1 = success
+ }
+}
+
+
+
+function insert_widget_icon(new_wid, no_layout) {
+ var icon;
+ icon = icon_button(widget_get_icon(new_wid), new_wid.name, 0);
+ icon.tooltip = new_wid.name;
+ new_wid.in_panel = true;
+ new_wid.visible = false;
+ new_wid.icon_dock = icon;
+ icon.button_click = on_widget_launch;
+ icon.widget = new_wid;
+ widget_ui.addChildren[0] = new_wid.icon_dock;
+ if (!no_layout) layout();
+}
+
+function scan_directory(dir)
+{
+ var i, j, count, list, new_wid, uri;
+ list = gpac.enum_directory(dir, '.xml;.wgt;.mgt', 0);
+ for (i=0; i<list.length; i++) {
+ uri = list[i].path + list[i].name;
+ if (list[i].directory) {
+ scan_directory(uri);
+ } else {
+ count = WidgetManager.num_widgets;
+ for (j=0; j<count; j++) {
+ var wid = WidgetManager.get(j);
+ if (wid.url==uri) break;
+ }
+ if (j==count) {
+ new_wid = WidgetManager.open(uri, null);
+ if (new_wid!=null) {
+ insert_widget_icon(new_wid, 1);
+ }
+ }
+ }
+ }
+}
+
+function new_file_browse(init_directory, label, filter, show_scan, show_upnp)
+{
+ var filebrowse = new SFNode('Transform2D');
+ filebrowse.list = new Array();
+ infobar.set_label(label);
+ dlg_display.children[0] = filebrowse;
+
+ filebrowse.upnp = null;
+ filebrowse.upnp_mode = false;
+
+ filebrowse.children[0] = icon_button('icons/emblem-unreadable.svg', 'Close', 0);
+ filebrowse.children[0].button_click = function() {
+ dlg_display.children.length = 0;
+ widget_display.scale.x = 1;
+ layout();
+ }
+
+ filebrowse.children[1] = icon_button('icons/go-previous.svg', 'Previous', 0);
+ filebrowse.children[1].filebrowse = filebrowse;
+ filebrowse.children[1].button_click = function () { this.filebrowse.layout(0) };
+
+ filebrowse.children[2] = icon_button('icons/go-next.svg', 'Next', 0);
+ filebrowse.children[2].filebrowse = filebrowse;
+ filebrowse.children[2].button_click = function () { this.filebrowse.layout(1) };
+
+ filebrowse.icon_up = icon_button('icons/go-up.svg', 'Up', 0);
+ filebrowse.icon_up.filebrowse = filebrowse;
+ filebrowse.icon_up.button_click = function () { this.filebrowse.browse(true) };
+ filebrowse.children[3] = filebrowse.icon_up;
+
+ if (show_scan) {
+ filebrowse.on_dir_scan = null;
+ filebrowse.children[4] = icon_button('icons/folder.svg', 'Scan Directory', 0);
+ filebrowse.children[4].filebrowse = filebrowse;
+ filebrowse.children[4].button_click = function () {
+ if (this.filebrowse.on_dir_scan) this.filebrowse.on_dir_scan(this.filebrowse.directory);
+
+ dlg_display.children.length = 0;
+ widget_display.scale.x = 0;
+ widget_ui_visible = true;
+ layout();
+ }
+ }
+
+ if (show_upnp && has_upnp) {
+ filebrowse.upnp = icon_button('icons/applications-internet.svg', 'Network Servers', 0);
+ filebrowse.upnp.filebrowse = filebrowse;
+ filebrowse.children[filebrowse.children.length] = filebrowse.upnp;
+ filebrowse.server_uuid = null;
+ filebrowse.upnp.button_click = function() {
+ if (this.filebrowse.upnp_mode) {
+ this.label = 'Network Servers';
+ this.filebrowse.upnp_mode = false;
+ this.filebrowse.directory = init_directory;
+ this.filebrowse.browse(false);
+ } else {
+ this.label = 'Local Drive';
+ this.filebrowse.upnp_mode = true;
+ this.filebrowse.browse(true);
+ }
+ }
+
+ filebrowse.upnp_get_server_list = function() {
+ var count, server, item;
+ this.directory = null;
+ this.children[3].hide();
+ this.server_uuid = null;
+ count = UPnP.MediaServersCount;
+ this.list.length = 0;
+ for (i=0; i<count; i++) {
+ server = UPnP.GetMediaServer(i);
+ item = new Object();
+ item.name = server.Name;
+ item.directory = true;
+ item.is_server = true;
+ item.path = server.UUID;
+ this.list[i] = item;
+ }
+ };
+ filebrowse.server_uuid = null;
+ }
+
+ filebrowse.label = text_label('', 'BEGIN');
+ filebrowse.set_label = function(label) {
+ this.label.set_label(label);
+ }
+ filebrowse.children[filebrowse.children.length] = filebrowse.label;
+ filebrowse.nb_tools = filebrowse.children.length;
+
+ filebrowse.browse = function(go_up) {
+ if (this.upnp_mode) {
+ var item;
+ var server = null;
+ if (this.server_uuid) server = UPnP.GetMediaServer(this.server_uuid);
+ if (!server || (go_up && !server.HasParentDirectory())) {
+ this.upnp_get_server_list();
+ this.icon_up.hide();
+ this.set_label('Media Servers');
+ this.first = 0;
+ this.layout(0);
+ return;
+ }
+ if (go_up) this.directory = '..';
+
+ this.icon_up.show();
+ server.Browse(this.directory, filter);
+ this.list.length = 0;
+ for (i=0; i<server.FilesCount; i++) {
+ var file = server.GetFile(i);
+ if (file.Directory) {
+ item = new Object();
+ item.directory = true;
+ item.name = file.Name;
+ item.path = file.ObjectID;
+ item.is_server = false;
+ this.list[this.list.length] = item;
+ } else {
+ var j;
+ for (j=0; j<file.ResourceCount; j++) {
+ item = new Object();
+ item.directory = false;
+ item.resource_uri = file.GetResourceURI(j);
+ item.name = file.Name;
+ var protoInfo = item.resource_uri.split(":");
+ item.name += ' ('+protoInfo[0]+')';
+ item.path = file.ObjectID;
+ item.is_server = false;
+ this.list[this.list.length] = item;
+ }
+ }
+ }
+ if (this.directory) this.set_label(this.directory);
+ else this.set_label(server.Name);
+ this.first = 0;
+ this.layout(0);
+ return;
+ }
+
+ if (this.directory == '')
+ this.icon_up.hide();
+ else
+ this.icon_up.show();
+
+ this.list = gpac.enum_directory(this.directory, filter, go_up);
+ if (this.list.length) {
+ this.directory = this.list[0].path;
+ this.set_label(this.directory);
+ } else {
+ this.set_label('');
+ }
+ this.first = 0;
+ this.layout(0);
+ }
+ filebrowse.on_browse = null;
+
+ filebrowse.layout = function(type) {
+ var w, h, i, y;
+ this.children.length = this.nb_tools;
+
+ if (this.upnp != null) {
+ if (UPnP.MediaServersCount) {
+ this.upnp.show();
+ } else {
+ this.upnp.hide();
+ }
+ }
+
+ this.children[1].hide();
+ this.children[2].hide();
+
+ if (type==0) {
+ this.first -= this.nb_items;
+ if (this.first<0) this.first = 0;
+ }
+ else if (type) {
+ this.first += this.nb_items;
+ if (this.first + this.nb_items > this.list.length) this.first = this.list.length - this.nb_items;
+ }
+ if (this.first) this.children[1].show();
+ if (this.first+this.nb_items < this.list.length) this.children[2].show();
+
+ for (i=0; i<this.nb_items; i++) {
+ var item;
+ if (i+this.first>=this.list.length) break;
+ item = text_rect(this.list[i+this.first].name);
+ item.path = this.list[i+this.first].path;
+ item.name = this.list[i+this.first].name;
+ item.directory = this.list[i+this.first].directory;
+ item.filebrowse = this;
+ if (this.upnp_mode) {
+ item.is_server = this.list[i+this.first].is_server;
+ item.resource_uri = this.list[i+this.first].resource_uri;
+ item.button_click = function() {
+ if (this.directory) {
+ if (this.is_server) {
+ this.filebrowse.server_uuid = this.path;
+ } else {
+ this.filebrowse.directory = this.path;
+ }
+ this.filebrowse.browse(false);
+ } else {
+ dlg_display.children.length = 0;
+ if (this.filebrowse.on_browse) {
+ this.filebrowse.on_browse(this.resource_uri, null);
+ }
+ }
+ };
+ } else {
+ item.button_click = function() {
+ if (this.directory) {
+ this.filebrowse.directory = this.path + this.name;
+ this.filebrowse.browse(false);
+ } else {
+ dlg_display.children.length = 0;
+ if (this.filebrowse.on_browse) {
+ this.filebrowse.on_browse(this.path + this.name, this.filebrowse.directory);
+ }
+ }
+ };
+ }
+ this.children[this.nb_tools+i] = item;
+ }
+ this.set_size(this.width, this.height);
+ }
+
+
+ filebrowse.set_size = function(w, h) {
+ var i, x, y, isize, nbi;
+ isize = 24;
+ if (w>display_width - isize) w = display_width - isize;
+
+ this.width = w;
+ this.height = h;
+
+ i = 1;
+ while ((i+1)*isize <= h - isize) i++;
+
+ if (i != this.nb_items) {
+ this.nb_items = i;
+ this.layout(0);
+ return;
+ }
+ x = -w/2 + isize/2;
+ y = h/2 - isize/2;
+
+ for (i=0;i<this.nb_tools;i++) {
+ if (this.nb_tools>i+1) {
+ this.children[i].set_size(isize, isize);
+ }
+ this.children[i].translation.x = x;
+ this.children[i].translation.y = y;
+ x += isize;
+ }
+ y-=isize;
+ while (i<this.children.length) {
+ this.children[i].set_size(w, isize);
+ this.children[i].translation.x = 0;
+ this.children[i].translation.y = y;
+ y-=isize;
+ i++;
+ }
+ }
+ filebrowse.nb_items = 0;
+ filebrowse.directory = init_directory;
+
+ gpac.set_focus(filebrowse);
+ return filebrowse;
+}
+
+function widget_browse()
+{
+ filebrowse = new_file_browse(WidgetManager.last_widget_dir, 'Select widget', '*.xml;*.wgt;*.mgt', true, false);
+ filebrowse.on_dir_scan = function(directory) {
+ scan_directory(directory);
+ WidgetManager.last_widget_dir = directory;
+ }
+ filebrowse.on_browse = function(value, directory) {
+ widget_display.scale.x = 1;
+ widget_ui_visible = true;
+ layout();
+ var new_wid = WidgetManager.open(value, null);
+ if (new_wid==null) return;
+
+ WidgetManager.last_widget_dir = directory;
+ insert_widget_icon(new_wid, 0);
+ }
+
+ filebrowse.browse(0);
+ widget_display.scale.x = 0;
+ layout();
+
+}
+
+//fileOpen function
+function on_fileopen()
+{
+ filebrowse = new_file_browse(gpac.last_working_directory, 'Select file', '*', false, true);
+ filebrowse.on_browse = function(value, directory) {
+ if (directory) gpac.last_working_directory = directory;
+ set_movie_url(value, false, true);
+ }
+
+ filebrowse.browse(0);
+ widget_display.scale.x = 0;
+ layout();
+}
+
+function onMediaRendererAdd(name, uuid, is_add)
+{
+ var i, count;
+
+ count = WidgetManager.num_widgets;
+ for (i=0; i<count; i++) {
+ wid = WidgetManager.get(i);
+ if (wid == null) continue;
+ if (!wid.widget_control) continue;
+ wid.widget_control.show_remote();
+ }
+
+ if (UPnP.MediaRenderersCount) upnp_icon.show();
+ else upnp_icon.hide();
+ dock_layout();
+
+ if (upnp_renders) upnp_renders.refresh();
+ if (!is_add && controlled_renderer && (name==controlled_renderer.Name) ) controlled_renderer = null;
+}
+
+function is_local_url(url)
+{
+ if (url.indexOf('://') < 0) return true;
+ if (url.indexOf('file://') >= 0) return true;
+ return false;
+}
+
+function on_upnpopen(push_mode, remote_only)
+{
+ upnp_renders = new SFNode('Transform2D');
+ upnp_renders.nb_items = 0;
+ upnp_renders.refresh = function () {
+ var i, count, render, item, start_y, w, str;
+ this.children.length = 0;
+ count = UPnP.MediaRenderersCount;
+ if (count+1>this.nb_items) count = this.nb_items-1;
+
+ item = text_rect('Close');
+ item.button_click = function() {
+ dlg_display.children.length = 0;
+ upnp_renders=null;
+ widget_display.scale.x = 1;
+ infobar.set_label('');
+ }
+ this.children[this.children.length] = item;
+
+ if (!remote_only) {
+ str = (controlled_renderer==null) ? '+ ' : '';
+ str += 'Local Renderer';
+ item = text_rect(str);
+ item.button_click = function() {
+ dlg_display.children.length = 0;
+ upnp_renders=null;
+ widget_display.scale.x = 1;
+ infobar.set_label('');
+ controlled_renderer = null;
+ }
+ this.children[this.children.length] = item;
+ }
+
+ for (i=0; i<count; i++) {
+ render = UPnP.GetMediaRenderer(i);
+ str = (controlled_renderer && controlled_renderer.Name==render.Name) ? '+ ' : '';
+ str +=render.Name;
+ item = text_rect(str);
+ item.render = render;
+
+ item.button_click = function() {
+ var uri;
+ dlg_display.children.length = 0;
+ upnp_renders=null;
+ widget_display.scale.x = 1;
+ infobar.set_label('');
+
+ if (widget_remote_candidate) {
+ WidgetManager.migrate_widget(this.render, widget_remote_candidate);
+ widget_close(widget_remote_candidate, 0);
+ widget_remote_candidate = null;
+ } else {
+ controlled_renderer = this.render;
+ if (current_url != "") {
+ if (is_local_url(current_url) ) {
+ if (UPnP.MediaServerEnabled) {
+ uri = UPnP.ShareResource(current_url);
+ log(l_inf, 'Sharing '+current_url+' to renderer '+item.render.Name + ' as resource '+uri);
+ item.render.Open(uri);
+ item.render.Seek(current_time);
+ set_movie_url('', true, false);
+ } else {
+ log(l_err, 'GPAC Media Server is disabled - Cannot share '+current_url);
+ }
+ } else if (gpac.getOption('Network', 'MobileIPEnabled')=='yes') {
+ uri = gpac.migrate_url(movie.children[0].url[0]);
+ log(l_inf, 'Migrating '+current_url+' to renderer '+item.render.Name + ' as Mobile IP resource '+uri);
+ set_movie_url('', true, false);
+ item.render.Open(uri);
+ } else {
+ log(l_inf, 'Migrating '+current_url+' to renderer '+item.render.Name);
+ item.render.Open(current_url);
+ item.render.Seek(current_time);
+ set_movie_url('', true, false);
+ }
+ }
+ }
+ }
+ this.children[this.children.length] = item;
+ }
+ this.set_size(this.width, this.height);
+ }
+
+ upnp_renders.set_size = function (w, h) {
+ var i, count, start_y, w;
+
+ this.width = w<300 ? w : 300;
+ this.height = h;
+
+ i = 1;
+ while ((i+1)*icon_size <= h - icon_size) i++;
+ if (i != this.nb_items) {
+ this.nb_items = i;
+ this.refresh();
+ return;
+ }
+ count = this.children.length;
+ start_y = this.height/2 - icon_size - 4;
+ for (i=0; i<count; i++) {
+ this.children[i].set_size(this.width, icon_size);
+ this.children[i].translation.y = start_y;
+ start_y-=icon_size+2;
+ }
+ }
+
+ infobar.set_label('Select remote display');
+ dlg_display.children[0] = upnp_renders;
+ widget_display.scale.x = 0;
+ layout();
+}
+
+
+function onMediaConnect(url, src_ip)
+{
+ if (WidgetManager.probe(url)) {
+ alert('OnMediaConnect receive widget '+url+' - ip '+src_ip);
+ var new_wid = WidgetManager.open(url, src_ip);
+ if (new_wid==null) {
+ return;
+ }
+ widget_insert(new_wid);
+ } else {
+ log(l_inf, 'DLNA URL connect ' + url);
+ movie_ctrl.mediaStartTime = -1;
+ set_movie_url(url, true, false);
+ }
+}
+
+function onMediaStop()
+{
+ log(l_inf, 'DLNA Media Stop');
+ movie_ctrl.mediaStartTime = 0;
+ movie_ctrl.mediaSpeed = 0;
+}
+function onMediaPause()
+{
+ log(l_inf, 'DLNA Media pause');
+ movie_ctrl.mediaSpeed = 0;
+ movie_ctrl.mediaStartTime = -1;
+}
+function onMediaPlay()
+{
+ log(l_inf, 'DLNA Media Play');
+ movie_ctrl.mediaSpeed = 1;
+}
+
+function OnMediaSeek(time)
+{
+ log(l_inf, 'DLNA Media Seek to '+time);
+ movie_ctrl.mediaStartTime = time;
+}
+
+function OnMediaMigrate() {
+ log(l_inf, 'InterMedia Migration Request received');
+ var str = gpac.migrate_url(movie.children[0].url[0]);
+ set_movie_url('', true, false);
+ return str;
+}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Authors:
+// Jean Le Feuvre, Telecom ParisTech
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+function gw_new_timer(progressive)
+{
+ var obj = new SFNode('TimeSensor');
+
+ obj.set_timeout = function(time, loop) {
+ this.cycleInterval = time ? time : 1;
+ this.loop = loop;
+ }
+ this.startTime = -1;
+ obj.start = function(when) {
+ this.startTime = when + this.getTime();
+ }
+ obj.stop = function(when) {
+ this.stopTime = when + this.getTime();
+ }
+ obj.on_event = function(val){};
+ obj._event = function(val) {
+ this.on_event( Math.floor(val/this.cycleInterval) );
+ }
+ Browser.addRoute(obj, 'cycleTime', obj, obj._event);
+
+ if (progressive) {
+ obj.on_fraction = function(val){}
+ obj._fraction = function(frac) {
+ this.on_fraction(frac);
+ }
+ Browser.addRoute(obj, 'fraction_changed', obj, obj._fraction);
+ }
+ obj.on_active = function(val) {}
+ obj._active = function(val) {
+ this.on_active(val);
+ }
+ Browser.addRoute(obj, 'isActive', obj, obj._active);
+ return obj;
+}
+
+function setup_gw_object(obj, name)
+{
+ obj._name = name;
+ obj.set_color = function() {}
+ obj.set_size = function(width, height) {
+ this.width = width;
+ this.height = height;
+ }
+ obj.hide = function() {
+ this.scale.x = this.scale.y = 0;
+ this.visible = false;
+ if (arguments.length==1) {
+ arguments[0].apply(this);
+ }
+ }
+ obj.show = function() { this.scale.x = this.scale.y = 1; this.visible = true;}
+ obj.visible = true;
+ obj.set_size = function(width, height) {
+ this.width = width;
+ this.height = height;
+ }
+ obj.move = function(x, y) {
+ this.translation.x = x;
+ this.translation.y = y;
+ }
+ obj.width = obj.height = 0;
+
+ obj.close = function() {
+ if (typeof this._pre_destroy != 'undefined') this._pre_destroy();
+ gw_detach_child(this);
+ };
+}
+
+function gw_object_set_dragable(obj)
+{
+ if (typeof (obj.on_drag) != 'undefined') return;
+
+ var ps2d = new SFNode('PlaneSensor2D');
+ obj._ps2d_idx = obj.children.length;
+ obj.children[obj.children.length] = ps2d;
+ ps2d.maxPosition.x = ps2d.maxPosition.y = -1;
+ ps2d.autoOffset = FALSE;
+ obj._drag = false;
+ obj.begin_drag = null;
+ obj.end_drag = null;
+ obj._drag_active = function(val) {
+ if (val) {
+ this.startx = this.translation.x;
+ this.starty = this.translation.y;
+ if (this.begin_drag) this.begin_drag();
+ } else {
+ if (this.end_drag) this.end_drag();
+ }
+ }
+ obj.on_drag = null;
+ obj._on_drag = function(val) {
+ if (this.on_drag) {
+ this.on_drag(this.startx + val.x, this.starty + val.y);
+ } else {
+ this.translation.x = this.startx + val.x;
+ this.translation.y = this.starty + val.y;
+ }
+ if (!this._drag && (val.x || val.y)) this._drag = true;
+ }
+ Browser.addRoute(ps2d, 'isActive', obj, obj._drag_active);
+ Browser.addRoute(ps2d, 'translation_changed', obj, obj._on_drag);
+}
+
+function gw_object_set_hitable(obj)
+{
+ if (typeof (obj._active) != 'undefined') return;
+
+ var ts = new SFNode('TouchSensor');
+ obj._ts_idx = obj.children.length;
+ obj.children[obj.children.length] = ts;
+ obj._drag = false;
+ obj._over = false;
+ obj.on_over = null;
+ obj._on_over = function(val) {
+ this._over = val;
+ if (this.on_over) this.on_over(val);
+ }
+ obj.last_click = 0;
+ obj.on_click = null;
+ obj.on_down = null;
+ obj._on_active = function(val, timestamp) {
+ if (!this._over) return;
+
+ if (this.on_down) this.on_down(val);
+
+ if (!val) {
+ if (this._drag) {
+ this._drag = false;
+ return;
+ }
+
+ if (this.last_click && (timestamp - this.last_click<gwskin.double_click_delay) ) {
+ this.last_click = timestamp;
+ if (this.on_double_click) {
+ this.on_double_click();
+ return;
+ }
+ }
+
+ this.last_click = timestamp;
+ if(this.on_click && this._over) this.on_click();
+ }
+ }
+ Browser.addRoute(ts, 'isOver', obj, obj._on_over);
+ Browser.addRoute(ts, 'isActive', obj, obj._on_active);
+}
+
+
+function gw_new_appearance(r, g, b)
+{
+ var appearance = new SFNode('Appearance');
+ appearance.material = new SFNode('Material2D');
+ appearance.material.filled = TRUE;
+ appearance.material.emissiveColor = new SFColor(r, g, b);
+ return appearance;
+}
+
+function gw_make_gradient(type, keys, colors)
+{
+ var i;
+ var obj = new SFNode(type=='radial' ? 'RadialGradient' : 'LinearGradient');
+ for (i=0; i<keys.length; i++) {
+ obj.key[i] = keys[i];
+ }
+ for (i=0; i<colors.length / 3; i++) {
+ obj.keyValue[i] = new SFColor(colors[3*i], colors[3*i+1], colors[3*i+2]);
+ }
+ if (type=='vertical') {
+ obj.endPoint.x = 0;
+ obj.endPoint.y = 1;
+ }
+ return obj;
+}
+
+function gw_new_fontstyle(size, align)
+{
+ var fs = new SFNode('FontStyle');
+ fs.size = size;
+ switch (align) {
+ case 0:
+ fs.justify[0] = 'BEGIN';
+ break;
+ case 1:
+ fs.justify[0] = 'MIDDLE';
+ break;
+ case 2:
+ fs.justify[0] = 'END';
+ break;
+ default:
+ fs.justify[0] = 'MIDDLE';
+ break;
+ }
+ fs.justify[1] = 'FIRST';
+ return fs;
+}
+
+gw_resources_bank = [];
+
+function gw_load_resource(url)
+{
+ var new_res;
+ if (gwskin.use_resource_bank) {
+ for (var i in gw_resources_bank) {
+ if (gw_resources_bank[i].url == url) {
+ gw_resources_bank[i].nb_instances++;
+ alert('Found existing resource for url '+url);
+ return gw_resources_bank[i];
+ }
+ }
+ }
+ if (gwskin.use_offscreen_icons) {
+ new_res = new SFNode('OffscreenGroup');
+ new_res.offscreen_mode = 2;
+ new_res.children[0] = new SFNode('Inline');
+ new_res.children[0].url[0] = url;
+ } else {
+ new_res = new SFNode('Inline');
+ new_res.url[0] = url;
+ }
+ new_res.nb_instances = 1;
+ if (gwskin.use_resource_bank) {
+ new_res.url = url;
+ gw_resources_bank.push(new_res);
+ alert('Created resource for url '+url + ' nb loaded resources '+gw_resources_bank.length);
+ }
+ return new_res;
+}
+
+function gw_unload_resource(res)
+{
+ if (!gwskin.use_resource_bank) return;
+
+ if (!res.nb_instances) return;
+ res.nb_instances--;
+ if (res.nb_instances) return;
+
+ for (var i in gw_resources_bank) {
+ if (gw_resources_bank[i] == res) {
+ alert('Unloading resource '+ res + ' nb loaded resources '+gw_resources_bank.length);
+ gw_resources_bank.splice(i, 1);
+ return;
+ }
+ }
+ alert('Unloading resource for url '+res.children[0].url[0] + ' not found in resource bank');
+}
+
+
+function gw_window_show_hide()
+{
+ if (typeof this.timer == 'undefined') {
+ this.timer = gw_new_timer(1);
+ this.timer.set_timeout(0.25, false);
+ this.timer.on_fraction = function(val) {
+ if (this.wnd.visible) {
+ this.wnd.scale.x = 1-val;
+ this.wnd.scale.y = 1-val;
+ this.wnd.set_alpha(1-val);
+ } else {
+ this.wnd.scale.x = val;
+ this.wnd.scale.y = val;
+ this.wnd.set_alpha(val);
+ }
+ }
+ this.timer.on_active = function(val) {
+ var fun;
+ if (val) return;
+ var wnd = this.wnd;
+ this.wnd = null;
+ wnd.visible = !wnd.visible;
+ wnd.scale.x = wnd.visible ? 1 : 0;
+ wnd.scale.y = wnd.visible ? 1 : 0;
+ fun = this.call_on_end;
+ this.call_on_end = null;
+ if (fun) {
+ fun.apply(wnd);
+ }
+ }
+ }
+ this.set_alpha(1.0);
+ this.timer.wnd = this;
+ this.timer.start(0);
+ this.timer.call_on_end = null;
+ if (arguments.length) {
+ this.timer.call_on_end = arguments[0];
+ }
+}
+
+function gw_window_show()
+{
+ if (this.visible) return;
+ gw_window_show_hide.call(this);
+}
+
+function gw_window_hide()
+{
+ if (!this.visible) return;
+ gw_window_show_hide.apply(this, arguments);
+}
+
+gwskin = new Object();
+gwskin.back_color = new SFColor(0.2, 0.2, 0.2);
+gwskin.pointing_device = true;
+gwskin.long_click_delay = 0.5;
+gwskin.double_click_delay = 0.5;
+gwskin.use_resource_bank = false;
+gwskin.use_offscreen_icons = false;
+gwskin.default_icon_size = 32;
+gwskin.appearance_transparent = gw_new_appearance(0, 0, 0);
+gwskin.appearance_transparent.material.transparency = 1;
+gwskin.appearance_transparent.skin = true;
+
+gwskin.tooltip_callback = null;
+
+gwskin.default_text_size = 18;
+
+gwskin.control = new Object();
+gwskin.control.normal = gw_new_appearance(0.6, 0.6, 0.6);
+gwskin.control.normal.skin = true;
+if (gwskin.pointing_device) {
+ gwskin.control.over = gw_new_appearance(0.7, 0.7, 0.8);
+ gwskin.control.over.material.transparency = 0.5;
+ gwskin.control.over.skin = true;
+} else {
+ gwskin.control.over = null;
+}
+
+gwskin.button = new Object();
+gwskin.button.width = 48;
+gwskin.button.height = 48;
+gwskin.button.font_size = 12;
+gwskin.button.normal = gw_new_appearance(0.7, 0.7, 0.8);
+gwskin.button.normal.skin = true;
+if (gwskin.pointing_device) {
+ gwskin.button.over = gw_new_appearance(0.7, 0.7, 0.8);
+ gwskin.button.over.material.transparency = 0.4;
+ gwskin.button.over.skin = true;
+} else {
+ gwskin.button.over = null;
+}
+gwskin.button.down = gw_new_appearance(0.3, 0.3, 0.4);
+gwskin.button.down.material.transparency = 0.3;
+gwskin.button.down.skin = true;
+gwskin.button.text = gw_new_appearance(0, 0, 0);
+gwskin.button.text.skin = true;
+gwskin.button.font = gw_new_fontstyle(gwskin.button.font_size, 1);
+gwskin.button.font.skin = true;
+
+
+gwskin.osdbutton = new Object();
+gwskin.osdbutton.width = 48;
+gwskin.osdbutton.height = 48;
+gwskin.osdbutton.font_size = 12;
+gwskin.osdbutton.normal = gw_new_appearance(0.7, 0.7, 0.8);
+gwskin.osdbutton.normal.skin = true;
+if (gwskin.pointing_device) {
+ gwskin.osdbutton.over = gw_new_appearance(0.7, 0.7, 0.8);
+ gwskin.osdbutton.over.material.transparency = 0.4;
+ gwskin.osdbutton.over.skin = true;
+} else {
+ gwskin.button.over = null;
+}
+gwskin.osdbutton.down = gw_new_appearance(0.3, 0.3, 0.4);
+gwskin.osdbutton.down.material.transparency = 0.3;
+gwskin.osdbutton.down.skin = true;
+gwskin.osdbutton.text = gw_new_appearance(1, 1, 1);
+gwskin.osdbutton.text.skin = true;
+gwskin.osdbutton.font = gw_new_fontstyle(gwskin.button.font_size, 1);
+gwskin.osdbutton.font.skin = true;
+
+gwskin.listitem = new Object();
+gwskin.listitem.width = 48;
+gwskin.listitem.height = 48;
+gwskin.listitem.font_size = 12;
+gwskin.listitem.normal = gwskin.button.normal;
+gwskin.listitem.over = gwskin.button.over;
+gwskin.listitem.down = gwskin.button.down;
+gwskin.listitem.text = gwskin.button.text;
+gwskin.listitem.font = gw_new_fontstyle(gwskin.listitem.font_size, 0);
+gwskin.listitem.font.skin = true;
+
+gwskin.label = new Object();
+gwskin.label.font_size = 18;
+gwskin.label.text = gw_new_appearance(0, 0, 0);
+gwskin.label.text.skin = true;
+gwskin.label.font = gw_new_fontstyle(gwskin.label.font_size, 1);
+gwskin.label.font.skin = true;
+
+gwskin.text = new Object();
+gwskin.text.font_size = 14;
+gwskin.text.text = gw_new_appearance(0, 0, 0);
+gwskin.text.text.skin = true;
+gwskin.text.font = gw_new_fontstyle(gwskin.text.font_size, 0);
+gwskin.text.font.skin = true;
+
+
+gwskin.edit = new Object();
+gwskin.edit.normal = gw_new_appearance(1, 1, 1);
+gwskin.edit.font_size = 18;
+gwskin.edit.text = gwskin.label.text;
+gwskin.edit.font = gw_new_fontstyle(gwskin.edit.font_size, 0);
+gwskin.edit.font.style += ' SIMPLE_EDIT';
+gwskin.edit.font.skin = true;
+
+gwskin.window = new Object();
+gwskin.window.font_size = 14;
+gwskin.window.width = 320;
+gwskin.window.height = 240;
+gwskin.window.normal = gw_new_appearance(0.6, 0.6, 0.6);
+gwskin.window.normal.texture = gw_make_gradient('vertical', [0, 0.85, 1], [0.6, 0.6, 0.6, 1, 1, 1, 0.6, 0.6, 0.6]);
+gwskin.window.normal.skin = true;
+gwskin.window.text = gwskin.label.text;
+gwskin.window.font = gw_new_fontstyle(gwskin.window.font_size, 1);
+gwskin.window.font.skin = true;
+gwskin.window.hide = gw_window_hide;
+gwskin.window.show = gw_window_show;
+
+gwskin.offscreen = new Object();
+gwskin.offscreen.font_size = 14;
+gwskin.offscreen.width = 100;
+gwskin.offscreen.height = 100;
+gwskin.offscreen.normal = gwskin.appearance_transparent;
+gwskin.offscreen.hide = gwskin.window.hide;
+gwskin.offscreen.show = gwskin.window.show;
+
+
+gwskin.osdwindow = new Object();
+gwskin.osdwindow.font_size = 14;
+gwskin.osdwindow.width = 320;
+gwskin.osdwindow.height = 240;
+gwskin.osdwindow.normal = gw_new_appearance(0.6, 0.6, 0.6);
+gwskin.osdwindow.normal.texture = gw_make_gradient('vertical', [0, 0.15, 0.85, 1], [0.6, 0.6, 0.6, 0, 0, 0, 0, 0, 0, 0.6, 0.6, 0.6]);
+gwskin.osdwindow.normal.skin = true;
+gwskin.osdwindow.text = gw_new_appearance(1, 1, 1);
+gwskin.osdwindow.text.skin = true;
+gwskin.osdwindow.font = gw_new_fontstyle(gwskin.osdwindow.font_size, 1);
+gwskin.osdwindow.font.justify[1] = 'MIDDLE';
+gwskin.osdwindow.font.skin = true;
+gwskin.osdwindow.hide = gw_window_hide;
+gwskin.osdwindow.show = gw_window_show;
+gwskin.osdwindow.over = gwskin.button.over;
+gwskin.osdwindow.down = gwskin.button.down;
+
+gwskin.progress = new Object();
+gwskin.progress.width = 200;
+gwskin.progress.height = 48;
+gwskin.progress.normal = gw_new_appearance(0.6, 0.6, 0.6);
+gwskin.progress.normal.texture = gw_make_gradient('vertical', [0, 0.5, 1], [0.6, 0.6, 0.6, 0, 0, 0, 0.6, 0.6, 0.6]);
+gwskin.progress.normal.skin = true;
+gwskin.progress.over = gw_new_appearance(0.7, 0.7, 0.8);
+gwskin.progress.over.texture = gw_make_gradient('vertical', [0, 0.5, 1], [0.6, 0.6, 0.6, 0, 0, 1, 0.6, 0.6, 0.6]);
+gwskin.progress.over.skin = true;
+gwskin.progress.down = gw_new_appearance(0.7, 0.7, 0.8);
+gwskin.progress.down.texture = gw_make_gradient('vertical', [0, 0.5, 1], [0.6, 0.6, 0.6, 1, 1, 1, 0.6, 0.6, 0.6]);
+gwskin.progress.down.skin = true;
+gwskin.progress.text = null;
+gwskin.progress.font = null;
+
+gwskin.icon = new Object();
+gwskin.icon.normal = gwskin.button.normal;
+gwskin.icon.over = gwskin.button.over;
+gwskin.icon.down = gwskin.button.down;
+gwskin.icon.text = null;
+gwskin.icon.font = null;
+gwskin.icon.width = 32;
+gwskin.icon.height = 32;
+
+gwskin.images = new Object();
+gwskin.images.cancel = 'icons/emblem-unreadable.svg';
+gwskin.images.previous = 'icons/go-previous.svg';
+gwskin.images.next = 'icons/go-next.svg';
+gwskin.images.up = 'icons/go-up.svg';
+gwskin.images.scan_directory = 'icons/emblem-symbolic-link.svg';
+gwskin.images.folder = 'icons/folder.svg';
+gwskin.images.mime_generic = 'icons/applications-multimedia.svg';
+gwskin.images.trash = 'icons/user-trash.svg';
+gwskin.images.add = 'icons/list-add.svg';
+gwskin.images.remove = 'icons/list-remove.svg';
+gwskin.images.remote_display = 'icons/video-display.svg';
+gwskin.images.information = 'icons/dialog-information.svg';
+gwskin.images.resize = 'icons/media-record.svg';
+
+gwskin.labels = new Object();
+gwskin.labels.file_open = 'Open';
+gwskin.labels.close = 'Close';
+gwskin.labels.cancel = 'Cancel';
+gwskin.labels.up = 'Up';
+gwskin.labels.down = 'Down';
+gwskin.labels.left = 'Left';
+gwskin.labels.right = 'Right';
+gwskin.labels.scan_directory = 'Select directory';
+gwskin.labels.previous = 'Previous';
+gwskin.labels.next = 'Next';
+gwskin.labels.trash = 'Delete';
+gwskin.labels.remote_display = 'Push to';
+gwskin.labels.information = 'Information';
+gwskin.labels.resize = 'Resize';
+
+gwskin.keys = new Object();
+gwskin.keys.close = 'Enter';
+
+
+function gw_add_child(container, child)
+{
+ if (container ==null) return;
+ if (typeof (container.add_child) != 'undefined') {
+ container.add_child(child);
+ } else {
+ container.children[container.children.length] = child;
+ }
+ child.parent = container;
+}
+
+function gw_detach_child(child)
+{
+ /*detach all default routes*/
+ Browser.deleteRoute(child, 'ALL', null, null);
+ if (typeof (child._ps2d_idx) != 'undefined') {
+ Browser.deleteRoute(child.children[child._ps2d_idx], 'ALL', null, null);
+ }
+ if (typeof (child._ts_idx) != 'undefined') {
+ Browser.deleteRoute(child.children[child._ts_idx], 'ALL', null, null);
+ }
+ if (typeof (child.dlg) != 'undefined') child.dlg = null;
+ if (typeof (child.parent) == 'undefined') return;
+
+ var p = child.parent;
+ child.parent = null;
+ if (typeof (p.remove_child) != 'undefined') {
+ p.remove_child(child);
+ } else {
+ p.removeChildren[0] = child;
+ }
+}
+
+function gw_close_child_list(list)
+{
+ var count = list.length;
+ if (!count) return;
+ for (var i=0;i<count; i++) {
+ var child = list[i];
+ if (typeof child.close != 'undefined') child.close();
+ else gw_detach_child(child);
+
+ if (list.length < count) {
+ i-= (count - list.length);
+ count = list.length;
+ }
+ }
+}
+
+gwskin.get_style = function(class_name, style_name)
+{
+ if (arguments.length==1) style_name = 'normal';
+ if (style_name=='invisible') return gwskin.appearance_transparent;
+
+ if (class_name=='null') return null;
+ if (class_name=='self') return gw_new_appearance(0.6, 0.6, 0.6);
+ if (typeof gwskin[class_name] == 'undefined') {
+ alert('Unknown class name ' + class_name);
+ return null;
+ }
+ if (typeof gwskin[class_name][style_name] != 'undefined')
+ return gwskin[class_name][style_name];
+
+ alert('Unknown style '+style_name + ' in class ' + class_name);
+ return null;
+}
+
+gwskin.get_font = function(class_name)
+{
+ if (class_name=='null') return null;
+ if (class_name=='self') return gw_new_fontstyle(gwskin.default_text_size, 1);
+
+ if (typeof gwskin[class_name] == 'undefined') {
+ alert('Unknown class name ' + class_name);
+ return null;
+ }
+ if (typeof gwskin[class_name].font != 'undefined')
+ return gwskin[class_name].font;
+
+ alert('No font style in class ' + class_name);
+ return null;
+}
+
+function gw_new_container()
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'Container');
+ obj.push_to_top = function(wnd) {
+ this.removeChildren[0] = wnd;
+ this.addChildren[0] = wnd;
+ }
+ return obj;
+}
+
+
+function gw_new_rectangle(class_name, style)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'Rectangle');
+ var shape = new SFNode('Shape');
+ obj.children[0] = shape;
+ if (arguments.length==1) style='normal';
+
+ shape.appearance = gwskin.get_style(class_name, style);
+
+ if (shape.appearance && (typeof (shape.appearance.skin) == 'undefined')) {
+ obj.set_alpha = function(alpha) {
+ this.children[0].appearance.material.transparency = 1-alpha;
+ }
+ obj.set_fill_color = function(r, g, b) {
+ this.children[0].appearance.material.emissiveColor.r = r;
+ this.children[0].appearance.material.emissiveColor.g = g;
+ this.children[0].appearance.material.emissiveColor.b = b;
+ }
+ obj.set_strike_color = function(r, g, b) {
+ if (!this.children[0].appearance.material.lineProps) this.children[0].appearance.material.lineProps = new SFNode('LineProperties');
+ this.children[0].appearance.material.lineProps.lineColor.r = r;
+ this.children[0].appearance.material.lineProps.lineColor.g = g;
+ this.children[0].appearance.material.lineProps.lineColor.b = b;
+ }
+ obj.set_line_width = function(width) {
+ if (!this.children[0].appearance.material.lineProps) this.children[0].appearance.material.lineProps = new SFNode('LineProperties');
+ this.children[0].appearance.material.lineProps.width = width;
+ }
+ } else {
+ obj.set_alpha = function(alpha) {}
+ obj.set_fill_color = function(r, g, b) {}
+ obj.set_strike_color = function(r, g, b) {}
+ obj.set_line_width = function(width) {}
+ }
+
+ obj.set_style = function(classname, style) {
+ var app = gwskin.get_style(classname, style);
+ if (app) this.children[0].appearance = app;
+ }
+
+
+ shape.geometry = new SFNode('Curve2D');
+ shape.geometry.point = new SFNode('Coordinate2D');
+
+ obj.corner_tl = true;
+ obj.corner_tr = true;
+ obj.corner_bl = true;
+ obj.corner_br = true;
+ obj.set_corners = function(tl, tr, br, bl) {
+ this.corner_tl = tl;
+ this.corner_tr = tr;
+ this.corner_bl = bl;
+ this.corner_br = br;
+ }
+
+ obj.set_size = function(w, h) {
+ var hw, hh, rx_bl, ry_bl, rx_br, ry_br, rx_tl, ry_tl, rx_tr, ry_tr, rx, ry;
+ var temp;
+ hw = w/2;
+ hh = h/2;
+ this.width = w;
+ this.height = h;
+ temp = this.children[0].geometry.type;
+ temp[0] = 7;
+ temp[1] = 1;
+ temp[2] = 7;
+ temp[3] = 1;
+ temp[4] = 7;
+ temp[5] = 1;
+ temp[6] = 7;
+ temp[7] = 6;/*close*/
+
+ /*compute default rx/ry*/
+ ry = rx = 10;
+ if (rx>=hw) rx=hw;
+ if (ry>=hh) ry=hh;
+ rx_bl = rx_br = rx_tl = rx_tr = rx;
+ ry_bl = ry_br = ry_tl = ry_tr = ry;
+ if (!this.corner_tl) rx_tl = ry_tl = 0;
+ if (!this.corner_tr) rx_tr = ry_tr = 0;
+ if (!this.corner_bl) rx_bl = ry_bl = 0;
+ if (!this.corner_br) rx_br = ry_br = 0;
+
+ temp = this.children[0].geometry.point.point;
+ temp[0] = new SFVec2f(hw-rx_tr, hh);
+ temp[1] = new SFVec2f(hw, hh);/*bezier ctrl point or line-to*/
+ temp[2] = new SFVec2f(hw, hh-ry_tr);
+ temp[3] = new SFVec2f(hw, -hh+ry_br);
+ temp[4] = new SFVec2f(hw, -hh);/*bezier control point*/
+ temp[5] = new SFVec2f(hw-rx_br, -hh);
+ temp[6] = new SFVec2f(-hw+rx_bl, -hh);
+ temp[7] = new SFVec2f(-hw, -hh);/*bezier control point*/
+ temp[8] = new SFVec2f(-hw, -hh+ry_bl);
+ temp[9] = new SFVec2f(-hw, hh-ry_tl);
+ temp[10] = new SFVec2f(-hw, hh);/*bezier control point*/
+ temp[11] = new SFVec2f(-hw+rx_tl, hh);
+ }
+ return obj;
+}
+
+function gw_new_text(parent, label, class_name)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'Text');
+ gw_add_child(parent, obj);
+ obj.children[0] = new SFNode('Transform2D');
+ obj.children[0].children[0] = new SFNode('Shape');
+ obj.children[0].children[0].appearance = gwskin.get_style(class_name, 'text');
+
+ obj.children[0].children[0].geometry = new SFNode('Text');
+ obj.children[0].children[0].geometry.fontStyle = gwskin.get_font(class_name);
+
+
+ obj.set_label = function(value) {
+ this.children[0].children[0].geometry.string.length = 0;
+ this.children[0].children[0].geometry.string[0] = value;
+ }
+
+ obj.set_labels = function() {
+ this.children[0].children[0].geometry.string.length = 0;
+ for (var i=0; i<arguments.length; i++) {
+ this.children[0].children[0].geometry.string[i] = '' + arguments[i];
+ }
+ }
+ obj.get_label = function() {
+ return this.children[0].children[0].geometry.string[0];
+ }
+ obj.set_width = function(value) {
+ this.children[0].children[0].geometry.maxExtent = -value;
+ this.width = value;
+ }
+ obj.font_size = function(value) {
+ return this.children[0].children[0].geometry.fontStyle ? this.children[0].children[0].geometry.fontStyle.size : 1;
+ }
+
+ if (obj.children[0].children[0].appearance && (typeof (obj.children[0].children[0].appearance.skin) == 'undefined')) {
+ obj.set_color = function(r, g, b) {
+ this.children[0].children[0].appearance.material.emissiveColor = new SFColor(r, g, b);
+ }
+ obj.children[0].set_alpha = function(a) {
+ this.children[0].children[0].appearance.material.transparency = 1-a;
+ }
+ } else {
+ obj.set_color = function(r, g, b) {}
+ obj.set_alpha = function(a) {}
+ }
+ obj.set_size = function(width, height) {
+ var justify = this.children[0].children[0].geometry.fontStyle ? this.children[0].children[0].geometry.fontStyle.justify[0] : '';
+ if (justify=='BEGIN') {
+ this.children[0].translation.x = - width / 2;
+ } else if (justify=='END') {
+ this.children[0].translation.x = width / 2;
+ } else {
+ this.children[0].translation.x = 0;
+ }
+ this.width = width;
+ this.height = height;
+ }
+
+ if (obj.children[0].children[0].geometry.fontStyle && (typeof (obj.children[0].children[0].geometry.fontStyle.skin) == 'undefined')) {
+ obj.children[0].set_font_size = function(value) {
+ this.children[0].children[0].geometry.fontStyle.size = value;
+ }
+ obj.children[0].set_align = function(value) {
+ this.children[0].children[0].geometry.fontStyle.justify[0] = (value==0) ? 'BEGIN' : (value==2) ? 'END' : 'MIDDLE';
+ }
+ } else {
+ obj.set_font_size = function(value) {}
+ obj.set_align = function(value) {}
+ }
+ if (label) obj.set_label(label);
+ return obj;
+}
+
+
+function gw_new_window(parent, offscreen, class_name)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'Window');
+ obj.rect = gw_new_rectangle(class_name);
+ obj.visible = false;
+ obj.scale.x = obj.scale.y = 0;
+
+ obj.on_event = function(evt) { return 0; }
+
+ obj.set_style = function(classname, style) {
+ this.rect.set_style(classname, style);
+ }
+ if (! offscreen) {
+ gw_add_child(obj, rect);
+ var item = new SFNode('Layer2D');
+ setup_gw_object(item, 'Layer');
+ gw_add_child(obj, item);
+ obj.set_size = function(width, height) {
+ this.width = width;
+ this.height = height;
+ this.children[0].set_size(width, height);
+ this.children[1].size.x = width;
+ this.children[1].size.y = height;
+ this.layout(width, height);
+ }
+ obj.set_alpha = function(alpha) {
+ this.children[0].set_alpha(alpha);
+ }
+ obj.add_child = function(child) {
+ this.children[1].children[this.children[1].children.length] = child;
+ }
+ obj.remove_child = function(child) {
+ this.children[1].removeChildren[0] = child;
+ }
+ obj._wnd_close = function() {
+ obj.rect = null;
+ gw_close_child_list(this.children);
+ }
+ } else {
+ var shape = new SFNode('Shape');
+ shape.appearance = new SFNode('Appearance');
+ shape.appearance.material = new SFNode('Material2D');
+ shape.appearance.material.filled = TRUE;
+ shape.appearance.texture = new SFNode('CompositeTexture2D');
+ shape.appearance.texture.children[0] = obj.rect;
+ shape.geometry = new SFNode('Bitmap');
+ obj.children[0] = shape;
+
+ obj.set_size = function(width, height) {
+ this.width = width;
+ this.height = height;
+ this.children[0].appearance.texture.pixelWidth = width;
+ this.children[0].appearance.texture.pixelHeight = height;
+ this.children[0].appearance.texture.children[0].set_size(width, height);
+ this.layout(width, height);
+ }
+
+ obj.set_alpha = function(alpha) {
+ this.children[0].appearance.material.transparency = 1 - alpha;
+ }
+ obj.add_child = function(child) {
+ this.children[0].appearance.texture.children[this.children[0].appearance.texture.children.length] = child;
+ }
+ obj.remove_child = function(child) {
+ this.children[0].appearance.texture.removeChildren[0] = child;
+ }
+ obj._wnd_close = function() {
+ obj.rect = null;
+ gw_close_child_list(this.children[0].appearance.texture.children);
+ }
+ }
+ obj._pre_destroy = obj._wnd_close;
+ obj.set_corners = function(tl, tr, br, bl) {
+ this.rect.set_corners(tl, tr, br, bl);
+ }
+
+ if (typeof gwskin[class_name] != 'undefined') {
+ if (typeof gwskin[class_name].show != 'undefined') obj.show = gwskin[class_name].show;
+ if (typeof gwskin[class_name].hide != 'undefined') obj.hide = gwskin[class_name].hide;
+ }
+ obj._on_wnd_close = obj.close;
+ obj.close = function () {
+ this.hide(this._on_wnd_close);
+ }
+ obj.layout = function (w, h) {}
+
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+function gw_new_icon_button(parent, icon_url, label, class_name, horizontal)
+{
+ var touch;
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'IconButton');
+
+ if (arguments.length<5) horizontal = false;
+
+ obj.children[0] = new SFNode('Transform2D');
+ obj.children[0].children[0] = new SFNode('Layer2D');
+ obj.children[1] = gw_new_rectangle(class_name, 'invisible');
+
+ obj.children[2] = new SFNode('TouchSensor');
+
+ if (gwskin.get_font(class_name) != null) {
+ obj.children[3] = gw_new_text(null, label, class_name);
+ if (horizontal) {
+ obj.set_size = function(width, height) {
+ this.children[0].children[0].size.x = height;
+ this.children[0].children[0].size.y = height;
+ this.children[0].translation.x = (height-width)/2;
+ this.children[1].set_size(width, height);
+ this.children[3].set_width(width-height);
+ this.children[3].translation.x = height - width/2;
+ this.width = width;
+ this.height = height;
+ };
+ } else {
+ obj.set_size = function(width, height) {
+ var fsize = this.children[3].font_size();
+ var h = height - fsize;
+ this.children[0].children[0].size.x = h;
+ this.children[0].children[0].size.y = h;
+ this.children[0].translation.y = (height-h)/2;
+ this.children[1].set_size(3*width/2, height);
+ this.children[3].set_width(3*width/2);
+ this.children[3].translation.y = -height/2+fsize/2;
+ this.width = 3*width/2;
+ this.height = height;
+ };
+ }
+ obj.set_label = function(label) {
+ this.children[3].set_label(label);
+ }
+ obj.get_label = function() {
+ return this.children[3].get_label();
+ }
+ } else {
+ obj.set_size = function(width, height) {
+ this.children[0].children[0].size.x = width;
+ this.children[0].children[0].size.y = height;
+ this.children[1].set_size(width, height);
+ this.width = width;
+ this.height = height;
+ };
+ obj.set_label = function(label) {
+ this.label = label;
+ }
+ obj.get_label = function() {
+ return this.label;
+ }
+ }
+
+ obj._last_ts = 0;
+ obj.on_long_click = NULL;
+ obj.on_click = NULL;
+ obj.on_over = null;
+ obj.down = false;
+ obj.over = false;
+ obj._on_active = function(value, timestamp) {
+ if (value) {
+ this.down = true;
+ this.children[1].set_style(class_name, 'down');
+ this._last_ts = timestamp;
+ } else {
+ if (this.down && this.over) {
+ if (this.on_long_click && (timestamp - this._last_ts > gwskin.long_click_delay)) this.on_long_click();
+ else if (this.on_click) this.on_click();
+ }
+ this.down = false;
+ this.children[1].set_style(class_name, (this.over && gwskin.pointing_device) ? 'over' : 'invisible');
+ }
+ };
+ obj._on_over = function(value) {
+ this.over = value;
+ if (gwskin.pointing_device) {
+ var app = gwskin.get_style(class_name, 'over');
+ if (app) {
+ this.children[1].set_style(class_name, value ? 'over' : 'invisible');
+ }
+ if (this.on_over) this.on_over(value);
+ if (gwskin.tooltip_callback) gwskin.tooltip_callback(value, this.get_label() );
+ }
+ };
+ Browser.addRoute(obj.children[2], 'isOver', obj, obj._on_over);
+ Browser.addRoute(obj.children[2], 'isActive', obj, obj._on_active);
+
+ obj.icons = [];
+ obj.add_icon = function(url) {
+
+ if(typeof url == 'string') {
+ var inl = gw_load_resource(url);
+ } else {
+ var inl = url;
+ }
+ this.icons[this.icons.length] = inl;
+
+ if (this.children[0].children[0].children.length==0) {
+ this.children[0].children[0].children[0] = this.icons[0];
+ }
+ }
+ obj.switch_icon = function(idx) {
+ while (idx>this.icons.length) idx-=this.icons.length;
+ this.children[0].children[0].children[0] = this.icons[idx];
+ }
+ obj._pre_destroy = function() {
+ for (var i in this.icons) {
+ gw_unload_resource(this.icons[i]);
+ }
+ this.icons.length = 0;
+ Browser.deleteRoute(this.children[2], 'ALL', null, null);
+ }
+
+
+ if (icon_url) obj.add_icon(icon_url);
+ obj.set_label(label);
+
+
+ if (typeof gwskin[class_name] != 'undefined') {
+ if (typeof gwskin[class_name].width == 'undefined') gwskin[class_name].width = control_icon_size;
+ if (typeof gwskin[class_name].height == 'undefined') gwskin[class_name].height = control_icon_size;
+ obj.set_size(gwskin[class_name].width, gwskin[class_name].height);
+ } else {
+ obj.set_size(gwskin.control_icon_size, gwskin.control_icon_size);
+ }
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+
+function gw_new_subscene(parent)
+{
+ var inline = new SFNode('Inline');
+ inline._name = 'Subscene';
+ inline._pre_destroy = function() {
+ this.url[0]='';
+ this.url.length = 0;
+ }
+ inline.connect = function(url) {
+ this.url.length = 0;
+ this.url[0]=url;
+ }
+ gw_add_child(parent, inline);
+ return inline;
+}
+
+function gw_new_button(parent, text, class_name)
+{
+ var label;
+ obj = gw_new_rectangle(class_name, 'normal');
+ label = gw_new_text(obj, text, class_name);
+ gw_object_set_hitable(obj);
+ obj.on_over = function(val) {
+ if (gwskin.pointing_device) {
+ this.set_style(class_name, val ? 'over' : 'normal');
+ }
+ if (gwskin.tooltip_callback) gwskin.tooltip_callback(value, this.get_label() );
+ }
+ obj.on_down = function(val) {
+ this.set_style(class_name, val ? 'down' : (this._over ? 'over' : 'normal') );
+ }
+
+ obj._set_size = obj.set_size;
+ obj.set_size = function(width, height) {
+ this._set_size(width, height);
+ this.children[1].set_size(width, height);
+ this.children[1].set_width(width);
+ };
+ obj.set_label = function(label) {
+ this.children[1].set_label(label);
+ }
+ obj.get_label = function() {
+ return this.children[1].get_label();
+ }
+ obj.set_labels = function() {
+ this.children[1].set_labels.apply(this.children[1], arguments);
+ }
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+
+
+function grid_event_navigate(dlg, children, type)
+{
+ var i;
+ if (dlg.current_focus==-1) {
+ for (i=0; i<children.length; i++) {
+ if (children[i].visible && (children[i].translation.x - children[i].width/2 >= -dlg.width/2)) {
+ dlg.current_focus = i;
+ gpac.set_focus(children[i]);
+ return true;
+ }
+ }
+ }
+ if (type=='Right') {
+ var orig_focus = dlg.current_focus;
+ var switch_page = 0;
+ var tr = children[dlg.current_focus].translation.y - children[dlg.current_focus].height/2;
+ if (dlg.current_focus + 1 == children.length) return false;
+ /*goto right item*/
+ dlg.current_focus++;
+ /*check we are not going down*/
+ while (1) {
+ if (children[dlg.current_focus].visible && (children[dlg.current_focus].translation.y + children[dlg.current_focus].height/2>tr))
+ break;
+ if (dlg.current_focus + 1 == children.length) {
+ dlg.current_focus = orig_focus;
+ return false;
+ }
+ dlg.current_focus++;
+ switch_page=1;
+ }
+ /*check we haven't move to a new page*/
+ if (children[orig_focus].translation.y + children[orig_focus].height/2 <= children[dlg.current_focus].translation.y - children[dlg.current_focus].height/2) {
+ switch_page=1;
+ }
+ gpac.set_focus(children[dlg.current_focus]);
+ if (switch_page) dlg._move_to(dlg.translate - dlg.width);
+ return true;
+ }
+
+ if (type=='Left') {
+ var orig_focus = dlg.current_focus;
+ var switch_page = 0;
+ var tr = children[dlg.current_focus].translation.y + children[dlg.current_focus].height/2;
+ if (!dlg.current_focus) return false;
+ /*goto left item*/
+ dlg.current_focus--;
+ /*check we are not going up*/
+ while (1) {
+ if (children[dlg.current_focus].visible && (children[dlg.current_focus].translation.y - children[dlg.current_focus].height/2 < tr))
+ break;
+ if (!dlg.current_focus) {
+ dlg.current_focus = orig_focus;
+ return false;
+ }
+ dlg.current_focus--;
+ switch_page=1;
+ }
+ /*check we haven't move to a new page*/
+ if (children[orig_focus].translation.y - children[orig_focus].height/2 >= children[dlg.current_focus].translation.y + children[dlg.current_focus].height/2) {
+ switch_page=1;
+ }
+ gpac.set_focus(children[dlg.current_focus]);
+ if (switch_page) dlg._move_to(dlg.translate + dlg.width);
+ return true;
+ }
+
+ if (type=='Down') {
+ var orig_focus = dlg.current_focus;
+ var switch_page = 0;
+ var ty = children[dlg.current_focus].translation.y - children[dlg.current_focus].height/2;
+ if (dlg.current_focus + 1 == children.length) return false;
+ dlg.current_focus++;
+ /*goto next line*/
+ while (1) {
+ if (children[dlg.current_focus].visible && (children[dlg.current_focus].translation.y - children[dlg.current_focus].height/2<ty))
+ break;
+ if (dlg.current_focus + 1 == children.length) {
+ dlg.current_focus = orig_focus;
+ return false;
+ }
+ dlg.current_focus++;
+ }
+ /*goto bottom child*/
+ var tx = children[orig_focus].translation.x - children[orig_focus].width/2;
+ while (1) {
+ if (children[dlg.current_focus].visible && (children[dlg.current_focus].translation.x + children[dlg.current_focus].width/2 > tx))
+ break;
+ if (dlg.current_focus + 1 == children.length) break;
+ dlg.current_focus++;
+ }
+
+ gpac.set_focus(children[dlg.current_focus]);
+ return true;
+ }
+
+ if (type=='Up') {
+ var orig_focus = dlg.current_focus;
+ var switch_page = 0;
+ var ty = children[dlg.current_focus].translation.y + children[dlg.current_focus].height/2;
+ if (!dlg.current_focus) return false;
+ dlg.current_focus--;
+ /*goto previous line*/
+ while (1) {
+ if (children[dlg.current_focus].visible && (children[dlg.current_focus].translation.y + children[dlg.current_focus].height/2>ty))
+ break;
+ if (!dlg.current_focus) {
+ dlg.current_focus = orig_focus;
+ return false;
+ }
+ dlg.current_focus--;
+ }
+ /*goto above child*/
+ var tx = children[orig_focus].translation.x + children[orig_focus].width/2;
+ while (1) {
+ if (children[dlg.current_focus].visible && (children[dlg.current_focus].translation.x - children[dlg.current_focus].width/2 < tx))
+ break;
+ if (!dlg.current_focus) {
+ dlg.current_focus = orig_focus;
+ return false;
+ }
+ dlg.current_focus--;
+ }
+ gpac.set_focus(children[dlg.current_focus]);
+ return true;
+ }
+ return false;
+}
+
+function gw_new_grid_container(parent)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'FlipContainer');
+
+ obj._ps2d = new SFNode('PlaneSensor2D');
+ obj._ps2d.maxPosition.x = obj._ps2d.maxPosition.y = -1;
+ obj._ps2d.autoOffset = TRUE;
+
+ obj.children[0] = new SFNode('Layer2D');
+// obj.children[0].children[0] = gw_new_rectangle('', 'invisible');
+ obj.children[0].children[0] = obj._ps2d;
+ obj.children[0].children[1] = new SFNode('Transform2D');
+
+ obj._move_to = function(value) {
+ this.translate = value;
+ if (this.translate>0) this.translate = 0;
+ else if (this.translate<-this.max_width) this.translate = -this.max_width;
+
+ if (0) {
+ this.timer = gw_new_timer(true);
+ this.timer.set_timeout(0.25, false);
+ this.timer.from = this.children[0].children[1].translation.x;
+ this.timer.dlg = this;
+ this.timer.on_fraction = function(val) {
+ var x = (1-val)*this.from + val*this.dlg.translate;
+ this.dlg.children[0].children[1].translation.x = x;
+
+ /*
+ var children = obj.children[0].children[1].children;
+ for (var i=0; i<children.length; i++) {
+ children[i].scale.x = (val>0.5) ? (2*val - 1) : (1 - 2*val);
+ }
+ */
+ }
+ this.timer.on_active = function(val) {
+ if (!val) {
+ this.dlg.timer = null;
+ this.dlg = null;
+ }
+ }
+ this.timer.start(0);
+ } else {
+ this.children[0].children[1].translation.x = this.translate;
+ }
+ this._ps2d.offset.x = -this.translate;
+ }
+
+ obj.translate = 0;
+ obj._on_slide = function(val) {
+ this.translate = - val.x;
+ if (this.translate>0) this.translate = 0;
+ else if (this.translate<-this.max_width) this.translate = -this.max_width;
+ this.children[0].children[1].translation.x = this.translate;
+ }
+ obj._on_active = function(val) {
+ if (!val) {
+ var off_x = 0;
+ while (off_x - this.width/2 > this.translate) off_x -= this.width;
+ this._move_to(off_x);
+ }
+ }
+ Browser.addRoute(obj._ps2d, 'translation_changed', obj, obj._on_slide);
+ Browser.addRoute(obj._ps2d, 'isActive', obj, obj._on_active);
+ obj.children[0].children[2] = obj._ps2d;
+
+ obj.spread_h = false;
+ obj.spread_v = false;
+ obj.break_at_hidden = false;
+ obj.set_size = function(width, height) {
+ this.width = width;
+ this.height = height;
+ this.children[0].size.x = width;
+ this.children[0].size.y = height;
+// this.children[0].children[0].set_size(width, height);
+ this.nb_visible=0;
+ this.first_visible=0;
+ this.layout();
+ }
+ obj.max_width = 0;
+ obj.layout = function() {
+ var spread_x, nb_wid_h, start_x, start_y, maxh, width, height, page_x, nb_on_line;
+ var children = obj.children[0].children[1].children;
+ width = this.width;
+ height = this.height;
+
+ page_x = 0;
+ maxh = 0;
+ spread_x = -1;
+ start_x = -width/2;
+ start_y = height/2;
+ nb_on_line = 0;
+ this.current_focus = -1;
+ for (var i=0; i<children.length; i++) {
+ //start of line: compute H spread and max V size
+ if (spread_x == -1) {
+ var j=0, len = 0, maxh = 0, nb_child = 0;
+ start_x = - width/2 + page_x;
+ while (1) {
+ if (!children[i+j].visible) {
+ j++;
+ if (i+j==children.length) break;
+ if (this.break_at_hidden) break;
+ continue;
+ }
+ if (len + children[i+j].width > width) break;
+ len += children[i+j].width;
+ if (maxh < children[i+j].height) maxh = children[i+j].height;
+ j++;
+ nb_child++;
+ if (i+j==children.length) break;
+ }
+ if (nb_child<=1) {
+ maxh = children[i].height;
+ if (this.spread_h) start_x = -len/2;
+ }
+ else if (this.spread_h) {
+ spread_x = (width - len) / (nb_child);
+ start_x += spread_x/2;
+ } else {
+ spread_x = 0;
+ }
+ }
+
+ if (!children[i].visible) {
+ if (nb_on_line && this.break_at_hidden) {
+ nb_on_line = 0;
+ spread_x = -1;
+ start_y -= maxh/2;
+ start_x = - width/2;
+ }
+ continue;
+ }
+ if (start_y - maxh < - height/2) {
+ nb_on_line = 0;
+ page_x += width;
+ spread_x = -1;
+ start_y = height/2;
+ i--;
+ continue;
+ }
+ children[i].translation.x = start_x + children[i].width/2;
+ children[i].translation.y = start_y - maxh/2;
+
+// alert('child i' + i + '/' + children.length + ' size ' + children[i].width + 'x' + children[i].height + ' translation ' + children[i].translation);
+ start_x += children[i].width + spread_x;
+
+ nb_on_line++;
+
+ if (i+1==children.length) {
+ break;
+ }
+ if (start_x - page_x + children[i+1].width > width/2) {
+ nb_on_line = 0;
+ spread_x = -1;
+ start_y -= maxh;
+ start_x = - width/2;
+ }
+ }
+ this.max_width = page_x;
+ this._ps2d.enabled = (this.max_width) ? TRUE : FALSE;
+ }
+
+ obj.add_child = function(child) {
+ this.children[0].children[1].children[this.children[0].children[1].children.length] = child;
+ gw_add_child(child, this._ps2d);
+ }
+ obj.remove_child = function(child) {
+ /*remove ps2d from each child, otherwise we create references which screw up JS GC*/
+ if (typeof child.remove_child != 'undefined') child.remove_child(this._ps2d);
+ else child.removeChildren[0] = this._ps2d;
+
+ this.children[0].children[1].removeChildren[0] = child;
+ }
+
+ obj.get_children = function() {
+ return this.children[0].children[1].children;
+ }
+ obj.reset_children = function () {
+ gw_close_child_list(this.children[0].children[1].children);
+ this.children[0].children[1].children.length = 0;
+ }
+ obj._pre_destroy = function() {
+ Browser.deleteRoute(this._ps2d, 'ALL', null, null);
+ this.reset_children();
+ this.children.length = 0;
+ this._ps2d = null;
+ }
+
+ obj.set_focus = function(type) {
+ grid_event_navigate(this, this.children[0].children[1].children, type);
+ }
+
+ obj.on_event = function(evt) {
+ switch (evt.type) {
+ case GF_EVENT_MOUSEWHEEL:
+ if (evt.button==1) {
+ var tr = this.translate + (evt.wheel>0 ? this.width : -this.width);
+ this._move_to(this.translate + (evt.wheel<0 ? this.width : -this.width) );
+ return 1;
+ }
+ return 0;
+ case GF_EVENT_KEYDOWN:
+ if ((evt.keycode=='Up') || (evt.keycode=='Down') || (evt.keycode=='Right') || (evt.keycode=='Left') ) {
+ return grid_event_navigate(this, this.children[0].children[1].children, evt.keycode);
+ }
+ case GF_EVENT_KEYDOWN:
+ if ((evt.keycode=='Up') || (evt.keycode=='Down') || (evt.keycode=='Right') || (evt.keycode=='Left') ) {
+ return grid_event_navigate(this, this.children[0].children[1].children, evt.keycode);
+ }
+ return 0;
+ }
+ return 0;
+ }
+
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+
+
+function gw_new_progress_bar(parent, vertical, with_progress, class_name)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'ProgressBar');
+ var ps2d;
+
+ if (arguments.length<=3) class_name = 'progress';
+ if (arguments.length<=2) with_progress = false;
+ if (arguments.length<=1) vertical = false;
+
+ obj.children[0] = gw_new_rectangle(class_name, 'normal');
+ if (with_progress) {
+ obj.children[1] = gw_new_rectangle(class_name, 'down');
+
+ obj.set_progress = function(prog) {
+ if (prog<0) prog=0;
+ else if (prog>100) prog=100;
+ this.prog = prog;
+ prog/=100;
+ if (this.vertical) {
+ var pheight = prog*this.height;
+ this.children[1].set_size(this.width, pheight);
+ this.children[1].move(0, (this.height-pheight)/2, 0);
+ } else {
+ var pwidth = prog*this.width;
+ this.children[1].set_size(pwidth, this.height);
+ this.children[1].move((pwidth-this.width)/2, 0);
+ }
+ }
+ } else {
+ obj.set_progress = function(prog) {}
+ }
+ obj.slide_idx = obj.children.length;
+ obj.children[obj.slide_idx] = gw_new_rectangle(class_name, 'over');
+
+ obj.children[obj.slide_idx+1] = gw_new_rectangle(class_name, 'invisible');
+ ps2d = new SFNode('PlaneSensor2D');
+ obj.children[obj.slide_idx+1].children[1] = ps2d;
+ ps2d.maxPosition.x = -1;
+ ps2d.maxPosition.y = -1;
+
+ obj.on_slide = function(value, type) { }
+
+ obj._with_progress = with_progress;
+ obj._sliding = false;
+ obj._slide_active = function(val) {
+ obj._sliding = val;
+ this.on_slide(this.min + (this.max-this.min) * this.frac, val ? 1 : 2);
+ }
+ Browser.addRoute(ps2d, 'isActive', obj, obj._slide_active);
+
+ obj._set_trackpoint = function(value) {
+ if (this.vertical) {
+ this.frac = value.y/this.height;
+ } else {
+ this.frac = value.x/this.width;
+ }
+ this.frac += 0.5;
+ if (this.frac>1) this.frac=1;
+ else if (this.frac<0) this.frac=0;
+
+ this._set_frac();
+ this.on_slide(this.min + (this.max-this.min) * this.frac, 0);
+ }
+ Browser.addRoute(ps2d, 'trackPoint_changed', obj, obj._set_trackpoint);
+
+ obj._set_frac = function() {
+ if (this.vertical) {
+ var pheight = this.frac*this.height;
+ if (pheight<this.width) pheight = this.width;
+ this.children[this.slide_idx].set_size(this.width, pheight);
+ this.children[this.slide_idx].move(0, (this.height-pheight)/2, 0);
+ } else {
+ var pwidth = this.frac*this.width;
+ if (pwidth<this.height) pwidth = this.height;
+ this.children[this.slide_idx].set_size(pwidth, this.height);
+ this.children[this.slide_idx].move((pwidth-this.width)/2, 0);
+ }
+ }
+
+ obj.set_value = function(value) {
+ if (this._sliding) return;
+
+ value -= this.min;
+ if (value<0) value = 0;
+ else if (value>this.max-this.min) value = this.max-this.min;
+ if (this.max==this.min) value = 0;
+ else value /= (this.max-this.min);
+
+ this.frac = value;
+ this._set_frac();
+ }
+
+
+ obj.vertical = vertical;
+ obj.set_size = function(w, h) {
+ this.width = w;
+ this.height = h;
+ this.children[0].set_size(w, h);
+ if (this._with_progress) {
+ this.children[3].set_size(w, h);
+ } else {
+ this.children[2].set_size(w, h);
+ }
+ this._set_frac();
+ this.set_progress(this.prog);
+ }
+ obj.min = 0;
+ obj.max = 100;
+
+ obj.move = function(x,y) {
+ this.translation.x = x;
+ this.translation.y = y;
+ }
+
+ obj.prog = 0;
+ obj.frac = 0;
+ obj.set_size(vertical ? 10 : 200, vertical ? 200 : 10);
+
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+function gw_new_slider(parent, vertical, class_name)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'Slider');
+
+ if (arguments.length<=2) class_name = 'progress';
+ if (arguments.length<=1) vertical = false;
+
+ obj.children[0] = gw_new_rectangle(class_name, 'normal');
+ obj.children[1] = gw_new_rectangle(class_name, 'over');
+ obj.children[2] = gw_new_rectangle(class_name, 'invisible');
+
+ var ps2d = new SFNode('PlaneSensor2D');
+ obj.children[2].children[1] = ps2d;
+ ps2d.maxPosition.x = -1;
+ ps2d.maxPosition.y = -1;
+ obj.on_slide = function(value, type) { }
+
+ obj.slide_active = function(val) {
+ this.on_slide(this.min + (this.max-this.min) * this.frac, val ? 1 : 2);
+ }
+ Browser.addRoute(ps2d, 'isActive', obj, obj.slide_active);
+ obj.set_trackpoint = function(value) {
+ if (vertical) {
+ this.frac = value.y/(this.height-this.children[1].height);
+ } else {
+ this.frac = value.x/(this.width-this.children[1].width);
+ }
+ this.frac += 0.5;
+ if (this.frac>1) this.frac=1;
+ else if (this.frac<0) this.frac=0;
+
+ if (vertical) {
+ value.y = (this.frac-0.5) * (this.height-this.children[1].height);
+ value.x = 0;
+ } else {
+ value.x = (this.frac-0.5) * (this.width-this.children[1].width);
+ value.y = 0;
+ }
+ this.children[1].translation = value;
+ this.on_slide(this.min + (this.max-this.min) * this.frac, 0);
+ }
+ Browser.addRoute(ps2d, 'trackPoint_changed', obj, obj.set_trackpoint);
+
+ obj.set_value = function(value) {
+ if (this.children[2].isActive) return;
+
+ value -= this.min;
+ if (value<0) value = 0;
+ else if (value>this.max-this.min) value = this.max-this.min;
+ if (this.max==this.min) value = 0;
+ else value /= (this.max-this.min);
+
+ value -= 0.5;
+ value *= (vertical ? this.height : this.width);
+
+ if (vertical) {
+ this.children[1].translation.y = value;
+ } else {
+ this.children[1].translation.x = value;
+ }
+ }
+
+ obj.vertical = vertical;
+ obj.set_size = function(w, h, cursor_w, cursor_h) {
+ this.width = w;
+ this.height = h;
+ this.children[0].set_size(w, h);
+
+ if (typeof(cursor_w)=='undefined') cursor_w = this.children[1].width;
+ if (typeof(cursor_h)=='undefined') cursor_h = this.children[1].height;
+ this.children[1].set_size(cursor_w, cursor_h);
+
+ if (this.vertical) {
+ this.children[2].set_size(this.children[1].width, h);
+ } else {
+ this.children[2].set_size(w, this.children[1].height);
+ }
+ }
+ obj.set_cursor_size = function(w, h) {
+ this.children[1].set_size(w, h);
+ }
+ obj.min = 0;
+ obj.max = 100;
+
+ obj.move = function(x,y) {
+ this.translation.x = x;
+ this.translation.y = y;
+ }
+ obj.set_size(vertical ? 10 : 200, vertical ? 200 : 10, 10, 10);
+
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+
+function gw_new_window_full(parent, offscreen, the_label, class_name, child_to_insert)
+{
+ var wnd = gw_new_window(parent, offscreen, class_name);
+
+ if (arguments.length<=4) child_to_insert = null;
+ if (child_to_insert) {
+ gw_add_child(wnd, child_to_insert);
+ }
+
+ wnd.area = null;
+
+ wnd.tools = gw_new_grid_container(wnd);
+ wnd.tools._name = 'ToolBar';
+ wnd.tool_size = gwskin.icon.width;
+
+ wnd.label = null;
+ if (the_label) {
+ wnd.label = gw_new_text(wnd.tools, the_label, class_name);
+ wnd.label.set_size(wnd.tool_size, wnd.tool_size);
+ wnd.label.set_width(wnd.tool_size);
+ }
+
+ wnd.set_label = function(label) {
+ if (wnd.label) wnd.label.set_label(label);
+ }
+
+
+ wnd.add_tool = function(icon, name) {
+ var tool = gw_new_icon_button(this.tools, icon, name, 'icon');
+ if (this.label) {
+ this.tools.remove_child(this.label);
+ this.tools.add_child(this.label);
+ }
+ tool.set_size(wnd.tool_size, wnd.tool_size);
+ tool._name = name;
+ tool.dlg = this;
+ return tool;
+ }
+
+
+ wnd.on_close = null;
+ var icon = wnd.add_tool(gwskin.images.cancel, gwskin.labels.close);
+ icon.on_click = function() {
+ if (this.dlg.on_close) this.dlg.on_close();
+ this.dlg.close();
+ }
+
+ wnd._pre_destroy = function() {
+ if (typeof this.predestroy != 'undefined') this.predestroy();
+ this.tools = null;
+ this.label = null;
+ this.area = null;
+ this._wnd_close();
+ }
+
+ wnd.on_size = null;
+ wnd.layout = function(width, height) {
+ var i;
+ var tools = this.tools.get_children();
+
+ if (this.area) {
+ this.area.set_size(width, height - this.tool_size);
+ this.area.move(0, (this.area.height-height)/2);
+ }
+ if (wnd.on_size) wnd.on_size(width, tools.length ? (height - this.tool_size) : height);
+
+ if (this.label) {
+ var textw = width;
+ for (i=0; i<tools.length-1; i++) {
+ if (tools[i].visible) textw -= tools[i].width;
+ }
+ if (textw<0) textw=0;
+ this.label.set_size(textw, this.tool_size);
+ this.label.set_width(textw);
+ }
+
+ this.tools.move(0, (height - this.tool_size)/2);
+ this.tools.set_size(width, this.tool_size);
+ }
+
+ wnd.set_tool_size = function(widget_tool_size) {
+ var i;
+ var tools = this.tools.get_children();
+ this.tool_size = widget_tool_size;
+ for (i=0; i<tools.length; i++) {
+ tools[i].set_size(this.tool_size, this.tool_size);
+ }
+ this.tools.set_size(this.width, widget_tool_size);
+ }
+
+ return wnd;
+}
+
+function gw_new_listbox(container)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'List');
+ obj.children[0] = new SFNode('Layer2D');
+
+ obj._ps2d = new SFNode('PlaneSensor2D');
+ obj._ps2d.maxPosition.x = obj._ps2d.maxPosition.y = -1;
+ obj._ps2d.autoOffset = FALSE;
+ obj._on_slide = function(val) {
+ this._translation_y = -val.y;
+ this.layout();
+ }
+ Browser.addRoute(obj._ps2d, 'translation_changed', obj, obj._on_slide);
+
+ obj.max_height = 0;
+ obj.set_size = function(width, height) {
+ for (var i=0; i<this.children[0].children.length; i++) {
+ this.children[0].children[i].set_size(width, this.children[0].children[i].height);
+ }
+ this.width = width;
+ this.height = height;
+ this.children[0].size.x = width;
+ this.children[0].size.y = height;
+ this._translation_y = 0;
+ this.selected_idx = 0;
+ this.layout_changed();
+ }
+ obj.layout_changed = function() {
+ this.max_height = 0;
+ for (i=0; i<this.children[0].children.length; i++) {
+ if (this.children[0].children[i].visible) {
+ this.max_height += this.children[0].children[i].height;
+ }
+ }
+ this.max_height -= this.height;
+ if (this.max_height < 0) this.max_height=0;
+ this.layout();
+ }
+
+ obj.get_selection = function() {
+ if (this.selected_idx<this.children[0].children.length) return this.children[0].children[this.selected_idx];
+ return null;
+ }
+
+ obj._translation_y = 0;
+ obj.width = obj.height = 0;
+ obj.first_visible = -1;
+ obj.last_visible = -1;
+
+ obj.layout = function() {
+ var children = this.children[0].children;
+ var start_y = this.height/2;
+
+ if (this._translation_y < 0) this._translation_y = 0;
+ else if (this._translation_y > this.max_height) this._translation_y = this.max_height;
+
+ this.first_visible = -1;
+ this.last_visible = -1;
+
+ for (var i=0; i<children.length; i++) {
+ var y = this._translation_y + start_y;
+ if (! children[i].visible) continue;
+
+ if (y - children[i].height > this.height/2) {
+ children[i].scale.x = 0;
+ } else if (y + children[i].height < -this.height/2) {
+ children[i].scale.x = 0;
+ } else {
+ children[i].move(0, y - children[i].height/2);
+ children[i].scale.x = 1;
+
+ if (this.first_visible == -1) {
+ if (y <= this.height/2) this.first_visible = i;
+ }
+ if (y - children[i].height >= -this.height/2) this.last_visible = i;
+
+ if (this.selected_idx == i) {
+ gpac.set_focus(children[i]);
+ }
+ }
+ start_y -= children[i].height;
+ }
+ if (this.selected_idx < this.first_visible) this.selected_idx = this.first_visible;
+ else if (this.selected_idx > this.last_visible) this.selected_idx = this.last_visible;
+ }
+ obj.add_child = function(child) {
+ this.children[0].children[this.children[0].children.length] = child;
+ gw_add_child(child, this._ps2d);
+ }
+ obj.remove_child = function(child) {
+ /*remove ps2d from each child, otherwise we create references which screw up JS GC*/
+ if (typeof child.remove_child != 'undefined') child.remove_child(this._ps2d);
+ else child.removeChildren[0] = this._ps2d;
+ this.children[0].removeChildren[0] = child;
+ }
+
+ obj.get_children = function () {
+ return this.children[0].children;
+ }
+ obj.reset_children = function () {
+ gw_close_child_list(this.children[0].children);
+ this.children[0].children.length = 0;
+ }
+ obj._pre_destroy = function() {
+ this.reset_children();
+ this._ps2d = null;
+ }
+
+ obj.on_event = function(evt) {
+ switch (evt.type) {
+ case GF_EVENT_MOUSEWHEEL:
+ this._translation_y += (evt.wheel>0) ? -this.height/20 : this.height/20;
+ this.layout();
+ return 1;
+ case GF_EVENT_KEYDOWN:
+ var children = this.get_children();
+ if (evt.keycode=='Up') {
+// alert('sel '+ this.selected_idx + ' first '+this.first_visible+ ' last '+this.last_visible);
+ if (children[this.selected_idx].translation.y + children[this.selected_idx].height/2 > this.height/2 ) {
+ this._translation_y -= this.height;
+ this.layout();
+ return 1;
+ }
+ if (!this.selected_idx) return 0;
+ this.selected_idx--;
+ if (this.selected_idx<this.first_visible)
+ this._translation_y -= children[this.last_visible].height;
+ this.layout();
+ return 1;
+ } else if (evt.keycode=='Down') {
+// alert('sel '+ this.selected_idx + ' first '+this.first_visible+ ' last '+this.last_visible);
+ if (this.selected_idx==children.length) return 0;
+
+ if (children[this.selected_idx].translation.y - children[this.selected_idx].height/2 < -this.height/2 ) {
+ this._translation_y += this.height;
+ this.layout();
+ return 1;
+ }
+ this.selected_idx++;
+ if (this.selected_idx>this.last_visible)
+ this._translation_y += children[this.first_visible].height;
+ this.layout();
+ return 1;
+ }
+ return 0;
+ }
+ return 0;
+ }
+
+
+ gw_add_child(container, obj);
+ return obj;
+}
+
+
+function gw_new_file_open(class_name)
+{
+ if (arguments.length==0) class_name = 'window';
+
+ var dlg = gw_new_window_full(null, true, 'Browse FileSystem', 'window');
+
+ dlg.area = gw_new_listbox(dlg);
+
+ dlg.on_event = function(evt) {
+ if (evt.type==GF_EVENT_KEYDOWN) {
+ if (evt.keycode=='Left') {
+ this._browse(null, true);
+ return 1;
+ }
+ else if (evt.keycode=='Enter') {
+ var child = this.area.get_selection();
+ if (child) child.on_click();
+ return 1;
+ }
+ }
+ if (this.area && typeof this.area.on_event != 'undefined') {
+ return this.area.on_event(evt);
+ }
+ }
+
+
+ dlg.go_up = dlg.add_tool(gwskin.images.previous, gwskin.labels.up);
+ dlg.go_up.on_click = function() {
+ this.dlg._browse(null, true);
+ }
+
+ dlg.on_directory = null;
+ dlg.scan_dir = dlg.add_tool(gwskin.images.scan_directory, gwskin.labels.scan_directory);
+ dlg.scan_dir.on_click = function() {
+ if (this.dlg.on_directory) this.dlg.on_directory(this.dlg.directory);
+ this.dlg.close();
+ }
+
+ dlg.predestroy = function() {
+ this.scan_dir = null;
+ this.go_up = null;
+ }
+
+ dlg.directory = '';
+ dlg.show_directory = false;
+ dlg.filter = '*';
+
+ dlg._on_dir_browse = function() {
+ this.dlg._browse(this.dlg.path + this.filename, false);
+ }
+ dlg._on_file_select = function() {
+ if (this.dlg.on_browse) {
+ this.dlg.on_browse(this.dlg.path + this.filename, this.dlg.directory);
+ }
+ this.dlg.close();
+ }
+
+ dlg.browse = function(dir) {
+ this.directory = dir;
+ this._browse(dir, false);
+ }
+ dlg._browse = function(dir, up) {
+ var w, h, i, y;
+ if (dir) this.directory = dir;
+
+ var filelist = gpac.enum_directory(this.directory, this.filter, up);
+
+ if (filelist.length) {
+ this.directory = filelist[0].path;
+ this.set_label(this.directory);
+ } else {
+ this.set_label('');
+ }
+
+ this.area.reset_children();
+
+ this.set_label(this.directory);
+
+ this.path = filelist.length ? filelist[0].path : '';
+
+ for (i=0; i<filelist.length; i++) {
+ var item = gw_new_icon_button(this.area, filelist[i].directory ? gwskin.images.folder : gwskin.images.mime_generic, filelist[i].name, 'listitem', true);
+ item.dlg = this;
+ item.filename = filelist[i].name;
+
+ if (filelist[i].directory) {
+ item.on_click = this._on_dir_browse;
+ } else {
+ item.on_click = this._on_file_select;
+ }
+ }
+ this.layout(this.width, this.height);
+
+ if (this.directory == '') this.go_up.hide();
+ else this.go_up.show();
+
+ if (this.show_directory || (this.filter == 'dir')) this.scan_dir.show();
+ else this.scan_dir.hide();
+
+ this.tools.layout(this.tools.width, this.tools.height);
+ }
+ dlg.scan_dir.hide();
+
+ dlg.on_size = function(width, height) {
+ dlg.area.set_size(width, height);
+ }
+ dlg.set_size(20, 20);
+ return dlg;
+}
+
+
+function gw_new_text_input(text_data, class_name)
+{
+ var obj = gw_new_text(null, text_data, 'edit');
+ obj.on_text = null;
+ obj._text_edited = function(val) {
+ if (this.on_text) this.on_text(val[0]);
+ }
+ Browser.addRoute(obj.children[0].children[0].geometry, 'string', obj, obj._text_edited);
+ return obj;
+}
+
+function gw_new_text_edit(parent, text_data)
+{
+ var obj = new SFNode('Transform2D');
+ var rect, edit;
+ setup_gw_object(obj, 'TextEdit');
+ rect = gw_new_rectangle('edit');
+ gw_add_child(obj, rect);
+ gw_object_set_hitable(rect);
+ rect.on_down = function(val) {
+ if (val) gpac.set_focus( this.parent.children[1] );
+ }
+
+ edit = gw_new_text(null, text_data, 'edit')
+ gw_add_child(obj, edit);
+ obj.on_text = null;
+ obj._text_edited = function(val) {
+ if (this.on_text) this.on_text(val[0]);
+ };
+ Browser.addRoute(obj.children[1].children[0].children[0].geometry, 'string', obj, obj._text_edited);
+
+ obj.set_size = function(w, h) {
+ this.width = w;
+ this.height = h;
+ this.children[0].set_size(w, h);
+ this.children[1].move(5-w/2, 0);
+ };
+
+ gw_add_child(parent, obj);
+
+ /*set focus to our edit node*/
+ gpac.set_focus(edit);
+
+ return obj;
+}
+
+function gw_new_text_area(parent, text_data, class_name)
+{
+ var obj = new SFNode('Transform2D');
+ setup_gw_object(obj, 'TextEdit');
+
+ obj.children[0] = new SFNode('Layout');
+ obj.children[0].parent = obj;
+ obj.children[0].wrap = true;
+ obj.children[0].justify[0] = "JUSTIFY";
+ obj.children[0].justify[1] = "FIRST";
+
+ gw_new_text(obj.children[0], text_data,class_name);
+ obj.set_size = function(width, height) {
+ this.children[0].size.x = width;
+ this.children[0].size.y = height;
+ this.width = width;
+ this.height = height;
+ }
+ obj.set_content = function(text) {
+ this.children[0].children[0].set_label(text);
+ }
+
+ gw_add_child(parent, obj);
+ return obj;
+}
+
+
+
+function gw_new_scrolltext_area(parent, text_data, class_name)
+{
+ var obj = gw_new_listbox(parent);
+ var child = gw_new_text_area(obj, text_data, class_name);
+ /*erase the resize routine*/
+ child.set_size = function(width, height) {
+ var bounds = this.children[0]._bounds;
+ this.children[0].size.x = width;
+ this.children[0].size.y = Math.ceil(bounds.height);
+ this.width = width;
+ this.height = this.children[0].size.y;
+ }
+
+ obj._orig_set_size = obj.set_size;
+ obj.set_size = function(width, height) {
+ this.get_children()[0].set_size(width, height);
+ this._orig_set_size(width, height);
+ }
+ obj.set_content = function(text) {
+ this.get_children()[0].set_label(text);
+ }
+ return obj;
+}
+
+
+function gw_new_message(container, label, content)
+{
+ var notif = gw_new_window_full(null, true, label, 'window');
+ notif.area = gw_new_scrolltext_area(notif, content, 'window');
+ notif.on_size = function(width, height) {
+ this.area.set_size(width-10, height);
+ }
+ notif.on_event = function(evt) {
+ if ((evt.type==GF_EVENT_KEYUP) && evt.keycode==gwskin.keys.close) {
+ this.close();
+ return 1;
+ }
+ return this.area.on_event(evt);
+ }
+ notif.set_size(240, 120);
+ return notif;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/steven/edit-find-48.png"
+ sodipodi:docname="edit-find.svg"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
+ inkscape:version="0.46"
+ sodipodi:version="0.32"
+ id="svg249"
+ height="48.000000px"
+ width="48.000000px"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective113" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5031"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5029"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5027"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4542">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop4544" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop4546" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient15662">
+ <stop
+ id="stop15664"
+ offset="0.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ <stop
+ id="stop15666"
+ offset="1.0000000"
+ style="stop-color:#f8f8f8;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <radialGradient
+ id="aigrd3"
+ cx="20.8921"
+ cy="64.5679"
+ r="5.257"
+ fx="20.8921"
+ fy="64.5679"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ offset="0"
+ style="stop-color:#F0F0F0"
+ id="stop15573" />
+ <stop
+ offset="1.0000000"
+ style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
+ id="stop15575" />
+ </radialGradient>
+ <radialGradient
+ id="aigrd2"
+ cx="20.8921"
+ cy="114.5684"
+ r="5.256"
+ fx="20.8921"
+ fy="114.5684"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ offset="0"
+ style="stop-color:#F0F0F0"
+ id="stop15566" />
+ <stop
+ offset="1.0000000"
+ style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
+ id="stop15568" />
+ </radialGradient>
+ <linearGradient
+ id="linearGradient269">
+ <stop
+ id="stop270"
+ offset="0.0000000"
+ style="stop-color:#a3a3a3;stop-opacity:1.0000000;" />
+ <stop
+ id="stop271"
+ offset="1.0000000"
+ style="stop-color:#4c4c4c;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient259">
+ <stop
+ id="stop260"
+ offset="0.0000000"
+ style="stop-color:#fafafa;stop-opacity:1.0000000;" />
+ <stop
+ id="stop261"
+ offset="1.0000000"
+ style="stop-color:#bbbbbb;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient269"
+ id="radialGradient15656"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.968273,0.000000,0.000000,1.032767,3.353553,0.646447)"
+ cx="8.8244190"
+ cy="3.7561285"
+ fx="8.8244190"
+ fy="3.7561285"
+ r="37.751713" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient259"
+ id="radialGradient15658"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="scale(0.960493,1.041132)"
+ cx="33.966679"
+ cy="35.736916"
+ fx="33.966679"
+ fy="35.736916"
+ r="86.708450" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15662"
+ id="radialGradient15668"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.968273,0.000000,0.000000,1.032767,3.353553,0.646447)"
+ cx="8.1435566"
+ cy="7.2678967"
+ fx="8.1435566"
+ fy="7.2678967"
+ r="38.158695" />
+ <radialGradient
+ r="5.256"
+ fy="114.5684"
+ fx="20.8921"
+ cy="114.5684"
+ cx="20.8921"
+ gradientTransform="matrix(0.229703,0.000000,0.000000,0.229703,4.613529,3.979808)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient2283"
+ xlink:href="#aigrd2"
+ inkscape:collect="always" />
+ <radialGradient
+ r="5.257"
+ fy="64.5679"
+ fx="20.8921"
+ cy="64.5679"
+ cx="20.8921"
+ gradientTransform="matrix(0.229703,0.000000,0.000000,0.229703,4.613529,3.979808)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient2285"
+ xlink:href="#aigrd3"
+ inkscape:collect="always" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4542"
+ id="radialGradient4548"
+ cx="24.306795"
+ cy="42.07798"
+ fx="24.306795"
+ fy="42.07798"
+ r="15.821514"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.284916,0.000000,30.08928)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient4440">
+ <stop
+ id="stop4442"
+ offset="0"
+ style="stop-color:#7d7d7d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#b1b1b1;stop-opacity:1.0000000;"
+ offset="0.50000000"
+ id="stop4448" />
+ <stop
+ id="stop4444"
+ offset="1.0000000"
+ style="stop-color:#686868;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4454">
+ <stop
+ id="stop4456"
+ offset="0.0000000"
+ style="stop-color:#729fcf;stop-opacity:0.20784314;" />
+ <stop
+ id="stop4458"
+ offset="1.0000000"
+ style="stop-color:#729fcf;stop-opacity:0.67619050;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4467">
+ <stop
+ id="stop4469"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop4471"
+ offset="1.0000000"
+ style="stop-color:#ffffff;stop-opacity:0.24761905;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4477"
+ inkscape:collect="always">
+ <stop
+ id="stop4479"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop4481"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2366">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2368" />
+ <stop
+ id="stop2374"
+ offset="0.50000000"
+ style="stop-color:#ffffff;stop-opacity:0.21904762;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2370" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2846">
+ <stop
+ style="stop-color:#8a8a8a;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2848" />
+ <stop
+ style="stop-color:#484848;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2850" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4477"
+ id="radialGradient1527"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.237968,-8.821068e-16,28.93278)"
+ cx="24.130018"
+ cy="37.967922"
+ fx="24.130018"
+ fy="37.967922"
+ r="16.528622" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2846"
+ id="linearGradient1529"
+ gradientUnits="userSpaceOnUse"
+ x1="27.366341"
+ y1="26.580296"
+ x2="31.335964"
+ y2="30.557772" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4440"
+ id="linearGradient1531"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.334593,0.000000,0.000000,1.291292,-6.973842,-7.460658)"
+ x1="30.656250"
+ y1="34.000000"
+ x2="33.218750"
+ y2="31.062500" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2366"
+ id="linearGradient1533"
+ gradientUnits="userSpaceOnUse"
+ x1="18.292673"
+ y1="13.602121"
+ x2="17.500893"
+ y2="25.743469" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4454"
+ id="radialGradient1537"
+ gradientUnits="userSpaceOnUse"
+ cx="18.240929"
+ cy="21.817987"
+ fx="18.240929"
+ fy="21.817987"
+ r="8.3085051" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4467"
+ id="radialGradient1539"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.592963,-7.746900e-24,-5.714443e-24,2.252104,-25.05975,-18.94100)"
+ cx="15.414371"
+ cy="13.078408"
+ fx="15.414371"
+ fy="13.078408"
+ r="6.6562500" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-y="30"
+ inkscape:window-x="418"
+ inkscape:window-height="818"
+ inkscape:window-width="1016"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showgrid="true"
+ inkscape:current-layer="layer6"
+ inkscape:cy="14.980943"
+ inkscape:cx="25.938708"
+ inkscape:zoom="1"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="0.25490196"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:showpageshadow="false" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Edit Find</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>edit</rdf:li>
+ <rdf:li>find</rdf:li>
+ <rdf:li>locate</rdf:li>
+ <rdf:li>search</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Steven Garrity</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source />
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer6"
+ inkscape:label="Shadow">
+ <g
+ style="display:inline"
+ id="g5022"
+ transform="matrix(2.165152e-2,0,0,1.485743e-2,43.0076,42.68539)">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect4173"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path5058"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path5018"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ </g>
+ <g
+ style="display:inline"
+ inkscape:groupmode="layer"
+ inkscape:label="Base"
+ id="layer1">
+ <rect
+ style="color:#000000;fill:url(#radialGradient15658);fill-opacity:1.0000000;fill-rule:nonzero;stroke:url(#radialGradient15656);stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15391"
+ width="34.875000"
+ height="40.920494"
+ x="6.6035528"
+ y="3.6464462"
+ ry="1.1490486" />
+ <rect
+ style="color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:nonzero;stroke:url(#radialGradient15668);stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15660"
+ width="32.775887"
+ height="38.946384"
+ x="7.6660538"
+ y="4.5839462"
+ ry="0.14904857"
+ rx="0.14904857" />
+ <g
+ transform="translate(0.646447,-3.798933e-2)"
+ id="g2270">
+ <g
+ id="g1440"
+ style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:nonzero;stroke:#000000;stroke-miterlimit:4.0000000"
+ transform="matrix(0.229703,0.000000,0.000000,0.229703,4.967081,4.244972)">
+ <radialGradient
+ id="radialGradient1442"
+ cx="20.892099"
+ cy="114.56840"
+ r="5.2560000"
+ fx="20.892099"
+ fy="114.56840"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ offset="0"
+ style="stop-color:#F0F0F0"
+ id="stop1444" />
+ <stop
+ offset="1"
+ style="stop-color:#474747"
+ id="stop1446" />
+ </radialGradient>
+ <path
+ style="stroke:none"
+ d="M 23.428000,113.07000 C 23.428000,115.04300 21.828000,116.64200 19.855000,116.64200 C 17.881000,116.64200 16.282000,115.04200 16.282000,113.07000 C 16.282000,111.09600 17.882000,109.49700 19.855000,109.49700 C 21.828000,109.49700 23.428000,111.09700 23.428000,113.07000 z "
+ id="path1448" />
+ <radialGradient
+ id="radialGradient1450"
+ cx="20.892099"
+ cy="64.567902"
+ r="5.2570000"
+ fx="20.892099"
+ fy="64.567902"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ offset="0"
+ style="stop-color:#F0F0F0"
+ id="stop1452" />
+ <stop
+ offset="1"
+ style="stop-color:#474747"
+ id="stop1454" />
+ </radialGradient>
+ <path
+ style="stroke:none"
+ d="M 23.428000,63.070000 C 23.428000,65.043000 21.828000,66.643000 19.855000,66.643000 C 17.881000,66.643000 16.282000,65.043000 16.282000,63.070000 C 16.282000,61.096000 17.882000,59.497000 19.855000,59.497000 C 21.828000,59.497000 23.428000,61.097000 23.428000,63.070000 z "
+ id="path1456" />
+ </g>
+ <path
+ style="fill:url(#radialGradient2283);fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000"
+ d="M 9.9950109,29.952326 C 9.9950109,30.405530 9.6274861,30.772825 9.1742821,30.772825 C 8.7208483,30.772825 8.3535532,30.405301 8.3535532,29.952326 C 8.3535532,29.498892 8.7210780,29.131597 9.1742821,29.131597 C 9.6274861,29.131597 9.9950109,29.499122 9.9950109,29.952326 z "
+ id="path15570" />
+ <path
+ style="fill:url(#radialGradient2285);fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000"
+ d="M 9.9950109,18.467176 C 9.9950109,18.920380 9.6274861,19.287905 9.1742821,19.287905 C 8.7208483,19.287905 8.3535532,18.920380 8.3535532,18.467176 C 8.3535532,18.013742 8.7210780,17.646447 9.1742821,17.646447 C 9.6274861,17.646447 9.9950109,18.013972 9.9950109,18.467176 z "
+ id="path15577" />
+ </g>
+ <path
+ style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.98855311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:0.017543854"
+ d="M 11.505723,5.4942766 L 11.505723,43.400869"
+ id="path15672"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:0.20467831"
+ d="M 12.500000,5.0205154 L 12.500000,43.038228"
+ id="path15674"
+ sodipodi:nodetypes="cc" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="Magnifying Glass"
+ style="display:inline">
+ <g
+ transform="matrix(0.909091,0.000000,0.000000,1.000000,2.363628,0.000000)"
+ id="g2253">
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15686"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="9.0000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15688"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="11.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15690"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="13.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15692"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="15.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15694"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="17.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15696"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="19.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15698"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="21.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15700"
+ width="22.000004"
+ height="1.0000000"
+ x="15.000002"
+ y="23.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15732"
+ width="9.9000053"
+ height="1.0000000"
+ x="14.999992"
+ y="25.000000"
+ rx="0.068204239"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15736"
+ width="22.000004"
+ height="1.0000000"
+ x="14.999992"
+ y="29.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15738"
+ width="22.000004"
+ height="1.0000000"
+ x="14.999992"
+ y="31.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15740"
+ width="22.000004"
+ height="1.0000000"
+ x="14.999992"
+ y="33.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15742"
+ width="22.000004"
+ height="1.0000000"
+ x="14.999992"
+ y="35.000000"
+ rx="0.15156493"
+ ry="0.065390877" />
+ <rect
+ style="color:#000000;fill:#9b9b9b;fill-opacity:0.54970759;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:0.081871338;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:block;overflow:visible"
+ id="rect15744"
+ width="15.400014"
+ height="1.0000000"
+ x="14.999992"
+ y="37.000000"
+ rx="0.10609552"
+ ry="0.065390877" />
+ </g>
+ <g
+ id="g1772"
+ transform="matrix(0.665377,0.000000,0.000000,0.665377,15.98645,17.90835)">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.17112298;color:#000000;fill:url(#radialGradient1527);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ id="path4475"
+ sodipodi:cx="24.130018"
+ sodipodi:cy="37.967922"
+ sodipodi:rx="16.528622"
+ sodipodi:ry="3.9332814"
+ d="M 40.658640 37.967922 A 16.528622 3.9332814 0 1 1 7.6013966,37.967922 A 16.528622 3.9332814 0 1 1 40.658640 37.967922 z"
+ transform="matrix(1.446431,0.000000,0.000000,1.519990,-10.97453,-17.75168)" />
+ <path
+ sodipodi:nodetypes="csscccscccscczzzz"
+ id="path2844"
+ d="M 18.627569,3.1435548 C 10.488439,3.1435548 3.8827682,9.7492259 3.8827682,17.888356 C 3.8827682,26.027486 10.488439,32.633158 18.627569,32.633158 C 22.107124,32.633158 25.178570,31.248765 27.701292,29.230511 C 27.495915,30.237392 27.623257,31.265879 28.457436,31.990436 L 39.421520,41.517846 C 40.654936,42.589175 42.508982,42.448806 43.580310,41.215389 C 44.651638,39.981971 44.511269,38.127927 43.277853,37.056599 L 32.313769,27.529188 C 31.642242,26.945909 30.820891,26.773219 30.007531,26.886466 C 31.994231,24.374044 33.372370,21.337663 33.372370,17.888356 C 33.372370,9.7492259 26.766699,3.1435548 18.627569,3.1435548 z M 18.551954,4.3697381 C 26.191413,4.3697381 31.843729,9.1586886 31.843729,17.661513 C 31.843729,26.336626 26.027039,30.953288 18.551954,30.953288 C 11.249005,30.953288 5.2601806,25.475196 5.2601806,17.661513 C 5.2601806,9.6774061 11.084819,4.3697380 18.551954,4.3697381 z "
+ style="opacity:1.0000000;color:#000000;fill:#dcdcdc;fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient1529);stroke-width:3.0058157;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:1.0000000;color:#000000;fill:#dcdcdc;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000004;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ d="M 18.602905,3.0803551 C 10.437465,3.0803551 3.8104408,9.7073791 3.8104408,17.872819 C 3.8104408,26.038259 10.437465,32.665283 18.602905,32.665283 C 22.093708,32.665283 25.175082,31.276416 27.705960,29.251638 C 27.499919,30.261774 27.627672,31.293585 28.464547,32.020484 L 39.464073,41.578691 C 40.701476,42.653483 42.561515,42.512661 43.636306,41.275256 C 44.711097,40.037852 44.570274,38.177814 43.332871,37.103023 L 32.333346,27.544815 C 31.659648,26.959651 30.835642,26.786402 30.019653,26.900016 C 32.012775,24.379472 33.395369,21.333276 33.395369,17.872819 C 33.395369,9.7073791 26.768345,3.0803551 18.602905,3.0803551 z M 18.527046,6.2664243 C 24.808154,6.2664245 29.905864,11.364135 29.905864,17.645243 C 29.905864,23.926351 24.808154,29.024061 18.527046,29.024061 C 12.245938,29.024061 7.1482276,23.926351 7.1482276,17.645243 C 7.1482278,11.364135 12.245938,6.2664243 18.527046,6.2664243 z "
+ id="path4430" />
+ <path
+ style="opacity:1.0000000;color:#000000;fill:url(#linearGradient1531);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ d="M 39.507004,41.577690 C 39.028332,39.304503 40.904334,36.766268 43.091057,36.789315 C 43.091057,36.789315 32.330690,27.531204 32.330690,27.531204 C 29.385899,27.474498 28.061188,29.803820 28.553876,32.131126 L 39.507004,41.577690 z "
+ id="path4438"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1.0000000;color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient1533);stroke-width:1.2064340;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ id="path4450"
+ sodipodi:cx="17.500893"
+ sodipodi:cy="18.920233"
+ sodipodi:rx="11.048544"
+ sodipodi:ry="11.048544"
+ d="M 28.549437 18.920233 A 11.048544 11.048544 0 1 1 6.4523487,18.920233 A 11.048544 11.048544 0 1 1 28.549437 18.920233 z"
+ transform="matrix(1.245743,0.000000,0.000000,1.245743,-3.425346,-6.177033)" />
+ <rect
+ style="opacity:0.43315509;color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.5029539;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ id="rect4495"
+ width="19.048439"
+ height="4.4404783"
+ x="40.373337"
+ y="0.14086054"
+ rx="3.2112026"
+ ry="2.8373930"
+ transform="matrix(0.752986,0.658037,-0.648902,0.760872,0.000000,0.000000)" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#radialGradient1537);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#3063a3;stroke-width:1.0745695;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible"
+ id="path4452"
+ sodipodi:cx="17.589281"
+ sodipodi:cy="18.478292"
+ sodipodi:rx="8.3085051"
+ sodipodi:ry="8.3085051"
+ d="M 25.897786 18.478292 A 8.3085051 8.3085051 0 1 1 9.2807760,18.478292 A 8.3085051 8.3085051 0 1 1 25.897786 18.478292 z"
+ transform="matrix(1.398614,0.000000,0.000000,1.398614,-6.224338,-8.298958)" />
+ <path
+ style="opacity:0.83422458;color:#000000;fill:url(#radialGradient1539);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ d="M 18.156915,7.3966938 C 12.949325,7.3966938 8.7323681,11.613651 8.7323681,16.821241 C 8.7323681,18.325216 9.1526753,19.709014 9.7795400,20.971144 C 11.031920,21.432757 12.362297,21.746827 13.774307,21.746827 C 19.945262,21.746827 24.873589,16.885190 25.254413,10.809698 C 23.523449,8.7641668 21.044374,7.3966938 18.156915,7.3966938 z "
+ id="path4462" />
+ </g>
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
+ width="48px"
+ height="48px"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/emblems"
+ sodipodi:docname="emblem-symbolic-link.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective32" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6719"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient6715"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ id="linearGradient11520">
+ <stop
+ id="stop11522"
+ offset="0.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ <stop
+ id="stop11524"
+ offset="1.0000000"
+ style="stop-color:#dcdcdc;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient11508"
+ inkscape:collect="always">
+ <stop
+ id="stop11510"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop11512"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient11508"
+ id="radialGradient1348"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.338462,-1.435476e-15,29.48178)"
+ cx="30.203562"
+ cy="44.565483"
+ fx="30.203562"
+ fy="44.565483"
+ r="6.5659914" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient11520"
+ id="radialGradient1366"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.995058,-1.651527e-32,0.000000,1.995058,-24.32488,-35.70087)"
+ cx="24.445690"
+ cy="35.878170"
+ fx="24.445690"
+ fy="35.878170"
+ r="20.530962" />
+ </defs>
+ <sodipodi:namedview
+ stroke="#ef2929"
+ fill="#888a85"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.25490196"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="1.1112243"
+ inkscape:cy="6.743533"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="872"
+ inkscape:window-height="707"
+ inkscape:window-x="271"
+ inkscape:window-y="141" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:title>Symbolic Link</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>emblem</rdf:li>
+ <rdf:li>symbolic</rdf:li>
+ <rdf:li>link</rdf:li>
+ <rdf:li>pointer</rdf:li>
+ <rdf:li>io</rdf:li>
+ <rdf:li>file</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ transform="matrix(2.243788e-2,0,0,2.086758e-2,44.06795,40.547)"
+ id="g6707">
+ <rect
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6709"
+ width="1339.6335"
+ height="478.35718"
+ x="-1559.2523"
+ y="-150.69685" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ id="path6711"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path6713"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <rect
+ ry="5.4548240"
+ rx="5.4548240"
+ y="3.5233452"
+ x="4.4147282"
+ height="40.061924"
+ width="40.061924"
+ id="rect11518"
+ style="opacity:1.0000000;color:#000000;fill:url(#radialGradient1366);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#9b9b9b;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:bevel;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ style="opacity:1.0000000;color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:bevel;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ id="rect11528"
+ width="37.696587"
+ height="37.696587"
+ x="5.5973887"
+ y="4.7060070"
+ rx="4.2426391"
+ ry="4.2426391" />
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path2177"
+ d="M 11.500037,31.436501 C 11.940474,20.09759 22.043105,11.32322 32.158766,21.979434 L 37.068811,17.246167 C 37.068811,17.246167 37.088388,32 37.088388,32 L 22.160133,31.978069 C 22.160133,31.978069 26.997745,27.140456 26.997745,27.140456 C 18.528582,18.264221 13.291696,25.230495 11.500037,31.436501 z "
+ style="opacity:0.69886361;color:#000000;fill:#888a85;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.9999997;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible" />
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48.000000px"
+ height="48.000000px"
+ id="svg97"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/status"
+ sodipodi:docname="folder-open.svg"
+ inkscape:export-filename="/home/jimmac/ximian_art/icons/nautilus/snowdunes/gnome-fs-directory-accept.png"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-ydpi="90.000000"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective75" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6719"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient6715"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient13842">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop13844" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop13846" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient9766">
+ <stop
+ style="stop-color:#6194cb;stop-opacity:1;"
+ offset="0"
+ id="stop9768" />
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="1"
+ id="stop9770" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient9806">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop9808" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop9810" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient9806"
+ id="radialGradient9812"
+ cx="24.35099"
+ cy="41.591846"
+ fx="24.35099"
+ fy="41.591846"
+ r="19.136078"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.242494,1.565588e-16,31.50606)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient148">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.13402061;"
+ offset="0.0000000"
+ id="stop149" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.051546391;"
+ offset="1.0000000"
+ id="stop150" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient335">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop336" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.0000000;"
+ offset="1.0000000"
+ id="stop337" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient1789">
+ <stop
+ style="stop-color:#a0a0a0;stop-opacity:1;"
+ offset="0"
+ id="stop1790" />
+ <stop
+ style="stop-color:#a8a8a8;stop-opacity:1;"
+ offset="1"
+ id="stop1791" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient137">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.70059878;"
+ offset="0.0000000"
+ id="stop138" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.0000000;"
+ offset="1.0000000"
+ id="stop139" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient335"
+ id="linearGradient155"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="scale(1.421537,0.703464)"
+ x1="19.116116"
+ y1="28.946041"
+ x2="19.426924"
+ y2="51.912693" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient148"
+ id="linearGradient156"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.535299,0,0,0.651339,3.451418,2.448)"
+ x1="14.899379"
+ y1="27.059643"
+ x2="22.715446"
+ y2="41.836895" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient137"
+ id="linearGradient158"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.462696,0,6.907908e-2,0.683669,-8.7075e-19,0)"
+ x1="5.2657914"
+ y1="18.725863"
+ x2="8.2122240"
+ y2="52.625851" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1789"
+ id="radialGradient159"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.015635,0,0.103105,1.000512,-6.73857e-18,-8.369458e-2)"
+ cx="26.106777"
+ cy="38.195114"
+ fx="26.106777"
+ fy="38.195114"
+ r="32.259769" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient9766"
+ id="linearGradient13162"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.022118,52.05694,-1.323026)"
+ x1="22.175976"
+ y1="36.987999"
+ x2="22.065331"
+ y2="32.050499" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient13842"
+ id="linearGradient13848"
+ x1="22.25"
+ y1="37.625"
+ x2="19.75"
+ y2="14.875"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="10.54135"
+ inkscape:cx="8.8898314"
+ inkscape:cy="26.16018"
+ inkscape:current-layer="layer3"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1027"
+ inkscape:window-height="818"
+ inkscape:window-x="271"
+ inkscape:window-y="30"
+ inkscape:showpageshadow="false" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Folder Icon Accept</dc:title>
+ <dc:date>2005-01-31</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:description>Active state - when files are being dragged to.</dc:description>
+ <dc:publisher>
+ <cc:Agent>
+ <dc:title>Novell, Inc.</dc:title>
+ </cc:Agent>
+ </dc:publisher>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Garrett LeSage</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Folder"
+ inkscape:groupmode="layer" />
+ <g
+ inkscape:label="Open"
+ id="layer3"
+ inkscape:groupmode="layer">
+ <g
+ style="display:inline"
+ transform="matrix(2.262383e-2,0,0,2.086758e-2,43.38343,36.36962)"
+ id="g6707">
+ <rect
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6709"
+ width="1339.6335"
+ height="478.35718"
+ x="-1559.2523"
+ y="-150.69685" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ id="path6711"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path6713"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <path
+ sodipodi:nodetypes="ccccccssssccc"
+ style="color:#000000;fill:url(#radialGradient159);fill-opacity:1;fill-rule:nonzero;stroke:#5a5a5a;stroke-width:0.99487108;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2375"
+ d="M 4.6200285,38.651015 C 4.6618365,39.07147 5.1174141,39.491924 5.5311838,39.491924 L 36.667346,39.491924 C 37.081116,39.491924 37.453078,39.07147 37.41127,38.651015 L 34.714653,11.531728 C 34.672845,11.111274 34.217267,10.69082 33.803498,10.69082 L 21.080082,10.69082 C 20.489536,10.69082 19.870999,10.311268 19.677221,9.7304849 L 18.574219,6.4246085 C 18.404967,5.9173308 18.027069,5.6888138 17.259746,5.6888138 L 2.3224188,5.6888138 C 1.9086492,5.6888138 1.5366876,6.109268 1.5784956,6.529722 L 4.6200285,38.651015 z "
+ transform="matrix(1.004486,0,0,1.005825,-8.234449e-2,-0.221964)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 5.3301525,37.533487 L 35.317907,37.533487"
+ id="path13160"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13139"
+ d="M 5.3301525,35.533487 L 35.317907,35.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="ccccccsscsscccc"
+ id="path2380"
+ d="M 6.1717518,38.418674 C 6.2031078,38.729001 6.017127,38.935886 5.6963478,38.832443 L 5.6963478,38.832443 C 5.3755686,38.729001 5.1477798,38.522116 5.1164238,38.211789 L 2.0868572,6.8445942 C 2.0555012,6.534267 2.2434512,6.3468711 2.5537784,6.3468711 L 17.303531,6.2554251 C 17.834815,6.2521313 18.04296,6.308731 18.18333,6.7726371 C 18.18333,6.7726371 19.268704,9.885435 19.429564,10.470742 L 17.873968,7.5537061 C 17.608788,7.0564434 17.275224,7.1399365 16.901178,7.1399365 L 3.7717775,7.1399365 C 3.4614503,7.1399365 3.2754695,7.3468213 3.3068255,7.6571485 L 6.2856462,38.522116 L 6.1717518,38.418674 z "
+ style="color:#000000;fill:url(#linearGradient158);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.17341149;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ transform="matrix(1.008872,0,0,1.012144,-0.101943,-0.33126)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 3.3386019,17.533487 L 34.488461,17.533487"
+ id="path13113"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13115"
+ d="M 2.7573333,11.533487 L 33.496214,11.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <g
+ inkscape:export-ydpi="74.800003"
+ inkscape:export-xdpi="74.800003"
+ inkscape:export-filename="/home/jimmac/ximian_art/icons/nautilus/suse93/gnome-fs-directory.png"
+ transform="matrix(1.034503,0,0.104528,1.035221,-9.922058,2.395183)"
+ id="g2381"
+ style="fill:#ffffff;fill-opacity:0.5803109;fill-rule:nonzero;stroke:#000000;stroke-miterlimit:4;display:block"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true">
+ <path
+ sodipodi:nodetypes="cscscs"
+ id="path2382"
+ d="M 41.785743,9.0363862 C 41.795369,8.5618034 41.800932,8.3118806 41.36235,8.312183 L 28.80653,8.3208402 C 28.50653,8.3208402 28.481916,8.1776341 28.80653,8.3208402 C 29.131144,8.4640463 30.053628,8.9791114 30.989227,9.0218349 C 30.989227,9.0218349 41.785704,9.0382983 41.785743,9.0363862 z "
+ style="stroke:none"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 5.1594716,33.533487 L 35.147226,33.533487"
+ id="path13121"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13119"
+ d="M 4.8658086,31.533487 L 34.974533,31.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 4.6336367,29.533487 L 34.802847,29.533487"
+ id="path13135"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13137"
+ d="M 4.4629557,27.533487 L 34.632166,27.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 4.2556718,25.533487 L 34.460793,25.533487"
+ id="path13143"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13133"
+ d="M 4.0235198,23.533487 L 34.289101,23.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 3.8528389,21.533487 L 34.11842,21.533487"
+ id="path13117"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13125"
+ d="M 3.6514189,19.533487 L 33.947215,19.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.39204545;color:#000000;fill:url(#linearGradient13848);fill-opacity:1.0;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 34.375,14.125 L 37,38.75 L 6,38.875 C 6,38.875 4.125,14.125 4.125,14.125 C 4.125,14.125 34.5,14.125 34.375,14.125 z "
+ id="path13840"
+ sodipodi:nodetypes="cccsc" />
+ <path
+ inkscape:export-ydpi="74.800003"
+ inkscape:export-xdpi="74.800003"
+ inkscape:export-filename="/home/jimmac/ximian_art/icons/nautilus/suse93/gnome-fs-directory.png"
+ sodipodi:nodetypes="cccsscccscc"
+ id="path2401"
+ d="M 5.7785654,39.065997 C 5.8820074,39.277466 6.0888914,39.488925 6.3992173,39.488925 L 39.70767,39.488925 C 39.914562,39.488925 40.228834,39.36262 40.415844,39.224574 C 40.946246,38.833039 41.070704,38.612189 41.308626,38.251107 C 43.756752,34.535647 47.113767,18.974214 47.113767,18.974214 C 47.217209,18.762754 47.010326,18.551294 46.7,18.551294 L 11.776358,18.551294 C 11.466032,18.551294 10.120393,34.658624 6.9133592,37.838317 L 5.6751235,39.065997 L 5.7785654,39.065997 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient13162);fill-opacity:1;fill-rule:nonzero;stroke:#3465a4;stroke-width:1.00416672;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ transform="matrix(0.988773,0,0,1.002979,-0.111407,-0.106563)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ id="path323"
+ d="M 13.134476,20.138641 C 12.361729,25.129398 11.633175,29.147884 10.418486,33.652505 C 12.804971,32.945398 17.534602,30.448 27.534602,30.448 C 37.534602,30.448 44.258175,21.199301 45.186253,20.094447 L 13.134476,20.138641 z "
+ style="fill:url(#linearGradient156);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ sodipodi:nodetypes="ccccc"
+ transform="matrix(0.988773,0,0,1.002979,-0.111407,-0.106563)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="opacity:0.52272728;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient155);stroke-width:1.00416696px;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 45.820083,19.6875 L 12.661612,19.6875 C 12.661612,19.6875 10.513864,35.707107 7.9393398,37.928078 C 16.060417,37.928078 39.510511,37.879442 39.53033,37.879442 C 41.281989,37.879442 44.437971,25.243248 45.820083,19.6875 z "
+ id="path324"
+ sodipodi:nodetypes="cccsc"
+ transform="matrix(0.988773,0,0,1.002979,-0.111407,-0.106563)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13123"
+ d="M 3.1628954,15.533487 L 33.993452,15.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000036;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 2.9642313,13.533487 L 33.990735,13.533487"
+ id="path13127"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path13145"
+ d="M 2.3052333,7.533487 L 17.088967,7.533487"
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.11363633;color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 2.5242572,9.5334871 L 17.805073,9.5334871"
+ id="path13147"
+ sodipodi:nodetypes="cc" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="pattern" />
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3440"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/apps"
+ sodipodi:docname="preferences-desktop-remote-desktop.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective227" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6719"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient6715"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ y2="3.8451097"
+ x2="35.520542"
+ y1="3.9384086"
+ x1="34.300991"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient2733"
+ xlink:href="#linearGradient2711"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="3.8451097"
+ x2="35.520542"
+ y1="3.9384086"
+ x1="34.300991"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient2729"
+ xlink:href="#linearGradient2711"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="3.8451097"
+ x2="35.520542"
+ y1="3.9384086"
+ x1="34.300991"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient2725"
+ xlink:href="#linearGradient2711"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="3.8451097"
+ x2="35.520542"
+ y1="3.9384086"
+ x1="34.300991"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient2721"
+ xlink:href="#linearGradient2711"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2711">
+ <stop
+ id="stop2713"
+ offset="0.0000000"
+ style="stop-color:#909090;stop-opacity:1.0000000;" />
+ <stop
+ id="stop2715"
+ offset="1.0000000"
+ style="stop-color:#bebebe;stop-opacity:0.0000000;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="3.8451097"
+ x2="35.520542"
+ y1="3.9384086"
+ x1="34.300991"
+ id="linearGradient2717"
+ xlink:href="#linearGradient2711"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2667">
+ <stop
+ id="stop2669"
+ offset="0.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ <stop
+ id="stop2671"
+ offset="1.0000000"
+ style="stop-color:#fcfcff;stop-opacity:0.0000000;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="26.729263"
+ x2="17.199417"
+ y1="1.6537577"
+ x1="11.492236"
+ gradientTransform="matrix(1.187725,0,0,0.845165,5.790998,2.901059)"
+ id="linearGradient2673"
+ xlink:href="#linearGradient2667"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2415">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2417" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop2419" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2415"
+ id="linearGradient2421"
+ gradientTransform="matrix(1.111794,0,0,0.88712,5.762539,4.104218)"
+ x1="17.698339"
+ y1="13.004725"
+ x2="34.974548"
+ y2="55.200756"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2683"
+ inkscape:collect="always">
+ <stop
+ id="stop2685"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop2687"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="162.45061"
+ x2="3.7069974"
+ y1="171.29134"
+ x1="3.7069976"
+ gradientTransform="matrix(5.705159,0,0,0.330801,5.5,-24.10971)"
+ id="linearGradient2689"
+ xlink:href="#linearGradient2683"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2675">
+ <stop
+ id="stop2677"
+ offset="0.0000000"
+ style="stop-color:#5b5b97;stop-opacity:1.0000000;" />
+ <stop
+ id="stop2679"
+ offset="1.0000000"
+ style="stop-color:#1b1b43;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2253">
+ <stop
+ style="stop-color:#8f8f8f;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2255" />
+ <stop
+ style="stop-color:#494949;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2257" />
+ </linearGradient>
+ <linearGradient
+ y2="31.246054"
+ x2="32.536823"
+ y1="5.3817744"
+ x1="10.390738"
+ gradientTransform="matrix(1.112679,0,0,0.909474,4.563508,2.854651)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient1561"
+ xlink:href="#linearGradient2253"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2245">
+ <stop
+ style="stop-color:#dde1d9;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2247" />
+ <stop
+ style="stop-color:#cacdc6;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2249" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2245"
+ id="linearGradient2251"
+ gradientTransform="matrix(1.138336,0,0,0.888975,2.926322,1.544513)"
+ x1="8.6116238"
+ y1="7.2293582"
+ x2="34.784473"
+ y2="33.339787"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient4750">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop4752" />
+ <stop
+ style="stop-color:#fefefe;stop-opacity:1.0000000;"
+ offset="0.37931034"
+ id="stop4758" />
+ <stop
+ style="stop-color:#1d1d1d;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop4754" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4350">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop4352" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop4354" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4126">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop4128" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.16494845;"
+ offset="1.0000000"
+ id="stop4130" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4114">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop4116" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop4118" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3962">
+ <stop
+ style="stop-color:#d3e9ff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop3964" />
+ <stop
+ style="stop-color:#d3e9ff;stop-opacity:1.0000000;"
+ offset="0.15517241"
+ id="stop4134" />
+ <stop
+ style="stop-color:#4074ae;stop-opacity:1.0000000;"
+ offset="0.75000000"
+ id="stop4346" />
+ <stop
+ style="stop-color:#36486c;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop3966" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3962"
+ id="radialGradient3968"
+ gradientTransform="matrix(1.008876,0,0,1.008898,-0.218353,-0.208728)"
+ cx="18.247644"
+ cy="15.716079"
+ fx="18.247644"
+ fy="15.716079"
+ r="29.993349"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4114"
+ id="radialGradient4120"
+ gradientTransform="scale(1.643990,0.608276)"
+ cx="15.115514"
+ cy="63.965388"
+ fx="15.115514"
+ fy="63.965388"
+ r="12.289036"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4126"
+ id="radialGradient4132"
+ gradientTransform="scale(0.999989,1.000011)"
+ cx="15.601279"
+ cy="12.142302"
+ fx="15.601279"
+ fy="12.142302"
+ r="43.526714"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4350"
+ id="radialGradient4356"
+ gradientTransform="scale(1.179536,0.847791)"
+ cx="11.826907"
+ cy="10.476453"
+ fx="11.826907"
+ fy="10.476453"
+ r="32.664848"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4750"
+ id="radialGradient4756"
+ gradientTransform="scale(1.036822,0.964486)"
+ cx="18.633780"
+ cy="17.486208"
+ fx="18.934305"
+ fy="17.810213"
+ r="40.692665"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1460"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1462"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1466"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1468"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1470"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1474"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1476"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1478"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1482"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1484"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1486"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1490"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1492"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1494"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1498"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1500"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1502"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1506"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1508"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1510"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1514"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1516"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1518"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1522"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1524"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1526"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1528"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1530"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1532"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1534"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1536"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1538"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1540"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1542"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1544"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1546"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1550"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1552"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1554"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ r="40.692665"
+ fy="17.810213"
+ fx="18.934305"
+ cy="17.486208"
+ cx="18.633780"
+ gradientTransform="scale(1.036822,0.964486)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient1558"
+ xlink:href="#linearGradient4750"
+ inkscape:collect="always" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4114"
+ id="radialGradient2808"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="scale(1.64399,0.608276)"
+ cx="15.115514"
+ cy="63.965388"
+ fx="15.115514"
+ fy="63.965388"
+ r="12.289036" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4114"
+ id="radialGradient5562"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="scale(1.64399,0.608276)"
+ cx="15.115514"
+ cy="63.965388"
+ fx="15.115514"
+ fy="63.965388"
+ r="12.289036" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.17254902"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="50.517774"
+ inkscape:cy="-4.02376"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="899"
+ inkscape:window-height="794"
+ inkscape:window-x="535"
+ inkscape:window-y="54"
+ inkscape:showpageshadow="false"
+ stroke="#888a85"
+ fill="#eeeeec" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Remote Desktop</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Tuomas Kuosmanen</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>vnc</rdf:li>
+ <rdf:li>remote</rdf:li>
+ <rdf:li>desktop</rdf:li>
+ <rdf:li>control</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient4120);fill-opacity:1.0000000;stroke:none;stroke-opacity:1.0000000;opacity:0.47777778"
+ id="path4112"
+ sodipodi:cx="24.849752"
+ sodipodi:cy="38.908627"
+ sodipodi:rx="20.203051"
+ sodipodi:ry="7.4751287"
+ d="M 45.052803 38.908627 A 20.203051 7.4751287 0 1 1 4.6467018,38.908627 A 20.203051 7.4751287 0 1 1 45.052803 38.908627 z"
+ transform="matrix(1.000000,0.000000,0.000000,1.243244,0.000000,-10.27241)" />
+ <g
+ transform="matrix(2.015e-2,0,0,2.086758e-2,36.74885,41.38063)"
+ id="g6707">
+ <rect
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6709"
+ width="1339.6335"
+ height="478.35718"
+ x="-1559.2523"
+ y="-150.69685" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ id="path6711"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path6713"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <path
+ style="fill:url(#radialGradient3968);fill-opacity:1;fill-rule:nonzero;stroke:#39396c;stroke-miterlimit:4;stroke-opacity:1"
+ d="M 44.132171,23.485487 C 44.132171,34.290382 35.37291,43.049544 24.569501,43.049544 C 13.765102,43.049544 5.0063361,34.290283 5.0063361,23.485487 C 5.0063361,12.681087 13.765102,3.9228173 24.569501,3.9228173 C 35.37291,3.9228173 44.132171,12.681087 44.132171,23.485487 L 44.132171,23.485487 z "
+ id="path3214"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.42159382;fill:url(#radialGradient4356);fill-opacity:1.0000000;stroke:none;stroke-opacity:1.0000000"
+ id="path4348"
+ sodipodi:cx="17.778685"
+ sodipodi:cy="15.271057"
+ sodipodi:rx="12.929953"
+ sodipodi:ry="9.2934036"
+ d="M 30.708637 15.271057 A 12.929953 9.2934036 0 1 1 4.8487320,15.271057 A 12.929953 9.2934036 0 1 1 30.708637 15.271057 z"
+ transform="matrix(0.835938,0.000000,0.000000,1.000000,9.886868,0.000000)" />
+ <g
+ id="g4136"
+ style="fill:#000000;fill-opacity:0.71345031;fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000"
+ transform="matrix(0.982371,0.000000,0.000000,0.982371,0.121079,0.232914)">
+ <g
+ id="g4138">
+ <g
+ id="g4142">
+ <path
+ d="M 44.071300,20.714400 C 44.071300,20.977100 44.071300,20.714400 44.071300,20.714400 L 43.526400,21.331600 C 43.192400,20.938000 42.817400,20.607000 42.436600,20.261300 L 41.600700,20.384300 L 40.837000,19.521000 L 40.837000,20.589400 L 41.491300,21.084500 L 41.926800,21.577700 L 42.508800,20.919500 C 42.655300,21.193900 42.799800,21.468300 42.945300,21.742700 L 42.945300,22.565000 L 42.290000,23.305200 L 41.090800,24.128400 L 40.182600,25.034700 L 39.600600,24.374500 L 39.891600,23.634300 L 39.310500,22.976100 L 38.329100,20.878400 L 37.493200,19.933100 L 37.274400,20.179200 L 37.602500,21.372600 L 38.219700,22.071800 C 38.572200,23.089400 38.920900,24.062000 39.383800,25.034700 C 40.101600,25.034700 40.778300,24.958500 41.491200,24.868700 L 41.491200,25.444900 L 40.619100,27.584100 L 39.819300,28.488400 L 39.165000,29.888800 C 39.165000,30.656400 39.165000,31.424000 39.165000,32.191500 L 39.383800,33.097800 L 39.020500,33.508000 L 38.219700,34.002100 L 37.383800,34.701300 L 38.075200,35.482600 L 37.129900,36.306800 L 37.311500,36.840000 L 35.893500,38.445500 L 34.949200,38.445500 L 34.149400,38.939600 L 33.639600,38.939600 L 33.639600,38.281400 L 33.422800,36.963000 C 33.141500,36.136800 32.848600,35.316500 32.550700,34.496200 C 32.550700,33.890700 32.586800,33.291100 32.623000,32.685700 L 32.987300,31.863400 L 32.477500,30.875100 L 32.514600,29.517700 L 31.823200,28.736400 L 32.168900,27.605500 L 31.606400,26.967300 L 30.624000,26.967300 L 30.296900,26.597200 L 29.315500,27.214900 L 28.916100,26.761300 L 28.006900,27.543000 C 27.389700,26.843300 26.771500,26.144100 26.153400,25.444900 L 25.426800,23.716400 L 26.081100,22.730100 L 25.717800,22.319000 L 26.516600,20.425400 C 27.172900,19.609000 27.858400,18.825800 28.551800,18.039700 L 29.788100,17.710600 L 31.169000,17.546500 L 32.114300,17.793600 L 33.459000,19.150000 L 33.931700,18.615800 L 34.585000,18.533800 L 35.821300,18.944900 L 36.766600,18.944900 L 37.420900,18.368700 L 37.711900,17.957600 L 37.056600,17.546500 L 35.965800,17.464500 C 35.663100,17.044600 35.381800,16.603200 35.022400,16.230100 L 34.658100,16.394200 L 34.512600,17.464500 L 33.858300,16.724300 L 33.713800,15.900100 L 32.987200,15.325900 L 32.695200,15.325900 L 33.422700,16.148200 L 33.131700,16.888400 L 32.550600,17.052500 L 32.913900,16.312300 L 32.258600,15.984200 L 31.678500,15.326000 L 30.586700,15.572100 L 30.442200,15.900200 L 29.787900,16.312300 L 29.424600,17.217600 L 28.516400,17.669700 L 28.116000,17.217600 L 27.680500,17.217600 L 27.680500,15.736200 L 28.625800,15.242100 L 29.352400,15.242100 L 29.205900,14.666900 L 28.625800,14.090700 L 29.606300,13.884600 L 30.151200,13.268400 L 30.586700,12.527200 L 31.387500,12.527200 L 31.168700,11.952000 L 31.678500,11.622900 L 31.678500,12.281100 L 32.768300,12.527200 L 33.858100,11.622900 L 33.931300,11.210800 L 34.875600,10.553100 C 34.533800,10.595600 34.192000,10.626800 33.858000,10.717700 L 33.858000,9.9766000 L 34.221300,9.1538000 L 33.858000,9.1538000 L 33.059600,9.8940000 L 32.840800,10.305600 L 33.059600,10.882300 L 32.695300,11.868600 L 32.114200,11.539500 L 31.606400,10.964300 L 30.805600,11.539500 L 30.514600,10.223600 L 31.895500,9.3188000 L 31.895500,8.8247000 L 32.768500,8.2490000 L 34.149400,7.9194000 L 35.094700,8.2490000 L 36.838800,8.5781000 L 36.403300,9.0713000 L 35.458000,9.0713000 L 36.403300,10.058600 L 37.129900,9.2363000 L 37.350600,8.8745000 C 37.350600,8.8745000 40.137700,11.372500 41.730500,14.105000 C 43.323300,16.838400 44.071300,20.060100 44.071300,20.714400 z "
+ id="path4144" />
+ </g>
+ </g>
+ <g
+ id="g4146">
+ <g
+ id="g4150">
+ <path
+ d="M 26.070300,9.2363000 L 25.997100,9.7295000 L 26.506900,10.058600 L 27.378000,9.4829000 L 26.942500,8.9892000 L 26.360500,9.3188000 L 26.070500,9.2363000"
+ id="path4152" />
+ </g>
+ </g>
+ <g
+ id="g4154">
+ <g
+ id="g4158">
+ <path
+ d="M 26.870100,5.8633000 L 24.979500,5.1226000 L 22.799800,5.3692000 L 20.109400,6.1094000 L 19.600600,6.6035000 L 21.272500,7.7549000 L 21.272500,8.4131000 L 20.618200,9.0713000 L 21.491200,10.800300 L 22.071300,10.470200 L 22.799800,9.3188000 C 23.922800,8.9716000 24.929700,8.5781000 25.997100,8.0844000 L 26.870100,5.8632000"
+ id="path4160" />
+ </g>
+ </g>
+ <g
+ id="g4162">
+ <g
+ id="g4166">
+ <path
+ d="M 28.833000,12.774900 L 28.542000,12.033700 L 28.032200,12.198700 L 28.178700,13.103000 L 28.833000,12.774900"
+ id="path4168" />
+ </g>
+ </g>
+ <g
+ id="g4170">
+ <g
+ id="g4174">
+ <path
+ d="M 29.123000,12.608900 L 28.977500,13.597200 L 29.777300,13.432200 L 30.358400,12.857000 L 29.849600,12.362900 C 29.678700,11.907800 29.482400,11.483000 29.268500,11.046500 L 28.833000,11.046500 L 28.833000,11.539700 L 29.123000,11.868800 L 29.123000,12.609000"
+ id="path4176" />
+ </g>
+ </g>
+ <g
+ id="g4178">
+ <g
+ id="g4182">
+ <path
+ d="M 18.365200,28.242200 L 17.783200,27.089900 L 16.692900,26.843300 L 16.111400,25.280800 L 14.657800,25.444900 L 13.422400,24.540600 L 12.113300,25.692000 L 12.113300,25.873600 C 11.717300,25.759300 11.230500,25.743700 10.877900,25.526900 L 10.586900,24.704600 L 10.586900,23.799300 L 9.7148000,23.881300 C 9.7876000,23.305100 9.8598000,22.729900 9.9331000,22.153800 L 9.4238000,22.153800 L 8.9155000,22.812000 L 8.4062000,23.058100 L 7.6791000,22.647900 L 7.6063000,21.742600 L 7.7518000,20.755300 L 8.8426000,19.933000 L 9.7147000,19.933000 L 9.8597000,19.438900 L 10.950000,19.685000 L 11.749800,20.673300 L 11.895300,19.026800 L 13.276600,17.875400 L 13.785400,16.641000 L 14.803000,16.229900 L 15.384500,15.407600 L 16.692600,15.159600 L 17.347400,14.173300 C 16.693100,14.173300 16.038800,14.173300 15.384500,14.173300 L 16.620300,13.597100 L 17.491900,13.597100 L 18.728200,13.185000 L 18.873700,12.692800 L 18.437200,12.280700 L 17.928400,12.115700 L 18.073900,11.622500 L 17.710600,10.882300 L 16.838000,11.210400 L 16.983500,10.552700 L 15.965900,9.9765000 L 15.166600,11.374400 L 15.238900,11.868500 L 14.439600,12.198600 L 13.930300,13.267900 L 13.712500,12.280600 L 12.331200,11.704400 L 12.112900,10.964200 L 13.930300,9.8939000 L 14.730100,9.1537000 L 14.802900,8.2489000 L 14.366900,8.0018000 L 13.785400,7.9193000 L 13.422100,8.8246000 C 13.422100,8.8246000 12.814200,8.9437000 12.657900,8.9823000 C 10.661800,10.821700 6.6286000,14.792400 5.6916000,22.288500 C 5.7287000,22.462300 6.3708000,23.470100 6.3708000,23.470100 L 7.8972000,24.374400 L 9.4236000,24.786500 L 10.078400,25.609700 L 11.095500,26.349900 L 11.677000,26.267900 L 12.113000,26.464200 L 12.113000,26.597000 L 11.531900,28.160000 L 11.095400,28.818200 L 11.240900,29.148300 L 10.877600,30.380700 L 12.186200,32.767400 L 13.494300,33.919700 L 14.076300,34.742000 L 14.003100,36.470500 L 14.439600,37.456800 L 14.003100,39.349400 C 14.003100,39.349400 13.968900,39.337700 14.024600,39.527100 C 14.080800,39.716600 16.353700,40.978300 16.498200,40.870900 C 16.642200,40.761500 16.765300,40.665800 16.765300,40.665800 L 16.620300,40.255600 L 17.201400,39.679400 L 17.419700,39.103200 L 18.365000,38.773100 L 19.091600,36.962600 L 18.873800,36.470400 L 19.381600,35.730200 L 20.472400,35.482200 L 21.054400,34.165800 L 20.908900,32.521300 L 21.781000,31.286900 L 21.926500,30.052500 C 20.733100,29.460700 19.549500,28.851300 18.365000,28.242000"
+ id="path4184" />
+ </g>
+ </g>
+ <g
+ id="g4186">
+ <g
+ id="g4190">
+ <path
+ d="M 16.765600,9.5649000 L 17.492200,10.058600 L 18.074200,10.058600 L 18.074200,9.4829000 L 17.347600,9.1538000 L 16.765600,9.5649000"
+ id="path4192" />
+ </g>
+ </g>
+ <g
+ id="g4194">
+ <g
+ id="g4198">
+ <path
+ d="M 14.876000,8.9072000 L 14.512200,9.8120000 L 15.239300,9.8120000 L 15.603100,8.9892000 C 15.916600,8.7675000 16.228600,8.5444000 16.547900,8.3310000 L 17.275000,8.5781000 C 17.759400,8.9072000 18.243800,9.2363000 18.728600,9.5649000 L 19.456100,8.9072000 L 18.655800,8.5781000 L 18.292000,7.8374000 L 16.911100,7.6728000 L 16.838300,7.2612000 L 16.184000,7.4262000 L 15.893600,8.0020000 L 15.529800,7.2613000 L 15.384800,7.5904000 L 15.457600,8.4132000 L 14.876000,8.9072000"
+ id="path4200" />
+ </g>
+ </g>
+ <g
+ id="g4202">
+ <g
+ style="opacity:0.75000000"
+ id="g4204">
+ <path
+ id="path4206"
+ d="" />
+ </g>
+ <g
+ id="g4208">
+ <path
+ id="path4210"
+ d="" />
+ </g>
+ </g>
+ <g
+ id="g4212">
+ <g
+ style="opacity:0.75000000"
+ id="g4214">
+ <path
+ id="path4216"
+ d="" />
+ </g>
+ <g
+ id="g4218">
+ <path
+ id="path4220"
+ d="" />
+ </g>
+ </g>
+ <g
+ id="g4222">
+ <g
+ id="g4226">
+ <path
+ d="M 17.492200,6.8496000 L 17.856000,6.5210000 L 18.583100,6.3564000 C 19.081100,6.1142000 19.581100,5.9511000 20.109500,5.7802000 L 19.819500,5.2865000 L 18.881000,5.4213000 L 18.437600,5.8632000 L 17.706600,5.9692000 L 17.056700,6.2744000 L 16.740800,6.4272000 L 16.547900,6.6855000 L 17.492200,6.8496000"
+ id="path4228" />
+ </g>
+ </g>
+ <g
+ id="g4230">
+ <g
+ id="g4234">
+ <path
+ d="M 18.728500,14.666500 L 19.165000,14.008300 L 18.510200,13.515100 L 18.728500,14.666500"
+ id="path4236" />
+ </g>
+ </g>
+ </g>
+ <g
+ id="g3216"
+ style="color:#000000;fill:url(#radialGradient1460);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0179454;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ transform="matrix(0.982371,0.000000,0.000000,0.982371,-8.095179e-2,3.088300e-2)">
+ <g
+ id="g3218"
+ style="color:#000000;fill:url(#radialGradient1462);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3222"
+ style="color:#000000;fill:url(#radialGradient1466);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 44.071300,20.714400 C 44.071300,20.977100 44.071300,20.714400 44.071300,20.714400 L 43.526400,21.331600 C 43.192400,20.938000 42.817400,20.607000 42.436600,20.261300 L 41.600700,20.384300 L 40.837000,19.521000 L 40.837000,20.589400 L 41.491300,21.084500 L 41.926800,21.577700 L 42.508800,20.919500 C 42.655300,21.193900 42.799800,21.468300 42.945300,21.742700 L 42.945300,22.565000 L 42.290000,23.305200 L 41.090800,24.128400 L 40.182600,25.034700 L 39.600600,24.374500 L 39.891600,23.634300 L 39.310500,22.976100 L 38.329100,20.878400 L 37.493200,19.933100 L 37.274400,20.179200 L 37.602500,21.372600 L 38.219700,22.071800 C 38.572200,23.089400 38.920900,24.062000 39.383800,25.034700 C 40.101600,25.034700 40.778300,24.958500 41.491200,24.868700 L 41.491200,25.444900 L 40.619100,27.584100 L 39.819300,28.488400 L 39.165000,29.888800 C 39.165000,30.656400 39.165000,31.424000 39.165000,32.191500 L 39.383800,33.097800 L 39.020500,33.508000 L 38.219700,34.002100 L 37.383800,34.701300 L 38.075200,35.482600 L 37.129900,36.306800 L 37.311500,36.840000 L 35.893500,38.445500 L 34.949200,38.445500 L 34.149400,38.939600 L 33.639600,38.939600 L 33.639600,38.281400 L 33.422800,36.963000 C 33.141500,36.136800 32.848600,35.316500 32.550700,34.496200 C 32.550700,33.890700 32.586800,33.291100 32.623000,32.685700 L 32.987300,31.863400 L 32.477500,30.875100 L 32.514600,29.517700 L 31.823200,28.736400 L 32.168900,27.605500 L 31.606400,26.967300 L 30.624000,26.967300 L 30.296900,26.597200 L 29.315500,27.214900 L 28.916100,26.761300 L 28.006900,27.543000 C 27.389700,26.843300 26.771500,26.144100 26.153400,25.444900 L 25.426800,23.716400 L 26.081100,22.730100 L 25.717800,22.319000 L 26.516600,20.425400 C 27.172900,19.609000 27.858400,18.825800 28.551800,18.039700 L 29.788100,17.710600 L 31.169000,17.546500 L 32.114300,17.793600 L 33.459000,19.150000 L 33.931700,18.615800 L 34.585000,18.533800 L 35.821300,18.944900 L 36.766600,18.944900 L 37.420900,18.368700 L 37.711900,17.957600 L 37.056600,17.546500 L 35.965800,17.464500 C 35.663100,17.044600 35.381800,16.603200 35.022400,16.230100 L 34.658100,16.394200 L 34.512600,17.464500 L 33.858300,16.724300 L 33.713800,15.900100 L 32.987200,15.325900 L 32.695200,15.325900 L 33.422700,16.148200 L 33.131700,16.888400 L 32.550600,17.052500 L 32.913900,16.312300 L 32.258600,15.984200 L 31.678500,15.326000 L 30.586700,15.572100 L 30.442200,15.900200 L 29.787900,16.312300 L 29.424600,17.217600 L 28.516400,17.669700 L 28.116000,17.217600 L 27.680500,17.217600 L 27.680500,15.736200 L 28.625800,15.242100 L 29.352400,15.242100 L 29.205900,14.666900 L 28.625800,14.090700 L 29.606300,13.884600 L 30.151200,13.268400 L 30.586700,12.527200 L 31.387500,12.527200 L 31.168700,11.952000 L 31.678500,11.622900 L 31.678500,12.281100 L 32.768300,12.527200 L 33.858100,11.622900 L 33.931300,11.210800 L 34.875600,10.553100 C 34.533800,10.595600 34.192000,10.626800 33.858000,10.717700 L 33.858000,9.9766000 L 34.221300,9.1538000 L 33.858000,9.1538000 L 33.059600,9.8940000 L 32.840800,10.305600 L 33.059600,10.882300 L 32.695300,11.868600 L 32.114200,11.539500 L 31.606400,10.964300 L 30.805600,11.539500 L 30.514600,10.223600 L 31.895500,9.3188000 L 31.895500,8.8247000 L 32.768500,8.2490000 L 34.149400,7.9194000 L 35.094700,8.2490000 L 36.838800,8.5781000 L 36.403300,9.0713000 L 35.458000,9.0713000 L 36.403300,10.058600 L 37.129900,9.2363000 L 37.350600,8.8745000 C 37.350600,8.8745000 40.137700,11.372500 41.730500,14.105000 C 43.323300,16.838400 44.071300,20.060100 44.071300,20.714400 z "
+ id="path3224"
+ style="color:#000000;fill:url(#radialGradient1468);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3226"
+ style="color:#000000;fill:url(#radialGradient1470);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3230"
+ style="color:#000000;fill:url(#radialGradient1474);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 26.070300,9.2363000 L 25.997100,9.7295000 L 26.506900,10.058600 L 27.378000,9.4829000 L 26.942500,8.9892000 L 26.360500,9.3188000 L 26.070500,9.2363000"
+ id="path3232"
+ style="color:#000000;fill:url(#radialGradient1476);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3234"
+ style="color:#000000;fill:url(#radialGradient1478);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3238"
+ style="color:#000000;fill:url(#radialGradient1482);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 26.870100,5.8633000 L 24.979500,5.1226000 L 22.799800,5.3692000 L 20.109400,6.1094000 L 19.600600,6.6035000 L 21.272500,7.7549000 L 21.272500,8.4131000 L 20.618200,9.0713000 L 21.491200,10.800300 L 22.071300,10.470200 L 22.799800,9.3188000 C 23.922800,8.9716000 24.929700,8.5781000 25.997100,8.0844000 L 26.870100,5.8632000"
+ id="path3240"
+ style="color:#000000;fill:url(#radialGradient1484);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3242"
+ style="color:#000000;fill:url(#radialGradient1486);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3246"
+ style="color:#000000;fill:url(#radialGradient1490);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 28.833000,12.774900 L 28.542000,12.033700 L 28.032200,12.198700 L 28.178700,13.103000 L 28.833000,12.774900"
+ id="path3248"
+ style="color:#000000;fill:url(#radialGradient1492);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3250"
+ style="color:#000000;fill:url(#radialGradient1494);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3254"
+ style="color:#000000;fill:url(#radialGradient1498);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 29.123000,12.608900 L 28.977500,13.597200 L 29.777300,13.432200 L 30.358400,12.857000 L 29.849600,12.362900 C 29.678700,11.907800 29.482400,11.483000 29.268500,11.046500 L 28.833000,11.046500 L 28.833000,11.539700 L 29.123000,11.868800 L 29.123000,12.609000"
+ id="path3256"
+ style="color:#000000;fill:url(#radialGradient1500);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3258"
+ style="color:#000000;fill:url(#radialGradient1502);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3262"
+ style="color:#000000;fill:url(#radialGradient1506);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 18.365200,28.242200 L 17.783200,27.089900 L 16.692900,26.843300 L 16.111400,25.280800 L 14.657800,25.444900 L 13.422400,24.540600 L 12.113300,25.692000 L 12.113300,25.873600 C 11.717300,25.759300 11.230500,25.743700 10.877900,25.526900 L 10.586900,24.704600 L 10.586900,23.799300 L 9.7148000,23.881300 C 9.7876000,23.305100 9.8598000,22.729900 9.9331000,22.153800 L 9.4238000,22.153800 L 8.9155000,22.812000 L 8.4062000,23.058100 L 7.6791000,22.647900 L 7.6063000,21.742600 L 7.7518000,20.755300 L 8.8426000,19.933000 L 9.7147000,19.933000 L 9.8597000,19.438900 L 10.950000,19.685000 L 11.749800,20.673300 L 11.895300,19.026800 L 13.276600,17.875400 L 13.785400,16.641000 L 14.803000,16.229900 L 15.384500,15.407600 L 16.692600,15.159600 L 17.347400,14.173300 C 16.693100,14.173300 16.038800,14.173300 15.384500,14.173300 L 16.620300,13.597100 L 17.491900,13.597100 L 18.728200,13.185000 L 18.873700,12.692800 L 18.437200,12.280700 L 17.928400,12.115700 L 18.073900,11.622500 L 17.710600,10.882300 L 16.838000,11.210400 L 16.983500,10.552700 L 15.965900,9.9765000 L 15.166600,11.374400 L 15.238900,11.868500 L 14.439600,12.198600 L 13.930300,13.267900 L 13.712500,12.280600 L 12.331200,11.704400 L 12.112900,10.964200 L 13.930300,9.8939000 L 14.730100,9.1537000 L 14.802900,8.2489000 L 14.366900,8.0018000 L 13.785400,7.9193000 L 13.422100,8.8246000 C 13.422100,8.8246000 12.814200,8.9437000 12.657900,8.9823000 C 10.661800,10.821700 6.6286000,14.792400 5.6916000,22.288500 C 5.7287000,22.462300 6.3708000,23.470100 6.3708000,23.470100 L 7.8972000,24.374400 L 9.4236000,24.786500 L 10.078400,25.609700 L 11.095500,26.349900 L 11.677000,26.267900 L 12.113000,26.464200 L 12.113000,26.597000 L 11.531900,28.160000 L 11.095400,28.818200 L 11.240900,29.148300 L 10.877600,30.380700 L 12.186200,32.767400 L 13.494300,33.919700 L 14.076300,34.742000 L 14.003100,36.470500 L 14.439600,37.456800 L 14.003100,39.349400 C 14.003100,39.349400 13.968900,39.337700 14.024600,39.527100 C 14.080800,39.716600 16.353700,40.978300 16.498200,40.870900 C 16.642200,40.761500 16.765300,40.665800 16.765300,40.665800 L 16.620300,40.255600 L 17.201400,39.679400 L 17.419700,39.103200 L 18.365000,38.773100 L 19.091600,36.962600 L 18.873800,36.470400 L 19.381600,35.730200 L 20.472400,35.482200 L 21.054400,34.165800 L 20.908900,32.521300 L 21.781000,31.286900 L 21.926500,30.052500 C 20.733100,29.460700 19.549500,28.851300 18.365000,28.242000"
+ id="path3264"
+ style="color:#000000;fill:url(#radialGradient1508);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3266"
+ style="color:#000000;fill:url(#radialGradient1510);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3270"
+ style="color:#000000;fill:url(#radialGradient1514);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 16.765600,9.5649000 L 17.492200,10.058600 L 18.074200,10.058600 L 18.074200,9.4829000 L 17.347600,9.1538000 L 16.765600,9.5649000"
+ id="path3272"
+ style="color:#000000;fill:url(#radialGradient1516);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3274"
+ style="color:#000000;fill:url(#radialGradient1518);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3278"
+ style="color:#000000;fill:url(#radialGradient1522);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 14.876000,8.9072000 L 14.512200,9.8120000 L 15.239300,9.8120000 L 15.603100,8.9892000 C 15.916600,8.7675000 16.228600,8.5444000 16.547900,8.3310000 L 17.275000,8.5781000 C 17.759400,8.9072000 18.243800,9.2363000 18.728600,9.5649000 L 19.456100,8.9072000 L 18.655800,8.5781000 L 18.292000,7.8374000 L 16.911100,7.6728000 L 16.838300,7.2612000 L 16.184000,7.4262000 L 15.893600,8.0020000 L 15.529800,7.2613000 L 15.384800,7.5904000 L 15.457600,8.4132000 L 14.876000,8.9072000"
+ id="path3280"
+ style="color:#000000;fill:url(#radialGradient1524);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3282"
+ style="color:#000000;fill:url(#radialGradient1526);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ style="opacity:0.75000000;color:#000000;fill:url(#radialGradient1528);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ id="g3284">
+ <path
+ d=""
+ style="color:#000000;fill:url(#radialGradient1530);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ id="path3286" />
+ </g>
+ <g
+ id="g3288"
+ style="color:#000000;fill:url(#radialGradient1532);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d=""
+ id="path3290"
+ style="color:#000000;fill:url(#radialGradient1534);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3292"
+ style="color:#000000;fill:url(#radialGradient1536);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ style="opacity:0.75000000;color:#000000;fill:url(#radialGradient1538);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ id="g3294">
+ <path
+ d=""
+ style="color:#000000;fill:url(#radialGradient1540);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ id="path3296" />
+ </g>
+ <g
+ id="g3298"
+ style="color:#000000;fill:url(#radialGradient1542);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d=""
+ id="path3300"
+ style="color:#000000;fill:url(#radialGradient1544);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3302"
+ style="color:#000000;fill:url(#radialGradient1546);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3306"
+ style="color:#000000;fill:url(#radialGradient1550);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 17.492200,6.8496000 L 17.856000,6.5210000 L 18.583100,6.3564000 C 19.081100,6.1142000 19.581100,5.9511000 20.109500,5.7802000 L 19.819500,5.2865000 L 18.881000,5.4213000 L 18.437600,5.8632000 L 17.706600,5.9692000 L 17.056700,6.2744000 L 16.740800,6.4272000 L 16.547900,6.6855000 L 17.492200,6.8496000"
+ id="path3308"
+ style="color:#000000;fill:url(#radialGradient1552);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ <g
+ id="g3310"
+ style="color:#000000;fill:url(#radialGradient1554);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <g
+ id="g3314"
+ style="color:#000000;fill:url(#radialGradient1558);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible">
+ <path
+ d="M 18.728500,14.666500 L 19.165000,14.008300 L 18.510200,13.515100 L 18.728500,14.666500"
+ id="path3316"
+ style="color:#000000;fill:url(#radialGradient4756);stroke-dashoffset:0.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ </g>
+ <path
+ style="fill:none;fill-opacity:1.0000000;fill-rule:nonzero;stroke:url(#radialGradient4132);stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 42.975093,23.485534 C 42.975093,33.651354 34.733915,41.892440 24.569493,41.892440 C 14.404139,41.892440 6.1634261,33.651261 6.1634261,23.485534 C 6.1634261,13.320180 14.404139,5.0799340 24.569493,5.0799340 C 34.733915,5.0799340 42.975093,13.320180 42.975093,23.485534 L 42.975093,23.485534 z "
+ id="path4122" />
+ <path
+ sodipodi:nodetypes="czzzcc"
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ id="path2794"
+ d="M 38.06066,5.8716896 C 43.124186,-0.0855393 47.193564,5.0853443 43.23231,12.47138 C 39.290627,19.82092 46.524776,23.714466 44.646524,30.088388 C 42.705717,36.674588 40.138717,35.37868 37.133513,37.87868 C 34.12831,40.37868 21.400388,40 21.400388,40 L 21,38"
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#babdb6;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 38.06066,5.8716896 C 43.124186,-0.0855393 47.193564,5.0853443 43.23231,12.47138 C 39.290627,19.82092 46.524776,23.714466 44.646524,30.088388 C 42.705717,36.674588 40.138717,35.37868 37.133513,37.87868 C 34.12831,40.37868 21.400388,40 21.400388,40 L 21,38"
+ id="path2784"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ sodipodi:nodetypes="czzzcc" />
+ <g
+ id="g1852"
+ transform="matrix(0.857741,0,0,0.857741,-3.490242,15.59392)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true">
+ <path
+ sodipodi:nodetypes="cssssssss"
+ id="rect2404"
+ d="M 6.6600157,4.5577672 L 42.641027,4.5577672 C 43.559204,4.5577672 44.313598,5.1427413 44.320279,5.9655492 L 44.528875,31.65672 C 44.538003,32.780881 43.621062,33.685956 42.493419,33.685956 L 6.6816866,33.685956 C 5.5540441,33.685956 4.6315936,32.780823 4.646231,31.65672 L 4.9807648,5.9655492 C 4.9908945,5.1876083 5.5323732,4.5577672 6.6600157,4.5577672 z "
+ style="color:#000000;fill:url(#linearGradient2251);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient1561);stroke-width:1.16585314;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#3465a4;stroke-width:1.16585279;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8.3577101,7.9937458 L 8.1254512,27.906829 L 38.477362,27.906829 L 38.156089,8.0781383 L 8.3577101,7.9937458 z "
+ id="path2377"
+ sodipodi:nodetypes="ccccc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ id="path2393"
+ d="M 6.6774331,31.404697 L 42.10591,31.404697"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:url(#linearGradient2689);stroke-width:1.16140115;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.24840764"
+ sodipodi:nodetypes="cc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient2421);stroke-width:1.16585267;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:0.70063692;visibility:visible;display:inline;overflow:visible"
+ d="M 6.6802114,5.7815313 L 42.646222,5.7443731 C 42.930873,5.744079 43.224195,5.9770157 43.230283,6.3858167 L 43.593392,30.767145 C 43.608888,31.80765 43.051829,32.522637 41.989647,32.522637 L 7.3496141,32.522637 C 6.2874323,32.522637 5.7945264,31.807669 5.8085792,30.767145 L 6.1337592,6.68964 C 6.1432754,5.9850207 6.3007039,5.7819236 6.6802114,5.7815313 z "
+ id="path2397"
+ sodipodi:nodetypes="cssssssss"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ id="path2443"
+ d="M 8.7828779,8.6344013 L 8.7325218,25.491693 C 19.320284,23.227151 24.714347,15.594279 37.878849,13.09021 L 37.843886,8.6967202 L 8.7828779,8.6344013 z "
+ style="opacity:0.53142856;fill:url(#linearGradient2673);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ sodipodi:nodetypes="ccccc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#linearGradient2717);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2709"
+ sodipodi:cx="34.780815"
+ sodipodi:cy="3.9384086"
+ sodipodi:rx="0.83968931"
+ sodipodi:ry="0.83968931"
+ d="M 35.620504 3.9384086 A 0.83968931 0.83968931 0 1 1 33.941126,3.9384086 A 0.83968931 0.83968931 0 1 1 35.620504 3.9384086 z"
+ transform="matrix(1.331237,0,0,0.658449,-5.212226,6.082418)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ transform="matrix(1.331237,0,0,0.658449,-5.098626,8.188202)"
+ d="M 35.620504 3.9384086 A 0.83968931 0.83968931 0 1 1 33.941126,3.9384086 A 0.83968931 0.83968931 0 1 1 35.620504 3.9384086 z"
+ sodipodi:ry="0.83968931"
+ sodipodi:rx="0.83968931"
+ sodipodi:cy="3.9384086"
+ sodipodi:cx="34.780815"
+ id="path2719"
+ style="color:#000000;fill:url(#linearGradient2721);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#linearGradient2725);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2723"
+ sodipodi:cx="34.780815"
+ sodipodi:cy="3.9384086"
+ sodipodi:rx="0.83968931"
+ sodipodi:ry="0.83968931"
+ d="M 35.620504 3.9384086 A 0.83968931 0.83968931 0 1 1 33.941126,3.9384086 A 0.83968931 0.83968931 0 1 1 35.620504 3.9384086 z"
+ transform="matrix(1.331237,0,0,0.658449,-4.985026,10.18821)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ transform="matrix(1.331237,0,0,0.658449,-4.871426,12.18821)"
+ d="M 35.620504 3.9384086 A 0.83968931 0.83968931 0 1 1 33.941126,3.9384086 A 0.83968931 0.83968931 0 1 1 35.620504 3.9384086 z"
+ sodipodi:ry="0.83968931"
+ sodipodi:rx="0.83968931"
+ sodipodi:cy="3.9384086"
+ sodipodi:cx="34.780815"
+ id="path2727"
+ style="color:#000000;fill:url(#linearGradient2729);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#linearGradient2733);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2731"
+ sodipodi:cx="34.780815"
+ sodipodi:cy="3.9384086"
+ sodipodi:rx="0.83968931"
+ sodipodi:ry="0.83968931"
+ d="M 35.620504 3.9384086 A 0.83968931 0.83968931 0 1 1 33.941126,3.9384086 A 0.83968931 0.83968931 0 1 1 35.620504 3.9384086 z"
+ transform="matrix(1.331237,0,0,0.658449,-4.757826,14.18821)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+ <path
+ transform="matrix(0.287993,0.273427,-0.350839,0.346922,40.62266,-11.07903)"
+ d="M 45.052803 38.908627 A 20.203051 7.4751287 0 1 1 4.6467018,38.908627 A 20.203051 7.4751287 0 1 1 45.052803 38.908627 z"
+ sodipodi:ry="7.4751287"
+ sodipodi:rx="20.203051"
+ sodipodi:cy="38.908627"
+ sodipodi:cx="24.849752"
+ id="path5560"
+ style="opacity:0.47777776;fill:url(#radialGradient5562);fill-opacity:1;stroke:none;stroke-opacity:1"
+ sodipodi:type="arc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ inkscape:c_rx="51.349732"
+ inkscape:c_ry="50.01685" />
+ <g
+ id="g2790"
+ transform="matrix(0.750525,-0.660841,0.660841,0.750525,-7.964352,18.96992)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ inkscape:c_rx="38.671572"
+ inkscape:c_ry="38.578873">
+ <path
+ sodipodi:nodetypes="ccccccc"
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ id="path2782"
+ d="M 37.558058,15.646447 L 37.558058,25.585787 L 40.259961,25.646447 C 42.378017,25.646447 44.558058,23.664998 44.558058,22.320622 L 44.558058,19.149049 C 44.558058,17.91525 42.838844,15.646447 40.348349,15.646447 L 37.558058,15.646447 z "
+ style="opacity:1;color:#000000;fill:#ef2929;fill-opacity:1;fill-rule:evenodd;stroke:#cc0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ id="path2788"
+ d="M 38,25 C 38,25 38,16 38,16 C 40.915148,15.751519 42.730387,16.602947 44,18 C 42.496591,17.258523 40.966016,16.58496 39,17 L 38,25 z "
+ style="opacity:0.46666667;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <rect
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2796"
+ width="25"
+ height="2"
+ x="4"
+ y="23"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2798"
+ width="9"
+ height="9"
+ x="15"
+ y="28"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:1;color:#000000;fill:#204a87;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2800"
+ width="9"
+ height="2"
+ x="15"
+ y="26"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:1;color:#000000;fill:#204a87;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2802"
+ width="4"
+ height="2"
+ x="7"
+ y="29"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2804"
+ width="4"
+ height="3"
+ x="7"
+ y="31"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2810"
+ sodipodi:cx="42.426407"
+ sodipodi:cy="3.0103309"
+ sodipodi:rx="0.61871845"
+ sodipodi:ry="0.61871845"
+ d="M 43.045125 3.0103309 A 0.61871845 0.61871845 0 1 1 41.807688,3.0103309 A 0.61871845 0.61871845 0 1 1 43.045125 3.0103309 z"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ d="M 43.045125 3.0103309 A 0.61871845 0.61871845 0 1 1 41.807688,3.0103309 A 0.61871845 0.61871845 0 1 1 43.045125 3.0103309 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="3.0103309"
+ sodipodi:cx="42.426407"
+ id="path2812"
+ style="opacity:0.52222224;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc"
+ transform="matrix(1.857143,0,0,1.857143,-42.90623,-0.547352)" />
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
+ width="48px"
+ height="48px"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/apps"
+ sodipodi:docname="preferences-system-windows.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective51" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5031"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5029"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5027"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4816">
+ <stop
+ style="stop-color:#204a87;stop-opacity:1;"
+ offset="0"
+ id="stop4818" />
+ <stop
+ style="stop-color:#204a87;stop-opacity:0;"
+ offset="1"
+ id="stop4820" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4808">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop4810" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop4812" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3832">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3834" />
+ <stop
+ style="stop-color:#e0e0e0;stop-opacity:1;"
+ offset="1"
+ id="stop3836" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3832"
+ id="linearGradient3838"
+ x1="17.88068"
+ y1="11.072588"
+ x2="17.88068"
+ y2="21.767578"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.993847,0.000000,0.000000,0.984817,-0.192265,-0.512678)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4808"
+ id="radialGradient4814"
+ cx="17.368311"
+ cy="25.681942"
+ fx="17.368311"
+ fy="25.681942"
+ r="11.799845"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.385768,8.417746e-16,15.77468)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4816"
+ id="linearGradient4822"
+ x1="13.267747"
+ y1="7.7190704"
+ x2="13.267747"
+ y2="12.480761"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4808"
+ id="radialGradient4832"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.385768,9.076565e-15,15.77468)"
+ cx="17.368311"
+ cy="25.681942"
+ fx="17.368311"
+ fy="25.681942"
+ r="11.799845" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3832"
+ id="linearGradient4834"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.993847,0.000000,0.000000,0.984817,-0.192265,-0.512678)"
+ x1="17.88068"
+ y1="11.072588"
+ x2="17.88068"
+ y2="21.767578" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4816"
+ id="linearGradient4836"
+ gradientUnits="userSpaceOnUse"
+ x1="13.267747"
+ y1="7.7190704"
+ x2="13.267747"
+ y2="12.480761" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient6673"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6675"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6677"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ </defs>
+ <sodipodi:namedview
+ stroke="#ef2929"
+ fill="#eeeeec"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.25490196"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="-98.183664"
+ inkscape:cy="-10.197409"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="872"
+ inkscape:window-height="688"
+ inkscape:window-x="234"
+ inkscape:window-y="160" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:title>Windows</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>window</rdf:li>
+ <rdf:li>manager</rdf:li>
+ <rdf:li>decoration</rdf:li>
+ <rdf:li>behavior</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ transform="matrix(1.789616e-2,0,0,2.086758e-2,33.54249,24.0286)"
+ id="g6665">
+ <rect
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient6673);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6667"
+ width="1339.6335"
+ height="478.35718"
+ x="-1559.2523"
+ y="-150.69685" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6675);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ id="path6669"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path6671"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6677);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <g
+ id="g3822"
+ transform="matrix(1.814279,0.000000,0.000000,1.599146,-7.071394,-9.273977)">
+ <rect
+ ry="0.69171613"
+ rx="0.60969371"
+ y="7.3579211"
+ x="5.2738938"
+ height="15.642846"
+ width="15.987699"
+ id="rect3818"
+ style="opacity:1;color:#000000;fill:url(#linearGradient3838);fill-opacity:1;fill-rule:evenodd;stroke:#8d8d8d;stroke-width:0.58708906;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.13899347"
+ rx="0.12251196"
+ y="8.3006659"
+ x="6.102366"
+ height="2.5013354"
+ width="14.330762"
+ id="rect3820"
+ style="opacity:1;color:#000000;fill:url(#linearGradient4822);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.58708918;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.47878789;visibility:visible;display:inline;overflow:visible"
+ id="rect4962"
+ width="14.758596"
+ height="14.440255"
+ x="5.8884473"
+ y="7.959219"
+ rx="0.22271593"
+ ry="0.22271593" />
+ </g>
+ <g
+ id="g5022"
+ transform="matrix(1.789616e-2,0,0,2.086758e-2,46.04249,38.0286)">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect4173"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path5058"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path5018"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <g
+ transform="matrix(1.814279,0.000000,0.000000,1.599146,5.952841,4.810926)"
+ id="g4826">
+ <rect
+ style="opacity:1;color:#000000;fill:url(#linearGradient4834);fill-opacity:1;fill-rule:evenodd;stroke:#8d8d8d;stroke-width:0.58708906;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect4828"
+ width="15.987699"
+ height="15.642846"
+ x="5.2738938"
+ y="7.3579211"
+ rx="0.60969371"
+ ry="0.69171613" />
+ <rect
+ style="opacity:1;color:#000000;fill:url(#linearGradient4836);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect4830"
+ width="14.330762"
+ height="2.5013354"
+ x="6.102366"
+ y="8.3006659"
+ rx="0.12251196"
+ ry="0.13899347" />
+ <rect
+ ry="0.14454938"
+ rx="0.14454938"
+ y="7.8840585"
+ x="5.8116298"
+ height="14.590583"
+ width="14.912238"
+ id="rect4958"
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.5870893;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.54545456;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+</svg>
-// to make sure the initialization fis done only once
-var init = true;
+// to make sure the initialization is done only once
+init = true;
// constant
-var xlinkns = 'http://www.w3.org/1999/xlink';
-var evns = 'http://www.w3.org/2001/xml-events';
+xlinkns = 'http://www.w3.org/1999/xlink';
+evns = 'http://www.w3.org/2001/xml-events';
// state of the widget manager: displays homepage (value=home) or executes widget (value="exec")
-var state = 'home';
+state = 'home';
// convenience variables for SVG elements
-var homepage, arrows, icons, widgetContainer, root, homebar, execbar;
+homepage = null, arrows = null, icons = null, widgetContainer = null, homebar = null, execbar = null;
// where is the index into pages of icons on the home page
-var where = 0, maxwhere = 0, whereW = 0;
+where = 0, maxwhere = 0, whereW = 0;
// array of activated widgets
-var activatedWidgets = new Array();
-var numActivatedWidgets = 0;
+activatedWidgets = new Array();
+numActivatedWidgets = 0;
// variables for flexible layout
// variables for flexible layout
-var totalWidth, totalHeight, iconNbHoriz, iconNbVert, iconsPerPage;
+totalWidth = 0, totalHeight = 0, iconNbHoriz = 0, iconNbVert = 0, iconsPerPage = 0;
//previous size
-var previousWidth = 0, previousHeight = 0;
+previousWidth = 0, previousHeight = 0;
// to differentiate between install icon and scan dir for icons
-var isThisAScan;
+isThisAScan = null;
// preferred icon type
-var preferredIconType = '.svg';
-
-function setPreferredSize() {
- var display_width = parseInt(gpac.getOption('Widgets', 'LastWMWidth'));
- var display_height = parseInt(gpac.getOption('Widgets', 'LastWMHeight'));
- if (display_width && display_height) {
- gpac.set_size(display_width, display_height);
- }
-}
+preferredIconType = '.svg';
// adapt layout to the size of the screen
function adaptLayoutToSize() {
if (l_deb < log_level) alert("[UI] adaptLayoutToSize");
var tmpObject, tmpObj2;
// get size to adapt to
- totalWidth = root.viewport.width;
- totalHeight = root.viewport.height;
+ totalWidth = document.documentElement.viewport.width;
+ totalHeight = document.documentElement.viewport.height;
if (totalWidth == 0) totalWidth = 160;
if (totalHeight == 0) totalHeight = 280;
while (totalWidth < 160 || totalHeight < 280) {
}
// constants
-var adjustFrom = "0,0";
-var animDue = true;
+adjustFrom = "0,0";
+animDue = true;
//
// after each change of icon page, this function adjusts the visibility of arrows in the lower bar
}
}
-var adjustFromW = "0,0";
-var oldwhereW = -1;
+adjustFromW = "0,0";
+oldwhereW = -1;
//
// after each change of icon page, this function adjusts the visibility of arrows in the lower bar
function initialize() {
if (l_deb < log_level) alert("[UI] initialize");
init = false;
- setPreferredSize();
+ var display_width = parseInt(gpac.getOption('Widgets', 'LastWMWidth'));
+ var display_height = parseInt(gpac.getOption('Widgets', 'LastWMHeight'));
+ if (display_width && display_height) {
+ gpac.set_size(display_width, display_height);
+ }
root = document.documentElement;
homepage = document.getElementById('homepage');
homebar = document.getElementById('homebar');
}
}
-var testCyrilsExtension = false;
-
//
// WM callback for when a component is activated by its parent
//
function widget_add(w) {
if (!w.activated) {
+/*
if (testCyrilsExtension) {
var anima = document.createElement("animation");
anima.setAttributeNS('http://gpac.sourceforge.net/svg-extensions', 'use-as-primary', 'false');
widget_launch(w, anima);
} else {
+*/
if (sameFileIgnoringSVGView(w.icon, w.main)) {
// same file in icon and main
} else {
widget_launch(w, document.createElement("animation"));
}
- }
+// }
return true;
} else if (w.multipleInstances) {
var newwid = WidgetManager.open(w.manifest, null);
//
function resize() {
if (init) initialize();
- if (root.viewport.width == previousWidth && root.viewport.height == previousHeight) return;
- if (l_deb < log_level) alert("[UI] start initialize() w:" + root.viewport.width + " h:" + root.viewport.height);
+ if (document.documentElement.viewport.width == previousWidth && document.documentElement.viewport.height == previousHeight) return;
+ if (l_deb < log_level) alert("[UI] start initialize() w:" + document.documentElement.viewport.width + " h:" + document.documentElement.viewport.height);
adaptLayoutToSize();
// start by filling the "home page" with known icons
where = 0;
}
adjustwhere(false);
adjustWhereWidgets(false);
- previousWidth = root.viewport.width;
- previousHeight = root.viewport.height;
+ previousWidth = document.documentElement.viewport.width;
+ previousHeight = document.documentElement.viewport.height;
gpac.setOption("Widgets", "LastWMWidth", '' + previousWidth);
gpac.setOption("Widgets", "LastWMHeight", '' + previousHeight);
}
}
// constant
-var corein = "urn:mpeg:mpegu:schema:widgets:core:in:2010";
+const corein = "urn:mpeg:mpegu:schema:widgets:core:in:2010";
//
// commodity method to empty a list of children
// process differently cases where widget.icon == widget.main
//
var container;
- if (!testCyrilsExtension && sameFileIgnoringSVGView(iconUrl, widget.main) && widget.main.indexOf('.svg') >= 0) {
+ if (sameFileIgnoringSVGView(iconUrl, widget.main) && widget.main.indexOf('.svg') >= 0) {
// see if the animation already exists
container = document.getElementById(name);
if (container == null) {
g2 = document.createElement("g");
g2.setAttribute("transform", 'translate(40,70)');
g.appendChild(g2);
- var anim = text(name, 'white', 0, 0, 14, 'Arial Unicode MS');
+ var anim = createtext(name, 'white', 0, 0, 14, 'Arial Unicode MS');
anim.setAttribute("text-anchor", "middle");
anim.setAttribute("display-align", "center");
g2.appendChild(anim);
if (container != null) icon = container.getAttributeNS(xlinkns, 'href');
}
if (icon != null &&
- !testCyrilsExtension &&
sameFileIgnoringSVGView(icon, wid.main) &&
endsWith(wid.main, '.svg')) {
// get the animation with id=shortName stored in mainDefs
}
}
-var upnp_renders;
+upnp_renders = null;
//
// widget remoting function
selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black'));
for (i = 0; i < count; i++) {
render = UPnP.GetMediaRenderer(i);
- obj = text(render.Name, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
+ obj = createtext(render.Name, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
obj.setAttribute('id', "selector" + i);
selector.appendChild(obj);
obj.addEventListener('mouseover', sw1("selector"+i), false);
obj.addEventListener('mouseout', sw2("selector"+i), false);
obj.addEventListener('click', sw3(i, widget), false);
}
- obj = text('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
+ obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
obj.setAttribute('id', "cancel");
selector.appendChild(obj);
obj.addEventListener('mouseover', function(evt) { document.getElementById("cancel").setAttribute("fill", "red"); }, false);
//
// file list vars
//
-var flstart = 0, fllist, maxFileNames = 14;
+flstart = 0, fllist = null, maxFileNames = 14;
//
// create a file menu in the main screen, allowing to navigate directories and choose widget config files
//
// create text
//
-function text(content, fill, x, y, size, family) {
+function createtext(content, fill, x, y, size, family) {
var child = document.createElement('text');
child.setAttribute('fill', fill);
child.textContent = content;
function wmjs_migrate_widget(render, widget) {
if (WidgetManager.upnp) {
var url, ctx, ctx_uri, uri;
+
url = widget.url;
ctx = widget.get_context();
uri = UPnP.ShareResource(url, render.HostName);
- if (ctx != "") {
+ if ((ctx!= null) && (ctx != "")) {
if ((uri.indexOf('?') < 0) && (uri.indexOf('%3f') < 0) && (uri.indexOf('%3F') < 0)) {
ctx_uri = uri + '?mpeg-u-context';
} else {
function wmjs_interface_invoke_callback_local(wid_dst, ifce_dst, is_reply) {
log(l_deb, "wmjs_interface_invoke_callback_local '" + wid_dst.name + "' '" + ifce_dst.type + "' - reply " + is_reply);
return function() {
+ log(l_deb, "wmjs_interface_invoke_callback_local/function '" + wid_dst.name + "' '" + ifce_dst.type + "' - reply " + is_reply);
var j, i, ai, param_count, msgHandler, msg_src, msg_dst, is_script;
var args = new Array();
is_script = 0;
/*get msg from source interface (this object)*/
msg_src = this.get_message(msgHandler.msgName);
// JCD: take into account message repetition, if any
- for (j = 0; j < ifce_dest.num_messages; j++) {
- msg_dst = ifce_dest.get_message(j);
- if (msg_dst.name == msgHandler.nsgName) {
+ for (j = 0; j < ifce_dst.num_messages; j++) {
+ msg_dst = ifce_dst.get_message(j);
+ if (msg_dst.name == msgHandler.msgName) {
log(l_deb, (is_reply ? 'invokeReply ' : 'invoke ') + msg_src.name + ' on ' + wid_dst.name + '.' + msg_dst.name);
if (msg_dst.has_script_input) is_script = 1;
param_count = msg_src.num_params;
// a_msg = a_ifce.get_message(msg.name);
for (l = 0; l < a_ifce.num_messages; l++) {
a_msg = a_ifce.get_message(l);
- alert(msg.name+" "+a_msg.name);
+ //alert(msg.name+" "+a_msg.name);
if (a_msg.name == msg.name) {
// the messages have matching names, check direction
if (msg.is_input == a_msg.is_input) {
u8 gf_mp3_layer(u32 hdr);
u16 gf_mp3_frame_size(u32 hdr);
u32 gf_mp3_get_next_header(FILE* in);
-u32 gf_mp3_get_next_header_mem(char *buffer, u32 size, u32 *pos);
+u32 gf_mp3_get_next_header_mem(const char *buffer, u32 size, u32 *pos);
#endif /*GPAC_DISABLE_AV_PARSERS*/
u32 gf_ac3_get_channels(u32 acmod);
u32 gf_ac3_get_bitrate(u32 brcode);
-GF_Err gf_avc_get_sps_info(char *sps, u32 sps_size, u32 *width, u32 *height, s32 *par_n, s32 *par_d);
+GF_Err gf_avc_get_sps_info(char *sps, u32 sps_size, u32 *sps_id, u32 *width, u32 *height, s32 *par_n, s32 *par_d);
const char *gf_avc_get_profile_name(u8 video_prof);
#endif /*GPAC_DISABLE_AV_PARSERS*/
GF_Err gf_bifs_decoder_remove_stream(GF_BifsDecoder *codec, u16 ESID);
/*decode a BIFS AU and applies it to the graph (non-memory mode only)*/
-GF_Err gf_bifs_decode_au(GF_BifsDecoder *codec, u16 ESID, char *data, u32 data_length, Double ts_offset);
+GF_Err gf_bifs_decode_au(GF_BifsDecoder *codec, u16 ESID, const char *data, u32 data_length, Double ts_offset);
/*Memory BIFS decoding - fills the command list with the content of the AU - cf scenegraph_vrml.h for commands usage
@ESID: ID of input stream
* \note In write mode on an existing data buffer, data overflow is never signaled but simply ignored, it is the caller responsability to ensure it
* does not write more than possible.
*/
-GF_BitStream *gf_bs_new(char *buffer, u64 size, u32 mode);
+GF_BitStream *gf_bs_new(const char *buffer, u64 size, u32 mode);
/*!
* \brief bitstream constructor from file handle
*
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / common tools sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _GF_CACHE_H_
+#define _GF_CACHE_H_
+
+/*!
+ * \file <gpac/cache.h>
+ * \brief Cache management functions.
+ */
+
+/*!
+ * \addtogroup dld_grp downloader
+ * \ingroup utils_grp
+ * \brief File Cache Downloader objects
+ *
+ * This section documents the file caching tools the GPAC framework.
+ *
+ * @{
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <gpac/tools.h>
+
+ /**
+ * Handle for Cache Entries.
+ * You can use the gf_cache_get_* functions to get the cache properties
+ */
+ typedef struct __DownloadedCacheEntryStruct * DownloadedCacheEntry;
+
+
+ typedef struct __CacheReaderStruct * GF_CacheReader;
+
+ /**
+ * Free The DownloadedCacheEntry handle
+ * \param entry The entry to delete
+ * \return GF_OK
+ */
+ GF_Err gf_cache_delete_entry( const DownloadedCacheEntry entry );
+
+ /**
+ * Get the ETag associated with this cache entry if any
+ * \param entry The entry
+ * \return The ETag if any was defined, NULL otherwise
+ */
+ const char * gf_cache_get_etag_on_server( const DownloadedCacheEntry entry );
+
+ /**
+ * Set the eTag in the cache. Data is duplicated, so original string can be freed by caller.
+ * \param entry The entry
+ * \param eTag The eTag to set
+ * \return GF_OK if entry and eTag are valid, GF_BAD_PARAM otherwise
+ */
+ GF_Err gf_cache_set_etag_on_disk(const DownloadedCacheEntry entry, const char * eTag );
+
+ /**
+ * Get the ETag associated with this cache entry if any
+ * \param entry The entry
+ * \return The ETag if any was defined, NULL otherwise
+ */
+ const char * gf_cache_get_etag_on_disk( const DownloadedCacheEntry entry );
+
+ /**
+ * Set the eTag in the cache. Data is duplicated, so original string can be freed by caller.
+ * \param entry The entry
+ * \param eTag The eTag to set
+ * \return GF_OK if entry and eTag are valid, GF_BAD_PARAM otherwise
+ */
+ GF_Err gf_cache_set_etag_on_server(const DownloadedCacheEntry entry, const char * eTag );
+
+
+ /**
+ * Get the Mime-Type associated with this cache entry.
+ * \param entry The entry
+ * \return The Mime-Type (never NULL if entry is valid)
+ */
+ const char * gf_cache_get_mime_type( const DownloadedCacheEntry entry );
+
+ /**
+ * Set the Mime-Type in the cache. Data is duplicated, so original string can be freed by caller.
+ * \param entry The entry
+ * \param eTag The mime-type to set
+ * \return GF_OK if entry and mime-type are valid, GF_BAD_PARAM otherwise
+ */
+ GF_Err gf_cache_set_mime_type(const DownloadedCacheEntry entry, const char * mime_type );
+
+ /**
+ * Get the URL associated with this cache entry.
+ * \param entry The entry
+ * \return The Hash key (never NULL if entry is valid)
+ */
+ const char * gf_cache_get_url( const DownloadedCacheEntry entry );
+
+ /**
+ * Get the Hash Key associated with this cache entry.
+ * \param entry The entry
+ * \return The Hash key (never NULL if entry is valid)
+ */
+ const char * gf_cache_get_hash( const DownloadedCacheEntry entry );
+
+ /**
+ * Tells whether a cache entry should be cached safely (no
+ * \param entry The entry
+ * \return 1 if entry should be cached
+ */
+ Bool gf_cache_can_be_cached( const DownloadedCacheEntry entry );
+
+ /**
+ * Get the Last-Modified information associated with this cache entry.
+ * \param entry The entry
+ * \return The Last-Modified header (can be NULL)
+ */
+ const char * gf_cache_get_last_modified_on_disk ( const DownloadedCacheEntry entry );
+
+ /**
+ * Get the Last-Modified information associated with this cache entry.
+ * \param entry The entry
+ * \return The Last-Modified header (can be NULL)
+ */
+ const char * gf_cache_get_last_modified_on_server ( const DownloadedCacheEntry entry );
+
+ /**
+ * Set the Last-Modified header for this cache entry
+ * \param entry The entry
+ * \param newLastModified The new value to set, will be duplicated
+ * \return GF_OK if everything went alright, GF_BAD_PARAM if entry is NULL
+ */
+ GF_Err gf_cache_set_last_modified_on_disk ( const DownloadedCacheEntry entry, const char * newLastModified );
+
+ /**
+ * Set the Last-Modified header for this cache entry
+ * \param entry The entry
+ * \param newLastModified The new value to set, will be duplicated
+ * \return GF_OK if everything went alright, GF_BAD_PARAM if entry is NULL
+ */
+ GF_Err gf_cache_set_last_modified_on_server ( const DownloadedCacheEntry entry, const char * newLastModified );
+
+ /**
+ * Get the file name of cache associated with this cache entry.
+ * \param entry The entry
+ * \return The Cache file (never NULL if entry is valid)
+ */
+ const char * gf_cache_get_cache_filename( const DownloadedCacheEntry entry );
+
+ /**
+ * Get the real file size of the cache entry
+ * \param entry The entry
+ * \return the file size
+ */
+ u32 gf_cache_get_cache_filesize( const DownloadedCacheEntry entry );
+
+ /**
+ * Flushes The disk cache for this entry (by persisting the property file
+ * \param entry The entry
+ */
+ GF_Err gf_cache_flush_disk_cache( const DownloadedCacheEntry entry );
+
+ GF_Err gf_cache_set_content_length( const DownloadedCacheEntry entry, u32 length );
+
+ u32 gf_cache_get_content_length( const DownloadedCacheEntry entry);
+
+ /**
+ * \brief append cache directives to an HTTP GET request
+ * \param entry The entry of cache to use
+ * \param httpRequest The HTTP GET request to populate. The request must have been allocated enough to handle the cache arguments
+ * \return GF_OK if everything went fine, GF_BAD_PARAM if parameters are wrong
+ */
+ GF_Err appendHttpCacheHeaders(const DownloadedCacheEntry entry, char * httpRequest);
+
+ /*
+ * Cache Management functions
+ */
+
+ /*!
+ * Delete all cached files in given directory starting with startpattern
+ * \param directory to clean up
+ * \return GF_OK if everything went fine
+ */
+ GF_Err gf_cache_delete_all_cached_files(const char * directory);
+
+
+ /*
+ * Cache Reader functions
+ */
+
+ GF_CacheReader gf_cache_reader_new(const DownloadedCacheEntry entry);
+
+ GF_Err gf_cache_reader_del( GF_CacheReader handle );
+
+ s64 gf_cache_reader_seek_at( GF_CacheReader reader, u64 seekPosition);
+
+ s64 gf_cache_reader_get_position( const GF_CacheReader reader);
+
+ s64 gf_cache_reader_get_currentSize( GF_CacheReader reader );
+
+ s64 gf_cache_reader_get_full_size( GF_CacheReader reader );
+
+ s32 gf_cache_reader_read( GF_CacheReader reader, char * buff, s32 length);
+
+ Bool gf_cache_check_if_cache_file_is_corrupted(const DownloadedCacheEntry entry);
+
+ void gf_cache_entry_set_delete_files_when_deleted(const DownloadedCacheEntry entry);
+
+ Bool gf_cache_entry_is_delete_files_when_deleted(const DownloadedCacheEntry entry);
+
+ u32 gf_cache_get_sessions_count_for_cache_entry(const DownloadedCacheEntry entry);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GF_CACHE_H_ */
*/
-#ifndef _GF_RASTER_2D_H_
-#define _GF_RASTER_2D_H_
+#ifndef _GF_COLOR_H_
+#define _GF_COLOR_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gpac/constants.h>
+#include <gpac/math.h>
/*!
#endif
-#endif /*_GF_RASTER_2D_H_*/
+#endif /*_GF_COLOR_H_*/
/*!
* \brief configuration file constructor
*
- *Constructs a configuration file
+ * Constructs a configuration file.
*\param filePath directory the file is located in
*\param fileName name of the configuration file
- *\return the configuration file object
+ *\return the configuration file object, NULL if the file does not exist
*/
GF_Config *gf_cfg_new(const char *filePath, const char *fileName);
+/*!
+ * \brief alternative configuration file constructor
+ *
+ * Constructs a configuration file. If file does not exist, configuration will be still created
+ *\param filePath directory the file is located in
+ *\param fileName name of the configuration file
+ *\return the configuration file object, never NULL, even if file does not exist
+ */
+GF_Config *gf_cfg_force_new(const char *filePath, const char *fileName);
/*!
* \brief configuration file destructor
*
*\param cfgFile the target configuration file
*/
void gf_cfg_del(GF_Config *cfgFile);
+/*!
+ * \brief configuration file destructor
+ *
+ *Destroys the configuration file and removes the file from disk.
+ *\param cfgFile the target configuration file
+ */
+void gf_cfg_remove(GF_Config *cfgFile);
/*!
* \brief configuration saving
*
*/
void gf_cfg_del_section(GF_Config *cfgFile, const char *secName);
-/*get a sub key (separator is ':') in a given key in a given section. Returns an error if the key does not exist
+/*!
+ * get a sub key (separator is ':') in a given key in a given section. Returns an error if the key does not exist
*\param cfgFile the target configuration file
*\param secName the target section
*\param keyName the name of the target key
*\param sub_index the 0-based index position of the sub key*/
const char *gf_cfg_get_sub_key(GF_Config *iniFile, const char *secName, const char *keyName,u32 sub_index);
+/*!
+ * Get the full filename associated with this config file
+ * The caller is responsible for freeing memory
+ * \param iniFile The Configuration
+ * \return a newly allocated filename
+ */
+char * gf_cfg_get_filename(GF_Config *iniFile);
#ifdef __cplusplus
}
#define GPAC_CONFIGURATION "(static configuration file)"
/*this file defines all common macros for libgpac compilation*/
+#ifdef WIN32
+#define GPAC_CONFIG_WIN32
+#endif
/*except for symbian32 which uses .mmp directives ... */
-#if defined(WIN32) || defined(_WIN32_WCE)
+#if defined(WIN32) || defined(_WIN32_WCE) || defined(GPAC_CONFIG_DARWIN) /*visual studio and xcode*/
/*enables GPAC fixed point*/
//#define GPAC_FIXED_POINT
/*spidermonkey enabled*/
#define GPAC_HAS_SPIDERMONKEY
+#ifdef GPAC_CONFIG_DARWIN
+#define MOZILLA_1_8_BRANCH
+#endif
/*libjpeg enabled*/
#define GPAC_HAS_JPEG
//#define GPAC_HAS_IPV6
/*3D compositor disabled*/
-//#define GPAC_DISABLE_3D
+#ifdef GPAC_CONFIG_DARWIN
+#define GPAC_DISABLE_3D
+#endif
/*use TinyGL instead of OpenGL*/
//#define GPAC_USE_TINYGL
/*use OpenGL ES instead of OpenGL*/
-//#define GPAC_USE_OGL_ES
+#ifdef GPAC_CONFIG_DARWIN
+#define GPAC_USE_OGL_ES
+#endif
#if defined(_WIN32_WCE)
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / exported constants
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*!GPAC Private Scene streams\n
*\n\note
- *this stream type (MPEG-4 user-private) is reserved for streams only used to create a scene decoder
+ *this stream type (MPEG-4 user-private) is reserved for streams only used to create a scene decoder
*handling the scene without input streams, as is the case for file readers (BT/VRML/XML..).\n
*The decoderSpecificInfo carried is as follows:
- \code
- u32 file_size: total file size
- char file_name[dsi_size - sizeof(u32)]: local file name.
+ \code
+ u32 file_size: total file size
+ char file_name[dsi_size - sizeof(u32)]: local file name.
\n\note: File may be a cache file, it is the decoder responsability to check if the file is completely
downloaded before parsing if needed.
- \endcode
+ \endcode
*The inBufferLength param for decoders using these streams is the stream clock in ms (no input data is given).\n
- *The "dummy_in" module is available to generate these streams for common files, and also takes care of proper
+ *The "dummy_in" module is available to generate these streams for common files, and also takes care of proper
clock init in case of seeking.\n
- *This is a reentrant stream type: if any media object with this streamtype also exist in the scene, they will be
- *attached to the scene decoder (except when a new inline scene is detected, in which case a new decoder will
+ *This is a reentrant stream type: if any media object with this streamtype also exist in the scene, they will be
+ *attached to the scene decoder (except when a new inline scene is detected, in which case a new decoder will
*be created). This allows for animation/sprite usage along with the systems timing/stream management.\n
*\n
*the objectTypeIndication currently in use for these streams are documented below\n
*/
GF_STREAM_PRIVATE_SCENE = 0x20,
+ /*!GPAC Private Media streams\n
+ *\n\note
+ *this stream type (MPEG-4 user-private) is reserved for media streams bypassing GPAC for decoding
+ and composition. The media decoder is only in charge of repositioning the video output, and the compositor will
+ draw an empty rectangle if using alpha composition
+
+ *The decoderSpecificInfo carried only contains an opaque pointer in the data field, which depends on the underlying InputServce provider
+
+ *the objectTypeIndication currently in use for these streams are documented below\n
+ */
+ GF_STREAM_PRIVATE_MEDIA = 0x21,
+
/*used internally to signal the the OTI carries a 4CC code, typically media subtype (stsd entry in file format)*/
GF_STREAM_4CC = 0xF0
};
/*!
* Media Object types
- *
+ *
* This type provides a hint to network modules which may have to generate an service descriptor on the fly.
- * They occur only if objects/services used in the scene are not referenced through ObjectDescriptors (MPEG-4)
+ * They occur only if objects/services used in the scene are not referenced through ObjectDescriptors (MPEG-4)
* but direct through URL
*/
enum
/*!
* \brief Pixel Formats
- *
+ *
* Supported pixel formats for everything using video
- *\note For textures using 32 bit ARGB/RGB_32/BGR_32:
- *\li on little endian machines, shall be ordered in memory as BGRA,
- *\li on big endians, shall be ordered in memory as ARGB
- *so that *(u32*)pixel_mem is always ARGB (0xAARRGGBB).
*/
typedef enum
{
GF_PIXEL_RGB_565 = GF_4CC('R','5','6','5'),
/*!24 bit RGB*/
GF_PIXEL_RGB_24 = GF_4CC('R','G','B','3'),
- /*!24 bit BGR - used for graphics cards video format signaling*/
+ /*!24 bit BGR*/
GF_PIXEL_BGR_24 = GF_4CC('B','G','R','3'),
- /*!32 bit RGB*/
+ /*!32 bit RGB. Component ordering in bytes is B-G-R-X.*/
GF_PIXEL_RGB_32 = GF_4CC('R','G','B','4'),
- /*!32 bit BGR - used for graphics cards video format signaling*/
+ /*!32 bit BGR. Component ordering in bytes is R-G-B-X.*/
GF_PIXEL_BGR_32 = GF_4CC('B','G','R','4'),
- /*!32 bit ARGB.*/
+ /*!32 bit ARGB. Component ordering in bytes is B-G-R-A.*/
GF_PIXEL_ARGB = GF_4CC('A','R','G','B'),
- /*!32 bit RGBA (openGL like)*/
+ /*!32 bit RGBA (openGL like). Component ordering in bytes is R-G-B-A.*/
GF_PIXEL_RGBA = GF_4CC('R','G','B', 'A'),
-
- /*!RGB24 + depth plane*/
+ /*!RGB24 + depth plane. Component ordering in bytes is R-G-B-D.*/
GF_PIXEL_RGBD = GF_4CC('R', 'G', 'B', 'D'),
-
- /*!RGB24 + depth plane (7 power bits) + shape mask*/
+ /*!RGB24 + depth plane (7 lower bits) + shape mask. Component ordering in bytes is R-G-B-(S+D).*/
GF_PIXEL_RGBDS = GF_4CC('3', 'C', 'D', 'S'),
-
+ /*!Stereo RGB24 */
+ GF_PIXEL_RGBS = GF_4CC('R', 'G', 'B', 'S'),
+ /*!Stereo RGBA. Component ordering in bytes is R-G-B-A. */
+ GF_PIXEL_RGBAS = GF_4CC('R', 'G', 'A', 'S'),
+
/*!YUV packed format*/
GF_PIXEL_YUY2 = GF_4CC('Y','U','Y','2'),
/*!YUV packed format*/
GF_PIXEL_YUNV = GF_4CC('Y','U','N','V'),
/*!YUV packed format*/
GF_PIXEL_V422 = GF_4CC('V','4','2','2'),
-
+
/*!YUV planar format*/
GF_PIXEL_YV12 = GF_4CC('Y','V','1','2'),
/*!YUV planar format*/
GF_PIXEL_IYUV = GF_4CC('I','Y','U','V'),
/*!YUV planar format*/
GF_PIXEL_I420 = GF_4CC('I','4','2','0'),
-
+
/*!YV12 + Alpha plane*/
GF_PIXEL_YUVA = GF_4CC('Y', 'U', 'V', 'A'),
/*!
* \brief Scene ObjectTypeIndication Formats
- *
+ *
* Supported ObjectTypeIndication for scene description streams. *_FILE_* are only used with private scene streams
* and only carry the file name for the scene. Other internal stream types can be used in a real streaming environment
*/
GPAC_OTI_OD_V2 = 0x02,
/*!OTI for BIFS InputSensor streams*/
GPAC_OTI_SCENE_INTERACT = 0x03,
- /*!OTI for AFX streams with extended BIFS config*/
+ /*!OTI for streams with extended BIFS config*/
GPAC_OTI_SCENE_BIFS_EXTENDED = 0x04,
- /*!OTI for AFX streams with extended AFXConfig*/
+ /*!OTI for AFX streams with AFXConfig*/
GPAC_OTI_SCENE_AFX = 0x05,
/*!OTI for Font data streams */
GPAC_OTI_FONT = 0x06,
GPAC_OTI_TEXT_MPEG4 = 0x08,
/*!OTI for LASeR streams*/
GPAC_OTI_SCENE_LASER = 0x09,
+ /*!OTI for SAF streams*/
+ GPAC_OTI_SCENE_SAF = 0x0A,
/*!OTI for MPEG-4 Video Part 2 streams*/
GPAC_OTI_VIDEO_MPEG4_PART2 = 0x20,
* it needs extensions for non-MPEG-4 streams such as AMR, H263 , etc.\n
*\note The decoder specific info for such streams is always carried encoded, with the following syntax:\n
* DSI Syntax for audio streams
- \code
+ \code
* u32 codec_four_cc: the codec 4CC reg code / codec id for ffmpeg
* u32 sample_rate: sampling rate or 0 if unknown
* u16 nb_channels: num channels or 0 if unknown
\endcode
\n
* DSI Syntax for video streams
- \code
+ \code
* u32 codec_four_cc: the codec 4CC reg code / codec id for ffmpeg
* u16 width: video width or 0 if unknown
* u16 height: video height or 0 if unknown
* \brief FFMPEG ObjectTypeIndication
*
* ObjectTypeIndication for FFMPEG codecs not defined in MPEG-4. FFMPEG uses the base GPAC_OTI_MEDIA_GENERIC specific info formats, and extends it as follows:
- \code
+ \code
* u32 bit_rate: the stream rate or 0 if unknown
* u32 codec_tag: FFMPEG codec tag as defined in libavcodec
* char *data: codec extensions till end of DSI bitstream
\endcode
*/
GPAC_OTI_MEDIA_FFMPEG = 0x81,
-
+
/*!OTI for EVRC Voice streams*/
GPAC_OTI_AUDIO_EVRC_VOICE = 0xA0,
/*!OTI for SMV Voice streams*/
GPAC_OTI_AUDIO_DTS_HD_HR = 0xAA,
/*!OTI for DTS-HD Master audio streams*/
GPAC_OTI_AUDIO_DTS_HD_MASTER = 0xAB,
-
+
/*!OTI for dummy streams (dsi = file name) using the generic context loader (BIFS/VRML/SWF/...) - GPAC internal*/
GPAC_OTI_PRIVATE_SCENE_GENERIC = 0xC0,
/*!OTI for SVG dummy stream (dsi = file name) - GPAC internal*/
*
* Object type indication for all OGG media. The DSI contains all intitialization ogg packets for the codec
* and is formated as follows:\n
- *\code
+ *\code
while (dsi_size) {
bit(16) packet_size;
char packet[packet_size];
GPAC_OTI_MEDIA_SUBPIC = 0xE0,
/*!OTI for 13K Voice / QCELP audio streams*/
- GPAC_OTI_AUDIO_13K_VOICE = 0xE1
+ GPAC_OTI_AUDIO_13K_VOICE = 0xE1,
+
+ /*!OTI for LIBPLAYER private streams. The data pointer in the DSI is the libplayer handle object*/
+ GPAC_OTI_PRIVATE_MEDIA_LIBPLAYER = 0xF1
};
+/*!
+ * \brief AFX Object Code
+*/
+enum
+{
+ /*!3D Mesh Compression*/
+ GPAC_AFX_3DMC = 0x00,
+ /*!Wavelet Subdivision Surface*/
+ GPAC_AFX_WAVELET_SUBDIVISION = 0x01,
+ /*!MeshGrid*/
+ GPAC_AFX_MESHGRID = 0x02,
+ /*!Coordinate Interpolator*/
+ GPAC_AFX_COORDINATE_INTERPOLATOR = 0x03,
+ /*!Orientation Interpolator*/
+ GPAC_AFX_ORIENTATION_INTERPOLATOR = 0x04,
+ /*!Position Interpolator*/
+ GPAC_AFX_POSITION_INTERPOLATOR = 0x05,
+ /*!Octree Image*/
+ GPAC_AFX_OCTREE_IMAGE = 0x06,
+ /*!BBA*/
+ GPAC_AFX_BBA = 0x07,
+ /*!PointTexture*/
+ GPAC_AFX_POINT_TEXTURE = 0x08,
+ /*!3DMC Extension*/
+ GPAC_AFX_3DMC_EXT = 0x09,
+ /*!FootPrint representation*/
+ GPAC_AFX_FOOTPRINT = 0x0A,
+ /*!Animated Mesh Compression*/
+ GPAC_AFX_ANIMATED_MESH = 0x0B,
+ /*!Scalable Complexity*/
+ GPAC_AFX_SCALABLE_COMPLEXITY = 0x0C,
+};
+
/*channel cfg flags - DECODERS MUST OUTPUT STEREO/MULTICHANNEL IN THIS ORDER*/
/*!
/*
* Output SHA-1(file contents), returns 0 if successful.
*/
-int gf_sha1_file(char *filename, u8 digest[20]);
+int gf_sha1_file(const char *filename, u8 digest[20]);
/*
* Output SHA-1(buf)
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / common tools sub-project
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/tools.h>
#include <gpac/module.h>
-
-
-/*!the download manager object. This is usually not used by GPAC modules*/
-typedef struct __gf_download_manager GF_DownloadManager;
-/*!the download manager session.*/
-typedef struct __gf_download_session GF_DownloadSession;
-
-/*!
- *\brief download manager constructor
- *
- *Creates a new download manager object.
- *\param cfg optional configuration file. Currently the download manager needs a configuration file for cache location and
- *other options. The cache directory must be indicated in the section "General", key "CacheDirectory" of the configuration
- *file. If the cache directory is not found, the cache will be disabled but the downloader will still work.
- *\return the download manager object
-*/
-GF_DownloadManager *gf_dm_new(GF_Config *cfg);
-/*
- *\brief download manager destructor
- *
- *Deletes the download manager. All running sessions are aborted
- *\param dm the download manager object
- */
-void gf_dm_del(GF_DownloadManager *dm);
-
-/*!
- *\brief callback function for authentication
- *
- * The gf_dm_get_usr_pass type is the type for the callback of the \ref gf_dm_set_auth_callback function used for password retrieval
- *\param usr_cbk opaque user data
- *\param site_url url of the site the user and password are requested for
- *\param usr_name the user name for this site. The allocated space for this buffer is 50 bytes. \note this varaibale may already be formatted.
- *\param password the password for this site and user. The allocated space for this buffer is 50 bytes.
- *\return 0 if user didn't fill in the information which will result in an authentication failure, 1 otherwise.
-*/
-typedef Bool (*gf_dm_get_usr_pass)(void *usr_cbk, const char *site_url, char *usr_name, char *password);
-
-/*!
- *\brief password retrieval assignment
- *
- *Assigns the callback function used for user password retrieval. If no such function is assigned to the download manager,
- *all downloads requiring authentication will fail.
- *\param dm the download manager object
- *\param get_pass \ref gf_dm_get_usr_pass callback function for user and password retrieval.
- *\param usr_cbk opaque user data passed to callback function
- */
-void gf_dm_set_auth_callback(GF_DownloadManager *dm, gf_dm_get_usr_pass get_pass, void *usr_cbk);
-
-/*!downloader session message types*/
-enum
-{
- /*!signal that session is setup and waiting for connection request*/
- GF_NETIO_SETUP = 0,
- /*!signal that session connection is done*/
- GF_NETIO_CONNECTED,
- /*!request a protocol method from the user. Default value is "GET" for HTTP*/
- GF_NETIO_GET_METHOD,
- /*!request a header from the user. */
- GF_NETIO_GET_HEADER,
- /*!requesting content from the user, if any. Content is appended to the request*/
- GF_NETIO_GET_CONTENT,
- /*!signal that request is sent and waiting for server reply*/
- GF_NETIO_WAIT_FOR_REPLY,
- /*!signal a header to user. */
- GF_NETIO_PARSE_HEADER,
- /*!signal request reply to user. The reply is always sent after the headers*/
- GF_NETIO_PARSE_REPLY,
- /*!send data to the user*/
- GF_NETIO_DATA_EXCHANGE,
- /*!all data has been transfered*/
- GF_NETIO_DATA_TRANSFERED,
- /*!signal that the session has been deconnected*/
- GF_NETIO_DISCONNECTED,
- /*!downloader session failed (error code set) or done/destroyed (no error code)*/
- GF_NETIO_STATE_ERROR
-};
-
-/*!session download flags*/
-enum
-{
- /*!session is not threaded, the user must explicitely fetch the data */
- GF_NETIO_SESSION_NOT_THREADED = 1,
- /*!session has no cache: data will be sent to the user if threaded mode (live streams like radios & co)*/
- GF_NETIO_SESSION_NOT_CACHED = 1<<1,
- /*! ignores any data already in the cache*/
- GF_NETIO_SESSION_FORCE_RESTART = 1<<2,
- /*! reuses any data already in the cache and appends the new data*/
- GF_NETIO_SESSION_REUSE_APPEND = 1<<3,
- /*! forces cache to be saved on disk - this is temporary until we cleanup cache management*/
- GF_NETIO_SESSION_KEEP_CACHE = 1<<4
-};
-
-
-/*!protocol I/O parameter*/
-typedef struct
-{
- /*!parameter message type*/
- u32 msg_type;
- /*error code if any. Valid for all message types.*/
- GF_Err error;
- /*!data received or data to send. Only valid for GF_NETIO_GET_CONTENT and GF_NETIO_DATA_EXCHANGE (when no cache is setup) messages*/
- char *data;
- /*!size of associated data. Only valid for GF_NETIO_GET_CONTENT and GF_NETIO_DATA_EXCHANGE messages*/
- u32 size;
- /*protocol header. Only valid for GF_NETIO_GET_HEADER, GF_NETIO_PARSE_HEADER and GF_NETIO_GET_METHOD*/
- char *name;
- /*protocol header value or server response. Only alid for GF_NETIO_GET_HEADER, GF_NETIO_PARSE_HEADER and GF_NETIO_PARSE_REPLY*/
- char *value;
- /*response code - only valid for GF_NETIO_PARSE_REPLY*/
- u32 reply;
-} GF_NETIO_Parameter;
-
-/*!
- *\brief callback function for data reception and state signaling
- *
- * The gf_dm_user_io type is the type for the data callback function of a download session
- *\param usr_cbk opaque user data
- *\param parameter the input/output parameter structure
-*/
-typedef void (*gf_dm_user_io)(void *usr_cbk, GF_NETIO_Parameter *parameter);
-
-
-
-/*!
- *\brief download session constructor
- *
- *Creates a new download session
- *\param dm the download manager object
- *\param url file to retrieve (no PUT/POST yet, only downloading is supported)
- *\param dl_flags combination of session download flags
- *\param user_io \ref gf_dm_user_io callback function for data reception and service messages
- *\param usr_cbk opaque user data passed to callback function
- *\param error error for failure cases
- *\return the session object or NULL if error. If no error is indicated and a NULL session is returned, this means the file is local
- */
-GF_DownloadSession * gf_dm_sess_new(GF_DownloadManager *dm, char *url, u32 dl_flags,
- gf_dm_user_io user_io,
- void *usr_cbk,
- GF_Err *error);
-
-/*!
- *brief downloader session destructor
- *
- *Deletes the download session, cleaning the cache if indicated in the configuration file of the download manager (section "Downloader", key "CleanCache")
- *\param sess the download session
-*/
-void gf_dm_sess_del(GF_DownloadSession * sess);
-/*!
- *\brief aborts downloading
- *
- *Aborts all operations in the session, regardless of its state. The session cannot be reused once this is called.
- *\param sess the download session
- */
-void gf_dm_sess_abort(GF_DownloadSession * sess);
-/*!
- *\brief sets private data
- *
- *associate private data with the session.
- *\param sess the download session
- *\param private_data the private data
- *\warning the private_data parameter is reserved for bandwidth statistics per service when used in the GPAC terminal.
- */
-void gf_dm_sess_set_private(GF_DownloadSession * sess, void *private_data);
-
-/*!
- *\brief gets private data
- *
- *Gets private data associated with the session.
- *\param sess the download session
- *\return the private data
- *\warning the private_data parameter is reserved for bandwidth statistics per service when used in the GPAC terminal.
- */
-void *gf_dm_sess_get_private(GF_DownloadSession * sess);
-/*!
- *\brief gets last session error
- *
- *Gets the last error that occured in the session
- *\param sess the download session
- *\return the last error
- */
-GF_Err gf_dm_sess_last_error(GF_DownloadSession *sess);
-
-/*!
- *\brief fetches data on session
- *
- *Fetches data from the server. This will also performs connections and all needed exchange with server.
- *\param sess the download session
- *\param buffer destination buffer
- *\param buffer_size destination buffer allocated size
- *\param read_size amount of data actually fetched
- *\note this can only be used when the session is not threaded
- */
-GF_Err gf_dm_sess_fetch_data(GF_DownloadSession * sess, char *buffer, u32 buffer_size, u32 *read_size);
-
-/*!
- *\brief get mime type
- *
- *Fetches the mime type of the URL this session is fetching
- *\param sess the download session
- *\return the mime type of the URL, or NULL if error. You should get the error with \ref gf_dm_sess_last_error
- */
-const char *gf_dm_sess_mime_type(GF_DownloadSession * sess);
-/*!
- *\brief get cache file name
- *
- *Gets the cache file name for the session.
- *\param sess the download session
- *\return the absolute path of the cache file, or NULL if the session is not cached*/
-const char *gf_dm_sess_get_cache_name(GF_DownloadSession * sess);
-/*!
- *\brief get statistics
- *
- *Gets download statistics for the session. All output parameters are optional and may be set to NULL.
- *\param sess the download session
- *\param server the remote server address
- *\param path the path on the remote server
- *\param total_size the total size in bytes the file fetched, 0 if unknown.
- *\param bytes_done the amount of bytes received from the server
- *\param bytes_per_sec the average data rate in bytes per seconds
- *\param net_status the session status
- */
-GF_Err gf_dm_sess_get_stats(GF_DownloadSession * sess, const char **server, const char **path, u32 *total_size, u32 *bytes_done, u32 *bytes_per_sec, u32 *net_status);
-
-
-/*!
- *\brief fetch session object
- *
- *Fetch the session object (process all headers and data transfer). This is only usable if the session is not threaded
- *\param sess the download session
- *\return the last error in the session or 0 if none*/
-GF_Err gf_dm_sess_process(GF_DownloadSession * sess);
-
-/*!
- *\brief Get session resource url
- *
- *Returns the original resource URL associated with the session
- *\param sess the download session
- *\return the associated URL*/
-const char *gf_dm_sess_get_resource_name(GF_DownloadSession *dnload);
-
-/*!
- *\brief Set session request range
- *
- *Sets the session range request
- *\param sess the download session
- *\param start start range of the request
- *\param end end range of the request
- *\return error code if any
- */
-GF_Err gf_dm_sess_set_range(GF_DownloadSession *sess, u32 start, u32 end);
-
-/*!
- *\brief Reset session
- *
- *Resets the session for new processing of the same url
- *\param sess the download session
- *\return error code if any
- */
-GF_Err gf_dm_sess_reset(GF_DownloadSession *sess);
-
-/*! @} */
+#include <gpac/cache.h>
+
+
+ /*!the download manager object. This is usually not used by GPAC modules*/
+ typedef struct __gf_download_manager GF_DownloadManager;
+ /*!the download manager session.*/
+ typedef struct __gf_download_session GF_DownloadSession;
+
+ typedef struct GF_URL_Info_Struct {
+ const char * protocol;
+ char * server_name;
+ char * remotePath;
+ char * canonicalRepresentation;
+ char * userName;
+ char * password;
+ u16 port;
+ } GF_URL_Info;
+
+ /*!
+ * Extracts the information from an URL. A call to gf_dm_url_info_init() must have been issue before calling this method.
+ * \param url The URL to fill
+ * \param info This structure will be initialized properly and filled with the data
+ * \param baseURL The baseURL to use if any (can be null)
+ * \return GF_OK if URL is well formed and supported by GPAC
+ */
+ GF_Err gf_dm_get_url_info(const char * url, GF_URL_Info * info, const char * baseURL);
+
+ /**
+ * Init the GF_URL_Info structure before it can be used
+ * \param info The structure to initialize
+ */
+ void gf_dm_url_info_init(GF_URL_Info * info);
+
+ /*!
+ * Frees the inner structures of a GF_URL_Info_Struct
+ * \param info The info to free
+ */
+ void gf_dm_url_info_del(GF_URL_Info * info);
+
+ /*!
+ *\brief download manager constructor
+ *
+ *Creates a new download manager object.
+ *\param cfg optional configuration file. Currently the download manager needs a configuration file for cache location and
+ *other options. The cache directory must be indicated in the section "General", key "CacheDirectory" of the configuration
+ *file. If the cache directory is not found, the cache will be disabled but the downloader will still work.
+ *\return the download manager object
+ */
+ GF_DownloadManager *gf_dm_new(GF_Config *cfg);
+ /*
+ *\brief download manager destructor
+ *
+ *Deletes the download manager. All running sessions are aborted
+ *\param dm the download manager object
+ */
+ void gf_dm_del(GF_DownloadManager *dm);
+
+ /*!
+ *\brief callback function for authentication
+ *
+ * The gf_dm_get_usr_pass type is the type for the callback of the \ref gf_dm_set_auth_callback function used for password retrieval
+ *\param usr_cbk opaque user data
+ *\param site_url url of the site the user and password are requested for
+ *\param usr_name the user name for this site. The allocated space for this buffer is 50 bytes. \note this varaibale may already be formatted.
+ *\param password the password for this site and user. The allocated space for this buffer is 50 bytes.
+ *\return 0 if user didn't fill in the information which will result in an authentication failure, 1 otherwise.
+ */
+ typedef Bool (*gf_dm_get_usr_pass)(void *usr_cbk, const char *site_url, char *usr_name, char *password);
+
+ /*!
+ *\brief password retrieval assignment
+ *
+ *Assigns the callback function used for user password retrieval. If no such function is assigned to the download manager,
+ *all downloads requiring authentication will fail.
+ *\param dm the download manager object
+ *\param get_pass \ref gf_dm_get_usr_pass callback function for user and password retrieval.
+ *\param usr_cbk opaque user data passed to callback function
+ */
+ void gf_dm_set_auth_callback(GF_DownloadManager *dm, gf_dm_get_usr_pass get_pass, void *usr_cbk);
+
+ /*!downloader session message types*/
+ enum
+ {
+ /*!signal that session is setup and waiting for connection request*/
+ GF_NETIO_SETUP = 0,
+ /*!signal that session connection is done*/
+ GF_NETIO_CONNECTED,
+ /*!request a protocol method from the user. Default value is "GET" for HTTP*/
+ GF_NETIO_GET_METHOD,
+ /*!request a header from the user. */
+ GF_NETIO_GET_HEADER,
+ /*!requesting content from the user, if any. Content is appended to the request*/
+ GF_NETIO_GET_CONTENT,
+ /*!signal that request is sent and waiting for server reply*/
+ GF_NETIO_WAIT_FOR_REPLY,
+ /*!signal a header to user. */
+ GF_NETIO_PARSE_HEADER,
+ /*!signal request reply to user. The reply is always sent after the headers*/
+ GF_NETIO_PARSE_REPLY,
+ /*!send data to the user*/
+ GF_NETIO_DATA_EXCHANGE,
+ /*!all data has been transfered*/
+ GF_NETIO_DATA_TRANSFERED,
+ /*!signal that the session has been deconnected*/
+ GF_NETIO_DISCONNECTED,
+ /*!downloader session failed (error code set) or done/destroyed (no error code)*/
+ GF_NETIO_STATE_ERROR
+ };
+
+ /*!session download flags*/
+ enum
+ {
+ /*!session is not threaded, the user must explicitely fetch the data */
+ GF_NETIO_SESSION_NOT_THREADED = 1,
+ /*!session has no cache: data will be sent to the user if threaded mode (live streams like radios & co)*/
+ GF_NETIO_SESSION_NOT_CACHED = 1<<1,
+ /*! ignores any data already in the cache */
+ GF_NETIO_SESSION_FORCE_NO_CACHE = 1<<2
+ };
+
+
+ /*!protocol I/O parameter*/
+ typedef struct
+ {
+ /*!parameter message type*/
+ u32 msg_type;
+ /*error code if any. Valid for all message types.*/
+ GF_Err error;
+ /*!data received or data to send. Only valid for GF_NETIO_GET_CONTENT and GF_NETIO_DATA_EXCHANGE (when no cache is setup) messages*/
+ const char *data;
+ /*!size of associated data. Only valid for GF_NETIO_GET_CONTENT and GF_NETIO_DATA_EXCHANGE messages*/
+ u32 size;
+ /*protocol header. Only valid for GF_NETIO_GET_HEADER, GF_NETIO_PARSE_HEADER and GF_NETIO_GET_METHOD*/
+ const char *name;
+ /*protocol header value or server response. Only alid for GF_NETIO_GET_HEADER, GF_NETIO_PARSE_HEADER and GF_NETIO_PARSE_REPLY*/
+ char *value;
+ /*response code - only valid for GF_NETIO_PARSE_REPLY*/
+ u32 reply;
+ } GF_NETIO_Parameter;
+
+ /*!
+ *\brief callback function for data reception and state signaling
+ *
+ * The gf_dm_user_io type is the type for the data callback function of a download session
+ *\param usr_cbk opaque user data
+ *\param parameter the input/output parameter structure
+ */
+ typedef void (*gf_dm_user_io)(void *usr_cbk, GF_NETIO_Parameter *parameter);
+
+
+
+ /*!
+ *\brief download session constructor
+ *
+ *Creates a new download session
+ *\param dm the download manager object
+ *\param url file to retrieve (no PUT/POST yet, only downloading is supported)
+ *\param dl_flags combination of session download flags
+ *\param user_io \ref gf_dm_user_io callback function for data reception and service messages
+ *\param usr_cbk opaque user data passed to callback function
+ *\param error error for failure cases
+ *\return the session object or NULL if error. If no error is indicated and a NULL session is returned, this means the file is local
+ */
+ GF_DownloadSession * gf_dm_sess_new(GF_DownloadManager *dm, const char *url, u32 dl_flags,
+ gf_dm_user_io user_io,
+ void *usr_cbk,
+ GF_Err *error);
+
+ /*!
+ *\brief download session simple constructor
+ *
+ *Creates a new download session
+ *\param url file to retrieve (no PUT/POST yet, only downloading is supported)
+ *\param dl_flags combination of session download flags
+ *\param user_io \ref gf_dm_user_io callback function for data reception and service messages
+ *\param usr_cbk opaque user data passed to callback function
+ *\param cache_name cache name
+ *\param error error for failure cases
+ *\return the session object or NULL if error. If no error is indicated and a NULL session is returned, this means the file is local
+ */
+ GF_DownloadSession *gf_dm_sess_new_simple(GF_DownloadManager * dm, const char *url, u32 dl_flags,
+ gf_dm_user_io user_io,
+ void *usr_cbk,
+ GF_Err *e);
+
+ /*!
+ *brief downloader session destructor
+ *
+ *Deletes the download session, cleaning the cache if indicated in the configuration file of the download manager (section "Downloader", key "CleanCache")
+ *\param sess the download session
+ */
+ void gf_dm_sess_del(GF_DownloadSession * sess);
+ /*!
+ *\brief aborts downloading
+ *
+ *Aborts all operations in the session, regardless of its state. The session cannot be reused once this is called.
+ *\param sess the download session
+ */
+ void gf_dm_sess_abort(GF_DownloadSession * sess);
+ /*!
+ *\brief sets private data
+ *
+ *associate private data with the session.
+ *\param sess the download session
+ *\param private_data the private data
+ *\warning the private_data parameter is reserved for bandwidth statistics per service when used in the GPAC terminal.
+ */
+ void gf_dm_sess_set_private(GF_DownloadSession * sess, void *private_data);
+
+ /*!
+ *\brief gets private data
+ *
+ *Gets private data associated with the session.
+ *\param sess the download session
+ *\return the private data
+ *\warning the private_data parameter is reserved for bandwidth statistics per service when used in the GPAC terminal.
+ */
+ void *gf_dm_sess_get_private(GF_DownloadSession * sess);
+
+ /*!
+ *\brief gets last session error
+ *
+ *Gets the last error that occured in the session
+ *\param sess the download session
+ *\return the last error
+ */
+ GF_Err gf_dm_sess_last_error(GF_DownloadSession *sess);
+
+ /*!
+ *\brief is download manager thread dead?
+ *
+ *Indicates whether the thread has ended
+ *\param sess the download session
+ */
+ Bool gf_dm_is_thread_dead(GF_DownloadSession *sess);
+
+ /*!
+ *\brief fetches data on session
+ *
+ *Fetches data from the server. This will also performs connections and all needed exchange with server.
+ *\param sess the download session
+ *\param buffer destination buffer
+ *\param buffer_size destination buffer allocated size
+ *\param read_size amount of data actually fetched
+ *\note this can only be used when the session is not threaded
+ */
+ GF_Err gf_dm_sess_fetch_data(GF_DownloadSession * sess, char *buffer, u32 buffer_size, u32 *read_size);
+
+ /*!
+ *\brief get mime type
+ *
+ *Fetches the mime type of the URL this session is fetching
+ *\param sess the download session
+ *\return the mime type of the URL, or NULL if error. You should get the error with \ref gf_dm_sess_last_error
+ */
+ const char *gf_dm_sess_mime_type(GF_DownloadSession * sess);
+ /*!
+ *\brief get cache file name
+ *
+ * Gets the cache file name for the session.
+ *\param sess the download session
+ *\return the absolute path of the cache file, or NULL if the session is not cached*/
+ const char *gf_dm_sess_get_cache_name(GF_DownloadSession * sess);
+
+ /*!
+ * \brief Marks the cache file to be deleted once the file is not used anymore by any session
+ * \param entry The cache entry to delete
+ */
+ void gf_dm_delete_cached_file_entry(const GF_DownloadManager * dm, const char * url);
+
+ /*!
+ * Convenience function
+ * \see gf_dm_delete_cached_file_entry
+ */
+ void gf_dm_delete_cached_file_entry_session(const GF_DownloadSession * dm, const char * url);
+
+ /*!
+ * Get a range of a cache entry file
+ * \param entry The session
+ * \param startOffset The first byte of the request to get
+ * \param endOffset The last byte of request to get
+ * \return The temporary name for the file created to have a range of the file
+ */
+ const char * gf_cache_get_cache_filename_range( const GF_DownloadSession * sess, u64 startOffset, u64 endOffset );
+
+ /*!
+ *\brief get statistics
+ *
+ *Gets download statistics for the session. All output parameters are optional and may be set to NULL.
+ *\param sess the download session
+ *\param server the remote server address
+ *\param path the path on the remote server
+ *\param total_size the total size in bytes the file fetched, 0 if unknown.
+ *\param bytes_done the amount of bytes received from the server
+ *\param bytes_per_sec the average data rate in bytes per seconds
+ *\param net_status the session status
+ */
+ GF_Err gf_dm_sess_get_stats(GF_DownloadSession * sess, const char **server, const char **path, u32 *total_size, u32 *bytes_done, u32 *bytes_per_sec, u32 *net_status);
+
+
+ /*!
+ *\brief fetch session object
+ *
+ *Fetch the session object (process all headers and data transfer). This is only usable if the session is not threaded
+ *\param sess the download session
+ *\return the last error in the session or 0 if none*/
+ GF_Err gf_dm_sess_process(GF_DownloadSession * sess);
+
+ /*!
+ *\brief Get session resource url
+ *
+ *Returns the original resource URL associated with the session
+ *\param sess the download session
+ *\return the associated URL
+ */
+ const char *gf_dm_sess_get_resource_name(GF_DownloadSession *dnload);
+
+ /*!
+ * \brief Download a file over the network using a download manager
+ * \param dm The downlaod manager to use, function will use all associated cache ressources
+ * \param url The url to download
+ * \param filename The filename to download
+ * \return GF_OK if everything went fine, an error otherwise
+ */
+ GF_Err gf_dm_wget_with_cache(GF_DownloadManager * dm,
+ const char *url, const char *filename);
+
+ /*!
+ * \brief Same as gf_dm_wget_with_cache, but initializes the GF_DownloadManager by itself.
+ * This function is deprecated, please use gf_dm_wget_with_cache instead
+ * \param url The url to download
+ * \param filename The filename to download
+ * \return GF_OK if everything went fine, an error otherwise
+ */
+ GF_Err gf_dm_wget(const char *url, const char *filename);
+
+ /*!
+ *\brief Reset session
+ *
+ *Resets the session for new processing of the same url
+ *\param sess the download session
+ *\return error code if any
+ */
+ GF_Err gf_dm_sess_reset(GF_DownloadSession *sess);
+
+ /*!
+ * \brief forces the refresh of a cache entry
+ * The entry is still allocated in the session.
+ * \param sess The session
+ * \return a pointer to the entry of session refreshed
+ */
+ DownloadedCacheEntry gf_dm_refresh_cache_entry(GF_DownloadSession *sess);
+
+ /*!
+ * Tells whether session can be cached on disk.
+ * Typically, when request has no content length, it deserves being streamed an cannot be cached
+ * (ICY or MPEG-streamed content
+ * \param sess The session
+ * \return True if a cache can be created
+ */
+ Bool gf_dm_sess_can_be_cached_on_disk(const GF_DownloadSession *sess);
+
+ /*! @} */
#ifdef __cplusplus
}
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / Events management
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/tools.h>
/*
- minimal event system
+ minimal event system
DO NOT CHANGE THEIR POSITION IN THE LIST, USED TO SPEED UP FILTERING OF USER INPUT EVENTS
*/
*******************************************************/
/*MouseEvents*/
- GF_EVENT_CLICK,
- GF_EVENT_MOUSEUP,
- GF_EVENT_MOUSEDOWN,
- GF_EVENT_MOUSEOVER,
- GF_EVENT_MOUSEOUT,
+ GF_EVENT_CLICK,
+ GF_EVENT_MOUSEUP,
+ GF_EVENT_MOUSEDOWN,
+ GF_EVENT_MOUSEOVER,
+ GF_EVENT_MOUSEOUT,
/*!! ALL MOUSE EVENTS SHALL BE DECLARED BEFORE MOUSEMOVE !! */
- GF_EVENT_MOUSEMOVE,
+ GF_EVENT_MOUSEMOVE,
/*mouse wheel event*/
GF_EVENT_MOUSEWHEEL,
/*DOM UIEvents*/
GF_EVENT_FOCUSIN,
- GF_EVENT_FOCUSOUT,
- GF_EVENT_ACTIVATE,
- GF_EVENT_CHANGE,
- GF_EVENT_FOCUS,
- GF_EVENT_BLUR,
+ GF_EVENT_FOCUSOUT,
+ GF_EVENT_ACTIVATE,
+ GF_EVENT_CHANGE,
+ GF_EVENT_FOCUS,
+ GF_EVENT_BLUR,
/*SVG (HTML) Events*/
- GF_EVENT_LOAD,
+ GF_EVENT_LOAD,
GF_EVENT_UNLOAD,
- GF_EVENT_ABORT,
- GF_EVENT_ERROR,
- GF_EVENT_RESIZE,
- GF_EVENT_SCROLL,
+ GF_EVENT_ABORT,
+ GF_EVENT_ERROR,
+ GF_EVENT_RESIZE,
+ GF_EVENT_SCROLL,
GF_EVENT_ZOOM,
GF_EVENT_BEGIN, /*this is a fake event, it is NEVER fired, only used in SMIL begin*/
GF_EVENT_BEGIN_EVENT,
/*scene attached event, dispatched when the root node of a scene is loaded and
attached to the window or parent object (animation, inline, ...)*/
GF_EVENT_SCENE_ATTACHED,
-
+
/*VP resize attached event, dispatched when viewport of a scene is being modified
attached to the window or parent object (animation, inline, ...)*/
GF_EVENT_VP_RESIZE,
-
+
/*window events*/
- /*size has changed - indicate new w & h in .x end .y fields of event.
+ /*size has changed - indicate new w & h in .x end .y fields of event.
When sent from gpac to a video plugin, indicates the output size should be changed. This is only sent when the plugin
manages the output video himself
When sent from a video plugin to gpac, indicates the output size has been changed. This is only sent when the plugin
manages the output video himself
*/
- GF_EVENT_SIZE,
+ GF_EVENT_SIZE,
/*signals the scene size (if indicated in scene) upon connection (sent to the user event proc only)
if scene size hasn't changed (seeking or other) this event is not sent
*/
- GF_EVENT_SCENE_SIZE,
+ GF_EVENT_SCENE_SIZE,
GF_EVENT_SHOWHIDE, /*window show/hide (minimized or other). This is also sent to the user to signal focus switch in fullscreen*/
GF_EVENT_SET_CURSOR, /*set mouse cursor*/
GF_EVENT_SET_CAPTION, /*set window caption*/
/*video hw setup message:
- when sent from gpac to plugin, indicates that the plugin should re-setup hardware context due to a window resize:
* for 2D output, this means resizing the backbuffer if needed (depending on HW constraints)
- * for 3D output, this means re-setup of OpenGL context (depending on HW constraints). Depending on windowing systems
+ * for 3D output, this means re-setup of OpenGL context (depending on HW constraints). Depending on windowing systems
and implementations, it could be possible to resize a window without destroying the GL context.
- when sent from plugin to gpac, indicates that hardware resources must be resetup before next render step (this is mainly
due to discard all openGL textures and cached objects)
*/
GF_EVENT_VIDEO_SETUP,
+ /*queries the list of system colors - only exchanged between compositor and video output*/
+ GF_EVENT_SYS_COLORS,
+
+ /*indicates some text has been pasted - from video output to compositor only*/
+ GF_EVENT_PASTE_TEXT,
+ /*queries for text to be copied - from video output to compositor only*/
+ GF_EVENT_COPY_TEXT,
/*terminal events*/
GF_EVENT_CONNECT, /*signal URL is connected*/
GF_EVENT_METADATA, /*indicates a change in associated metadata*/
GF_EVENT_MIGRATE, /*indicates a session migration request*/
GF_EVENT_DISCONNECT, /*indicates the current url should be disconnected*/
- GF_EVENT_SYS_COLORS, /*queries the list of system colors*/
GF_EVENT_RESOLUTION, /*indicates the screen resolution has changed*/
+
+ /* Events for Keyboad */
+ GF_EVENT_TEXT_EDITING_START,
+ GF_EVENT_TEXT_EDITING_END
};
/*GPAC/DOM3 key codes*/
enum {
- GF_KEY_UNIDENTIFIED = 0,
+ GF_KEY_UNIDENTIFIED = 0,
GF_KEY_ACCEPT = 1, /* "Accept" The Accept (Commit) key.*/
GF_KEY_AGAIN, /* "Again" The Again key.*/
GF_KEY_ALLCANDIDATES, /* "AllCandidates" The All Candidates key.*/
GF_KEY_EURO, /*"U+20AC" The Euro Currency Sign key (�).*/
GF_KEY_DEADVOICESOUND, /*"U+3099" The Combining Katakana-Hiragana Voiced Sound Mark (Dead Voiced Sound) key.*/
GF_KEY_DEADSEMIVOICESOUND, /*"U+309A" The Combining Katakana-Hiragana Semi-Voiced Sound Mark (Dead Semivoiced Sound) key. */
+ /* STB */
+ GF_KEY_CHANNELUP, /*ChannelUp*/
+ GF_KEY_CHANNELDOWN, /*ChannelDown*/
+ GF_KEY_TEXT, /*Text*/
+ GF_KEY_INFO, /*Info*/
+ GF_KEY_EPG, /*EPG*/
+ GF_KEY_RECORD, /*Record*/
+ GF_KEY_BEGINPAGE, /*BeginPage*/
+ /* end STB */
/*non-dom keys, used in LASeR*/
GF_KEY_CELL_SOFT1, /*soft1 key of cell phones*/
GF_KEY_CELL_SOFT2, /*soft2 key of cell phones*/
-
+
/*for joystick handling*/
GF_KEY_JOYSTICK
};
enum
{
GF_CURSOR_NORMAL = 0x00,
- GF_CURSOR_ANCHOR,
+ GF_CURSOR_ANCHOR,
GF_CURSOR_TOUCH,
/*discSensor, cylinderSensor, sphereSensor*/
- GF_CURSOR_ROTATE,
+ GF_CURSOR_ROTATE,
/*proximitySensor & proximitySensor2D*/
- GF_CURSOR_PROXIMITY,
+ GF_CURSOR_PROXIMITY,
/*planeSensor & planeSensor2D*/
GF_CURSOR_PLANE,
/*collision*/
- GF_CURSOR_COLLIDE,
- GF_CURSOR_HIDE,
+ GF_CURSOR_COLLIDE,
+ GF_CURSOR_HIDE,
};
/*event proc return value: ignored*/
For import events, no units defined (depends on importers)
*/
u32 done, total;
+ /* for download events */
+ u32 bytes_per_seconds;
} GF_EventProgress;
/*event proc return value: ignored*/
/*GF_EVENT_SYS_COLORS*/
u8 type;
/*ARGB colors, in order:
- ActiveBorder, ActiveCaption, AppWorkspace, Background, ButtonFace, ButtonHighlight, ButtonShadow,
- ButtonText, CaptionText, GrayText, Highlight, HighlightText, InactiveBorder, InactiveCaption,
- InactiveCaptionText, InfoBackground, InfoText, Menu, MenuText, Scrollbar, ThreeDDarkShadow,
+ ActiveBorder, ActiveCaption, AppWorkspace, Background, ButtonFace, ButtonHighlight, ButtonShadow,
+ ButtonText, CaptionText, GrayText, Highlight, HighlightText, InactiveBorder, InactiveCaption,
+ InactiveCaptionText, InfoBackground, InfoText, Menu, MenuText, Scrollbar, ThreeDDarkShadow,
ThreeDFace, ThreeDHighlight, ThreeDLightShadow, ThreeDShadow, Window, WindowFrame, WindowText
*/
u32 sys_colors[28];
SFRotation start_ori, end_ori;
Fixed start_fov, end_fov;
/*for 2D cameras we never animate except for vp reset*/
- Fixed start_zoom;
+ Fixed start_zoom, end_zoom;
SFVec2f start_trans, start_rot;
/*center of examine movement*/
/*frustrum bounding sphere (for sphere-sphere frustum intersection checks)*/
SFVec3f center;
Fixed radius;
+
+ GF_BBox world_bbox;
} GF_Camera;
/*invalidate camera to force recompute of all params*/
void camera_invalidate(GF_Camera *cam);
/*updates camera. user transform is only used in 2D to set global user zoom/pan/translate*/
-void camera_update(GF_Camera *cam, GF_Matrix2D *user_transform, Bool center_coords);
+void camera_update(GF_Camera *cam, GF_Matrix2D *user_transform, Bool center_coords, Fixed horizontal_shift, Fixed viewing_distance, Fixed view_distance_offset, u32 camera_layout);
/*reset to last viewport*/
void camera_reset_viewpoint(GF_Camera *cam, Bool animate);
/*move camera to given vp*/
SFVec3f camera_get_pos_dir(GF_Camera *cam);
SFVec3f camera_get_target_dir(GF_Camera *cam);
SFVec3f camera_get_right_dir(GF_Camera *cam);
+void camera_set_2d(GF_Camera *cam);
#endif
#ifndef _COMPOSITOR_DEV_H_
#define _COMPOSITOR_DEV_H_
-
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <gpac/compositor.h>
/*include scene graph API*/
#include <gpac/internal/camera.h>
#include <gpac/internal/mesh.h>
-#ifdef WIN32
-#include <windows.h>
-typedef void (APIENTRY * PFNGLARBMULTITEXTUREPROC)(unsigned int target);
-#else
-typedef void (*PFNGLARBMULTITEXTUREPROC) (unsigned int target);
-#endif
-
typedef struct
{
Bool multisample;
Bool abgr_texture;
Bool npot_texture;
Bool rect_texture;
+ Bool point_sprite;
+ Bool vbo;
u32 yuv_texture;
- PFNGLARBMULTITEXTUREPROC glActiveTextureARB;
- PFNGLARBMULTITEXTUREPROC glClientActiveTextureARB;
} GLCaps;
#endif
/*simulation frame rate*/
Double frame_rate;
+ Bool no_regulation;
u32 frame_duration;
u32 frame_time[GF_SR_FPS_COMPUTE_SIZE];
u32 current_frame;
+ u32 last_frame_time, caret_next_draw_time;
+ Bool show_caret;
+ Bool text_edit_changed;
u32 last_click_time;
Bool is_hidden, freeze_display;
Bool debug_defer;
+ Bool disable_composite_blit, disable_hardware_blit, rebuild_offscreen_textures;
+
/*current frame number*/
u32 frame_number;
/*count number of initialized sensors*/
/*list of VRML sensors active after the picking phase*/
GF_List *sensors;
/*indicates a sensor is currently active*/
- Bool grabbed_sensor;
+ u32 grabbed_sensor;
/*current keynav node if any*/
GF_Node *keynav_node;
/*screen buffer for direct access*/
GF_VideoSurface hw_surface;
/*output buffer is configured in video memory*/
- Bool video_memory;
+ Bool video_memory, request_video_memory;
/*indicate if overlays were prezsent in the previous frame*/
Bool last_had_overlays;
GF_RasterCallback raster_callbacks;
struct _drawable *focus_highlight;
/*highlight fill and stroke colors (ARGB)*/
u32 highlight_fill, highlight_stroke;
+ Fixed highlight_stroke_width;
/*picking info*/
u8 *selected_text;
/*text selection color - reverse video not yet supported*/
u32 text_sel_color;
+ s32 picked_glyph_idx, picked_span_idx;
/*set whenever the focus node is a text node*/
u32 focus_text_type;
/*YUV textures in OpenGL are disabled (soft YUV->RGB )*/
Bool disable_yuvgl;
+ u32 default_navigation_mode;
+
/*unit box (1.0 size) and unit sphere (1.0 radius)*/
GF_Mesh *unit_bbox;
void *tgl_ctx;
#endif
+ Float depth_gl_scale, depth_gl_strips_filter;
+ /*0: none - 1: point-based, 2: elevation grid*/
+ u32 depth_gl_type;
+ /*increase/decrease the standard interoccular offset by the specified distance in cm*/
+ Fixed interoccular_offset;
+ /*increase/decrease the view distance by the specified distance in cm*/
+ Fixed view_distance_offset;
+
#endif
u32 networks_time;
/*display depth in pixels - if -1, it is the height of the display area*/
s32 display_depth;
#endif
-
};
/*texture is SVG (needs special treatment in OpenGL)*/
GF_SR_TEXTURE_SVG = (1<<5),
+
+ /*special flag indicating the underlying media directly handled by the hardware (decoding and composition)*/
+ GF_SR_TEXTURE_PRIVATE_MEDIA = (1<<6),
};
typedef struct _gf_sc_texture_handler
Bool (*IsEnabled)(GF_Node *node);
/*user input on sensor:
is_over: pointing device is over a shape the sensor is attached to
+ is_cancel: the sensor state has been canceled due to another sensor. This typically happens following "click" events in SVG
+ which do not consume the mousedown but consumes the mouseup
evt_type: mouse event type
compositor: pointer to compositor - hit info is stored at compositor level
+ return: was the event consumed ?
*/
- void (*OnUserEvent)(struct _sensor_handler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor);
+ Bool (*OnUserEvent)(struct _sensor_handler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor);
+ Bool grabbed;
/*pointer to the sensor node*/
GF_Node *sensor;
} GF_SensorHandler;
Bool in_svg_filter;
+ u32 subscene_not_over;
+
#ifndef GPAC_DISABLE_3D
/*the current camera*/
GF_Camera *camera;
void compositor_2d_init_callbacks(GF_Compositor *compositor);
GF_Rect compositor_2d_update_clipper(GF_TraverseState *tr_state, GF_Rect this_clip, Bool *need_restore, GF_Rect *original, Bool for_layer);
+Bool compositor_texture_rectangles(GF_VisualManager *visual, GF_TextureHandler *txh, GF_IRect *clip, GF_Rect *unclip, GF_Window *src, GF_Window *dst, Bool *disable_blit, Bool *has_scale);
+
Bool compositor_get_2d_plane_intersection(GF_Ray *ray, SFVec3f *res);
void compositor_send_resize_event(GF_Compositor *compositor, GF_SceneGraph *subscene, Fixed old_z, Fixed old_tx, Fixed old_ty, Bool is_resize);
void gf_sc_load_opengl_extensions(GF_Compositor *sr);
+Bool gf_sc_fit_world_to_screen(GF_Compositor *compositor);
+
#endif
Bool gf_sc_exec_event(GF_Compositor *sr, GF_Event *evt);
void gf_sc_change_key_navigator(GF_Compositor *sr, GF_Node *n);
GF_Node *gf_scene_get_keynav(GF_SceneGraph *sg, GF_Node *sensor);
const char *gf_scene_get_service_url(GF_SceneGraph *sg);
-Bool gf_scene_lock(GF_SceneGraph *sg, Bool do_lock);
+
+
+Bool gf_scene_is_over(GF_SceneGraph *sg);
#ifndef GPAC_DISABLE_SVG
to async restart of animation nodes*/
GF_Node *compositor_svg_get_xlink_resource_node(GF_Node *node, XMLRI *xlink);
+GF_SceneGraph *gf_sc_animation_get_scenegraph(GF_Node *node);
+
#endif
/*Text handling*/
+/*we identify the edit caret in a text string as this value*/
+#define GF_CARET_CHAR 0x1
+
typedef struct _gf_font GF_Font;
struct _gf_font
GF_Font *gf_compositor_svg_set_font(GF_FontManager *fm, char *a_font, u32 styles, Bool check_only);
-
-u32 gf_sc_focus_switch_ring(GF_Compositor *compositor, Bool move_prev);
+/*switches focus node:
+@compositor: compositor
+@move_prev: finds previous focus rather than next
+@focus: new focus if force_focus_type is set
+@force_focus_type: 0: focus not forced, 1: focus forced to focus, 2: focus forced to prev/next focusable child of focus node*/
+u32 gf_sc_focus_switch_ring(GF_Compositor *compositor, Bool move_prev, GF_Node *focus, u32 force_focus_type);
Bool compositor_handle_navigation(GF_Compositor *compositor, GF_Event *ev);
GF_Err gf_sc_add_audio_listener(GF_Compositor *compositor, GF_AudioListener *al);
GF_Err gf_sc_remove_audio_listener(GF_Compositor *compositor, GF_AudioListener *al);
+#ifdef __cplusplus
+}
+#endif
#endif /*_COMPOSITOR_DEV_H_*/
u32 u32_rx_udp_port; /* destination port */
u32 u32_udp_data_size;
u32 u32_udp_chksm;
- GF_Socket *sock; /* socket of the */
-
}GF_M2TS_IP_Packet;
void gf_m2ts_process_mpe(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_MPE *mpe, unsigned char *data, u32 data_size, u8 table_id);
void gf_m2ts_gather_ipdatagram_information(MPE_FEC_FRAME *mff,GF_M2TS_Demuxer *ts);
-void socket_simu(GF_M2TS_IP_Packet *ip_packet, GF_M2TS_Demuxer *ts);
+void socket_simu(GF_M2TS_IP_Packet *ip_packet, GF_M2TS_Demuxer *ts, Bool yield);
+void gf_m2ts_mpe_send_datagram(GF_M2TS_Demuxer *ts, u32 pid, unsigned char *data, u32 data_size);
/* allocate the necessary memory space*/
u32 init_frame(MPE_FEC_FRAME * mff, u32 rows);
/*macros for RTSP command and response formmating*/
#define RTSP_WRITE_STEPALLOC 250
-#define RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, str) \
- if (str) { \
- if (strlen((const char *) str)+pos >= buf_size) { \
- buf_size += RTSP_WRITE_STEPALLOC; \
- buf = (char *) gf_realloc(buf, buf_size); \
- } \
- strcpy(buf+pos, (const char *) str); \
- pos += strlen((const char *) str); \
- }\
+#define RTSP_WRITE_ALLOC_STR_WITHOUT_CHECK(buf, buf_size, pos, str) \
+ if (strlen(str)+pos >= buf_size) { \
+ buf_size += RTSP_WRITE_STEPALLOC; \
+ buf = (char *) gf_realloc(buf, buf_size); \
+ } \
+ strcpy(buf+pos, (const char *) str); \
+ pos += strlen((const char *) str); \
+#define RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, str) \
+ if (str){ \
+ RTSP_WRITE_ALLOC_STR_WITHOUT_CHECK(buf, buf_size, pos, str); \
+ } \
+
#define RTSP_WRITE_HEADER(buf, buf_size, pos, type, str) \
- if (str) { \
- RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, type); \
- RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, ": "); \
- RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, str); \
- RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, "\r\n"); \
- } \
+ if( str ) { \
+ RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, type); \
+ RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, ": "); \
+ RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, str); \
+ RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, "\r\n"); \
+ } \
#define RTSP_WRITE_INT(buf, buf_size, pos, d, sig) \
- if (sig) { \
+ if (sig < 0) { \
sprintf(temp, "%d", d); \
} else { \
- sprintf(temp, "%u", d); \
+ sprintf(temp, "%ud", d); \
} \
- RTSP_WRITE_ALLOC_STR(buf, buf_size, pos, temp);
+ RTSP_WRITE_ALLOC_STR_WITHOUT_CHECK(buf, buf_size, pos, temp);
+
+#define RTSP_WRITE_FLOAT_WITHOUT_CHECK(buf, buf_size, pos, d) \
+ sprintf(temp, "%.4f", d); \
+ RTSP_WRITE_ALLOC_STR_WITHOUT_CHECK(buf, buf_size, pos, temp);
#define RTSP_WRITE_FLOAT(buf, buf_size, pos, d) \
sprintf(temp, "%.4f", d); \
GF_ISOM_BOX_TYPE_AC3 = GF_4CC( 'a', 'c', '-', '3' ),
GF_ISOM_BOX_TYPE_DAC3 = GF_4CC( 'd', 'a', 'c', '3' ),
+ GF_ISOM_BOX_TYPE_SUBS = GF_4CC( 's', 'u', 'b', 's' ),
+
/*ALL INTERNAL BOXES - NEVER WRITTEN TO FILE!!*/
/*generic handlers*/
} GF_SampleDependencyTypeBox;
+typedef struct
+{
+ u32 sample_delta;
+ GF_List *SubSamples;
+} GF_SampleEntry;
+
+typedef struct
+{
+ u32 subsample_size;
+ u8 subsample_priority;
+ u8 discardable;
+ u32 reserved;
+} GF_SubSampleEntry;
+
+typedef struct
+{
+ GF_ISOM_FULL_BOX
+ GF_List *Samples;
+} GF_SubSampleInformationBox;
+
+u32 gf_isom_sample_get_subsample_entry(GF_ISOFile *movie, u32 track, u32 sampleNumber, GF_SampleEntry **sub_sample);
+#ifndef GPAC_DISABLE_ISOM_WRITE
+GF_Err gf_isom_add_subsample_info(GF_SubSampleInformationBox *sub_samples, u32 sampleNumber, u32 subSampleSize, u32 priority, Bool discardable);
+#endif
+
typedef struct
{
GF_ISOM_BOX
GF_SampleDependencyTypeBox *SampleDep;
GF_SampleFragmentBox *Fragments;
+ GF_SubSampleInformationBox *SubSamples;
+
u32 MaxSamplePerChunk;
u16 groupID;
u16 trackPriority;
/*keep a pointer to default flags*/
GF_TrackExtendsBox *trex;
GF_SampleDependencyTypeBox *sdtp;
+ GF_SubSampleInformationBox *subs;
/*when data caching is on*/
u32 DataCache;
GF_Box *tfad;
{
GF_ISOM_FULL_BOX
- u32 reference_track_ID;
- u32 nb_track_times;
- GF_SIDXTrackTimes *tracks_times;
+ u32 reference_ID;
+ u32 timescale;
+ u64 earliest_presentation_time;
+ u64 first_offset;
u32 nb_refs;
GF_SIDXReference *refs;
} GF_SegmentIndexBox;
GF_List *moof_list;
Bool use_segments, moof_first;
+
+ Bool is_index_segment;
#endif
/*this contains ALL the root boxes excepts fragments*/
void AVC_RewriteESDescriptor(GF_MPEGVisualSampleEntryBox *avc);
GF_Err reftype_AddRefTrack(GF_TrackReferenceTypeBox *ref, u32 trackID, u16 *outRefIndex);
+GF_XMLBox *gf_isom_get_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, Bool *is_binary);
#ifndef GPAC_DISABLE_ISOM_HINTING
GF_Err sidx_Size(GF_Box *s);
GF_Err sidx_dump(GF_Box *a, FILE * trace);
+GF_Box *subs_New();
+void subs_del(GF_Box *);
+GF_Err subs_Write(GF_Box *s, GF_BitStream *bs);
+GF_Err subs_Size(GF_Box *s);
+GF_Err subs_Read(GF_Box *s, GF_BitStream *bs);
+GF_Err subs_dump(GF_Box *a, FILE * trace);
#endif /*GPAC_DISABLE_ISOM*/
--- /dev/null
+/**\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) Jean Le Feuvre 2000-2005\r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ * Written by Pierre Souchay for VizionR SAS\r
+ *\r
+ */\r
+#ifndef M3U8_PLAYLIST_H\r
+#define M3U8_PLAYLIST_H\r
+#include <gpac/tools.h>\r
+#include <gpac/list.h>\r
+\r
+/**\r
+ * Global Structure\r
+ *\r
+ * For a stream with multiple bandwidths and multiple programs\r
+ *\r
+ * VariantPlayList\r
+ * |\r
+ * |_ program id 1\r
+ * | |\r
+ * | |_ bandwidth X : playlistElement1\r
+ * | |- bandwidth Y : playlistElement2\r
+ * |\r
+ * |- program id 2\r
+ * |\r
+ * |_ bandwidth Z : playlistElement\r
+ *\r
+ * For a "normal" playlist\r
+ *\r
+ * VariantPlayList\r
+ * |\r
+ * |_ program id 1\r
+ * |\r
+ * |_ bandwidth 0 : playlistElement1\r
+ *\r
+ * Where PlaylistElement can be :\r
+ * - a stream (real resource)\r
+ * - a playlist (list of PlaylistElements itself)\r
+ */\r
+\r
+#define M3U8_UNKOWN_MIME_TYPE "unknown"\r
+\r
+/**\r
+ * Basic Stream structure\r
+ */\r
+typedef struct s_stream {\r
+ u8 i;\r
+} Stream;\r
+\r
+/**\r
+ * The playlist contains a list of elements to play\r
+ */\r
+typedef struct s_playList {\r
+ int currentMediaSequence;\r
+ int target_duration;\r
+ int mediaSequenceMin;\r
+ int mediaSequenceMax;\r
+ char is_ended;\r
+ GF_List * elements;\r
+} Playlist;\r
+\r
+typedef enum e_playlistElementType { TYPE_PLAYLIST, TYPE_STREAM, TYPE_UNKNOWN} PlaylistElementType;\r
+\r
+/**\r
+ * The Structure containing the playlist element\r
+ */\r
+typedef struct s_playlistElement {\r
+ int durationInfo;\r
+ int bandwidth;\r
+ char * title;\r
+ char * codecs;\r
+ char * url;\r
+ PlaylistElementType elementType;\r
+ union { Playlist playlist;\r
+ Stream stream;\r
+ } element;\r
+\r
+} PlaylistElement;\r
+\r
+typedef struct s_program {\r
+ int programId;\r
+ GF_List * bitrates;\r
+ int currentBitrateIndex;\r
+} Program;\r
+\r
+\r
+/**\r
+ * The root playlist, can contains several PlaylistElements structures\r
+ */\r
+typedef struct s_variantPlaylist {\r
+ GF_List * programs;\r
+ int currentProgram;\r
+ Bool playlistNeedsRefresh;\r
+} VariantPlaylist;\r
+\r
+/**\r
+ * Creates a new playlist\r
+ * @return NULL if playlist could not be allocated\r
+ *\r
+Playlist * playlist_new();\r
+*/\r
+/**\r
+ * Deletes a given playlist and all of its sub elements\r
+ *\r
+GF_Err playlist_del(Playlist *);\r
+*/\r
+\r
+/**\r
+ * Deletes an Playlist element\r
+ */\r
+GF_Err playlist_element_del(PlaylistElement *);\r
+\r
+/**\r
+ * Creates a new program properly initialized\r
+ */\r
+Program * program_new(int programId);\r
+\r
+/**\r
+ * Deletes the specified program\r
+ */\r
+GF_Err program_del(Program * program);\r
+\r
+/**\r
+ * Creates an Playlist element.\r
+ * This element can be either a playlist of a stream according to first parameter.\r
+ * @return NULL if element could not be created. Element deletion will be deleted recusivly by #playlist_del(Playlist*)\r
+ */\r
+PlaylistElement * playlist_element_new(PlaylistElementType elementType, const char * url, const char * title, const char *codecs, int durationInfo);\r
+\r
+/**\r
+ * Creates a new VariantPlaylist\r
+ * @return NULL if VariantPlaylist element could not be allocated\r
+ */\r
+VariantPlaylist * variant_playlist_new ();\r
+\r
+/**\r
+ * Deletes the given VariantPlaylist and all of its sub elements\r
+ */\r
+GF_Err variant_playlist_del(VariantPlaylist *);\r
+\r
+GF_Err playlist_element_dump(const PlaylistElement * e, int indent);\r
+\r
+GF_Err variant_playlist_dump(const VariantPlaylist *);\r
+\r
+Program * variant_playlist_find_matching_program(const VariantPlaylist *, const u32 programId);\r
+\r
+Program * variant_playlist_get_current_program(const VariantPlaylist *);\r
+\r
+\r
+\r
+/**\r
+ * Parse the given playlist file\r
+ * @param file The file from cache to parse\r
+ * @param The playlist to fill. If argument is null, and file is valid, playlist will be allocated\r
+ * @return GF_OK if playlist valid\r
+ */\r
+GF_Err parse_root_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL);\r
+/**\r
+ * Parse the given playlist file as a subplaylist of an existing playlist\r
+ * @param file The file from cache to parse\r
+ * @param The playlist to fill.\r
+ * @param baseURL base URL of the playlist\r
+ * @param program in which the playlist is parsed\r
+ * @param sub_playlist existing subplaylist element in the @playlist in which the playlist is parsed\r
+ * @return GF_OK if playlist valid\r
+ */\r
+GF_Err parse_sub_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL, Program * in_program, PlaylistElement *sub_playlist);\r
+\r
+#endif /* M3U8_PLAYLIST_H */\r
+\r
#ifndef GPAC_DISABLE_AV_PARSERS
+
+#define GF_SVC_SSPS_ID_SHIFT 16
+
/*returns 0 if not a start code, or size of start code (3 or 4 bytes). If start code, bitstream
is positionned AFTER start code*/
u32 AVC_IsStartCode(GF_BitStream *bs);
{
u8 cpb_removal_delay_length_minus1;
u8 dpb_output_delay_length_minus1;
+ u8 time_offset_length;
/*to be eventually completed by other hrd members*/
} AVC_HRD;
/*used to discard repeated SPSs - 0: not parsed, 1 parsed, 2 sent*/
u32 state;
+
+ /*for SVC stats during import*/
+ u32 nb_ei, nb_ep, nb_eb;
} AVC_SPS;
typedef struct
typedef struct
{
- s32 temporal_id;
s32 idr_pic_flag;
+ u8 temporal_id, priority_id, dependency_id, quality_id;
} SVC_NALUHeader;
typedef struct
#endif
} GF_Vertex;
+/*memory offset in bytes from start of vertex to texcoords = 3 * 4bytes*/
+#define MESH_TEX_OFFSET 12
+/*memory offset in bytes from start of vertex to normal = 5 * 4bytes*/
+#define MESH_NORMAL_OFFSET 20
+/*memory offset in bytes from start of vertex to color - platform dependent*/
+#ifdef MESH_USE_FIXED_NORMAL
+/*3+2+3 * 4*/
+#define MESH_COLOR_OFFSET 32
+#else
+/*3+2 * 4 + 4 (3 + 1 byte alignment)*/
+#define MESH_COLOR_OFFSET 24
+#endif
+
/*mesh type used*/
enum
{
/*triangle indexes used in AABB tree - order may be different than the one in mesh->indices*/
IDX_TYPE *aabb_indices;
// u32 aabb_nb_index;
+
+ u32 vbo;
} GF_Mesh;
GF_Mesh *new_mesh();
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Authors: Cyril Concolato\r
+ * Copyright (c) Telecom ParisTech 2010-\r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / 3GPP/MPEG Media Presentation Description input module\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ * \r
+ */\r
+#ifndef _MPD_IN_H_\r
+#define _MPD_IN_H_\r
+\r
+#include <gpac/constants.h>\r
+#include <gpac/xml.h>\r
+#include <gpac/media_tools.h>\r
+#include <gpac/internal/terminal_dev.h>\r
+\r
+typedef struct\r
+{\r
+ char *url;\r
+ Bool use_byterange;\r
+ u32 byterange_start;\r
+ u32 byterange_end;\r
+} GF_MPD_SegmentInfo;\r
+\r
+typedef struct {\r
+ char *id;\r
+ u32 bandwidth;\r
+ u32 width;\r
+ u32 height;\r
+ char *lang;\r
+ char *mime;\r
+ u32 groupID;\r
+ Bool startWithRap;\r
+ /* TODO: maximumRAPPeriod */\r
+ /* TODO: depid*/\r
+ /* TODO: default rep*/\r
+\r
+ u32 qualityRanking;\r
+ char *content_protection_type;\r
+ char *content_protection_uri;\r
+ double alternatePlayoutRate;\r
+ u32 default_segment_duration;\r
+ /*TODO: multiple views */\r
+ char *default_base_url;\r
+\r
+ /* initialization segment */\r
+ char *init_url;\r
+ Bool init_use_range;\r
+ u32 init_byterange_start;\r
+ u32 init_byterange_end;\r
+ \r
+ /* other segments */\r
+ char *url_template;\r
+ u32 startIndex;\r
+ u32 endIndex;\r
+\r
+ GF_List *segments;\r
+} GF_MPD_Representation;\r
+\r
+typedef struct {\r
+ u32 start; /* expressed in seconds, relative to the start of the MPD */\r
+ u32 duration; /* TODO */\r
+ char *id; /* TODO */\r
+ u8 flags;\r
+ Bool segment_alignment_flag; /* to be merged into real flags */\r
+ Bool bitstream_switching_flag;\r
+\r
+ u32 default_segment_duration; /* milliseconds */\r
+ char *default_base_url;\r
+ /* TODO: default timeline */\r
+ char *url_template;\r
+\r
+ /* TODO: xlink:href & xlink:actuate */\r
+\r
+ GF_List *representations;\r
+ /* TODO: representation groups */\r
+ /* TODO: subset */\r
+} GF_MPD_Period;\r
+\r
+typedef enum {\r
+ GF_MPD_TYPE_ON_DEMAND,\r
+ GF_MPD_TYPE_LIVE,\r
+} GF_MPD_Type;\r
+\r
+typedef struct {\r
+ GF_MPD_Type type;\r
+ char *base_url;\r
+ /* TODO: add alternate URL */\r
+ u32 duration; /* expressed in milliseconds */\r
+ u32 min_update_time; /* expressed in milliseconds */\r
+ u32 min_buffer_time; /* expressed in milliseconds */\r
+ /*start time*/\r
+ /*end time*/\r
+ u32 time_shift_buffer_depth; /* expressed in milliseconds */\r
+ char *title;\r
+ char *source;\r
+ char *copyright;\r
+ char *more_info_url;\r
+\r
+ /* the number of periods is dynamic since we may update the MPD from time to time, cannot avoid GF_List */\r
+ GF_List *periods;\r
+} GF_MPD;\r
+\r
+GF_Err gf_mpd_init_from_dom(GF_XMLNode *root, GF_MPD *mpd);\r
+\r
+GF_MPD *gf_mpd_new();\r
+void gf_mpd_del(GF_MPD *mpd);\r
+\r
+GF_Err gf_m3u8_to_mpd(GF_ClientService *service, const char *m3u8_file, const char *base_url, \r
+ const char *mpd_file,\r
+ u32 reload_count, char *mimeTypeForM3U8Segments);\r
+\r
+#endif // _MPD_IN_H_\r
+\r
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / MPEG-4 ObjectDescriptor sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _GF_OD_PARSE_COMMON_H_
+#define _GF_OD_PARSE_COMMON_H_
+#include <gpac/setup.h>
+
+#define GET_U8(field) { u32 d; if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u8) d; } else { ret += sscanf(val, "%u", &d); if (ret) field = (u8) d; } }
+#define GET_U16(field) { u16 d; if (strstr(val, "0x")) { ret += sscanf(val, "%hx", &d); if (ret) field = d; } else { ret += sscanf(val, "%hu", &d); if (ret) field = d; } }
+#define GET_S16(field) { s16 d; if (strstr(val, "0x")) { ret += sscanf(val, "%hx", (u16*)&d); if (ret) field = d; } else { ret += sscanf(val, "%hd", &d); if (ret) field = d; } }
+#define GET_U32(field) { u32 d; if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = d; } else { ret += sscanf(val, "%ud", &d); if (ret) field = d; } }
+#define GET_S32(field) { s32 d; if (strstr(val, "0x")) { ret += sscanf(val, "%x", (u32*)&d); if (ret) field = d; } else { ret += sscanf(val, "%d", &d); if (ret) field = d; } }
+#define GET_BOOL(field) { ret = 1; field = (!stricmp(val, "true") || !stricmp(val, "1")) ? 1 : 0; }
+#define GET_U64(field) { u64 d; if (strstr(val, "0x")) { ret += sscanf(val, LLX, &d); if (ret) field = d; } else { ret += sscanf(val, LLU, &d); if (ret) field = d; } }
+
+#define GET_DOUBLE(field) { Float v; ret = 1; sscanf(val, "%f", &v); field = (Double) v;}
+#define GET_STRING(field) { ret = 1; field = gf_strdup(val); if (val[0] == '"') strcpy(field, val+1); if (field[strlen(field)-1] == '"') field[strlen(field)-1] = 0; }
+
+
+#endif /* _GF_OD_PARSE_COMMON_H_ */
+
#include <gpac/scenegraph_svg.h>
+#include <gpac/thread.h>
+
#ifdef __cplusplus
extern "C" {
#endif
Bool abort_bubbling;
+ GF_Mutex *dom_evt_mx;
GF_DOMEventTarget dom_evt;
u32 nb_evts_focus;
u32 nb_evts_mouse;
/*creates an undefined GF_Node - for parsing only*/
GF_Node *gf_sg_new_base_node();
-
-void gf_sg_lock_javascript(Bool LockIt);
-
#ifndef GPAC_DISABLE_VRML
struct _route
#include <gpac/network.h>
-#define JS_SETUP_CLASS(the_class, cname, flag, getp, setp, fin) \
- memset(&the_class, 0, sizeof(the_class)); \
- the_class.name = cname; \
- the_class.flags = flag; \
- the_class.addProperty = JS_PropertyStub; \
- the_class.delProperty = JS_PropertyStub; \
- the_class.getProperty = getp; \
- the_class.setProperty = setp; \
- the_class.enumerate = JS_EnumerateStub; \
- the_class.resolve = JS_ResolveStub; \
- the_class.convert = JS_ConvertStub; \
- the_class.finalize = fin; \
- the_class.hasInstance = my_js_has_instance;
-
struct JSContext *gf_sg_ecmascript_new(GF_SceneGraph *sg);
void gf_sg_ecmascript_del(struct JSContext *);
void gf_sg_script_init_sm_api(GF_ScriptPriv *sc, GF_Node *script);
-Bool gf_js_add_root(struct JSContext *cx, void *rp);
-Bool gf_js_add_named_root(struct JSContext *cx, void *rp, const char *name);
-Bool gf_js_remove_root(struct JSContext *cx, void *rp);
+/*GC thing type: 0 for jsval, 1 for jsstring, 2 for jsobject*/
+enum
+{
+ GF_JSGC_VAL=0,
+ GF_JSGC_STRING,
+ GF_JSGC_OBJECT,
+};
+
+Bool gf_js_add_root(struct JSContext *cx, void *rp, u32 type);
+Bool gf_js_add_named_root(struct JSContext *cx, void *rp, u32 type, const char *name);
+Bool gf_js_remove_root(struct JSContext *cx, void *rp, u32 type);
void gf_js_vrml_flush_event_out(GF_Node *node, GF_ScriptPriv *priv);
+#ifdef GPAC_HAS_SPIDERMONKEY
+void gf_sg_lock_javascript(struct JSContext *c, Bool LockIt);
+Bool gf_sg_try_lock_javascript(struct JSContext *c);
+void gf_sg_js_call_gc(struct JSContext *c);
+#endif /* GPAC_HAS_SPIDERMONKEY */
+
+
typedef struct
{
GF_FieldInfo field;
void gf_sg_load_script_extensions(GF_SceneGraph *sg, struct JSContext *c, struct JSObject *obj, Bool unload);
+Bool gf_sg_javascript_initialized();
#endif /*GPAC_HAS_SPIDERMONKEY*/
GF_Err gf_sg_reload_xml_doc(const char *src, GF_SceneGraph *scene);
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Authors: Jean Le Feuvre
+ * Copyright (c) Telecom ParisTech 2010
+ * All rights reserved
+ *
+ * This file is part of GPAC / Scene Management sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef GPAC_JSAPI
+#define GPAC_JSAPI
+
+#include <gpac/setup.h>
+
+#ifdef GPAC_ANDROID
+#ifndef XP_UNIX
+#define XP_UNIX
+#endif
+#endif
+
+#include <jsapi.h>
+
+#ifndef JS_VERSION
+#define JS_VERSION 170
+#endif
+
+/*new APIs*/
+#if (JS_VERSION>=185)
+
+#define JS_NewDouble(c, v) v
+#define JS_PropertyStub_forSetter JS_StrictPropertyStub
+#define SMJS_PROP_SETTER jsid id, JSBool strict
+#define SMJS_PROP_GETTER jsid id
+#define SMJS_FUNCTION_SPEC(__name, __fun, __argc) {__name, __fun, __argc, 0}
+#define SMJS_FUNCTION(__name) __name(JSContext *c, uintN argc, jsval *argsvp)
+#define SMJS_FUNCTION_EXT(__name, __ext) __name(JSContext *c, uintN argc, jsval *argsvp, __ext)
+#define SMJS_ARGS jsval *argv = JS_ARGV(c, argsvp);
+#define SMJS_OBJ JSObject *obj = JS_THIS_OBJECT(c, argsvp);
+#define SMJS_SET_RVAL(__rval) JS_SET_RVAL(c, argsvp, __rval)
+#define SMJS_GET_RVAL & JS_RVAL(c, argsvp)
+#define SMJS_CALL_ARGS c, argc, argsvp
+#define SMJS_DECL_RVAL jsval *rval = & JS_RVAL(c, argsvp);
+
+#define SMJS_CHARS_FROM_STRING(__c, __jsstr) (char *) JS_EncodeString(__c, __jsstr)
+#define SMJS_CHARS(__c, __val) SMJS_CHARS_FROM_STRING(__c, JSVAL_TO_STRING(__val))
+#define SMJS_FREE(__c, __str) if (__str) JS_free(__c, __str)
+
+
+#define SMJS_OBJ_CONSTRUCTOR JSObject *obj = NULL;\
+ if (!JS_IsConstructing_PossiblyWithGivenThisObject(c, argsvp, &obj)) { \
+ return JS_FALSE;\
+ }\
+ if (obj == NULL) obj = JS_NewObjectForConstructor(c, argsvp); \
+ SMJS_SET_RVAL(OBJECT_TO_JSVAL(obj));\
+
+#define JS_GetFunctionName(_v) (JS_GetFunctionId(_v)!=NULL) ? SMJS_CHARS_FROM_STRING(c, JS_GetFunctionId(_v)) : NULL
+
+#define SMJS_ID_IS_STRING JSID_IS_STRING
+#define SMJS_ID_TO_STRING JSID_TO_STRING
+#define SMJS_ID_IS_INT JSID_IS_INT
+#define SMJS_ID_TO_INT JSID_TO_INT
+
+#ifndef JS_THREADSAFE
+#define JS_THREADSAFE
+#endif
+
+#else
+#define SMJS_PROP_SETTER jsval id
+#define SMJS_PROP_GETTER jsval id
+#define JS_PropertyStub_forSetter JS_PropertyStub
+#define SMJS_FUNCTION_SPEC(__name, __fun, __argc) {__name, __fun, __argc, 0, 0}
+#define SMJS_FUNCTION(__name) __name(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+#define SMJS_FUNCTION_EXT(__name, __ext) __name(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, __ext)
+#define SMJS_ARGS
+#define SMJS_OBJ
+#define SMJS_OBJ_CONSTRUCTOR
+#define SMJS_GET_RVAL rval
+#define SMJS_SET_RVAL(__rval) *rval = __rval
+#define SMJS_CALL_ARGS c, obj, argc, argv, rval
+#define SMJS_DECL_RVAL
+
+#define SMJS_CHARS_FROM_STRING(__c, __str) JS_GetStringBytes(__str)
+#define SMJS_CHARS(__c, __val) JS_GetStringBytes(JSVAL_TO_STRING(__val))
+#define SMJS_FREE(__c, __str)
+
+#define SMJS_ID_IS_STRING JSVAL_IS_STRING
+#define SMJS_ID_TO_STRING JSVAL_TO_STRING
+#define SMJS_ID_IS_INT JSVAL_IS_INT
+#define SMJS_ID_TO_INT JSVAL_TO_INT
+
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if (JS_VERSION>=185)
+JSBool gf_sg_js_has_instance(JSContext *c, JSObject *obj,const jsval *val, JSBool *vp);
+#else
+JSBool gf_sg_js_has_instance(JSContext *c, JSObject *obj, jsval val, JSBool *vp);
+#endif
+
+#define JS_SETUP_CLASS(the_class, cname, flag, getp, setp, fin) \
+ memset(&the_class, 0, sizeof(the_class)); \
+ the_class.name = cname; \
+ the_class.flags = flag; \
+ the_class.addProperty = JS_PropertyStub; \
+ the_class.delProperty = JS_PropertyStub; \
+ the_class.getProperty = getp; \
+ the_class.setProperty = setp; \
+ the_class.enumerate = JS_EnumerateStub; \
+ the_class.resolve = JS_ResolveStub; \
+ the_class.convert = JS_ConvertStub; \
+ the_class.finalize = fin; \
+ the_class.hasInstance = gf_sg_js_has_instance;
+
+
+#define JS_MAKE_DOUBLE(__c, __double) DOUBLE_TO_JSVAL(JS_NewDouble(__c, __double) )
+
+
+JSObject *gf_sg_js_global_object(JSContext *cx, JSClass *__class);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //GPAC_JSAPI
/*OD codec - specific to MPEG-4*/
struct _generic_codec *od_codec;
- /*mutex for scene access*/
- GF_Mutex *mx;
-
/*all sub resources of this scene (eg, list of GF_ObjectManager), namespace of this scene. This includes
both external resources (urls) and ODs sent in MPEG-4 systems*/
GF_List *resources;
Bool gf_scene_check_clocks(GF_ClientService *ns, GF_Scene *scene);
-void gf_scene_notify_event(GF_Scene *scene, u32 event_type, GF_Node *n, void *dom_evt);
+void gf_scene_notify_event(GF_Scene *scene, u32 event_type, GF_Node *n, void *dom_evt, GF_Err code);
+void gf_scene_mpeg4_inline_restart(GF_Scene *scene);
GF_Node *gf_scene_get_subscene_root(GF_Node *inline_node);
enum
{
- GF_TERM_RUNNING= 1,
- GF_TERM_DEAD = 1<<1,
- GF_TERM_SINGLE_THREAD = 1<<2,
- GF_TERM_MULTI_THREAD = 1<<3,
- GF_TERM_SYSDEC_RESYNC = 1<<4,
- GF_TERM_SINGLE_CLOCK = 1<<5
+ GF_TERM_RUNNING = 1<<20,
+ GF_TERM_DEAD = 1<<21,
+ GF_TERM_SINGLE_THREAD = 1<<22,
+ GF_TERM_MULTI_THREAD = 1<<23,
+ GF_TERM_SYSDEC_RESYNC = 1<<24,
+ GF_TERM_SINGLE_CLOCK = 1<<25
};
/*URI relocators are used for containers like zip or ISO FF with file items. The relocator
GF_List *channels_pending;
/*media objects pending for stop/play*/
GF_List *media_queue;
+ /*media_queue lock*/
+ GF_Mutex *media_queue_mx;
/*network lock*/
GF_Mutex *net_mx;
/*all X3D key/mouse/string sensors*/
GF_List *unthreaded_extensions; /*list of extensions to call at each frame*/
GF_List *event_filters; /*list of extensions filtering events*/
GF_Mutex *evt_mx;
+ u32 in_event_filter;
/*static URI relocator for locales*/
GF_TermLocales locales;
void gf_term_set_threading(GF_Terminal *term, u32 mode);
void gf_term_set_priority(GF_Terminal *term, s32 Priority);
-void gf_term_register_event_filter(GF_Terminal *term, GF_TermExt *filter);
-void gf_term_unregister_event_filter(GF_Terminal *term, GF_TermExt *filter);
-Bool gf_term_forward_event(GF_Terminal *term, GF_Event *evt, Bool consumed);
+Bool gf_term_forward_event(GF_Terminal *term, GF_Event *evt, Bool consumed, Bool forward_only);
/*error report function*/
void gf_term_message(GF_Terminal *app, const char *service, const char *message, GF_Err error);
/*close service and queue for delete*/
void gf_term_close_services(GF_Terminal *app, GF_ClientService *service);
+/*locks media quaue*/
+void gf_term_lock_media_queue(GF_Terminal *app, Bool LockIt);
+
/*locks net manager*/
void gf_term_lock_net(GF_Terminal *app, Bool LockIt);
Bool gf_term_lock_codec(GF_Codec *codec, Bool lock);
+typedef struct
+{
+ void *udta;
+ /*called when an event should be filtered
+ */
+ Bool (*on_event)(void *udta, GF_Event *evt, Bool consumed_by_compositor);
+} GF_TermEventFilter;
+
+GF_Err gf_term_add_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef);
+GF_Err gf_term_remove_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef);
+
/*clock*/
struct _object_clock
Fixed speed;
u32 discontinuity_time;
s32 drift;
+ u32 data_timeout;
};
/*destroys clock*/
/*codec type (streamType from base layer)*/
u32 type;
u32 flags;
- /*current decoder interface */
+ /*decoder module interface */
GF_BaseDecoder *decio;
+
+ /*base process routine*/
+ GF_Err (*process)(GF_Codec *codec, u32 TimeAvailable);
+
/*composition memory for media streams*/
struct _composition_memory *CB;
/*input media channles*/
GF_ODM_STATE_PLAY,
GF_ODM_STATE_IN_SETUP,
GF_ODM_STATE_BLOCKED,
+ GF_ODM_STATE_DESTROYED,
};
enum
GF_ODM_ACTION_PLAY,
GF_ODM_ACTION_STOP,
GF_ODM_ACTION_DELETE,
+ GF_ODM_ACTION_SCENE_DISCONNECT,
+ GF_ODM_ACTION_SCENE_RECONNECT,
+ GF_ODM_ACTION_SCENE_INLINE_RESTART,
};
struct _od_manager
void gf_odm_set_duration(GF_ObjectManager *odm, GF_Channel *, u64 stream_duration);
/*signals end of stream on channels*/
void gf_odm_on_eos(GF_ObjectManager *odm, GF_Channel *);
-/*start Object streams and queue object for network PLAY*/
-void gf_odm_start(GF_ObjectManager *odm, Bool was_in_media_queue);
+/*start Object streams and queue object for network PLAY
+media_queue_state: 0: object was not in media queue and must be queued
+ 1: object is already in media queue
+ 2: object shall not be queued bu started directly
+*/
+void gf_odm_start(GF_ObjectManager *odm, u32 media_queue_state);
/*stop OD streams*/
void gf_odm_stop(GF_ObjectManager *odm, Bool force_close);
/*send PLAY request to network - needed to properly handle multiplexed inputs
GFINLINE static void vobsub_trim_ext(char *filename)
{
- char *pos = strchr(filename, '.');
+ char *pos = strrchr(filename, '.');
if (pos != NULL) {
if (!stricmp(pos, ".idx") || !stricmp(pos, ".sub")) {
Bool gf_isom_is_JPEG2000(GF_ISOFile *mov);
+u64 gf_isom_get_file_size(GF_ISOFile *the_file);
+
/********************************************************************
STREAMING API FUNCTIONS
********************************************************************/
/*set meta XML data from file - erase any previously (Binary)XML info*/
GF_Err gf_isom_set_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *XMLFileName, Bool IsBinaryXML);
+/*set meta XML data from memory - erase any previously (Binary)XML info*/
+GF_Err gf_isom_set_meta_xml_memory(GF_ISOFile *file, Bool root_meta, u32 track_num, unsigned char *data, u32 data_size, Bool IsBinaryXML);
/*adds item to meta:
@self_reference: indicates this item is the file itself
GF_ISOM_ITUNE_WRITER = GF_4CC( 0xA9, 'w', 'r', 't' ),
GF_ISOM_ITUNE_ENCODER = GF_4CC( 0xA9, 'e', 'n', 'c' ),
GF_ISOM_ITUNE_ALBUM_ARTIST = GF_4CC( 'a', 'A', 'R', 'T' ),
- GF_ISOM_ITUNE_GAPELESS = GF_4CC( 'p', 'g', 'a', 'p' ),
+ GF_ISOM_ITUNE_GAPLESS = GF_4CC( 'p', 'g', 'a', 'p' ),
};
/*get the given tag info.
!! 'genre' may be coded by ID, the libisomedia doesn't translate the ID. In such a case, the result data is set to NULL
#endif /*GPAC_DISABLE_ISOM_WRITE*/
+/*returns the number of subsamples in the given sample */
+u32 gf_isom_sample_has_subsamples(GF_ISOFile *movie, u32 track, u32 sampleNumber);
+GF_Err gf_isom_sample_get_subsample(GF_ISOFile *movie, u32 track, u32 sampleNumber, u32 subSampleNumber, u32 *size, u8 *priority, Bool *discardable);
+#ifndef GPAC_DISABLE_ISOM_WRITE
+/*adds subsample information to a given sample. Subsample information shall be added in increasing order of sampleNumbers, insertion of information is not supported.
+Note that you may add subsample information for samples not yet added to the file
+specifying 0 as subSampleSize will remove the last subsample information if any*/
+GF_Err gf_isom_add_subsample(GF_ISOFile *movie, u32 track, u32 sampleNumber, u32 subSampleSize, u32 priority, Bool discardable);
+#endif
+/*add subsample information for the latest sample added to the current track fragment*/
+GF_Err gf_isom_fragment_add_subsample(GF_ISOFile *movie, u32 TrackID, u32 subSampleSize, u32 priority, Bool discardable);
+/*copy over the subsample information of the given sample from the source track/file to the last sample added to the current track fragment of the destination file*/
+GF_Err gf_isom_fragment_copy_subsample(GF_ISOFile *dest, u32 TrackID, GF_ISOFile *orig, u32 track, u32 sampleNumber);
+
+
#endif /*GPAC_DISABLE_ISOM*/
#ifdef __cplusplus
GF_Err gf_laser_decoder_remove_stream(GF_LASeRCodec *codec, u16 ESID);
/*decode a laser AU and applies it to the graph (non-memory mode only)*/
-GF_Err gf_laser_decode_au(GF_LASeRCodec *codec, u16 ESID, char *data, u32 data_length);
+GF_Err gf_laser_decode_au(GF_LASeRCodec *codec, u16 ESID, const char *data, u32 data_length);
/*Memory laser decoding - fills the command list with the content of the AU - cf scenegraph_vrml.h for commands usage
@ESID: ID of input stream
* \param ptr target list object
* \return number of items in the list
*/
-u32 gf_list_count(GF_List *ptr);
+u32 gf_list_count(const GF_List *ptr);
/*!
* \brief add item
*
/*save file as fragmented movie
@dash_mode: 0 = DASH not used, 1 = DASH used without GOP spliting, 2 = DASH used with GOP spliting, */
-GF_Err gf_media_fragment_file(GF_ISOFile *input, char *output_file, Double max_duration_sec, u32 dash_mode, Double dash_duration_sec, char *seg_rad_name, u32 fragments_per_sidx, Bool daisy_chain_sidx);
+GF_Err gf_media_fragment_file(GF_ISOFile *input, char *output_file, Double max_duration_sec, u32 dash_mode, Double dash_duration_sec, char *seg_rad_name, char *seg_ext, u32 fragments_per_sidx, Bool daisy_chain_sidx, Bool use_url_template);
/*make the file ISMA compliant: creates ISMA BIFS / OD tracks if needed, and update audio/video IDs
the file should not contain more than one audio and one video track
/*opens media object*/
void gf_mo_play(GF_MediaObject *mo, Double clipBegin, Double clipEnd, Bool can_loop);
/*stops media object - video memory is not reset, last frame is kept*/
-void gf_mo_stop(GF_MediaObject *mo);
+Bool gf_mo_stop(GF_MediaObject *mo);
/*restarts media object - shall be used for all looping media instead of stop/play for mediaControl
to restart appropriated objects*/
void gf_mo_restart(GF_MediaObject *mo);
/*checks if the service associated withthis object has an audio stream*/
Bool gf_mo_has_audio(GF_MediaObject *mo);
+/*checks if the service associated withthis object has an audio stream*/
+Bool gf_mo_is_private_media(GF_MediaObject *mo);
+
+void gf_mo_set_position(GF_MediaObject *mo, GF_Window *src, GF_Window *dst);
+
enum
{
/*this is set to 0 by the OD manager whenever a change occur in the media (w/h change, SR change, etc)
#include <gpac/module.h>
#include <gpac/mpeg4_odf.h>
+#include <gpac/color.h>
#ifdef __cplusplus
extern "C" {
if the codec does not support the request capability, return GF_NOT_SUPPORTED
@CanHandleStream
Can module handle this codec? Return 0 if No and !0 otherwise
- decoderSpecificInfo is provided for MPEG4 audio/visual where a bunch of codecs are defined
- with same objectType
+ esd is provided for more advanced inspection ( eg MPEG4 audio/visual where a bunch of codecs are defined with same objectType). If esd is NULL, only
+ decoder type is checked (audio or video), not codec type
@GetDecoderName
returns codec name - only called once the stream is successfully attached
@privateStack
GF_Err (*DetachStream)(IFCE_NAME, u16 ES_ID);\
GF_Err (*GetCapabilities)(IFCE_NAME, GF_CodecCapability *capability);\
GF_Err (*SetCapabilities)(IFCE_NAME, GF_CodecCapability capability);\
- Bool (*CanHandleStream)(IFCE_NAME, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL);\
+ Bool (*CanHandleStream)(IFCE_NAME, u32 StreamType, GF_ESD *esd, u8 ProfileLevelIndication);\
const char *(*GetName)(IFCE_NAME);\
void *privateStack; \
} GF_BaseDecoder;
/*interface name and version for media decoder */
-#define GF_MEDIA_DECODER_INTERFACE GF_4CC('G', 'M', 'D', '1')
+#define GF_MEDIA_DECODER_INTERFACE GF_4CC('G', 'M', 'D', '2')
/*the media module interface. A media module MUST be implemented in synchronous mode as time
and resources management is done by the terminal*/
} GF_MediaDecoder;
-
+/*
+ WARNING - DO NOT MODIFY THE POSITION OF ProcessData IN SCENE OR NODE DECODER, AS THE BOTH STRUCTURES
+ ARE TYPE_CASTED BY THE TERMINAL WHEN CALLING ProcessData
+*/
typedef struct _scene *LPSCENE;
/*interface name and version for scene decoder */
-#define GF_SCENE_DECODER_INTERFACE GF_4CC('G', 'S', 'D', '1')
+#define GF_SCENE_DECODER_INTERFACE GF_4CC('G', 'S', 'D', '3')
typedef struct _scenedecoder
{
GF_CODEC_BASE_INTERFACE(struct _basedecoder *)
+ /*Process the scene data in inAU.
+ @inBuffer, inBufferLength: encoded input data (complete framing of encoded data)
+ @ES_ID: stream this data belongs too (scalable object)
+ @AU_Time: specifies the current AU time. This is usually unused, however is needed for decoder
+ handling the scene graph without input data (cf below). In this case the buffer passed is always NULL and the AU
+ time caries the time of the scene (or of the stream object attached to the scene decoder, cf below)
+ @mmlevel: speed indicator for the decoding - cf above for values*/
+ GF_Err (*ProcessData)(struct _scenedecoder *, const char *inBuffer, u32 inBufferLength,
+ u16 ES_ID, u32 AU_Time, u32 mmlevel);
+
+
/*attaches scene to the decoder - a scene may be attached to several decoders of several types
(BIFS or others scene dec, ressource decoders (OD), etc.
is: inline scene owning graph (and not just graph), defined in intern/terminal_dev.h. With inline scene
This is called each time the scene is about to be reseted (eg, seek and destroy)
*/
GF_Err (*ReleaseScene)(struct _scenedecoder *);
- /*Process the scene data in inAU.
+} GF_SceneDecoder;
+
+
+/*interface name and version for node decoder mainly used by AFX*/
+#define GF_NODE_DECODER_INTERFACE GF_4CC('G', 'N', 'D', '3')
+
+typedef struct _base_node *LPNODE;
+
+typedef struct _nodedecoder
+{
+ GF_CODEC_BASE_INTERFACE(struct _basedecoder *)
+
+ /*Process the node data in inAU.
@inBuffer, inBufferLength: encoded input data (complete framing of encoded data)
@ES_ID: stream this data belongs too (scalable object)
@AU_Time: specifies the current AU time. This is usually unused, however is needed for decoder
handling the scene graph without input data (cf below). In this case the buffer passed is always NULL and the AU
time caries the time of the scene (or of the stream object attached to the scene decoder, cf below)
@mmlevel: speed indicator for the decoding - cf above for values*/
- GF_Err (*ProcessData)(struct _scenedecoder *, char *inBuffer, u32 inBufferLength,
+ GF_Err (*ProcessData)(struct _nodedecoder *, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 AU_Time, u32 mmlevel);
-} GF_SceneDecoder;
+ /*attaches node to the decoder - currently only one node is only attached to a single decoder*/
+ GF_Err (*AttachNode)(struct _nodedecoder *, LPNODE node);
+} GF_NodeDecoder;
void (*DispatchFrame)(struct __input_device *, u8 *data, u32 data_len);
} GF_InputSensorDevice;
+
+
+
+/*interface name and version for media decoder */
+#define GF_PRIVATE_MEDIA_DECODER_INTERFACE GF_4CC('G', 'P', 'M', '2')
+
+/*the media module interface. A media module MUST be implemented in synchronous mode as time
+and resources management is done by the terminal*/
+typedef struct _private_mediadecoder
+{
+ GF_CODEC_BASE_INTERFACE(struct _basedecoder *)
+
+ /*Control media decoder.
+ @mute: set mute or not
+ @x, y, w, h: video output position in screen coordinate
+ */
+ GF_Err (*Control)(struct _private_mediadecoder *, Bool mute, GF_Window *src_rect, GF_Window *dst_rect);
+} GF_PrivateMediaDecoder;
+
#ifdef __cplusplus
}
#endif
/*proxy stuff*/
GF_Err (*query_proxy)(struct _netinterface *, GF_NetworkCommand *param);
void *proxy_udta;
+ /*!
+ * This is needed for modules supporting mime types, when this method is called,
+ * the module has to call gf_term_register_mime_type() for all the mime-types
+ * its supports.
+ * \return The number of declared mime types
+ * \see gf_term_register_mime_type(GF_InputService *, const char *, const char *, const char *)
+ */
+ u32 (*RegisterMimeTypes) (const struct _netinterface *);
} GF_InputService;
/*callback functions - these can be linked with non-LGPL modules*/
/*check if @fileExt extension is supported for given mimeType, and if associated with module. If mimeType not registered, register it for given module*/
Bool gf_term_check_extension(GF_InputService *ifce, const char *mimeType, const char *extList, const char *description, const char *fileExt);
/*register mime types & file extensions - most modules should only need the check version above*/
-void gf_term_register_mime_type(GF_InputService *ifce, const char *mimeType, const char *extList, const char *description);
+void gf_term_register_mime_type(const GF_InputService *ifce, const char *mimeType, const char *extList, const char *description);
GF_InputService *gf_term_get_service_interface(GF_ClientService *service);
@return: ignored
*/
GF_TERM_EXT_PROCESS,
-
- /*filter event - only called if the GF_TERM_EXTENSION_FILTER_EVENT capability is set
- associated param: GF_Event *evt
- @return: 1 if the event must be discarded, 0 otherwise
- */
- GF_TERM_EXT_EVENT,
/*load/unload js bindings of this extension
associated param: GF_TermExtJS *jsext
the GF_TERM_EXT_START command and cannot be changed at run-time*/
GF_TERM_EXTENSION_NOT_THREADED = 1<<1,
- /*extension wants to filter events*/
- GF_TERM_EXTENSION_FILTER_EVENT = 1<<2,
-
- GF_TERM_EXTENSION_JS = 1<<3,
+ GF_TERM_EXTENSION_JS = 1<<2,
};
GF_VIDEO_HW_HAS_YUV = (1<<3),
/*HW supports YUV overlays*/
GF_VIDEO_HW_HAS_YUV_OVERLAY = (1<<4),
+ /*HW supports stretching for RGB and YUV buffers*/
+ GF_VIDEO_HW_HAS_STRETCH = (1<<5),
/*HW supports OpenGL rendering. Whether this is OpenGL or OpenGL-ES depends on compilation settings
and cannot be changed at runtime*/
- GF_VIDEO_HW_OPENGL = (1<<5),
+ GF_VIDEO_HW_OPENGL = (1<<6),
/*HW supports OpenGL offscreen rendering. Whether this is OpenGL or OpenGL-ES depends on compilation settings
and cannot be changed at runtime*/
- GF_VIDEO_HW_OPENGL_OFFSCREEN = (1<<6),
+ GF_VIDEO_HW_OPENGL_OFFSCREEN = (1<<7),
/*HW supports OpenGL offscreen rendering with alpha. Whether this is OpenGL or OpenGL-ES depends on compilation settings
and cannot be changed at runtime*/
- GF_VIDEO_HW_OPENGL_OFFSCREEN_ALPHA = (1<<7),
+ GF_VIDEO_HW_OPENGL_OFFSCREEN_ALPHA = (1<<8),
+
+ /*HW supports RGB+Depth or YUV+Depth blitting*/
+ GF_VIDEO_HW_HAS_DEPTH = (1<<9),
/*HW supports line blitting*/
GF_VIDEO_HW_HAS_LINE_BLIT = (1<<15),
/*for auto-stereoscopic output*/
/*maximum pixel disparity*/
u32 disparity;
- /*nominal display viewing distance in pixels*/
+ /*nominal display viewing distance in cm*/
Fixed view_distance;
/*driver private*/
u32 maxBitrate;
u32 avgBitrate;
GF_DefaultDescriptor *decoderSpecificInfo;
+
+ /*placeholder for RVC decoder config*/
+ GF_DefaultDescriptor *rvc_config;
+
GF_List *profileLevelIndicationIndexDescriptor;
} GF_DecoderConfig;
GF_List *IPIDataSet;
GF_List *IPMPDescriptorPointers;
GF_List *extensionDescriptors;
-
} GF_ESD;
/*get the encoded AU. user is responsible of allocated space*/
GF_Err gf_odf_codec_get_au(GF_ODCodec *codec, char **outAU, u32 *au_length);
/* set the encoded AU to the codec*/
-GF_Err gf_odf_codec_set_au(GF_ODCodec *codec, char *au, u32 au_length);
+GF_Err gf_odf_codec_set_au(GF_ODCodec *codec, const char *au, u32 au_length);
/*decode the previously set-up AU*/
GF_Err gf_odf_codec_decode(GF_ODCodec *codec);
/*get the first OD command in the list. Once called, the command is removed
this descriptor*/
GF_Err gf_odf_desc_add_desc(GF_Descriptor *parentDesc, GF_Descriptor *newDesc);
+/*returns complete textual description of stream*/
+const char *gf_esd_get_textual_description(GF_ESD *esd);
+
+const char *gf_afx_get_type_description(u8 afx_code);
/*Since IPMP V2, we introduce a new set of functions to read / write a list of descriptors
/*Maximum number of service in a TS*/
#define GF_M2TS_MAX_SERVICES 65535
+/*When ODProfileLevelIndication has this value, only scene and od streams are sl-packetized*/
+#define GPAC_MAGIC_OD_PROFILE_FOR_MPEG4_SIGNALING 10
+
/*MPEG-2 TS Media types*/
enum
{
/*don't use data framing: all packets are raw PES packets*/
GF_M2TS_PES_FRAMING_RAW,
/*skip pes processing: all transport packets related to this stream are discarded*/
- GF_M2TS_PES_FRAMING_SKIP
+ GF_M2TS_PES_FRAMING_SKIP,
+ /*same as GF_M2TS_PES_FRAMING_SKIP but keeps internal PES buffer alive*/
+ GF_M2TS_PES_FRAMING_SKIP_NO_RESET
};
/*PES packet flags*/
/*visual frame starting in this packet is a P frame*/
GF_M2TS_PES_PCK_P_FRAME = 1<<3,
/*visual frame starting in this packet is a B frame*/
- GF_M2TS_PES_PCK_B_FRAME = 1<<4
+ GF_M2TS_PES_PCK_B_FRAME = 1<<4,
+ /*Possible PCR discontinuity from this packet on*/
+ GF_M2TS_PES_PCK_DISCONTINUITY = 1<<5
};
/*Events used by the MPEGTS demuxer*/
GF_M2TS_EVT_PES_PCK,
/*PCR has been received - assoctiated parameter: PES packet with no data*/
GF_M2TS_EVT_PES_PCR,
+ /*PTS/DTS/PCR info - assoctiated parameter: PES packet with no data*/
+ GF_M2TS_EVT_PES_TIMING,
/*An MPEG-4 SL Packet has been received in a section - assoctiated parameter: SL packet */
GF_M2TS_EVT_SL_PCK,
/*An IP datagram has been received in a section - assoctiated parameter: IP datagram */
GF_M2TS_EVT_DVB_GENERAL,
/* MPE / MPE-FEC frame extraction and IP datagrams decryptation */
GF_M2TS_EVT_DVB_MPE,
+ /*CAT has been found (service tune-in) - assoctiated parameter: new CAT*/
+ GF_M2TS_EVT_CAT_FOUND,
+ /*repeated CAT has been found (carousel) - assoctiated parameter: updated CAT*/
+ GF_M2TS_EVT_CAT_REPEAT,
+ /*PMT has been changed - assoctiated parameter: updated PMT*/
+ GF_M2TS_EVT_CAT_UPDATE,
};
enum
GF_List *additional_ods;
/*first dts found on this program - this is used by parsers, but not setup by the lib*/
u64 first_dts;
+
+ /* Last PCR value received for this program and associated packet number */
+ u64 last_pcr_value;
+ u32 last_pcr_value_pck_number;
+ /* PCR value before the last received one for this program and associated packet number
+ used to compute PCR interpolation value*/
+ u64 before_last_pcr_value;
+ u32 before_last_pcr_value_pck_number;
} GF_M2TS_Program;
/*ES flags*/
u32 pes_len;
Bool rap;
u64 PTS, DTS;
-
+ u32 pes_end_packet_number;
+
+ u32 pes_start_packet_number;
+ /* PCR info related to the PES start */
+ /* Last PCR value received for this program and associated packet number */
+ u64 last_pcr_value;
+ u32 last_pcr_value_pck_number;
+ /* PCR value before the last received one for this program and associated packet number
+ used to compute PCR interpolation value*/
+ u64 before_last_pcr_value;
+ u32 before_last_pcr_value_pck_number;
+
+
/*PES reframer - if NULL, pes processing is skiped*/
u32 frame_state;
/*returns the number of bytes consummed from the input data buffer*/
u32 buf_len;
GF_M2TS_DVB_Subtitling_Descriptor sub;
-
} GF_M2TS_PES;
/*SDT information object*/
time_t unix_start;
time_t unix_duration;
+
u8 running_status;
u8 free_CA_mode;
GF_List *short_events;
GF_List *extended_events;
GF_List *components;
GF_List *contents;
- GF_List *ratings;
+ GF_List *ratings;
} GF_M2TS_EIT_Event;
typedef struct
u32 transport_stream_id;
u16 service_id;
GF_List *events;
+ u8 table_id;
} GF_M2TS_EIT;
/*MPEG-2 TS packet*/
char *buffer;
u32 buffer_size, alloc_size;
/*default transport PID filters*/
- GF_M2TS_SectionFilter *pat, *nit, *sdt, *eit, *tdt_tot_st;
+ GF_M2TS_SectionFilter *pat, *cat, *nit, *sdt, *eit, *tdt_tot_st;
Bool has_4on2;
/* analyser */
FILE *pes_out;
+ Bool direct_mpe;
Bool dvb_h_demux;
/*user callback - MUST NOT BE NULL*/
/* Structure to hold all the INT tables if the TS contains IP streams */
struct __gf_dvb_mpe_ip_platform *ip_platform;
+ u32 pck_number;
};
GF_M2TS_Demuxer *gf_m2ts_demux_new();
u32 mpeg2_stream_type;
u32 mpeg2_stream_id;
- GF_ESIPacket pck;
+ GF_ESIPacket curr_pck; /*current packet being processed - does not belong to the packet fifo*/
u32 pck_offset;
Bool force_new;
+ Bool discard_data;
struct __elementary_stream_ifce *ifce;
Double ts_scale;
u32 last_aac_time;
} GF_M2TS_Mux_Stream;
+enum {
+ GF_M2TS_MPEG4_SIGNALING_NONE = 0,
+ GF_M2TS_MPEG4_SIGNALING_FULL,
+ /*experimental profile where all PES media streams (audio, video, images) are sent directly on PES without SL-packetization*/
+ GF_M2TS_MPEG4_SIGNALING_SCENE
+};
+
struct __m2ts_mux_program {
struct __m2ts_mux_program *next;
u32 last_sys_clock;
GF_Descriptor *iod;
+ Bool mpeg4_signaling;
+ Bool mpeg4_signaling_for_scene_only;
};
struct __m2ts_mux {
Bool eos_found;
u32 pck_sent_over_br_window, last_br_time, avg_br;
u64 tot_pck_sent, tot_pad_sent;
-
- Bool mpeg4_signaling;
};
GF_M2TS_STATE_EOS,
};
-GF_M2TS_Mux *gf_m2ts_mux_new(u32 mux_rate, Bool real_time);
+/*!
+ * mux_rate en kbps
+ */
+GF_M2TS_Mux *gf_m2ts_mux_new(u32 mux_rate, u32 pat_refresh_rate, Bool real_time);
void gf_m2ts_mux_del(GF_M2TS_Mux *mux);
-GF_M2TS_Mux_Program *gf_m2ts_mux_program_add(GF_M2TS_Mux *muxer, u32 program_number, u32 pmt_pid);
+GF_M2TS_Mux_Program *gf_m2ts_mux_program_add(GF_M2TS_Mux *muxer, u32 program_number, u32 pmt_pid, u32 pmt_refresh_rate, Bool mpeg4_signaling);
GF_M2TS_Mux_Stream *gf_m2ts_program_stream_add(GF_M2TS_Mux_Program *program, GF_ESInterface *ifce, u32 pid, Bool is_pcr);
void gf_m2ts_mux_update_config(GF_M2TS_Mux *mux, Bool reset_time);
const char *gf_m2ts_mux_process(GF_M2TS_Mux *muxer, u32 *status);
u32 gf_m2ts_get_sys_clock(GF_M2TS_Mux *muxer);
u32 gf_m2ts_get_ts_clock(GF_M2TS_Mux *muxer);
+/*user inteface functions*/
+GF_Err gf_m2ts_program_stream_update_ts_scale(GF_ESInterface *_self, u32 time_scale);
+void gf_m2ts_program_stream_update_sl_config(GF_ESInterface *_self, GF_SLConfig *slc);
+
#endif /*GPAC_DISABLE_MPEG2TS_MUX*/
*\param local_ip the local interface IP address if desired. If NULL, the default interface will be used.
*\param sock the socket object
*\param port port number to bind this socket to
- *\param peer_name the remote server address
+ *\param peer_name the remote server address, if NULL, will use localhost
*\param peer_port remote port number to connect the socket to
*\param options list of option for the bind operation.
*/
-GF_Err gf_sk_bind(GF_Socket *sock, char *local_ip, u16 port, char *peer_name, u16 peer_port, u32 options);
+GF_Err gf_sk_bind(GF_Socket *sock, const char *local_ip, u16 port, const char *peer_name, u16 peer_port, u32 options);
/*!
*\brief connects a socket
*
*\param port remote port number to connect the socket to
*\param local_ip the local (client) address (IP or DNS) if any, NULL otherwise.
*/
-GF_Err gf_sk_connect(GF_Socket *sock, char *peer_name, u16 port, char *local_ip);
+GF_Err gf_sk_connect(GF_Socket *sock, const char *peer_name, u16 port, const char *local_ip);
/*!
*\brief data emission
*
*\param buffer the data buffer to send
*\param length the data length to send
*/
-GF_Err gf_sk_send(GF_Socket *sock, char *buffer, u32 length);
+GF_Err gf_sk_send(GF_Socket *sock, const char *buffer, u32 length);
/*!
*\brief data reception
*
*\param no_bind if sets, only join the multicast
*\param local_interface_ip the local interface IP address if desired. If NULL, the default interface will be used.
*/
-GF_Err gf_sk_setup_multicast(GF_Socket *sock, char *multi_ip_add, u16 multi_port, u32 TTL, Bool no_bind, char *local_interface_ip);
+GF_Err gf_sk_setup_multicast(GF_Socket *sock, const char *multi_ip_add, u16 multi_port, u32 TTL, Bool no_bind, char *local_interface_ip);
/*!
*brief multicast address test
*
*\param delay_sec the maximum delay in second to wait before aborting
*\return If the operation timeed out, the function will return a GF_IP_SOCK_WOULD_BLOCK error.
*/
-GF_Err gf_sk_send_wait(GF_Socket *sock, char *buffer, u32 length, u32 delay_sec);
+GF_Err gf_sk_send_wait(GF_Socket *sock, const char *buffer, u32 length, u32 delay_sec);
/* receive data with a max wait delay of Second - used for http / ftp sockets mainly*/
/*!
*\brief receive data with wait delay
*Checks if an address is an IPV6 or IPV4 one.
*\return true 1 if address is IPV6 one, 0 otherwise
*/
-Bool gf_net_is_ipv6(char *address);
+Bool gf_net_is_ipv6(const char *address);
/*!
TAG_LSR_rectClip,
TAG_LSR_selector,
TAG_LSR_simpleLayout,
+ TAG_LSR_updates,
/*undefined elements (when parsing) use this tag*/
TAG_SVG_UndefinedElement
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / common tools sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _GF_RINGBUFFER_H
+#define _GF_RINGBUFFER_H
+
+#include <gpac/tools.h>
+#include <gpac/thread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+ u8 *buf;
+ volatile u32 write_ptr;
+ volatile u32 read_ptr;
+ u32 size;
+ u32 size_mask;
+ GF_Mutex * mx;
+}
+GF_Ringbuffer ;
+
+
+/*!
+ * Creates a new ringbuffer with specified size. The caller has the
+ * reponsability to free the ringbuffer using gf_ringbuffer_del()
+ *
+ * \param sz the ringbuffer size in bytes
+ *
+ * \return a pointer to a new ringbuffer if successful, NULL otherwise.
+ */
+GF_Ringbuffer * gf_ringbuffer_new(u32 sz);
+
+/*!
+ * Frees a previously allocated ringbuffer
+ * \param ringbuffer The ringbuffer to free
+ */
+void gf_ringbuffer_del(GF_Ringbuffer * ringbuffer);
+
+/*!
+ * Reads bytes from ringbuffer
+ * \param rb The ringbuffer to read from
+ * \param dest The destination
+ * \param szDest Size of destination
+ * \return the number of bytes readen
+ */
+u32 gf_ringbuffer_read(GF_Ringbuffer *rb, u8 *dest, u32 szDest);
+
+/*!
+ * Return the number of bytes available for reading. This is the
+ * number of bytes in front of the read pointer and behind the write
+ * pointer.
+ * \param rb The ringbuffer
+ * \return the number of bytes available for reading
+ */
+u32 gf_ringbuffer_available_for_read (GF_Ringbuffer * rb);
+
+/*!
+ * Copy at most sz bytes to rb from src.
+ * \param rb The ringbuffer to write to
+ * \param src The source buffer
+ * \param sz the size of source
+ * \return Returns the actual number of bytes copied, may be lower than sz if ringbuffer is already full
+ */
+u32 gf_ringbuffer_write (GF_Ringbuffer * rb, const u8 * src, u32 sz);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _GF_RINGBUFFER_H */
*
* must be called after gf_seng_init()
*/
-GF_Err gf_seng_get_stream_config(GF_SceneEngine *seng, u32 idx, u16 *ESID, const char **config, u32 *config_len, u32 *streamType, u32 *objectType, u32 *timeScale);
+GF_Err gf_seng_get_stream_config(GF_SceneEngine *seng, u32 idx, u16 *ESID, char * * const config, u32 *config_len, u32 *streamType, u32 *objectType, u32 *timeScale);
/**
* Encodes the AU context which is not encoded when calling BENC_EncodeAUFromString/File
void *loader_priv;
GF_Err (*process)(GF_SceneLoader *loader);
void (*done)(GF_SceneLoader *loader);
- GF_Err (*parse_string)(GF_SceneLoader *loader, char *str);
+ GF_Err (*parse_string)(GF_SceneLoader *loader, const char *str);
GF_Err (*suspend)(GF_SceneLoader *loader, Bool suspend);
};
if clean_at_end is set, associated parser is destroyed. Otherwise, a call to gf_sm_load_done must be done
to clean ressources (needed for SAX progressive loading)
*/
-GF_Err gf_sm_load_string(GF_SceneLoader *load, char *str, Bool clean_at_end);
+GF_Err gf_sm_load_string(GF_SceneLoader *load, const char *str, Bool clean_at_end);
#ifndef GPAC_DISABLE_SCENE_ENCODER
*/
void gf_node_dirty_clear(GF_Node *node, u32 flags);
-/*if the node is in a dirty state, resets it and the state of all its children*/
-void gf_node_dirty_reset(GF_Node *node);
+/*if the node is in a dirty state, resets it and the state of all its children if desired*/
+void gf_node_dirty_reset(GF_Node *node, Bool reset_children);
/*get dirty flag value*/
u32 gf_node_dirty_get(GF_Node *node);
/*for GF_EVENT_ATTR_MODIFIED*/
GF_FieldInfo *attr;
+ GF_Err error_state;
} GF_DOM_Event;
/*fires event on the specified node
#define strnicmp _strnicmp
#define strupr _strupr
#define mkdir _mkdir
+#define snprintf _snprintf
+#define memccpy _memccpy
+
#ifndef _PTRDIFF_T_DEFINED
#include <stdarg.h>
#include <assert.h>
+#define snprintf _snprintf
#endif /*END WIN32 non win-ce*/
/*end WIN32 config*/
#define _LARGEFILE64_SOURCE
#endif
-#include <stdint.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <string.h>
#include <assert.h>
+#if __APPLE__ && defined GPAC_IPHONE
+#include <TargetConditionals.h>
+#endif
typedef uint64_t u64;
typedef uint32_t u32;
#define gf_malloc(size) gf_mem_malloc(size, __FILE__, __LINE__)
#define gf_calloc(num, size_of) gf_mem_calloc(num, size_of, __FILE__, __LINE__)
#define gf_strdup(s) gf_mem_strdup(s, __FILE__, __LINE__)
-#define gf_realloc(ptr1, ptr2) gf_mem_realloc(ptr1, ptr2, __FILE__, __LINE__)
+#define gf_realloc(ptr1, size) gf_mem_realloc(ptr1, size, __FILE__, __LINE__)
#else
/*end GPAC memory tracking*/
#if (defined (WIN32) || defined (_WIN32_WCE)) && !defined(__GNUC__)
+
#define LLD "%I64d"
#define LLU "%I64u"
#define LLX "%I64x"
+#define LLXPAD( pad ) "%" pad "I64x"
#define LLD_CAST
#define LLU_CAST
+#define PTR_TO_U_CAST (u32)
+
#elif defined (__SYMBIAN32__)
+
#define LLD "%d"
#define LLU "%u"
#define LLX "%x"
+#define LLXPAD( pad ) "%" pad "x"
#define LLD_CAST (u32)
#define LLU_CAST (s32)
-#else
-#ifdef _LP64 /*Unix 64 bits*/
+#define PTR_TO_U_CAST (u32)
+
+/*seems that even though _LP64 is defined in OSX, %ll modifiers are still needed*/
+#elif defined(__DARWIN__) || defined(__APPLE__)
+
+#define LLD "%lld"
+#define LLU "%llu"
+#define LLX "%llx"
+#define LLXPAD( pad ) "%" pad "llx"
+#define PTR_TO_U_CAST (u32)
+
+#elif defined(_LP64) /*Unix 64 bits*/
+
#define LLD "%ld"
#define LLU "%lu"
#define LLX "%lx"
+#define LLXPAD( pad ) "%" pad "lx"
+#define PTR_TO_U_CAST (u64)
+
#else /*Unix 32 bits*/
+
#define LLD "%lld"
#define LLU "%llu"
#define LLX "%llx"
+#define LLXPAD( pad ) "%" pad "llx"
+#define PTR_TO_U_CAST (u32)
+
#endif
+#ifndef LLD_CAST
#define LLD_CAST
+#endif
+
+#ifndef LLU_CAST
#define LLU_CAST
#endif
+#ifndef PTR_TO_U_CAST
+#define PTR_TO_U_CAST
+#endif
+
#ifndef GF_EXPORT
/*use def files for windows or let compiler decide*/
u32 gf_sl_get_header_size(GF_SLConfig* slConfig, GF_SLHeader *Header);
/*depacketize SL-PDU*/
-void gf_sl_depacketize(GF_SLConfig *slConfig, GF_SLHeader *Header, char *PDU, u32 PDULength, u32 *HeaderLen);
+void gf_sl_depacketize(GF_SLConfig *slConfig, GF_SLHeader *Header, const char *PDU, u32 PDULength, u32 *HeaderLen);
#ifdef __cplusplus
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / common tools sub-project
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
*/
void gf_th_set_priority(GF_Thread *th, s32 priority);
/*!
- *\brief current thread ID
+ *\brief current thread ID
*
*Gets the ID of the current thread the caller is in.
*/
u32 gf_th_id();
+#ifdef GPAC_ANDROID
+/*!
+ * Register a function that will be called before pthread_exist is called
+ */
+GF_Err gf_register_before_exit_function(GF_Thread *t, u32 (*toRunBeforePthreadExit)(void *param));
+
+/*! Get the current Thread if any. May return NULL
+ */
+GF_Thread * gf_th_current();
+#endif /* GPAC_ANDROID */
/*!
*\brief abstracted mutex object
*\brief abstracted semaphore object
*
*The abstracted semaphore object allows you to control how portions of the code (typically access to variables) are executed
- *by two threads (or a thread and the main process) at the same time. The best image for a semaphore is a limited set
- *of money coins (always easy to understand hmm?). If no money is in the set, nobody can buy anything until a coin is
+ *by two threads (or a thread and the main process) at the same time. The best image for a semaphore is a limited set
+ *of money coins (always easy to understand hmm?). If no money is in the set, nobody can buy anything until a coin is
*put back in the set. When the set is full, the money is wasted (call it "the bank"...).
*/
typedef struct __tag_semaphore GF_Semaphore;
*Notifies the semaphore of a certain amount of releases.
*\param sm the semaphore object
*\param nb_rel sm the number of release to notify
- *\return the number of previous notification count in the semaphore
+ *\return the number of previous notification count in the semaphore
*/
u32 gf_sema_notify(GF_Semaphore *sm, u32 nb_rel);
/*
*\param token_size output buffer allocated size
*\return position of the first char in the buffer after the last terminating separator, or -1 if token could not be found
*/
-s32 gf_token_get(char *buffer, s32 start, char *separators, char *token, s32 token_size);
+s32 gf_token_get(const char* Buffer, s32 Start, const char* Separator, char* Container, s32 ContainerSize);
/*!
*\brief get string component without delimitting characters
*
*\param token_size output buffer allocated size
*\return position of the first char in the buffer after the last terminating separator, or -1 if token could not be found
*/
-s32 gf_token_get_strip(char *buffer, s32 start, char *separators, char *strip_set, char *token, s32 token_size);
+s32 gf_token_get_strip(const char* Buffer, s32 Start, const char* Separator, const char* strip_set, char* Container, s32 ContainerSize);
/*!
*\brief line removal
*
*\param line_buffer_size output buffer allocated size
*\return position of the first char in the buffer after the last line delimiter, or -1 if no line could be found
*/
-s32 gf_token_get_line(char *buffer, u32 start, u32 size, char *line_buffer, u32 line_buffer_size);
+s32 gf_token_get_line(const char *buffer, u32 start, u32 size, char *line_buffer, u32 line_buffer_size);
/*!
*\brief pattern location
*
*\param pattern pattern to locate
*\return position of the first char in the buffer after the pattern, or -1 if pattern could not be found
*/
-s32 gf_token_find(char *buffer, u32 start, u32 size, char *pattern);
+s32 gf_token_find(const char* Buffer, u32 Start, u32 Size, const char* Pattern);
/*! @} */
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / common tools sub-project
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*KEEP SPACE SEPARATORS FOR MAKE / GREP (SEE MAIN MAKEFILE)!!!, and NO SPACE in GPAC_VERSION for proper install*/
#define GPAC_VERSION "0.4.6-DEV"
-#define GPAC_INTERNAL_REV "8"
-#define GPAC_FULL_VERSION GPAC_VERSION" (internal rev. "GPAC_INTERNAL_REV")"
+#include <gpac/version.h>
+#define GPAC_FULL_VERSION GPAC_VERSION"-rev"GPAC_SVN_REVISION
/*!
* \brief GPAC Version
*/
#define GF_4CC(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
-
+
/*!
* \brief GPAC feature list
*
*/
const char *gf_4cc_to_str(u32 type);
+/*!
+ * \brief asprintf() portable implementation
+ *
+ * similar to sprintf, except it allows the string on the
+ * \note asprintf implementation for windows
+*/
+int gf_asprintf(char **buffer, const char *fmt, ...);
+
/*!
* \brief large file opening
*
* \ingroup utils_grp
* \brief Errors used in GPAC.
*
- * This section documents all error codes used in the GPAC framework. Most of the GPAC's functions will use these as
+ * This section documents all error codes used in the GPAC framework. Most of the GPAC's functions will use these as
* return values, and some of these errors are also used for state communication with the different modules of the framework.
* @{
*/
{
/*!Message from any scripting engine used in the presentation (ECMAScript, MPEG-J, ...) (Info).*/
GF_SCRIPT_INFO = 3,
- /*!Indicates an data frame has several AU packed (not MPEG-4 compliant). This is used by decoders to force
+ /*!Indicates an data frame has several AU packed (not MPEG-4 compliant). This is used by decoders to force
multiple decoding of the same data frame (Info).*/
GF_PACKED_FRAMES = 2,
/*!Indicates the end of a stream or of a file (Info).*/
/*!
* GPAC Log Levels
* \hideinitializer
- *
+ *
* These levels describes messages priority used when filtering logs
*/
enum
/*! Log for audio compositor*/
GF_LOG_AUDIO = 1<<19,
/*! generic Log for modules*/
- GF_LOG_MODULE = 1<<20
+ GF_LOG_MODULE = 1<<20,
+ /*! log for threads and mutexes */
+ GF_LOG_MUTEX = 1<<21
};
* \brief Log overwrite
*
* Assigns a user-defined callback for printing log messages. By default all logs are redirected to stdout
- * \param usr_cbk Opaque user data
+ * \param usr_cbk Opaque user data
* \param cbk callback log function
* \return previous callback function
*/
*/
#ifndef GPAC_DISABLE_LOG
-/*note:
+/*note:
to turn log on, change to GPAC_ENABLE_LOG
to turn log off, change to GPAC_DISABLE_LOG
this is needed by configure+sed to modify this file directly
u32 gf_log_parse_tools(const char *val);
#ifdef GPAC_DISABLE_LOG
-#define GF_LOG(_ll, _lm, __args)
+#define GF_LOG(_ll, _lm, __args)
#else
/*!
* \brief Message logging
u32 gf_rand();
/*!
- * \brief user name
+ * \brief user name
*
* Gets current user (login) name.
*/
* Enumerates a directory content. Feedback is provided by the enum_dir_item function
* \param dir Directory to enumerate
* \param enum_directory If set, only directories will be enumerated, otherwise only files are.
- * \param enum_dir \ref gf_enum_dir_item callback function for enumeration.
+ * \param enum_dir \ref gf_enum_dir_item callback function for enumeration.
* \param cbck Opaque user data passed to callback function.
* \param filter optional filter for file extensions. If a file extension without the dot '.' character is not found in the
* filter the file will be skipped.
* Deletes a file from the disk.
* \param fileName absolute name of the file or name relative to the current working directory.
*/
-void gf_delete_file(char *fileName);
+GF_Err gf_delete_file(const char *fileName);
/*!
* \brief File Move
* \param fileName absolute path of the file / directory to move or rename
* \param newFileName absolute new path/name of the file / directory
*/
-void gf_move_file(char *fileName, char *newFileName);
+void gf_move_file(const char *fileName, const char *newFileName);
/*!
* \brief Temporary File Creation
* \param done Current amount performed of the action.
* \param total Total amount of the action.
*/
-void gf_set_progress(char *title, u64 done, u64 total);
+void gf_set_progress(const char *title, u64 done, u64 total);
/*!
* \brief Progress Callback
* \param total Total amount of the action.
*
*/
-typedef void (*gf_on_progress_cbk)(void *cbck, char *title, u64 done, u64 total);
+typedef void (*gf_on_progress_cbk)(const void *cbck, const char *title, u64 done, u64 total);
/*!
* \brief Progress overwriting
/*!
- * \brief Prompt checking
+ * \brief Prompt checking
*
* Checks if a character is pending in the prompt buffer.
* \return 1 if a character is ready to be fetched, 0 otherwise.
/*!
* \brief System setup
*
- * Inits the system high-resolution clock if any, and CPU usage manager. It is strongly recommended to call this
+ * Inits the system high-resolution clock if any, and CPU usage manager. It is strongly recommended to call this
* function before calling any other GPAC functions, since on some systems (like winCE) it may result in a better memory usage estimation.
- * \note This can be called several times but only the first call will result in system setup.
+ * \note This can be called several times but only the first call will result in system setup.
*/
void gf_sys_init(Bool enable_memory_tracker);
/*!
/*!\brief run-time system info object
*
- *The Run-Time Info object is used to get CPU and memory occupation of the calling process.
+ *The Run-Time Info object is used to get CPU and memory occupation of the calling process.
*All time values are expressed in milliseconds (accuracy is not guaranteed).
*/
typedef struct
/*!Indicates all processes' times must be fetched. If not set, only the current process times will be retrieved, and the
thread count and total times won't be available*/
GF_RTI_ALL_PROCESSES_TIMES = 1,
- /*!Indicates the process allocated heap size must be fetch. If not set, only the system physical memory is fetched.
+ /*!Indicates the process allocated heap size must be fetch. If not set, only the system physical memory is fetched.
Fetching the entire ocess allocated memory can have a large impact on performances*/
GF_RTI_PROCESS_MEMORY = 1<<1,
/*!Indicates that only system memory should be fetched. When set, all refreshing info is ignored*/
Bool gf_sys_get_battery_state(Bool *onBattery, u32 *onCharge, u32 *level, u32 *batteryLifeTime, u32 *batteryFullLifeTime);
+typedef struct _GF_GlobalLock_opaque GF_GlobalLock;
+
+/*!
+ * This function allows the user to create a global lock for all GPAC instances.
+ * This allow to disable some features for other instances for instance.
+ * \param resourceName The name of the resource to lock
+ * \return false if resource has been locked, true if resource could not be locked
+ */
+GF_GlobalLock * gf_global_resource_lock(const char * resourceName);
+
+/*!
+ * Unlock a previouly locked resource
+ * \param lock The resource to unlock
+ * \return GF_OK if evertything went fine
+ */
+GF_Err gf_global_resource_unlock(GF_GlobalLock * lock);
+
+
+/**
+ * Gets a newly allocated string containing the default cache directory.
+ * It is the responsibility of the caller to free the string.
+ * \return a fully qualified path to the default cache directory
+ */
+char * gf_get_default_cache_directory();
+
+
+
+/**
+ * Compresses a data buffer in place using zlib. Buffer may be reallocated in the process.
+ * \param data pointer to the data buffer to be compressed
+ * \param data_len length of the data buffer to be compressed
+ * \param out_size pointer for output buffer size
+ * \return GF_OK if evertything went fine
+ */
+GF_Err gf_gz_compress_payload(char **data, u32 data_len, u32 *out_size);
+
+/**
+ * Decompresses a data buffer using zlib.
+ * \param data data buffer to be decompressed
+ * \param data_len length of the data buffer to be decompressed
+ * \param uncompressed_data pointer to the uncompressed data buffer. It is the responsibility of the caller to free this buffer.
+ * \param out_size size of the uncompressed buffer
+ * \return GF_OK if evertything went fine
+ */
+GF_Err gf_gz_decompress_payload(char *data, u32 data_len, char **uncompressed_data, u32 *out_size);
+
/*! @} */
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / common tools sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _GF_UNICODE_H_
+#define _GF_UNICODE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \file <gpac/math.h>
+ * \brief math and trigo functions.
+ */
+
+#include <gpac/setup.h>
+
+/*!
+ * \brief Unicode conversion from UTF-8 to UCS-4
+ * \param ucs4_buf The UCS-4 buffer to fill
+ * \param utf8_len The length of the UTF-8 buffer
+ * \param utf8_buf The buffer containing the UTF-8 data
+ * \return the length of the ucs4_buf. Note that the ucs4_buf should be allocated by parent and should be at least utf8_len * 4
+ */
+u32 utf8_to_ucs4 (u32 *ucs4_buf, u32 utf8_len, unsigned char *utf8_buf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_GF_UNICODE_H_*/
+
* rendering is done after media decoding
* the user is responsible for updating the terminal
*/
- GF_TERM_NO_THREAD = 1<<2,
+ GF_TERM_NO_DECODER_THREAD = 1<<2,
+
+ /*works with no visual thread for the composition - compositor is driven by the media manager
+ if GF_TERM_NO_DECODER_THREAD, equivalent to GF_TERM_NO_COMPOSITOR_THREAD
+ */
+ GF_TERM_NO_VISUAL_THREAD = 1<<3,
+
+ /*works with no visual thread for the composition - compositor is driven by gf_term_process*/
+ GF_TERM_NO_COMPOSITOR_THREAD = 1<<4,
+
/*disables frame-rate regulation (used when dumping content)*/
- GF_TERM_NO_REGULATION = 1<<3,
- /*lets the main user handle window events (neede for browser plugins)*/
- GF_TERM_NO_WINDOWPROC_OVERRIDE = 1<<4,
+ GF_TERM_NO_REGULATION = 1<<5,
+ /*works without window thread*/
+ GF_TERM_WINDOW_NO_THREAD = 1<<6,
+ /*lets the main user handle window events (needed for browser plugins)*/
+ GF_TERM_NO_WINDOWPROC_OVERRIDE = 1<<7,
+ /*works without title bar*/
+ GF_TERM_WINDOW_NO_DECORATION = 1<<8,
+ /*framebuffer works in 32 bit alpha mode - experimental, only supported on Win32*/
+ GF_TERM_WINDOW_TRANSPARENT = 1<<9,
/*works in windowless mode - experimental, only supported on Win32*/
- GF_TERM_WINDOWLESS = 1<<5,
- /*works with no visual thread fr the composition - compositor is driven by the media manager*/
- GF_TERM_DRAW_FRAME = 1<<6
+ GF_TERM_WINDOWLESS = 1<<10,
};
/*user object for all callbacks*/
assume UTF-8 compatible coding*/
GF_Err gf_xml_sax_init(GF_SAXParser *parser, unsigned char *BOM);
/*parses input string data. string data MUST be terminated by the 0 character (eg 2 0s for UTF-16)*/
-GF_Err gf_xml_sax_parse(GF_SAXParser *parser, void *string_bytes);
+GF_Err gf_xml_sax_parse(GF_SAXParser *parser, const void *string_bytes);
/*suspends/resume sax parsing.
When resuming on file, the function will run until suspended/end of file/error
When resuming on steram, the function will simply return
u32 gf_xml_sax_get_node_start_pos(GF_SAXParser *parser);
u32 gf_xml_sax_get_node_end_pos(GF_SAXParser *parser);
-
typedef struct _tag_dom_parser GF_DOMParser;
GF_DOMParser *gf_xml_dom_new();
void gf_xml_dom_del(GF_DOMParser *parser);
--- /dev/null
+/* 7.8 Format conversion of integer types <inttypes.h> */
+
+#ifndef _INTTYPES_H_
+#define _INTTYPES_H_
+
+
+typedef signed char int8_t;\r
+typedef signed short int16_t;\r
+typedef signed int int32_t;\r
+typedef unsigned char uint8_t;\r
+typedef unsigned short uint16_t;\r
+typedef unsigned int uint32_t;\r
+typedef signed __int64 int64_t;\r
+typedef unsigned __int64 uint64_t;\r
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ndef _INTTYPES_H */
--- /dev/null
+\r
+#ifndef _STDINT_H\r
+#define _STDINT_H\r
+\r
+\r
+typedef signed char int8_t;\r
+typedef signed short int16_t;\r
+typedef signed int int32_t;\r
+typedef unsigned char uint8_t;\r
+typedef unsigned short uint16_t;\r
+typedef unsigned int uint32_t;\r
+typedef signed __int64 int64_t;\r
+typedef unsigned __int64 uint64_t;\r
+\r
+\r
+\r
+#endif /* _STDINT_H */\r
--- /dev/null
+#ifdef _WIN32_WCE\r
+\r
+/***\r
+*errno.h - system wide error numbers (set by system calls)\r
+*\r
+* Copyright (c) Microsoft Corporation. All rights reserved.\r
+*\r
+*Purpose:\r
+* This file defines the system-wide error numbers (set by\r
+* system calls). Conforms to the XENIX standard. Extended\r
+* for compatibility with Uniforum standard.\r
+* [System V]\r
+*\r
+* [Public]\r
+*\r
+****/\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#ifndef _INC_ERRNO\r
+#define _INC_ERRNO\r
+\r
+#include <crtdefs.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* declare reference to errno */\r
+\r
+#ifndef _CRT_ERRNO_DEFINED\r
+#define _CRT_ERRNO_DEFINED\r
+_CRTIMP extern int * __cdecl _errno(void);\r
+#define errno (*_errno())\r
+\r
+errno_t __cdecl _set_errno(__in int _Value);\r
+errno_t __cdecl _get_errno(__out int * _Value);\r
+#endif\r
+\r
+/* Error Codes */\r
+\r
+#define EPERM 1\r
+#define ENOENT 2\r
+#define ESRCH 3\r
+#define EINTR 4\r
+#define EIO 5\r
+#define ENXIO 6\r
+#define E2BIG 7\r
+#define ENOEXEC 8\r
+#define EBADF 9\r
+#define ECHILD 10\r
+#define EAGAIN 11\r
+#define ENOMEM 12\r
+#define EACCES 13\r
+#define EFAULT 14\r
+#define EBUSY 16\r
+#define EEXIST 17\r
+#define EXDEV 18\r
+#define ENODEV 19\r
+#define ENOTDIR 20\r
+#define EISDIR 21\r
+#define ENFILE 23\r
+#define EMFILE 24\r
+#define ENOTTY 25\r
+#define EFBIG 27\r
+#define ENOSPC 28\r
+#define ESPIPE 29\r
+#define EROFS 30\r
+#define EMLINK 31\r
+#define EPIPE 32\r
+#define EDOM 33\r
+#define EDEADLK 36\r
+#define ENAMETOOLONG 38\r
+#define ENOLCK 39\r
+#define ENOSYS 40\r
+#define ENOTEMPTY 41\r
+\r
+/* Error codes used in the Secure CRT functions */\r
+\r
+#ifndef RC_INVOKED\r
+#if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED)\r
+#define _SECURECRT_ERRCODE_VALUES_DEFINED\r
+#define EINVAL 22\r
+#define ERANGE 34\r
+#define EILSEQ 42\r
+#define STRUNCATE 80\r
+#endif\r
+#endif\r
+\r
+\r
+/*\r
+ * Support EDEADLOCK for compatibiity with older MS-C versions.\r
+ */\r
+#define EDEADLOCK EDEADLK\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _INC_ERRNO */\r
+\r
+#endif //_WIN32_WCE
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#set -e
+
+source_path=.
+
+function rewrite_deps {
+dylib=$1
+# echo rewriting deps for $1
+for ref in `otool -L $1 | grep '/local' | awk '{print $1'}`
+do
+# echo changing $ref to @executable_path/lib/`basename $ref` $1
+ install_name_tool -change $ref @executable_path/lib/`basename $ref` $1 || { echo "Failed, permissions issue for $1 ? Try with sudo..." ; exit 1 ;}
+ copy_lib $ref
+done
+
+}
+
+function copy_lib {
+# echo testing $1 for bundle copy
+basefile=`basename $1`
+if [ ! $basefile == 'libgpac.dylib' ] && [ ! -e lib/$basefile ];
+then
+# echo copying $1 to bundle
+ cp $1 lib/
+ rewrite_deps lib/$basefile
+fi
+}
+
+#copy all libs
+echo Copying binaries
+if [ -d tmpdmp ]
+then
+rm -fr tmpdmp
+fi
+mkdir -p tmpdmg/Osmo4.app
+rsync -r --exclude=.svn $source_path/build/osxdmg/Osmo4.app/ ./tmpdmg/Osmo4.app/
+ln -s /Applications ./tmpdmg/Applications
+cp $source_path/README ./tmpdmg
+cp $source_path/COPYING ./tmpdmg
+
+cp bin/gcc/gm* tmpdmg/Osmo4.app/Contents/MacOS/modules
+cp bin/gcc/libgpac.dylib tmpdmg/Osmo4.app/Contents/MacOS/lib
+cp bin/gcc/MP4Client tmpdmg/Osmo4.app/Contents/MacOS/Osmo4
+cp bin/gcc/MP4Box tmpdmg/Osmo4.app/Contents/MacOS/MP4Box
+
+cd tmpdmg/Osmo4.app/Contents/MacOS/
+
+#check all external deps, and copy them
+echo rewriting DYLIB dependencies
+for dylib in lib/*.dylib modules/*.dylib
+do
+ rewrite_deps $dylib
+done
+
+echo rewriting APPS dependencies
+install_name_tool -change /usr/local/lib/libgpac.dylib @executable_path/lib/libgpac.dylib Osmo4
+install_name_tool -change /usr/local/lib/libgpac.dylib @executable_path/lib/libgpac.dylib MP4Box
+install_name_tool -change ../bin/gcc/libgpac.dylib @executable_path/lib/libgpac.dylib Osmo4
+install_name_tool -change ../bin/gcc/libgpac.dylib @executable_path/lib/libgpac.dylib MP4Box
+
+
+cd ../../../..
+
+echo Copying GUI
+rsync -r --exclude=.svn $source_path/gui ./tmpdmg/Osmo4.app/Contents/MacOS/
+
+echo Building DMG
+version=`grep '#define GPAC_VERSION ' $source_path/include/gpac/tools.h | cut -d '"' -f 2`
+
+cur_dir=`pwd`
+cd $source_path
+rev=`LANG=en_US svn info | grep Revision | tr -d 'Revision: '`
+cd $cur_dir
+
+full_version=$version
+if [ "$rev" != "" ]
+then
+ full_version="$full_version-r$rev"
+else
+ #if no revision can be extracted from SVN, use date
+ $rev = $(date +%Y%m%d)
+fi
+
+sed 's/<string>.*<\/string><!-- VERSION_REV_REPLACE -->/<string>'"$version"'<\/string>/' tmpdmg/Osmo4.app/Contents/Info.plist > tmpdmg/Osmo4.app/Contents/Info.plist.new && sed 's/<string>.*<\/string><!-- BUILD_REV_REPLACE -->/<string>'"$rev"'<\/string>/' tmpdmg/Osmo4.app/Contents/Info.plist.new > tmpdmg/Osmo4.app/Contents/Info.plist && rm tmpdmg/Osmo4.app/Contents/Info.plist.new
+
+#create dmg
+hdiutil create ./gpac.dmg -volname "GPAC for OSX" -srcfolder tmpdmg -ov
+rm -rf ./tmpdmg
+
+#add SLA
+echo "Adding licence"
+hdiutil convert -format UDCO -o gpac_sla.dmg gpac.dmg
+rm gpac.dmg
+hdiutil unflatten gpac_sla.dmg
+/Developer/Tools/Rez /Developer/Headers/FlatCarbon/*.r $source_path/build/osxdmg/SLA.r -a -o gpac_sla.dmg
+hdiutil flatten gpac_sla.dmg
+hdiutil internet-enable -yes gpac_sla.dmg
+
+echo "GPAC-$full_version.dmg ready"
+mv gpac_sla.dmg GPAC-$full_version.dmg
+
include ../config.mak
#all OS and lib independent
-PLUGDIRS=aac_in ac3_in audio_filter bifs_dec ctx_load dummy_in soft_raster mp3_in isom_in odf_dec rtp_in timedtext img_in svg_in saf_in mpegts_in ismacryp widgetman redirect_av
+#PLUGDIRS=aac_in ac3_in audio_filter bifs_dec ctx_load dummy_in soft_raster mp3_in isom_in odf_dec rtp_in timedtext img_in svg_in saf_in mpegts_in ismacryp widgetman redirect_av mpd_in
+PLUGDIRS=aac_in ac3_in audio_filter bifs_dec ctx_load dummy_in soft_raster mp3_in isom_in odf_dec rtp_in timedtext img_in svg_in saf_in mpegts_in ismacryp widgetman mpd_in
ifeq ($(DISABLE_SVG), no)
PLUGDIRS+=laser_dec svg_in
vpath %.c $(SRC_PATH)/modules/aac_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#local faad lib
ifeq ($(CONFIG_FAAD), local)
EXTRALIBS+=-L../../extra_lib/lib/gcc
-CFLAGS+= -I$(LOCAL_INC_PATH)/faad
+CFLAGS+= -I"$(LOCAL_INC_PATH)/faad"
endif
EXTRALIBS+= -lfaad
endif
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / AAC reader module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
+#ifndef DONT_USE_TERMINAL_MODULE_API
#include <gpac/modules/service.h>
+#endif
+
#include <gpac/modules/codec.h>
#include <gpac/avparse.h>
#include <gpac/constants.h>
+#include <gpac/download.h>
#ifndef GPAC_DISABLE_AV_PARSERS
typedef struct
{
+#ifndef DONT_USE_TERMINAL_MODULE_API
GF_ClientService *service;
+ LPNETCHANNEL ch;
+#endif
Bool is_remote;
-
+
FILE *stream;
u32 duration;
u32 pad_bytes;
Bool done;
u32 is_inline;
- LPNETCHANNEL ch;
unsigned char *data;
u32 data_size;
Double start_range, end_range;
u32 current_time, nb_samp;
/*file downloader*/
- GF_DownloadSession * dnload;
+ GF_DownloadSession *dnload;
+#ifdef DONT_USE_TERMINAL_MODULE_API
+ GF_DownloadManager *dm;
+#endif
Bool is_live;
char prev_data[1000];
u32 profile, sr_idx, nb_ch, frame_size, hdr_size;
} ADTSHeader;
+#ifndef DONT_USE_TERMINAL_MODULE_API
+
+static const char * AAC_MIMES[] = { "audio/x-m4a", "audio/aac", "audio/aacp", 0 };
+
+static const char * AAC_EXTENSIONS = "aac mp4a";
+
+static const char * AAC_DESC = "MPEG-4 AAC Music";
+
+static u32 AAC_RegisterMimeTypes(const GF_InputService *plug){
+ int i;
+ if (!plug)
+ return 0;
+ for (i = 0 ; AAC_MIMES[i] ; i++)
+ gf_term_register_mime_type( plug, AAC_MIMES[i], AAC_EXTENSIONS, AAC_DESC);
+ return i;
+}
+
+
static Bool AAC_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ if (!plug || !url)
+ return 0;
sExt = strrchr(url, '.');
- if (!strnicmp(url, "rtsp://", 7)) return 0;
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "audio/x-m4a", "aac", "MPEG-4 AAC Music", sExt)) return 1;
- if (gf_term_check_extension(plug, "audio/aac", "aac", "MPEG-4 AAC Music", sExt)) return 1;
- if (gf_term_check_extension(plug, "audio/aacp", "aac", "MPEG-4 AACPlus Music", sExt)) return 1;
+ if (!strnicmp(url, "rtsp://", 7)) return 0;
+ {
+ int i;
+ for (i = 0 ; AAC_MIMES[i] ; i++)
+ if (gf_term_check_extension(plug, AAC_MIMES[i], AAC_EXTENSIONS, AAC_DESC, sExt))
+ return 1;
+ }
return 0;
}
-
-static Bool aac_is_local(const char *url)
-{
- if (!strnicmp(url, "file://", 7)) return 1;
- if (strstr(url, "://")) return 0;
- return 1;
-}
+#endif
static GF_ESD *AAC_GetESD(AACReader *read)
{
u32 i, sbr_sr_idx;
esd = gf_odf_desc_esd_new(0);
+ if (!esd)
+ return NULL;
esd->decoderConfig->streamType = GF_STREAM_AUDIO;
esd->decoderConfig->objectTypeIndication = read->oti;
esd->ESID = 1;
return esd;
}
+#ifndef DONT_USE_TERMINAL_MODULE_API
static void AAC_SetupObject(AACReader *read)
{
GF_ESD *esd;
esd = AAC_GetESD(read);
esd->OCRESID = 0;
gf_list_add(od->ESDescriptors, esd);
+
gf_term_add_media(read->service, (GF_Descriptor*)od, 0);
}
+#endif
static Bool ADTS_SyncFrame(GF_BitStream *bs, Bool is_complete, ADTSHeader *hdr)
{
Bool sync;
GF_BitStream *bs;
ADTSHeader hdr;
- if (!read->stream) return 0;
+ if (!read || !read->stream) return 0;
bs = gf_bs_from_file(read->stream, GF_BITSTREAM_READ);
sync = ADTS_SyncFrame(bs, !read->is_remote, &hdr);
read->sample_rate = GF_M4ASampleRates[read->sr_idx];
read->duration = 0;
-
+
if (!read->is_remote) {
read->duration = 1024;
gf_bs_skip_bytes(bs, hdr.frame_size);
return 1;
}
+#ifndef DONT_USE_TERMINAL_MODULE_API
static void AAC_RegulateDataRate(AACReader *read)
{
GF_NetworkCommand com;
-
+ if (!read)
+ return;
memset(&com, 0, sizeof(GF_NetworkCommand));
com.command_type = GF_NET_CHAN_BUFFER_QUERY;
com.base.on_channel = read->ch;
gf_sleep(2);
}
}
+#endif
-static void AAC_OnLiveData(AACReader *read, char *data, u32 data_size)
+static void AAC_OnLiveData(AACReader *read, const char *data, u32 data_size)
{
u32 pos;
Bool sync;
GF_BitStream *bs;
ADTSHeader hdr;
-
+ assert( read->data || (!read->data && !read->data_size));
read->data = gf_realloc(read->data, sizeof(char)*(read->data_size+data_size) );
memcpy(read->data + read->data_size, data, sizeof(char)*data_size);
read->data_size += data_size;
read->sample_rate = GF_M4ASampleRates[read->sr_idx];
read->is_live = 1;
memset(&read->sl_hdr, 0, sizeof(GF_SLHeader));
+#ifndef DONT_USE_TERMINAL_MODULE_API
gf_term_on_connect(read->service, NULL, GF_OK);
AAC_SetupObject(read);
+#endif
}
+#ifndef DONT_USE_TERMINAL_MODULE_API
if (!read->ch) return;
+#endif
/*need a full adts header*/
if (read->data_size<=7) return;
read->sl_hdr.AU_sequenceNumber++;
read->sl_hdr.compositionTimeStampFlag = 1;
read->sl_hdr.compositionTimeStamp += 1024;
+#ifndef DONT_USE_TERMINAL_MODULE_API
gf_term_on_sl_packet(read->service, read->ch, read->data + pos, hdr.frame_size, &read->sl_hdr, GF_OK);
+#else
+ SampleCallBack(audio_prog, AUDIO_DATA_ESID, read->data + pos, hdr.frame_size, read->sl_hdr.compositionTimeStamp);
+#endif
gf_bs_skip_bytes(bs, hdr.frame_size);
}
if (pos) {
char *d;
+ assert( read->data);
+ assert( read->data_size >= pos);
read->data_size -= pos;
d = gf_malloc(sizeof(char) * read->data_size);
+ assert( d );
memcpy(d, read->data + pos, sizeof(char) * read->data_size);
gf_free(read->data);
read->data = d;
}
+#ifndef DONT_USE_TERMINAL_MODULE_API
AAC_RegulateDataRate(read);
+#endif
+}
+
+static void AAC_disconnect_from_http_and_free(AACReader * read)
+{
+ if (!read)
+ return;
+ if (read->dnload){
+ gf_dm_sess_abort(read->dnload);
+#ifdef DONT_USE_TERMINAL_MODULE_API
+ gf_dm_sess_del( read->dnload);
+#else
+ gf_term_download_del(read->dnload);
+#endif /* DONT_USE_TERMINAL_MODULE_API */
+ }
+ read->dnload = NULL;
}
void AAC_NetIO(void *cbk, GF_NETIO_Parameter *param)
read->icy_genre = gf_strdup(param->value);
}
if (!strcmp(param->name, "icy-meta")) {
+#ifndef DONT_USE_TERMINAL_MODULE_API
GF_NetworkCommand com;
+#endif
char *meta;
if (read->icy_track_name) gf_free(read->icy_track_name);
read->icy_track_name = NULL;
while (meta && meta[0]) {
char *sep = strchr(meta, ';');
if (sep) sep[0] = 0;
-
+
if (!strnicmp(meta, "StreamTitle=", 12)) {
read->icy_track_name = gf_strdup(meta+12);
+ if (!strcmp(read->icy_track_name, "''")){
+ /* On some servers, '' means not track name */
+ gf_free(read->icy_track_name);
+ read->icy_track_name = NULL;
+ }
}
if (!sep) break;
sep[0] = ';';
meta = sep+1;
}
-
+#ifndef DONT_USE_TERMINAL_MODULE_API
com.base.command_type = GF_NET_SERVICE_INFO;
gf_term_on_command(read->service, &com, GF_OK);
+#endif
}
return;
} else {
/*handle service message*/
+#ifndef DONT_USE_TERMINAL_MODULE_API
gf_term_download_update_stats(read->dnload);
+#endif
if (param->msg_type!=GF_NETIO_DATA_EXCHANGE) return;
}
/*OK confirm*/
if (read->needs_connection) {
read->needs_connection = 0;
+#ifndef DONT_USE_TERMINAL_MODULE_API
gf_term_on_connect(read->service, NULL, e);
if (!e) AAC_SetupObject(read);
+#endif
}
}
-void aac_download_file(GF_InputService *plug, char *url)
+void aac_download_file(AACReader *read, char *url)
{
- AACReader *read = (AACReader*) plug->priv;
-
read->needs_connection = 1;
-
+ AAC_disconnect_from_http_and_free(read);
+#ifndef DONT_USE_TERMINAL_MODULE_API
read->dnload = gf_term_download_new(read->service, url, 0, AAC_NetIO, read);
+#else
+ {
+ GF_Err e;
+ if (!read->dm)
+ read->dm = gf_dm_new(NULL);
+ assert( read->dm );
+ read->dnload = gf_dm_sess_new_simple(read->dm, url, 0, AAC_NetIO, read, &e);
+ }
+#endif
+
if (!read->dnload ) {
read->needs_connection = 0;
+#ifndef DONT_USE_TERMINAL_MODULE_API
gf_term_on_connect(read->service, NULL, GF_NOT_SUPPORTED);
+#endif
}
/*service confirm is done once fetched*/
}
+static void AAC_Reader_del(AACReader * read)
+{
+ if (!read)
+ return;
+ AAC_disconnect_from_http_and_free(read);
+#ifdef DONT_USE_TERMINAL_MODULE_API
+ if (read->dm)
+ gf_dm_del(read->dm);
+ read->dm = NULL;
+#endif
+ if (read->icy_name)
+ gf_free(read->icy_name);
+ if (read->icy_genre)
+ gf_free(read->icy_genre);
+ if (read->icy_track_name)
+ gf_free(read->icy_track_name);
+ read->icy_name = read->icy_genre = read->icy_track_name = NULL;
+ if (read->stream)
+ fclose(read->stream);
+ if (read->data)
+ gf_free(read->data);
+ read->data = NULL;
+ read->stream = NULL;
+ gf_free( read );
+}
+
+static AACReader * AAC_Reader_new(){
+ AACReader *reader = gf_malloc(sizeof(AACReader));
+ memset(reader, 0, sizeof(AACReader));
+ return reader;
+}
+
+
+#ifndef DONT_USE_TERMINAL_MODULE_API
+static Bool aac_is_local(const char *url)
+{
+ if (!strnicmp(url, "file://", 7)) return 1;
+ if (strstr(url, "://")) return 0;
+ return 1;
+}
static GF_Err AAC_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
{
char *ext;
GF_Err reply;
AACReader *read = plug->priv;
- read->service = serv;
+ read->service = serv;
- if (read->dnload) gf_term_download_del(read->dnload);
- read->dnload = NULL;
+ AAC_disconnect_from_http_and_free(read);
strcpy(szURL, url);
ext = strrchr(szURL, '#');
/*remote fetch*/
read->is_remote = !aac_is_local(szURL);
if (read->is_remote) {
- aac_download_file(plug, (char *) szURL);
+ aac_download_file(read, (char *) szURL);
return GF_OK;
}
static GF_Err AAC_CloseService(GF_InputService *plug)
{
- AACReader *read = plug->priv;
- if (read->stream) fclose(read->stream);
- read->stream = NULL;
- if (read->dnload) gf_term_download_del(read->dnload);
- read->dnload = NULL;
-
- if (read->data) gf_free(read->data);
- read->data = NULL;
+ AACReader *read;
+ if (!plug)
+ return GF_BAD_PARAM;
+ read = plug->priv;
+ if (!read)
+ return GF_BAD_PARAM;
gf_term_on_disconnect(read->service, NULL, GF_OK);
+ AAC_Reader_del( read );
+ plug->priv = NULL;
return GF_OK;
}
AACReader *read = plug->priv;
e = GF_SERVICE_ERROR;
- if (read->ch==channel) goto exit;
+ if (read->ch==channel) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[AAC_IN] read->ch==channel = %p, GF_SERVICE_ERROR\n", channel));
+ goto exit;
+ }
e = GF_STREAM_NOT_FOUND;
if (strstr(url, "ES_ID")) {
- sscanf(url, "ES_ID=%d", &ES_ID);
+ sscanf(url, "ES_ID=%ud", &ES_ID);
}
/*URL setup*/
else if (!read->ch && AAC_CanHandleURL(plug, url)) ES_ID = 1;
GF_Err e = GF_STREAM_NOT_FOUND;
if (read->ch == channel) {
+ AAC_disconnect_from_http_and_free(read);
read->ch = NULL;
- if (read->data) gf_free(read->data);
+ if (read->data)
+ gf_free(read->data);
read->data = NULL;
e = GF_OK;
}
read->current_time = 0;
if (read->stream) gf_f64_seek(read->stream, 0, SEEK_SET);
- if (read->ch == com->base.on_channel) {
- read->done = 0;
+ if (read->ch == com->base.on_channel) {
+ read->done = 0;
/*PLAY after complete download, estimate duration*/
if (!read->is_remote && !read->duration) {
AAC_ConfigureFromFile(read);
read->start_range = 0;
}
}
-
- read->sl_hdr.compositionTimeStamp = read->current_time;
+ read->sl_hdr.compositionTimeStamp = read->current_time;
+ assert( !read->data);
read->data = gf_malloc(sizeof(char) * (read->data_size+read->pad_bytes));
gf_bs_read_data(bs, read->data, read->data_size);
if (read->pad_bytes) memset(read->data + read->data_size, 0, sizeof(char) * read->pad_bytes);
GF_InputService *AAC_Load()
{
- AACReader *reader;
+
GF_InputService *plug = gf_malloc(sizeof(GF_InputService));
memset(plug, 0, sizeof(GF_InputService));
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC AAC Reader", "gpac distribution")
/*we do support pull mode*/
plug->ChannelGetSLP = AAC_ChannelGetSLP;
plug->ChannelReleaseSLP = AAC_ChannelReleaseSLP;
-
- reader = gf_malloc(sizeof(AACReader));
- memset(reader, 0, sizeof(AACReader));
- plug->priv = reader;
+ plug->RegisterMimeTypes = AAC_RegisterMimeTypes;
+ plug->priv = AAC_Reader_new();
return plug;
}
void AAC_Delete(void *ifce)
{
+ AACReader *read;
GF_InputService *plug = (GF_InputService *) ifce;
- AACReader *read = plug->priv;
- gf_free(read);
+ if (!plug)
+ return;
+ read = plug->priv;
+ if (read){
+ AAC_Reader_del(read);
+ plug->priv = NULL;
+ }
gf_free(plug);
}
#endif
+#ifndef DONT_USE_TERMINAL_MODULE_API
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_AV_PARSERS
#endif
GF_EXPORT
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
{
#ifndef GPAC_DISABLE_AV_PARSERS
if (InterfaceType == GF_NET_CLIENT_INTERFACE) return (GF_BaseInterface *)AAC_Load();
#endif
}
}
+#endif
+#endif
#include <gpac/constants.h>
#include <gpac/avparse.h>
+
typedef struct
{
faacDecHandle codec;
static GF_Err FAAD_AttachStream(GF_BaseDecoder *ifcg, GF_ESD *esd)
{
+ s8 Test;
#ifndef GPAC_DISABLE_AV_PARSERS
GF_Err e;
GF_M4ADecSpecInfo a_cfg;
e = gf_m4a_get_config((unsigned char *) esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg);
if (e) return e;
#endif
-
- if ( (s8) faacDecInit2(ctx->codec, (unsigned char *) esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, (unsigned long *) &ctx->sample_rate, (u8 *) &ctx->num_channels) < 0)
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("ctx->sample_rate:%d ctx->num_channels:%d esd->decoderConfig->decoderSpecificInfo->dataLength:%d esd->decoderConfig->decoderSpecificInfo->data:%s \n",ctx->sample_rate,ctx->num_channels,esd->decoderConfig->decoderSpecificInfo->dataLength,esd->decoderConfig->decoderSpecificInfo->data));
+ Test = (s8) faacDecInit2(ctx->codec, (unsigned char *) esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, (unsigned long *) &ctx->sample_rate, (u8 *) &ctx->num_channels);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("Test: %d \n",Test));
+ if ( Test < 0)
{
#ifndef GPAC_DISABLE_AV_PARSERS
s8 res;
case GF_M4A_AAC_LTP:
case GF_M4A_AAC_SBR:
case GF_M4A_AAC_PS:
- GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[FAAD] Error initializing stream %d\n", esd->ESID));
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[FAAD] 1 Error initializing stream %d\n", esd->ESID));
return GF_NOT_SUPPORTED;
default:
break;
if (res < 0)
#endif
{
- GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[FAAD] Error initializing stream %d\n", esd->ESID));
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[FAAD] 2 Error initializing stream %d\n", esd->ESID));
return GF_NOT_SUPPORTED;
}
}
return "FAAD2 " FAAD2_VERSION;
}
-static Bool FAAD_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool FAAD_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
#ifndef GPAC_DISABLE_AV_PARSERS
GF_M4ADecSpecInfo a_cfg;
#endif
/*audio decs*/
if (StreamType != GF_STREAM_AUDIO) return 0;
+ /*media type query*/
+ if (!esd) return 1;
- switch (ObjectType) {
+ switch (esd->decoderConfig->objectTypeIndication) {
/*MPEG2 aac*/
case GPAC_OTI_AUDIO_AAC_MPEG2_MP:
case GPAC_OTI_AUDIO_AAC_MPEG2_LCP:
/*MPEG4 aac*/
case GPAC_OTI_AUDIO_AAC_MPEG4:
break;
- /*cap query*/
- case 0:
- return 1;
default:
return 0;
}
- if (!decSpecInfoSize || !decSpecInfo) return 0;
+ if (!esd->decoderConfig->decoderSpecificInfo || !esd->decoderConfig->decoderSpecificInfo->data) return 0;
#ifndef GPAC_DISABLE_AV_PARSERS
- if (gf_m4a_get_config((unsigned char *) decSpecInfo, decSpecInfoSize, &a_cfg) != GF_OK) return 0;
+ if (gf_m4a_get_config((unsigned char *) esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg) != GF_OK) return 0;
/*BSAC not supported*/
if (a_cfg.base_object_type == GF_M4A_ER_BSAC) return 0;
#endif
vpath %.c $(SRC_PATH)/modules/ac3_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#local faad lib
ifeq ($(CONFIG_FAAD), local)
EXTRALIBS+=-L../../extra_lib/lib/gcc
-CFLAGS+= -I$(LOCAL_INC_PATH)
+CFLAGS+= -I"$(LOCAL_INC_PATH)"
endif
EXTRALIBS+= -la52
endif
char *icy_track_name;
} AC3Reader;
+static const char * AC3_MIMES[] = { "audio/ac3", "audio/x-ac3", NULL };
+
+static const char * AC3_EXTS = "ac3";
+
+static const char * AC3_DESC = "AC3 Music";
+
+static u32 AC3_RegisterMimeTypes(const GF_InputService *plug)
+{
+ u32 i;
+ for (i = 0 ; AC3_MIMES[i]; i++)
+ gf_term_register_mime_type(plug, AC3_MIMES[i], AC3_EXTS, AC3_DESC);
+ return i;
+}
+
static Bool AC3_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ u32 i;
sExt = strrchr(url, '.');
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "audio/ac3", "ac3", "AC3 Music", sExt)) return 1;
- if (gf_term_check_extension(plug, "audio/x-ac3", "ac3", "AC3 Music", sExt)) return 1;
+ for (i = 0 ; AC3_MIMES[i]; i++){
+ if (gf_term_check_extension(plug, AC3_MIMES[i], AC3_EXTS, AC3_DESC, sExt)) return 1;
+ }
return 0;
}
}
}
-static void AC3_OnLiveData(AC3Reader *read, char *data, u32 data_size)
+static void AC3_OnLiveData(AC3Reader *read, const char *data, u32 data_size)
{
u64 pos;
Bool sync;
if (read->data_size<=7) return;
bs = gf_bs_new(read->data, read->data_size, GF_BITSTREAM_READ);
- hdr.framesize = pos = 0;
+ hdr.framesize = 0;
+ pos = 0;
while (gf_ac3_parser_bs(bs, &hdr, 0)) {
pos = gf_bs_get_position(bs);
read->sl_hdr.accessUnitStartFlag = 1;
if (pos) {
char *d;
- read->data_size -= pos;
+ read->data_size -= (u32) pos;
d = gf_malloc(sizeof(char) * read->data_size);
memcpy(d, read->data + pos, sizeof(char) * read->data_size);
gf_free(read->data);
e = GF_STREAM_NOT_FOUND;
if (strstr(url, "ES_ID")) {
- sscanf(url, "ES_ID=%d", &ES_ID);
+ sscanf(url, "ES_ID=%ud", &ES_ID);
}
/*URL setup*/
else if (!read->ch && AC3_CanHandleURL(plug, url)) ES_ID = 1;
memset(plug, 0, sizeof(GF_InputService));
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC AC3 Reader", "gpac distribution")
+ plug->RegisterMimeTypes = AC3_RegisterMimeTypes;
plug->CanHandleURL = AC3_CanHandleURL;
plug->ConnectService = AC3_ConnectService;
plug->CloseService = AC3_CloseService;
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
u8 num_channels;
/*no support for scalability in FAAD yet*/
u16 ES_ID;
-
+
char ch_reorder[16];
} AC3Dec;
static GF_Err AC3_AttachStream(GF_BaseDecoder *ifcg, GF_ESD *esd)
{
A52CTX();
-
+
if (ctx->ES_ID && ctx->ES_ID!=esd->ESID) return GF_NOT_SUPPORTED;
GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("[A52] Attaching stream %d\n", esd->ESID));
case A52_DOLBY:
break;
case A52_3F:
- capability->cap.valueInt = GF_AUDIO_CH_FRONT_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT;
+ capability->cap.valueInt = GF_AUDIO_CH_FRONT_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT;
break;
case A52_2F1R:
- capability->cap.valueInt = GF_AUDIO_CH_BACK_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT;
+ capability->cap.valueInt = GF_AUDIO_CH_BACK_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT;
break;
case A52_3F1R:
- capability->cap.valueInt = GF_AUDIO_CH_FRONT_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT | GF_AUDIO_CH_BACK_CENTER;
+ capability->cap.valueInt = GF_AUDIO_CH_FRONT_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT | GF_AUDIO_CH_BACK_CENTER;
break;
case A52_2F2R:
- capability->cap.valueInt = GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT | GF_AUDIO_CH_BACK_LEFT | GF_AUDIO_CH_BACK_RIGHT;
+ capability->cap.valueInt = GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT | GF_AUDIO_CH_BACK_LEFT | GF_AUDIO_CH_BACK_RIGHT;
break;
case A52_3F2R:
- capability->cap.valueInt = GF_AUDIO_CH_FRONT_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT | GF_AUDIO_CH_BACK_LEFT | GF_AUDIO_CH_BACK_RIGHT;
+ capability->cap.valueInt = GF_AUDIO_CH_FRONT_CENTER | GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT | GF_AUDIO_CH_BACK_LEFT | GF_AUDIO_CH_BACK_RIGHT;
break;
}
if (ctx->flags & A52_LFE)
- capability->cap.valueInt |= GF_AUDIO_CH_LFE;
+ capability->cap.valueInt |= GF_AUDIO_CH_LFE;
break;
default:
capability->cap.valueInt = 0;
2, 1, 2, 3, 3, 4, 4, 5
};
-static GF_Err AC3_ProcessData(GF_MediaDecoder *ifcg,
+static GF_Err AC3_ProcessData(GF_MediaDecoder *ifcg,
char *inBuffer, u32 inBufferLength,
u16 ES_ID,
char *outBuffer, u32 *outBufferLength,
return "LIBA52 AC3 Decoder";
}
-static Bool AC3_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool AC3_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
- /*audio decs*/
+ /*audio decs*/
if (StreamType != GF_STREAM_AUDIO) return 0;
- switch (ObjectType) {
+ /*media type query*/
+ if (!esd) return 1;
+ switch (esd->decoderConfig->objectTypeIndication) {
case 0xA5:
- case 0:
return 1;
}
return 0;
ifce->privateStack = dec;
- /*setup our own interface*/
+ /*setup our own interface*/
ifce->AttachStream = AC3_AttachStream;
ifce->DetachStream = AC3_DetachStream;
ifce->GetCapabilities = AC3_GetCapabilities;
void DeleteAC3Dec(GF_BaseDecoder *ifcg)
{
- A52CTX();
- if (ctx->codec) a52_free(ctx->codec);
- gf_free(ctx);
+ AC3Dec *ctx;
+ if (!ifcg)
+ return;
+ ctx = (AC3Dec *) ifcg->privateStack;
+ if (ctx){
+ if (ctx->codec)
+ a52_free(ctx->codec);
+ ctx->codec = NULL;
+ gf_free(ctx);
+ ifcg->privateStack = NULL;
+ }
gf_free(ifcg);
}
vpath %.c $(SRC_PATH)/modules/alsa
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include $(OSS_CFLAGS)
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(OSS_CFLAGS)
LDFLAGS+=$(OSS_LDFLAGS)
ifeq ($(DEBUGBUILD), yes)
vpath %.c $(SRC_PATH)/modules/amr_dec
#note: __MSDOS__ defined is the same cfg as linux. There may be some pbs on other platforms, to check...
-CFLAGS= $(OPTFLAGS) -w -I$(SRC_PATH)/include -D__MSDOS__ -DMMS_IO -DWMOPS=0 -DVAD1
+CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include" -D__MSDOS__ -DMMS_IO -DWMOPS=0 -DVAD1
ifeq ($(DEBUGBUILD), yes)
/*include AMR stuff*/
-#include "amr_nb/sp_dec.h"
-#include "amr_nb/d_homing.h"
+//#include "amr_nb/sp_dec.h"
+//#include "amr_nb/d_homing.h"
/*remove AMR types to avoid any typedef warning/error*/
#undef Float
#undef Bool
#include <gpac/modules/service.h>
#include <gpac/constants.h>
-
/*default size in CU of composition memory for audio*/
#define DEFAULT_AUDIO_CM_SIZE 12
/*default critical size in CU of composition memory for audio*/
#define DEFAULT_AUDIO_CM_TRIGGER 4
+/*our own headers for AMR NB*/
+#if (defined(WIN32) || defined(_WIN32_WCE))
+#include "amr_nb_api.h"
+#if !defined(__GNUC__)
+#pragma comment(lib, "libamrnb")
+#endif
+#else
+#include "amr_nb/sp_dec.h"
+#include "amr_nb/d_homing.h"
+#endif
+
typedef struct
{
u32 out_size;
/*AMR NB state vars*/
- Speech_Decode_FrameState * speech_decoder_state;
+ __Speech_Decode_FrameState * speech_decoder_state;
enum RXFrameType rx_type;
enum Mode mode;
}
/* reset decoder if current frame is a homing frame */
if (ctx->reset_flag != 0) {
- Speech_Decode_Frame_reset(ctx->speech_decoder_state);
+ Speech_Decode_Frame_reset(&ctx->speech_decoder_state);
}
ctx->reset_flag_old = ctx->reset_flag;
}
-static u32 AMR_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static u32 AMR_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
+ char *dsi;
/*we handle audio only*/
- if (!ObjectType) return (StreamType==GF_STREAM_AUDIO) ? 1 : 0;
-
- /*audio dec*/
- if (!decSpecInfo || (StreamType != GF_STREAM_AUDIO) || (ObjectType != GPAC_OTI_MEDIA_GENERIC)) return 0;
- if (decSpecInfoSize<4) return 0;
- if (!strnicmp(decSpecInfo, "samr", 4) || !strnicmp(decSpecInfo, "amr ", 4)) return 1;
+ if (StreamType!=GF_STREAM_AUDIO) return 0;
+ /*media type query*/
+ if (!esd) return 1;
+
+ if (esd->decoderConfig->objectTypeIndication != GPAC_OTI_MEDIA_GENERIC) return 0;
+ dsi = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data : NULL;
+ if (!dsi) return 0;
+ if (esd->decoderConfig->decoderSpecificInfo->dataLength < 4) return 0;
+
+ if (!strnicmp(dsi, "samr", 4) || !strnicmp(dsi, "amr ", 4)) return 1;
return 0;
}
--- /dev/null
+#ifndef _AMR_NB_API_H\r
+#define _AMR_NB_API_H\r
+\r
+enum Mode { MR475 = 0,
+ MR515,
+ MR59,
+ MR67,
+ MR74,
+ MR795,
+ MR102,
+ MR122,
+
+ MRDTX,
+
+ N_MODES /* number of (SPC) modes */
+
+ };
+\r
+enum RXFrameType { RX_SPEECH_GOOD = 0,
+ RX_SPEECH_DEGRADED,
+ RX_ONSET,
+ RX_SPEECH_BAD,
+ RX_SID_FIRST,
+ RX_SID_UPDATE,
+ RX_SID_BAD,
+ RX_NO_DATA,
+ RX_N_FRAMETYPES /* number of frame types */
+};
+\r
+typedef struct{
+ void* decoder_amrState;
+ void* post_state;
+ void* postHP_state;
+ enum Mode prev_mode;
+
+ int complexityCounter; /* Only for complexity computation */
+} __Speech_Decode_FrameState;
+\r
+int Speech_Decode_Frame_init (__Speech_Decode_FrameState **st, char *id);
+void Speech_Decode_Frame_exit (__Speech_Decode_FrameState **st);
+void Speech_Decode_Frame (__Speech_Decode_FrameState *st, enum Mode mode, short *serial, enum RXFrameType frame_type, short *synth);\r
+int Speech_Decode_Frame_reset (__Speech_Decode_FrameState **st);\r
+
+s16 decoder_homing_frame_test_first (s16 input_frame[], enum Mode mode);
+s16 decoder_homing_frame_test (s16 input_frame[], enum Mode mode);
+\r
+#ifdef MMS_IO\r
+\r
+enum RXFrameType UnpackBits (\r
+ s8 q, /* i : Q-bit (i.e. BFI) */\r
+ s16 ft, /* i : frame type (i.e. mode) */\r
+ u8 packed_bits[], /* i : sorted & packed bits */\r
+ enum Mode *mode, /* o : mode information */\r
+ s16 bits[] /* o : serial bits */\r
+);\r
+#endif\r
+\r
+#define EHF_MASK 0x0008 /* encoder homing frame pattern */
+#define L_FRAME 160 /* Frame size */
+
+#endif //_AMR_NB_API_H
\ No newline at end of file
vpath %.c $(SRC_PATH)/modules/amr_float_dec
#note: __MSDOS__ defined is the same cfg as linux. There may be some pbs on other platforms, to check...
-CFLAGS= $(OPTFLAGS) -w -I$(SRC_PATH)/include -D__MSDOS__
+CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include" -D__MSDOS__
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g -DDEBUG
--- /dev/null
+#ifndef _AMR_API_H\r
+#define _AMR_API_H\r
+\r
+/*AMR*/\r
+void Decoder_Interface_Decode( void *st,\r
+#ifndef ETSI\r
+ unsigned char *bits,\r
+#else\r
+ short *bits,\r
+#endif\r
+ short *synth, int bfi );\r
+\r
+void *Decoder_Interface_init( void );\r
+\r
+\r
+void Decoder_Interface_exit( void *state );\r
+
+
+
+/*AMR WB*/
+
+\r
+#define NB_SERIAL_MAX 61 /* max serial size */\r
+#define L_FRAME16k 320 /* Frame size at 16kHz */\r
+\r
+#define _good_frame 0\r
+#define _bad_frame 1\r
+#define _lost_frame 2\r
+#define _no_frame 3\r
+\r
+void D_IF_decode(void *st, unsigned char *bits, short *synth, long bfi);\r
+void * D_IF_init(void);\r
+void D_IF_exit(void *state);\r
+
+#endif //_AMR_API_H
\ No newline at end of file
#include <gpac/modules/service.h>
#include <gpac/constants.h>
-#ifdef GPAC_HAS_AMR_FT
+#if (defined(WIN32) || defined (_WIN32_WCE)) && defined(GPAC_HAS_AMR_FT)
/*AMR NB*/
+#include "amr_api.h"
+
+#ifndef GPAC_HAS_AMR_FT_WB
+#define GPAC_HAS_AMR_FT_WB
+#endif
+
+#if !defined(__GNUC__)
+#pragma comment(lib, "libamrfloat")
+#endif
+
+#else
+
+#ifdef GPAC_HAS_AMR_FT
+/*AMR WB*/
#include "amr_nb_ft/interf_dec.h"
#endif
#include "amr_wb_ft/dec_if.h"
#endif
+#endif
+
/*default size in CU of composition memory for audio*/
#define DEFAULT_AUDIO_CM_SIZE 12
/*default critical size in CU of composition memory for audio*/
offset = 0;
if (ctx->is_amr_wb) {
#ifdef GPAC_HAS_AMR_FT_WB
- D_IF_decode(ctx->wb_destate, inBuffer, (Word16 *) outBuffer, 0);
+ D_IF_decode(ctx->wb_destate, inBuffer, (s16 *) outBuffer, 0);
*outBufferLength += 320*2;
outBuffer += 320*2;
offset = GF_AMR_WB_FRAME_SIZE[ft] + 1;
#endif
} else {
#ifdef GPAC_HAS_AMR_FT
- Decoder_Interface_Decode(ctx->nb_destate, inBuffer, (Word16 *) outBuffer, 0);
+ Decoder_Interface_Decode(ctx->nb_destate, inBuffer, (s16 *) outBuffer, 0);
*outBufferLength += 160*2;
outBuffer += 160*2;
offset = GF_AMR_FRAME_SIZE[ft] + 1;
}
-static u32 AMR_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static u32 AMR_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
+ char *dsi;
/*we handle audio only*/
- if (!ObjectType) return (StreamType==GF_STREAM_AUDIO) ? 1 : 0;
+ if (StreamType!=GF_STREAM_AUDIO) return 0;
+ /*media type query*/
+ if (!esd) return 1;
- /*audio dec*/
- if (!decSpecInfo || (StreamType != GF_STREAM_AUDIO) || (ObjectType != GPAC_OTI_MEDIA_GENERIC)) return 0;
- if (decSpecInfoSize<4) return 0;
+ if (esd->decoderConfig->objectTypeIndication != GPAC_OTI_MEDIA_GENERIC) return 0;
+ dsi = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data : NULL;
+ if (!dsi) return 0;
+ if (esd->decoderConfig->decoderSpecificInfo->dataLength < 4) return 0;
#ifdef GPAC_HAS_AMR_FT
- if (!strnicmp(decSpecInfo, "samr", 4) || !strnicmp(decSpecInfo, "amr ", 4)) return 1;
+ if (!strnicmp(dsi, "samr", 4) || !strnicmp(dsi, "amr ", 4)) return 1;
#endif
#ifdef GPAC_HAS_AMR_FT_WB
- if (!strnicmp(decSpecInfo, "sawb", 4)) return 1;
+ if (!strnicmp(dsi, "sawb", 4)) return 1;
#endif
return 0;
}
vpath %.c $(SRC_PATH)/modules/audio_filter
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/modules/bifs_dec
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef GPAC_DISABLE_BIFS
-typedef struct
+typedef struct
{
GF_Scene *pScene;
GF_Terminal *app;
if (priv->codec) return GF_BAD_PARAM;
priv->pScene = scene;
priv->app = scene->root_od->term;
-
+
priv->codec = gf_bifs_decoder_new(scene->graph, 0);
gf_bifs_decoder_set_extraction_path(priv->codec, (char *) gf_modules_get_option((GF_BaseInterface *)plug, "General", "CacheDirectory"), scene->root_od->net_service->url);
/*ignore all size info on anim streams*/
return GF_OK;
}
-static GF_Err BIFS_ProcessData(GF_SceneDecoder*plug, char *inBuffer, u32 inBufferLength,
+static GF_Err BIFS_ProcessData(GF_SceneDecoder*plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 AU_time, u32 mmlevel)
{
Double ts_offset;
e = gf_bifs_decode_au(priv->codec, ES_ID, inBuffer, inBufferLength, ts_offset);
/*if scene not attached do it*/
- gf_scene_attach_to_compositor(priv->pScene);
+ if (e == GF_OK) {
+ gf_scene_attach_to_compositor(priv->pScene);
+ }
return e;
}
-Bool BIFS_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool BIFS_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
BIFSPriv *priv = (BIFSPriv *)ifce->privateStack;
if (StreamType!=GF_STREAM_SCENE) return 0;
- switch (ObjectType) {
- case 0x00:
- return 1;
+ /*media type query*/
+ if (!esd) return 1;
+
+ switch (esd->decoderConfig->objectTypeIndication) {
case GPAC_OTI_SCENE_BIFS:
case GPAC_OTI_SCENE_BIFS_V2:
- /*Streams with this value with a StreamType indicating a systems stream (values 1,2,3, 6, 7, 8, 9)
+ /*Streams with this value with a StreamType indicating a systems stream (values 1,2,3, 6, 7, 8, 9)
shall be treated as if the ObjectTypeIndication had been set to 0x01*/
- case 0xFF:
+ case 0xFF:
priv->PL = PL;
return 1;
default:
void DeleteBIFSDec(GF_BaseDecoder *plug)
{
- BIFSPriv *priv = (BIFSPriv *)plug->privateStack;
- /*in case something went wrong*/
- if (priv->codec) gf_bifs_decoder_del(priv->codec);
- gf_free(priv);
+ BIFSPriv *priv;
+ if (!plug)
+ return;
+ priv = (BIFSPriv *)plug->privateStack;
+ if (priv){
+ /*in case something went wrong*/
+ if (priv->codec) gf_bifs_decoder_del(priv->codec);
+ priv->codec = NULL;
+ gf_free(priv);
+ plug->privateStack = NULL;
+ }
gf_free(plug);
}
{
BIFSPriv *priv;
GF_SceneDecoder *tmp;
-
+
GF_SAFEALLOC(tmp, GF_SceneDecoder);
if (!tmp) return NULL;
GF_SAFEALLOC(priv, BIFSPriv);
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_BIFS
vpath %.c $(SRC_PATH)/modules/ctx_load
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / GPAC Scene Context loader module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef GPAC_DISABLE_VRML
-typedef struct
+typedef struct
{
GF_Scene *scene;
GF_Terminal *app;
GF_Scene *scene = (GF_Scene *) gf_node_get_private(node);
M_Conditional*c = (M_Conditional*)node;
/*always apply in parent graph to handle protos correctly*/
- if (!c->reverseActivate)
+ if (!c->reverseActivate)
CTXLoad_ExecuteConditional(c, scene);
}
return GF_NON_COMPLIANT_BITSTREAM;
}
/*main dummy stream we need a dsi*/
- if (!esd->decoderConfig->decoderSpecificInfo)
+ if (!esd->decoderConfig->decoderSpecificInfo)
return GF_NON_COMPLIANT_BITSTREAM;
bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
priv->file_size = gf_bs_read_u32(bs);
priv->load_flags = 0;
priv->base_stream_id = esd->ESID;
-
+
CTXLoad_Setup(plug);
priv->progressive_support = 0;
if (!ext) return GF_OK;
ext++;
- if (!stricmp(ext, "xmt") || !stricmp(ext, "xmtz") || !stricmp(ext, "xmta")
+ if (!stricmp(ext, "xmt") || !stricmp(ext, "xmtz") || !stricmp(ext, "xmta")
|| !stricmp(ext, "x3d") || !stricmp(ext, "x3dz")
) {
ext = gf_modules_get_option((GF_BaseInterface *)plug, "SAXLoader", "Progressive");
}
}
-static GF_Err CTXLoad_ProcessData(GF_SceneDecoder *plug, char *inBuffer, u32 inBufferLength,
+static GF_Err CTXLoad_ProcessData(GF_SceneDecoder *plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 stream_time, u32 mmlevel)
{
GF_Err e = GF_OK;
if (stream_time==(u32)-1) {
/*seek on root stream: destroy the context manager and reload it. We cannot seek on the main stream
because commands may have changed node attributes/children and we d'ont track the initial value*/
- if (priv->base_stream_id == ES_ID) {
+ if (priv->load_flags && (priv->base_stream_id == ES_ID)) {
if (priv->src) fclose(priv->src);
priv->src = NULL;
gf_sm_load_done(&priv->load);
priv->file_pos = 0;
- /*this will call detach scene*/
- gf_scene_disconnect(priv->scene, 0);
+ /*queue scene for detach*/
+ gf_term_lock_media_queue(priv->scene->root_od->term, 1);
+ priv->scene->root_od->action_type = GF_ODM_ACTION_SCENE_RECONNECT;
+ gf_list_add(priv->scene->root_od->term->media_queue, priv->scene->root_od);
+ gf_term_lock_media_queue(priv->scene->root_od->term, 0);
+
return CTXLoad_Setup((GF_BaseDecoder *)plug);
}
i=0;
gf_sg_set_scene_time_callback(priv->scene->graph, CTXLoad_GetVRMLTime);
}
}
- }
+ }
/*load the rest*/
else {
priv->load_flags = 2;
e = gf_sm_load_run(&priv->load);
gf_sm_load_done(&priv->load);
+ /*in case this was not set in the first pass (XMT)*/
+ gf_sg_set_scene_size_info(priv->scene->graph, priv->ctx->scene_width, priv->ctx->scene_height, priv->ctx->is_pixel_metrics);
}
if (e<0) {
while ((au = (GF_AUContext *)gf_list_enum(sc->AUs, &j))) {
u32 au_time = (u32) (au->timing*1000/sc->timeScale);
- if (au_time > stream_time)
+ if (au_time > stream_time)
break;
if (au->flags & GF_SM_AU_RAP) last_rap = j-1;
}
gf_sg_command_del(com);
}
}
- }
+ }
else if (sc->streamType == GF_STREAM_OD) {
/*apply the commands*/
while (gf_list_count(au->commands)) {
}
}
-Bool CTXLoad_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool CTXLoad_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
if (StreamType==GF_STREAM_PRIVATE_SCENE) {
- switch (ObjectType) {
+ /*media type query*/
+ if (!esd) return 1;
+ switch (esd->decoderConfig->objectTypeIndication) {
case GPAC_OTI_PRIVATE_SCENE_GENERIC:
return 1;
/*LASeR ML: we use this plugin since it has command handling*/
void DeleteContextLoader(GF_BaseDecoder *plug)
{
- CTXLoadPriv *priv = (CTXLoadPriv *)plug->privateStack;
- if (priv->file_name) gf_free(priv->file_name);
- assert(!priv->ctx);
- gf_list_del(priv->files_to_delete);
- gf_free(priv);
+ CTXLoadPriv *priv;
+ if (!plug)
+ return;
+ priv = (CTXLoadPriv *)plug->privateStack;
+ if (priv){
+ if (priv->file_name)
+ gf_free(priv->file_name);
+ priv->file_name = NULL;
+ assert(!priv->ctx);
+ if (priv->files_to_delete)
+ gf_list_del(priv->files_to_delete);
+ priv->files_to_delete = NULL;
+ gf_free(priv);
+ plug->privateStack = NULL;
+ }
gf_free(plug);
}
{
CTXLoadPriv *priv;
GF_SceneDecoder *tmp;
-
+
GF_SAFEALLOC(tmp, GF_SceneDecoder);
GF_SAFEALLOC(priv, CTXLoadPriv);
priv->files_to_delete = gf_list_new();
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_VRML
vpath %.c $(SRC_PATH)/modules/demo_is
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/modules/directfb_out
CFLAGS= $(OPTFLAGS)
-CFLAGS+=-I$(SRC_PATH)/include -I$(DIRECTFB_INC_PATH)
-LDFLAGS+=-ldirectfb-1.4 -lfusion-1.4 -ldirect-1.4
+CFLAGS+=-I"$(SRC_PATH)/include" -I$(DIRECTFB_INC_PATH)
+LDFLAGS+=-ldirectfb -lfusion -ldirect
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
int argc;
char **argv = {"toto"};
+//static const PredefineKeyID(keyIDs);
+
u32 DirectFBVid_TranslatePixelFormatToGPAC(u32 dfbpf)
{
switch (dfbpf) {
}
}
-u32 DirectFBVid_TranslatePixelFormatFromGPAC(u32 dfbpf)
+u32 DirectFBVid_TranslatePixelFormatFromGPAC(u32 gpacpf)
{
- switch (dfbpf) {
+ switch (gpacpf) {
case GF_PIXEL_RGB_565: return DSPF_RGB16;
case GF_PIXEL_RGB_555 : return DSPF_RGB555;
+ case GF_PIXEL_BGR_24 : return DSPF_RGB24;
case GF_PIXEL_RGB_24 : return DSPF_RGB24;
case GF_PIXEL_RGB_32 : return DSPF_RGB32;
case GF_PIXEL_ARGB: return DSPF_ARGB;
+ case GF_PIXEL_RGBA: return DSPF_ARGB;
+ case GF_PIXEL_BGRA: return DSPF_ARGB;
case GF_PIXEL_YUY2 : return DSPF_YUY2;
case GF_PIXEL_YV12 : return DSPF_YV12;
- default: return 0;
+ default:
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[DirectFB] pixel format %s not supported\n", gf_4cc_to_str(gpacpf)));
+ return 0;
}
}
+static DFBEnumerationResult enum_input_device(DFBInputDeviceID device_id, DFBInputDeviceDescription desc, void *data )
+{
+ DeviceInfo **devices = data;
+ DeviceInfo *device;
+
+ device = malloc( sizeof(DeviceInfo) );
+
+ device->device_id = device_id;
+ device->desc = desc;
+ device->next = *devices;
+
+ *devices = device;
+
+ return GF_OK;
+}
+
+static void directfb_translate_key(DFBInputDeviceKeySymbol DirectFBkey, GF_EventKey *evt)
+{
+ evt->flags = 0;
+ evt->hw_code = DirectFBkey;
+ switch (DirectFBkey){
+ case DIKS_BACKSPACE:
+ evt->key_code = GF_KEY_BACKSPACE; break;
+ case DIKS_RETURN:
+ evt->key_code = GF_KEY_ENTER; break;
+ case DIKS_CANCEL:
+ evt->key_code = GF_KEY_CANCEL; break;
+ case DIKS_ESCAPE:
+ evt->key_code = GF_KEY_ESCAPE; break;
+ case DIKS_SPACE:
+ evt->key_code = GF_KEY_SPACE; break;
+ case DIKS_EXCLAMATION_MARK:
+ evt->key_code = GF_KEY_EXCLAMATION; break;
+ case DIKS_QUOTATION:
+ evt->key_code = GF_KEY_QUOTATION; break;
+ case DIKS_NUMBER_SIGN:
+ evt->key_code = GF_KEY_NUMBER; break;
+ case DIKS_DOLLAR_SIGN:
+ evt->key_code = GF_KEY_DOLLAR; break;
+#if 0
+ case DIKS_PERCENT_SIGN:
+ evt->key_code = GF_KEY_PERCENT; break;
+#endif
+ case DIKS_AMPERSAND:
+ evt->key_code = GF_KEY_AMPERSAND; break;
+ case DIKS_APOSTROPHE:
+ evt->key_code = GF_KEY_APOSTROPHE; break;
+ case DIKS_PARENTHESIS_LEFT:
+ evt->key_code = GF_KEY_LEFTPARENTHESIS; break;
+ case DIKS_PARENTHESIS_RIGHT:
+ evt->key_code = GF_KEY_RIGHTPARENTHESIS; break;
+ case DIKS_ASTERISK:
+ evt->key_code = GF_KEY_STAR; break;
+ case DIKS_PLUS_SIGN:
+ evt->key_code = GF_KEY_PLUS; break;
+ case DIKS_COMMA:
+ evt->key_code = GF_KEY_COMMA; break;
+ case DIKS_MINUS_SIGN:
+ evt->key_code = GF_KEY_HYPHEN; break;
+ case DIKS_PERIOD:
+ evt->key_code = GF_KEY_FULLSTOP; break;
+ case DIKS_SLASH:
+ evt->key_code = GF_KEY_SLASH; break;
+ case DIKS_0:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_0; break;
+ case DIKS_1:
+ //fprintf(stderr, "DIKS_1: %d\n", GF_KEY_1);
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_1; break;
+ case DIKS_2:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_2; break;
+ case DIKS_3:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_3; break;
+ case DIKS_4:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_4; break;
+ case DIKS_5:
+ // fprintf(stderr, "DIKS_5\n");
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_5; break;
+ case DIKS_6:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_6; break;
+ case DIKS_7:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_7; break;
+ case DIKS_8:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_8; break;
+ case DIKS_9:
+ evt->flags = GF_KEY_EXT_NUMPAD; evt->key_code = GF_KEY_9; break;
+ case DIKS_COLON:
+ evt->key_code = GF_KEY_COLON; break;
+ case DIKS_SEMICOLON:
+ evt->key_code = GF_KEY_SEMICOLON; break;
+ case DIKS_LESS_THAN_SIGN:
+ evt->key_code = GF_KEY_LESSTHAN; break;
+ case DIKS_EQUALS_SIGN:
+ evt->key_code = GF_KEY_EQUALS; break;
+ case DIKS_GREATER_THAN_SIGN:
+ evt->key_code = GF_KEY_GREATERTHAN; break;
+ case DIKS_QUESTION_MARK:
+ evt->key_code = GF_KEY_QUESTION; break;
+ case DIKS_AT:
+ evt->key_code = GF_KEY_AT; break;
+ case DIKS_CAPITAL_A:
+ evt->key_code = GF_KEY_A; break;
+ case DIKS_CAPITAL_B:
+ evt->key_code = GF_KEY_B; break;
+ case DIKS_CAPITAL_C:
+ evt->key_code = GF_KEY_C; break;
+ case DIKS_CAPITAL_D:
+ evt->key_code = GF_KEY_D; break;
+ case DIKS_CAPITAL_E:
+ evt->key_code = GF_KEY_E; break;
+ case DIKS_CAPITAL_F:
+ evt->key_code = GF_KEY_F; break;
+ case DIKS_CAPITAL_G:
+ evt->key_code = GF_KEY_G; break;
+ case DIKS_CAPITAL_H:
+ evt->key_code = GF_KEY_H; break;
+ case DIKS_CAPITAL_I:
+ evt->key_code = GF_KEY_I; break;
+ case DIKS_CAPITAL_J:
+ evt->key_code = GF_KEY_J; break;
+ case DIKS_CAPITAL_K:
+ evt->key_code = GF_KEY_K; break;
+ case DIKS_CAPITAL_L:
+ evt->key_code = GF_KEY_L; break;
+ case DIKS_CAPITAL_M:
+ evt->key_code = GF_KEY_M; break;
+ case DIKS_CAPITAL_N:
+ evt->key_code = GF_KEY_N; break;
+ case DIKS_CAPITAL_O:
+ evt->key_code = GF_KEY_O; break;
+ case DIKS_CAPITAL_P:
+ evt->key_code = GF_KEY_P; break;
+ case DIKS_CAPITAL_Q:
+ evt->key_code = GF_KEY_Q; break;
+ case DIKS_CAPITAL_R:
+ evt->key_code = GF_KEY_R; break;
+ case DIKS_CAPITAL_S:
+ evt->key_code = GF_KEY_S; break;
+ case DIKS_CAPITAL_T:
+ evt->key_code = GF_KEY_T; break;
+ case DIKS_CAPITAL_U:
+ evt->key_code = GF_KEY_U; break;
+ case DIKS_CAPITAL_V:
+ evt->key_code = GF_KEY_V; break;
+ case DIKS_CAPITAL_W:
+ evt->key_code = GF_KEY_W; break;
+ case DIKS_CAPITAL_X:
+ evt->key_code = GF_KEY_X; break;
+ case DIKS_CAPITAL_Y:
+ evt->key_code = GF_KEY_Y; break;
+ case DIKS_CAPITAL_Z:
+ evt->key_code = GF_KEY_Z; break;
+ case DIKS_SQUARE_BRACKET_LEFT:
+ evt->key_code = GF_KEY_LEFTSQUAREBRACKET; break;
+ case DIKS_BACKSLASH:
+ evt->key_code = GF_KEY_BACKSLASH; break;
+ case DIKS_SQUARE_BRACKET_RIGHT:
+ evt->key_code = GF_KEY_RIGHTSQUAREBRACKET; break;
+ case DIKS_CIRCUMFLEX_ACCENT:
+ evt->key_code = GF_KEY_CIRCUM; break;
+ case DIKS_UNDERSCORE:
+ evt->key_code = GF_KEY_UNDERSCORE; break;
+ case DIKS_GRAVE_ACCENT:
+ evt->key_code = GF_KEY_GRAVEACCENT; break;
+ case DIKS_CURLY_BRACKET_LEFT:
+ evt->key_code = GF_KEY_LEFTCURLYBRACKET; break;
+ case DIKS_VERTICAL_BAR:
+ evt->key_code = GF_KEY_PIPE; break;
+ case DIKS_CURLY_BRACKET_RIGHT:
+ evt->key_code = GF_KEY_RIGHTCURLYBRACKET; break;
+ case DIKS_TILDE: break;
+ case DIKS_DELETE:
+ evt->key_code = GF_KEY_DEL; break;
+ case DIKS_CURSOR_LEFT:
+ evt->key_code = GF_KEY_LEFT; break;
+ case DIKS_CURSOR_RIGHT:
+ evt->key_code = GF_KEY_RIGHT; break;
+ case DIKS_CURSOR_UP:
+ evt->key_code = GF_KEY_UP; break;
+ case DIKS_CURSOR_DOWN:
+ evt->key_code = GF_KEY_DOWN; break;
+ case DIKS_INSERT:
+ evt->key_code = GF_KEY_INSERT; break;
+ case DIKS_HOME:
+ evt->key_code = GF_KEY_HOME; break;
+ case DIKS_END:
+ evt->key_code = GF_KEY_END; break;
+ case DIKS_PAGE_UP:
+ evt->key_code = GF_KEY_PAGEUP; break;
+ case DIKS_PAGE_DOWN:
+ evt->key_code = GF_KEY_PAGEDOWN; break;
+ case DIKS_PRINT:
+ evt->key_code = GF_KEY_PRINTSCREEN; break;
+ case DIKS_SELECT:
+ evt->key_code = GF_KEY_SELECT; break;
+ case DIKS_CLEAR:
+ evt->key_code = GF_KEY_CLEAR; break;
+ case DIKS_HELP:
+ evt->key_code = GF_KEY_HELP; break;
+ case DIKS_ZOOM:
+ evt->key_code = GF_KEY_ZOOM; break;
+ case DIKS_VOLUME_UP:
+ evt->key_code = GF_KEY_VOLUMEUP; break;
+ case DIKS_VOLUME_DOWN:
+ evt->key_code = GF_KEY_VOLUMEDOWN; break;
+ case DIKS_MUTE:
+ evt->key_code = GF_KEY_VOLUMEMUTE; break;
+ case DIKS_PLAYPAUSE:
+ case DIKS_PAUSE:
+ evt->key_code = GF_KEY_MEDIAPLAYPAUSE; break;
+ case DIKS_PLAY:
+ evt->key_code = GF_KEY_PLAY; break;
+ case DIKS_STOP:
+ evt->key_code = GF_KEY_MEDIASTOP; break;
+ case DIKS_PREVIOUS:
+ evt->key_code = GF_KEY_MEDIAPREVIOUSTRACK; break;
+ case DIKS_F1:
+ evt->key_code = GF_KEY_F1; break;
+ case DIKS_F2:
+ evt->key_code = GF_KEY_F2; break;
+ case DIKS_F3:
+ evt->key_code = GF_KEY_F3; break;
+ case DIKS_F4:
+ evt->key_code = GF_KEY_F4; break;
+ case DIKS_F5:
+ evt->key_code = GF_KEY_F5; break;
+ case DIKS_F6:
+ evt->key_code = GF_KEY_F6; break;
+ case DIKS_F7:
+ evt->key_code = GF_KEY_F7; break;
+ case DIKS_F8:
+ evt->key_code = GF_KEY_F8; break;
+ case DIKS_F9:
+ evt->key_code = GF_KEY_F9; break;
+ case DIKS_F10:
+ evt->key_code = GF_KEY_F10; break;
+ case DIKS_F11:
+ evt->key_code = GF_KEY_F11; break;
+ case DIKS_F12:
+ evt->key_code = GF_KEY_F12; break;
+ case DIKS_SHIFT:
+ evt->key_code = GF_KEY_SHIFT; break;
+ case DIKS_CONTROL:
+ evt->key_code = GF_KEY_CONTROL; break;
+ case DIKS_ALT:
+ evt->key_code = GF_KEY_ALT; break;
+ case DIKS_ALTGR:
+ evt->key_code = GF_KEY_ALTGRAPH; break;
+ case DIKS_META:
+ evt->key_code = GF_KEY_META; break;
+ case DIKS_CAPS_LOCK:
+ evt->key_code = GF_KEY_CAPSLOCK; break;
+ case DIKS_NUM_LOCK:
+ evt->key_code = GF_KEY_NUMLOCK; break;
+ case DIKS_SCROLL_LOCK:
+ evt->key_code = GF_KEY_SCROLL; break;
+ case DIKS_FAVORITES:
+ evt->key_code = GF_KEY_BROWSERFAVORITES; break;
+ case DIKS_CUSTOM0:
+ evt->key_code = GF_KEY_BROWSERREFRESH; break;
+ case DIKS_MENU:
+ evt->key_code = GF_KEY_BROWSERHOME; break;
+ case DIKS_POWER:
+ evt->key_code = GF_KEY_ENTER; break;
+ case DIKS_RED:
+ evt->key_code = GF_KEY_TAB; break;
+ case DIKS_GREEN:
+ evt->key_code = GF_KEY_CANCEL; break;
+ case DIKS_YELLOW:
+ evt->key_code = GF_KEY_COPY; break;
+ case DIKS_BLUE:
+ evt->key_code = GF_KEY_CUT; break;
+ case DIKS_MODE:
+ evt->key_code = GF_KEY_MODECHANGE; break;
+ case DIKS_BACK:
+ evt->key_code = GF_KEY_BROWSERBACK; break;
+ case DIKS_TV:
+ evt->key_code = GF_KEY_CLEAR; break;
+ case DIKS_OK:
+ evt->key_code = GF_KEY_SELECT; break;
+ case DIKS_REWIND:
+ evt->key_code = GF_KEY_BROWSERBACK; break;
+ case DIKS_FASTFORWARD:
+ evt->key_code = GF_KEY_BROWSERFORWARD; break;
+ case DIKS_SUBTITLE:
+ evt->key_code = GF_KEY_DEL; break;
+ case DIKS_CHANNEL_UP:
+ evt->key_code = GF_KEY_CHANNELUP; break;
+ case DIKS_CHANNEL_DOWN:
+ evt->key_code = GF_KEY_CHANNELDOWN; break;
+ case DIKS_TEXT:
+ evt->key_code = GF_KEY_TEXT; break;
+ case DIKS_INFO:
+ evt->key_code = GF_KEY_INFO; break;
+ case DIKS_EPG:
+ evt->key_code = GF_KEY_EPG; break;
+ case DIKS_RECORD:
+ evt->key_code = GF_KEY_RECORD; break;
+ case DIKS_AUDIO:
+ evt->key_code = GF_KEY_BEGINPAGE; break;
+ default:
+ evt->key_code = GF_KEY_UNIDENTIFIED; break;
+ }
+}
+#if 0
+
+static int compare_symbol( const void *a, const void *b )
+{
+ u32 *keycode = (u32 *) a;
+ struct predef_keyid *idname = (struct predef_keyid *) b;
+
+ return *keycode - idname->key_code;
+}
+
+static const char *get_local_key_name(u32 key_code) {
+ struct predef_keyid *predefine_keyid;
+
+ predefine_keyid = bsearch(&key_code, keyIDs, sizeof(keyIDs) / sizeof(keyIDs[0]) - 1, sizeof(keyIDs[0]), compare_symbol );
+ if (predefine_keyid) return predefine_keyid->name;
+ else return NULL;
+}
+
+static void show_key_event(DirectFBVidCtx *ctx, GF_EventKey *evt )
+{
+ //DirectFBVID();
+ char buf[16];
+ struct predef_keyid *predefine_keyid;
+
+ predefine_keyid = bsearch(&evt->key_code, keyIDs, sizeof(keyIDs) / sizeof(keyIDs[0]) - 1, sizeof(keyIDs[0]), compare_symbol );
+
+
+ if (predefine_keyid) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[DirectFB] Predefined key ID from show_key_event():%s\n",predefine_keyid->name));
+ }
+ ctx->primary->SetColor( ctx->primary, 0x60, 0x60, 0x60, 0xFF );
+ snprintf (buf, sizeof(buf), "0x%X", evt->key_code);
+ ctx->primary->DrawString( ctx->primary, buf, -1,
+ ctx->width - 40, ctx->height/3,
+ DSTF_RIGHT );
+
+
+}
+
+#endif
+
+static void DirectFBVid_DrawHLine(GF_VideoOutput *driv, u32 x, u32 y, u32 length, GF_Color color)
+{
+ DirectFBVID();
+ u8 r, g, b;
+
+ //GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] in DirectFBVid_DrawHLine(). Drawing line x %d y %d length %d color %08X\n", x, y, length, color));
+ SET_DRAWING_FLAGS( DSDRAW_NOFX );
+
+ r = GF_COL_R(color);
+ g = GF_COL_G(color);
+ b = GF_COL_B(color);
+
+ ctx->primary->SetColor(ctx->primary, r, g, b, 0xFF); // no alpha
+ //ctx->primary->DrawLine(ctx->primary, x, y, x+length, y); // no acceleration
+ ctx->primary->FillRectangle(ctx->primary, x, y,length, 1);
+
+}
+
+static void DirectFBVid_DrawHLineAlpha(GF_VideoOutput *driv, u32 x, u32 y, u32 length, GF_Color color, u8 alpha)
+{
+ DirectFBVID();
+ u8 r, g, b;
+
+ //GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] in DirectFBVid_DrawHLineAlpha(). Alpha line drawing x %d y %d length %d color %08X alpha %d\n", x, y, length, color, alpha));
+
+ SET_DRAWING_FLAGS( DSDRAW_BLEND ); // use alpha
+
+ r = GF_COL_R(color);
+ g = GF_COL_G(color);
+ b = GF_COL_B(color);
+
+ ctx->primary->SetColor(ctx->primary, r, g, b, alpha);
+ //ctx->primary->DrawLine(ctx->primary, x, y, x+length, y);
+ ctx->primary->FillRectangle(ctx->primary, x, y, length, 1); // with acceleration
+}
+
+static void DirectFBVid_DrawRectangle(GF_VideoOutput *driv, u32 x, u32 y, u32 width, u32 height, GF_Color color)
+{
+ DirectFBVID();
+ u8 r, g, b, a;
+
+ //GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] in DirectFBVid_DrawRectangle(). Drawing rectangle x %d y %d width %d height %d color %08x\n", x, y, width, height, color));
+
+
+ r = GF_COL_R(color);
+ g = GF_COL_G(color);
+ b = GF_COL_B(color);
+ a = GF_COL_A(color);
+
+ SET_DRAWING_FLAGS( DSDRAW_NOFX );
+
+ ctx->primary->SetColor(ctx->primary, r, g, b, a);
+ ctx->primary->FillRectangle(ctx->primary, x, y, width, height);
+ //ctx->primary->Blit( ctx->primary, ctx->primary, NULL, x, y );
+}
+
+
GF_Err DirectFBVid_Setup(GF_VideoOutput *driv, void *os_handle, void *os_display, u32 init_flags)
{
+ const char* opt;
DFBResult err;
DFBSurfaceDescription dsc;
DFBSurfacePixelFormat dfbpf;
DFBAccelerationMask mask;
+ DeviceInfo *devices = NULL;
DirectFBVID();
ctx->is_init = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] Initialization\n"));
- /* create an input buffer for key events */
-// DFBCHECK(ctx->dfb->CreateInputEventBuffer( ctx->dfb, DICAPS_KEYS, DFB_FALSE, &key_events ));
+ /* create a list of input devices */
+ ctx->dfb->EnumInputDevices(ctx->dfb, enum_input_device, &devices );
+
+ /* create an event buffer for all devices */
+ DFBCHECK(ctx->dfb->CreateInputEventBuffer(ctx->dfb, DICAPS_KEYS, DFB_FALSE, &(ctx->events) ));
/* Set the cooperative level */
err = ctx->dfb->SetCooperativeLevel( ctx->dfb, DFSCL_FULLSCREEN );
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
- if (ctx->use_systems_memory)
- dsc.caps |= DSCAPS_SYSTEMONLY;
+ if (ctx->use_systems_memory) dsc.caps |= DSCAPS_SYSTEMONLY;
DFBCHECK(ctx->dfb->CreateSurface( ctx->dfb, &dsc, &(ctx->primary) ));
ctx->pixel_format = DirectFBVid_TranslatePixelFormatToGPAC(dfbpf);
ctx->primary->GetSize( ctx->primary, &(ctx->width), &(ctx->height) );
ctx->primary->Clear( ctx->primary, 0, 0, 0, 0xFF);
-
- ctx->primary->GetAccelerationMask( ctx->primary, NULL, &mask );
- if (mask & DFXL_DRAWLINE ) // DrawLine() is accelerated.
- accel_drawline = 1;
- if (mask & DFXL_FILLRECTANGLE) // FillRectangle() is accelerated.
- accel_fillrect = 1;
- printf("accel_drawline=%d\n",accel_drawline);
- printf("accel_fillrect=%d\n",accel_fillrect);
+ ctx->disable_acceleration = 0;
+ opt = gf_modules_get_option((GF_BaseInterface *)driv, "DirectFB", "DisableAcceleration");
+ if (!opt) gf_modules_set_option((GF_BaseInterface *)driv, "DirectFB", "DisableAcceleration", "no");
+ if (opt && !strcmp(opt, "yes")) ctx->disable_acceleration = 1;
+
+ ctx->disable_display = 0;
+ opt = gf_modules_get_option((GF_BaseInterface *)driv, "DirectFB", "DisableDisplay");
+ if (!opt) gf_modules_set_option((GF_BaseInterface *)driv, "DirectFB", "DisableDisplay", "no");
+ if (opt && !strcmp(opt, "yes")) ctx->disable_display = 1;
+
+
+ ctx->flip_mode = DSFLIP_BLIT;
+ opt = gf_modules_get_option((GF_BaseInterface *)driv, "DirectFB", "FlipSyncMode");
+ if (!opt) gf_modules_set_option((GF_BaseInterface *)driv, "DirectFB", "FlipSyncMode", "waitsync");
+ if (!opt || !strcmp(opt, "waitsync")) ctx->flip_mode |= DSFLIP_WAITFORSYNC;
+ else if (opt && !strcmp(opt, "wait")) ctx->flip_mode |= DSFLIP_WAIT;
+ else if (opt && !strcmp(opt, "sync")) ctx->flip_mode |= DSFLIP_ONSYNC;
+ else if (opt && !strcmp(opt, "swap")) ctx->flip_mode &= ~DSFLIP_BLIT;
+
+ opt = gf_modules_get_option((GF_BaseInterface *)driv, "DirectFB", "DisableBlit");
+ if (!opt) gf_modules_set_option((GF_BaseInterface *)driv, "DirectFB", "DisableBlit", "no");
+ if (opt && !strcmp(opt, "all")) {
+ driv->hw_caps &= ~(GF_VIDEO_HW_HAS_RGB | GF_VIDEO_HW_HAS_RGBA | GF_VIDEO_HW_HAS_YUV);
+ }
+ else if (opt && !strcmp(opt, "yuv")) driv->hw_caps &= ~GF_VIDEO_HW_HAS_YUV;
+ else if (opt && !strcmp(opt, "rgb")) driv->hw_caps &= ~GF_VIDEO_HW_HAS_RGB;
+ else if (opt && !strcmp(opt, "rgba")) driv->hw_caps &= ~GF_VIDEO_HW_HAS_RGBA;
+
+
+ if (!ctx->disable_acceleration){
+ ctx->primary->GetAccelerationMask( ctx->primary, NULL, &mask );
+ GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[DirectFB] hardware acceleration mask %08x \n", mask));
+ if (mask & DFXL_DRAWLINE ) // DrawLine() is accelerated. DFXL_DRAWLINE
+ ctx->accel_drawline = 1;
+ if (mask & DFXL_FILLRECTANGLE) // FillRectangle() is accelerated.
+ ctx->accel_fillrect = 1;
+
+ GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[DirectFB] hardware acceleration mask %08x - Line: %d Rectangle: %d\n", mask, ctx->accel_drawline, ctx->accel_fillrect));
+
+ driv->hw_caps |= GF_VIDEO_HW_HAS_LINE_BLIT;
+ driv->DrawHLine = DirectFBVid_DrawHLine;
+ driv->DrawHLineAlpha = DirectFBVid_DrawHLineAlpha;
+ driv->DrawRectangle = DirectFBVid_DrawRectangle;
+ }
+
ctx->is_init = 1;
GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] Initialization success\n"));
+// GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] Pixel format %s\n", gf_4cc_to_str(ctx->pixel_format)));
return GF_OK;
}
DirectFBVID();
if (!ctx->is_init) return;
ctx->primary->Release( ctx->primary );
-// ctx->key_events->Release( ctx->key_events );
+ ctx->events->Release( ctx->events );
ctx->dfb->Release( ctx->dfb );
ctx->is_init = 0;
}
static GF_Err DirectFBVid_Flush(GF_VideoOutput *driv, GF_Window *dest)
{
-
+ const char* opt;
+
DirectFBVID();
GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] Flipping backbuffer\n"));
- ctx->primary->Flip( ctx->primary, NULL, DSFLIP_ONSYNC );
+ if (ctx->disable_display) return GF_OK;
+
+ ctx->primary->Flip( ctx->primary, NULL, ctx->flip_mode);
}
return GF_OK;
}
-#if 0
+
Bool DirectFBVid_ProcessMessageQueue(DirectFBVidCtx *ctx, GF_VideoOutput *driv)
{
- DFBInputEvent ev;
- u32 err;
-
- while (ctx->key_events->GetEvent( ctx->key_events, DFB_EVENT(&ev) ) == DFB_OK)
+ DFBInputEvent directfb_evt;
+ GF_Event gpac_evt;
+
+ while (ctx->events->GetEvent( ctx->events, DFB_EVENT(&directfb_evt) ) == DFB_OK)
{
- if (ev.type == DIET_KEYPRESS)
- {
- switch (ev.key_symbol)
- {
- case DIKS_ESCAPE:
- case DIKS_SMALL_Q:
- case DIKS_CAPITAL_Q:
- case DIKS_BACK:
- case DIKS_STOP:
- DirectFBVid_Shutdown(driv);
- exit( 42 );
- break;
- default:
- break;
- }
- }
+ u32 i;
+ switch (directfb_evt.type){
+ case DIET_KEYPRESS:
+ case DIET_KEYRELEASE:
+ //GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[DirectFB] in ProcessMessageQueue\n"));
+ directfb_translate_key(directfb_evt.key_symbol, &gpac_evt.key);
+ gpac_evt.type = (directfb_evt.type == DIET_KEYPRESS) ? GF_EVENT_KEYDOWN : GF_EVENT_KEYUP;
+#if 0
+ fprintf(stderr, "before %d %s\n", gpac_evt.key.key_code,
+ gf_dom_get_key_name(gpac_evt.key.key_code));
+
+ for (i=0;i<200; i++) {
+ fprintf(stderr, "%03d %s\n", i, gf_dom_get_key_name(i));
+ }
+#endif
+ driv->on_event(driv->evt_cbk_hdl, &gpac_evt);
+ //fprintf(stderr, "after %d %s\n", gpac_evt.key.key_code, gf_dom_get_key_name(gpac_evt.key.key_code));
+ default:
+ break;
+ }
+
}
- return 1;
+
+ return GF_OK;
}
-#endif
+
static GF_Err DirectFBVid_ProcessEvent(GF_VideoOutput *driv, GF_Event *evt)
{
DirectFBVID();
+
if (!evt) {
- //DirectFBVid_ProcessMessageQueue(ctx, driv);
+ DirectFBVid_ProcessMessageQueue(ctx, driv);
return GF_OK;
}
+
switch (evt->type) {
case GF_EVENT_SIZE:
if ((ctx->width !=evt->size.width) || (ctx->height != evt->size.height)) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] backbuffer locked\n"));
} else {
- ctx->primary->Unlock(ctx->primary);
+ ctx->primary->Unlock(ctx->primary);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] backbuffer unlocked\n"));
}
return GF_OK;
static GF_Err DirectFBVid_Blit(GF_VideoOutput *driv, GF_VideoSurface *video_src, GF_Window *src_wnd, GF_Window *dst_wnd, u32 overlay_type)
{
DirectFBVID();
- if (overlay_type == 0) return GF_OK;
- else return GF_NOT_SUPPORTED;
- //return GF_OK;
-}
-static void DirectFBVid_DrawHLine(GF_VideoOutput *driv, u32 x, u32 y, u32 length, GF_Color color)
-{
- DirectFBVID();
- u8 r, g, b;
-
- SET_DRAWING_FLAGS( DSDRAW_NOFX );
-
- r = GF_COL_R(color);
- g = GF_COL_G(color);
- b = GF_COL_B(color);
-
- ctx->primary->SetColor(ctx->primary, r, g, b, 0xFF); // no alpha
- ctx->primary->DrawLine(ctx->primary, x, y, x+length, y);
+ DFBResult res;
+ DFBSurfaceDescription srcdesc;
+ IDirectFBSurface *src;
+ DFBRectangle dfbsrc, dfbdst;
+ DFBAccelerationMask mask;
-}
+ if (overlay_type != 0) return GF_NOT_SUPPORTED;
+ if (ctx->disable_display) return GF_OK;
-static void DirectFBVid_DrawHLineAlpha(GF_VideoOutput *driv, u32 x, u32 y, u32 length, GF_Color color, u8 alpha)
-{
- DirectFBVID();
- u8 r, g, b;
+ memset(&srcdesc, 0, sizeof(srcdesc));
+ srcdesc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_PREALLOCATED;
+ srcdesc.width = video_src->width;
+ srcdesc.height = video_src->height;
+ srcdesc.pixelformat = DirectFBVid_TranslatePixelFormatFromGPAC(video_src->pixel_format);
+ srcdesc.preallocated[0].data = video_src->video_buffer;
+ srcdesc.preallocated[0].pitch = video_src->pitch_y;
- SET_DRAWING_FLAGS( DSDRAW_BLEND ); // use alpha
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] video_src->pitch_y %d \n",video_src->pitch_y ));
- r = GF_COL_R(color);
- g = GF_COL_G(color);
- b = GF_COL_B(color);
-
- ctx->primary->SetColor(ctx->primary, r, g, b, alpha);
- ctx->primary->DrawLine(ctx->primary, x, y, x+length, y);
-}
+ switch (video_src->pixel_format){
+ case GF_PIXEL_ARGB: //return DSPF_ARGB;
+ case GF_PIXEL_RGBA: //return DSPF_ARGB;
+ case GF_PIXEL_BGRA: //return DSPF_ARGB;
+ ctx->primary->SetBlittingFlags(ctx->primary, DSBLIT_BLEND_ALPHACHANNEL);
+ break;
+ default:
+ ctx->primary->SetBlittingFlags(ctx->primary, DSBLIT_NOFX);
+ }
-static void DirectFBVid_DrawRectangle(GF_VideoOutput *driv, u32 x, u32 y, u32 width, u32 height, GF_Color color)
-{
- DirectFBVID();
- u8 r, g, b, a;
+ res = ctx->dfb->CreateSurface(ctx->dfb, &srcdesc, &src);
+ if (res != DFB_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[DirectFB] cannot create blit source surface for pixel format %s: %s (%d)\n", gf_4cc_to_str(video_src->pixel_format), DirectFBErrorString(res), res));
+ return GF_IO_ERR;
+ }
+
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DirectFB] blit source surface created\n"));
+
+ dfbsrc.x = src_wnd->x;
+ dfbsrc.y = src_wnd->y;
+ dfbsrc.w = src_wnd->w;
+ dfbsrc.h = src_wnd->h;
+
+ if (!src_wnd->x && !src_wnd->y && (dst_wnd->w==src_wnd->w) && (dst_wnd->h==src_wnd->h)) {
+ ctx->primary->Blit(ctx->primary, src, &dfbsrc, dst_wnd->x, dst_wnd->y);
+ } else {
+ dfbdst.x = dst_wnd->x;
+ dfbdst.y = dst_wnd->y;
+ dfbdst.w = dst_wnd->w;
+ dfbdst.h = dst_wnd->h;
+ ctx->primary->StretchBlit(ctx->primary, src, &dfbsrc, &dfbdst);
+ }
- r = GF_COL_R(color);
- g = GF_COL_G(color);
- b = GF_COL_B(color);
- a = GF_COL_A(color);
-
- SET_DRAWING_FLAGS( DSDRAW_NOFX );
+ src->Release(src);
- ctx->primary->SetColor(ctx->primary, r, g, b, a);
- ctx->primary->FillRectangle(ctx->primary, x, y, width, height);
- //ctx->primary->Blit( ctx->primary, ctx->primary, NULL, x, y );
+ return GF_OK;
}
void *DirectFBNewVideo()
driv->LockBackBuffer = DirectFBVid_LockBackBuffer;
driv->LockOSContext = NULL;
driv->Blit = DirectFBVid_Blit;
- driv->hw_caps |= GF_VIDEO_HW_HAS_RGB | GF_VIDEO_HW_HAS_RGBA | GF_VIDEO_HW_HAS_YUV | GF_VIDEO_HW_HAS_LINE_BLIT;
-
- if (driv->hw_caps & GF_VIDEO_HW_HAS_LINE_BLIT)
- {
- driv->DrawHLine = DirectFBVid_DrawHLine;
- driv->DrawHLineAlpha = DirectFBVid_DrawHLineAlpha;
- driv->DrawRectangle = DirectFBVid_DrawRectangle;
- }
+ driv->hw_caps |= GF_VIDEO_HW_HAS_RGB | GF_VIDEO_HW_HAS_RGBA | GF_VIDEO_HW_HAS_YUV;
return driv;
}
#include <gpac/modules/video_out.h>
+#include <gpac/scenegraph_svg.h>
/* DirectFB */
#define __DIRECT__STDTYPES__ //prevent u8, s8, ... definitions by directFB as we have them in GPAC
#include <direct/util.h>
static int do_xor = 0;
-static int accel_drawline = 0;
-static int accel_fillrect = 0;
/* macro for a safe call to DirectFB functions */
#define DFBCHECK(x...) \
#define SET_DRAWING_FLAGS( flags ) \
ctx->primary->SetDrawingFlags( ctx->primary, (flags) | (do_xor ? DSDRAW_XOR : 0) )
+typedef struct _DeviceInfo DeviceInfo;
+struct _DeviceInfo {
+ DFBInputDeviceID device_id;
+ DFBInputDeviceDescription desc;
+ DeviceInfo *next;
+};
+
+struct predef_keyid {
+ u32 key_code;
+ const char *name;
+};
+
+#if 0
+#define PredefineKeyID(predefined_key_identifiers) struct predef_keyid predefined_key_identifiers[] = {\
+ { GF_KEY_ACCEPT, "Accept" },\
+ { GF_KEY_AGAIN, "Again" },\
+ { GF_KEY_ALLCANDIDATES, "AllCandidates" },\
+ { GF_KEY_ALPHANUM, "Alphanumeric" },\
+ { GF_KEY_ALT, "Alt" },\
+ { GF_KEY_ALTGRAPH, "AltGraph" },\
+ { GF_KEY_APPS, "Apps" },\
+ { GF_KEY_ATTN, "Attn" },\
+ { GF_KEY_BROWSERBACK, "BrowserBack" },\
+ { GF_KEY_BROWSERFAVORITES, "BrowserFavorites" },\
+ { GF_KEY_BROWSERFORWARD, "BrowserForward" },\
+ { GF_KEY_BROWSERHOME, "BrowserHome" },\
+ { GF_KEY_BROWSERREFRESH, "BrowserRefresh" },\
+ { GF_KEY_BROWSERSEARCH, "BrowserSearch" },\
+ { GF_KEY_BROWSERSTOP, "BrowserStop" },\
+ { GF_KEY_CAPSLOCK, "CapsLock" },\
+ { GF_KEY_CLEAR, "Clear" },\
+ { GF_KEY_CODEINPUT, "CodeInput" },\
+ { GF_KEY_COMPOSE, "Compose" },\
+ { GF_KEY_CONTROL, "Control" },\
+ { GF_KEY_CRSEL, "Crsel" },\
+ { GF_KEY_CONVERT, "Convert" },\
+ { GF_KEY_COPY, "Copy" },\
+ { GF_KEY_CUT, "Cut" },\
+ { GF_KEY_DOWN, "Down" },\
+ { GF_KEY_END, "End" },\
+ { GF_KEY_ENTER, "Enter" },\
+ { GF_KEY_EPG, "EPG" }, \
+ { GF_KEY_ERASEEOF, "EraseEof" },\
+ { GF_KEY_EXECUTE, "Execute" },\
+ { GF_KEY_EXSEL, "Exsel" },\
+ { GF_KEY_F1, "F1" },\
+ { GF_KEY_F2, "F2" },\
+ { GF_KEY_F3, "F3" },\
+ { GF_KEY_F4, "F4" },\
+ { GF_KEY_F5, "F5" },\
+ { GF_KEY_F6, "F6" },\
+ { GF_KEY_F7, "F7" },\
+ { GF_KEY_F8, "F8" },\
+ { GF_KEY_F9, "F9" },\
+ { GF_KEY_F10, "F10" },\
+ { GF_KEY_F11, "F11" },\
+ { GF_KEY_F12, "F12" },\
+ { GF_KEY_F13, "F13" },\
+ { GF_KEY_F14, "F14" },\
+ { GF_KEY_F15, "F15" },\
+ { GF_KEY_F16, "F16" },\
+ { GF_KEY_F17, "F17" },\
+ { GF_KEY_F18, "F18" },\
+ { GF_KEY_F19, "F19" },\
+ { GF_KEY_F20, "F20" },\
+ { GF_KEY_F21, "F21" },\
+ { GF_KEY_F22, "F22" },\
+ { GF_KEY_F23, "F23" },\
+ { GF_KEY_F24, "F24" },\
+ { GF_KEY_FINALMODE, "FinalMode" },\
+ { GF_KEY_FIND, "Find" },\
+ { GF_KEY_FULLWIDTH, "FullWidth" },\
+ { GF_KEY_HALFWIDTH, "HalfWidth" },\
+ { GF_KEY_HANGULMODE, "HangulMode" },\
+ { GF_KEY_HANJAMODE, "HanjaMode" },\
+ { GF_KEY_HELP, "Help" },\
+ { GF_KEY_HIRAGANA, "Hiragana" },\
+ { GF_KEY_HOME, "Home" },\
+ { GF_KEY_INFO, "Info" }, \
+ { GF_KEY_INSERT, "Insert" },\
+ { GF_KEY_JAPANESEHIRAGANA, "JapaneseHiragana" },\
+ { GF_KEY_JAPANESEKATAKANA, "JapaneseKatakana" },\
+ { GF_KEY_JAPANESEROMAJI, "JapaneseRomaji" },\
+ { GF_KEY_JUNJAMODE, "JunjaMode" },\
+ { GF_KEY_KANAMODE, "KanaMode" },\
+ { GF_KEY_KANJIMODE, "KanjiMode" },\
+ { GF_KEY_KATAKANA, "Katakana" },\
+ { GF_KEY_LAUNCHAPPLICATION1, "LaunchApplication1" },\
+ { GF_KEY_LAUNCHAPPLICATION2, "LaunchApplication2" },\
+ { GF_KEY_LAUNCHMAIL, "LaunchMail" },\
+ { GF_KEY_LEFT, "Left" },\
+ { GF_KEY_META, "Meta" },\
+ { GF_KEY_MEDIANEXTTRACK, "MediaNextTrack" },\
+ { GF_KEY_MEDIAPLAYPAUSE, "MediaPlayPause" },\
+ { GF_KEY_MEDIAPREVIOUSTRACK, "MediaPreviousTrack" },\
+ { GF_KEY_MEDIASTOP, "MediaStop" },\
+ { GF_KEY_MODECHANGE, "ModeChange" },\
+ { GF_KEY_NONCONVERT, "Nonconvert" },\
+ { GF_KEY_NUMLOCK, "NumLock" },\
+ { GF_KEY_PAGEDOWN, "PageDown" },\
+ { GF_KEY_PAGEUP, "PageUp" },\
+ { GF_KEY_PASTE, "Paste" },\
+ { GF_KEY_PAUSE, "Pause" },\
+ { GF_KEY_PLAY, "Play" },\
+ { GF_KEY_PREVIOUSCANDIDATE, "PreviousCandidate" },\
+ { GF_KEY_PRINTSCREEN, "PrintScreen" },\
+ { GF_KEY_PROCESS, "Process" },\
+ { GF_KEY_PROPS, "Props" },\
+ { GF_KEY_RIGHT, "Right" },\
+ { GF_KEY_ROMANCHARACTERS, "RomanCharacters" },\
+ { GF_KEY_SCROLL, "Scroll" },\
+ { GF_KEY_SELECT, "Select" },\
+ { GF_KEY_SELECTMEDIA, "SelectMedia" },\
+ { GF_KEY_SHIFT, "Shift" },\
+ { GF_KEY_STOP, "Stop" },\
+ { GF_KEY_UP, "Up" },\
+ { GF_KEY_UNDO, "Undo" },\
+ { GF_KEY_VOLUMEDOWN, "VolumeDown" },\
+ { GF_KEY_VOLUMEMUTE, "VolumeMute" },\
+ { GF_KEY_VOLUMEUP, "VolumeUp" },\
+ { GF_KEY_WIN, "Win" },\
+ { GF_KEY_ZOOM, "Zoom" },\
+ { GF_KEY_BACKSPACE, "U+0008" },\
+ { GF_KEY_TAB, "U+0009" },\
+ { GF_KEY_CANCEL, "U+0018" },\
+ { GF_KEY_ESCAPE, "U+001B" },\
+ { GF_KEY_SPACE, "U+0020" },\
+ { GF_KEY_EXCLAMATION, "U+0021" },\
+ { GF_KEY_QUOTATION, "U+0022" },\
+ { GF_KEY_NUMBER, "U+0023" },\
+ { GF_KEY_DOLLAR, "U+0024" },\
+ { GF_KEY_AMPERSAND, "U+0026" },\
+ { GF_KEY_APOSTROPHE, "U+0027" },\
+ { GF_KEY_LEFTPARENTHESIS, "U+0028" },\
+ { GF_KEY_RIGHTPARENTHESIS, "U+0029" },\
+ { GF_KEY_STAR, "U+002A" },\
+ { GF_KEY_PLUS, "U+002B" },\
+ { GF_KEY_COMMA, "U+002C" },\
+ { GF_KEY_HYPHEN, "U+002D" },\
+ { GF_KEY_FULLSTOP, "U+002E" },\
+ { GF_KEY_SLASH, "U+002F" },\
+ { GF_KEY_0, "U+0030" },\
+ { GF_KEY_1, "U+0031" },\
+ { GF_KEY_2, "U+0032" },\
+ { GF_KEY_3, "U+0033" },\
+ { GF_KEY_4, "U+0034" },\
+ { GF_KEY_5, "U+0035" },\
+ { GF_KEY_6, "U+0036" },\
+ { GF_KEY_7, "U+0037" },\
+ { GF_KEY_8, "U+0038" },\
+ { GF_KEY_9, "U+0039" },\
+ { GF_KEY_COLON, "U+003A" },\
+ { GF_KEY_SEMICOLON, "U+003B" },\
+ { GF_KEY_LESSTHAN, "U+003C" },\
+ { GF_KEY_EQUALS, "U+003D" },\
+ { GF_KEY_GREATERTHAN, "U+003E" },\
+ { GF_KEY_QUESTION, "U+003F" },\
+ { GF_KEY_AT, "U+0040" },\
+ { GF_KEY_A, "U+0041" },\
+ { GF_KEY_B, "U+0042" },\
+ { GF_KEY_C, "U+0043" },\
+ { GF_KEY_D, "U+0044" },\
+ { GF_KEY_E, "U+0045" },\
+ { GF_KEY_F, "U+0046" },\
+ { GF_KEY_G, "U+0047" },\
+ { GF_KEY_H, "U+0048" },\
+ { GF_KEY_I, "U+0049" },\
+ { GF_KEY_J, "U+004A" },\
+ { GF_KEY_K, "U+004B" },\
+ { GF_KEY_L, "U+004C" },\
+ { GF_KEY_M, "U+004D" },\
+ { GF_KEY_N, "U+004E" },\
+ { GF_KEY_O, "U+004F" },\
+ { GF_KEY_P, "U+0050" },\
+ { GF_KEY_Q, "U+0051" },\
+ { GF_KEY_R, "U+0052" },\
+ { GF_KEY_S, "U+0053" },\
+ { GF_KEY_T, "U+0054" },\
+ { GF_KEY_U, "U+0055" },\
+ { GF_KEY_V, "U+0056" },\
+ { GF_KEY_W, "U+0057" },\
+ { GF_KEY_X, "U+0058" },\
+ { GF_KEY_Y, "U+0059" },\
+ { GF_KEY_Z, "U+005A" },\
+ { GF_KEY_LEFTSQUAREBRACKET, "U+005B" },\
+ { GF_KEY_BACKSLASH, "U+005C" },\
+ { GF_KEY_RIGHTSQUAREBRACKET, "U+005D" },\
+ { GF_KEY_CIRCUM, "U+005E" },\
+ { GF_KEY_UNDERSCORE, "U+005F" },\
+ { GF_KEY_GRAVEACCENT, "U+0060" },\
+ { GF_KEY_LEFTCURLYBRACKET, "U+007B" },\
+ { GF_KEY_PIPE, "U+007C" },\
+ { GF_KEY_RIGHTCURLYBRACKET, "U+007D" },\
+ { GF_KEY_DEL, "U+007F" },\
+ { GF_KEY_INVERTEXCLAMATION, "U+00A1" },\
+ { GF_KEY_DEADGRAVE, "U+0300" },\
+ { GF_KEY_DEADEACUTE, "U+0301" },\
+ { GF_KEY_DEADCIRCUM, "U+0302" },\
+ { GF_KEY_DEADTILDE, "U+0303" },\
+ { GF_KEY_DEADMACRON, "U+0304" }, \
+ { GF_KEY_DEADBREVE, "U+0306" },\
+ { GF_KEY_DEADABOVEDOT, "U+0307" },\
+ { GF_KEY_DEADDIARESIS, "U+0308" }, \
+ { GF_KEY_DEADRINGABOVE, "U+030A" },\
+ { GF_KEY_DEADDOUBLEACUTE, "U+030B" },\
+ { GF_KEY_DEADCARON, "U+030C" },\
+ { GF_KEY_DEADCEDILLA, "U+0327" },\
+ { GF_KEY_DEADOGONEK, "U+0328" },\
+ { GF_KEY_DEADIOTA, "U+0345" },\
+ { GF_KEY_EURO, "U+20AC" },\
+ { GF_KEY_DEADVOICESOUND, "U+3099" },\
+ { GF_KEY_DEADSEMIVOICESOUND, "U+309A" }\
+};
+#endif
typedef struct
{
/* the super interface */
/* screen width, height */
u32 width, height, pixel_format;
- Bool use_systems_memory, disable_acceleration, disable_aa, is_init;
+ Bool use_systems_memory, disable_acceleration, disable_aa, is_init, disable_display;
+
+ /* acceleration */
+ int accel_drawline, accel_fillrect;
+ DFBSurfaceFlipFlags flip_mode;
+
+ /*===== for key events =====*/
+
+ /* Input interfaces: devices and its buffer */
+ IDirectFBEventBuffer *events;
- /* Input interfaces: event buffer */
-// IDirectFBEventBuffer *key_events;
+ /*=============================
+ if using window
+ ============================= */
+
+ /* DirectFB window */
+ IDirectFBWindow *window;
+
+ /* display layer */
+ IDirectFBDisplayLayer *layer;
} DirectFBVidCtx;
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ * nvluyen81@gmail.com\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ */\r
+\r
+#include "javaenv.h"\r
+\r
+#include <gpac/modules/audio_out.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <math.h>\r
+\r
+#define STREAM_MUSIC 3\r
+#define CHANNEL_CONFIGURATION_MONO 2\r
+#define CHANNEL_CONFIGURATION_STEREO 3\r
+#define ENCODING_PCM_8BIT 3\r
+#define ENCODING_PCM_16BIT 2\r
+#define MODE_STREAM 1\r
+#define CHANNEL_OUT_MONO 4\r
+#define CHANNEL_IN_STEREO 12\r
+#define CHANNEL_IN_MONO 16\r
+\r
+\r
+/*for channel codes*/\r
+#include <gpac/constants.h>\r
+\r
+static const char android_device[] = "Android Default";\r
+\r
+static jclass cAudioTrack = NULL;\r
+static jobject mtrack = NULL;\r
+\r
+static jmethodID mAudioTrack;\r
+static jmethodID setStereoVolume;\r
+static jmethodID mGetMinBufferSize;\r
+static jmethodID mPlay;\r
+static jmethodID mStop;\r
+static jmethodID mRelease;\r
+static jmethodID mWrite;\r
+static jmethodID mFlush;\r
+\r
+#include <android/log.h>\r
+#define TAG "GPAC Android Audio"\r
+#define LOGV(X, Y) __android_log_print(ANDROID_LOG_VERBOSE, TAG, X, Y)\r
+#define LOGV3(X, Y, Z, K) __android_log_print(ANDROID_LOG_VERBOSE, TAG, X, Y, Z, K)\r
+#define LOGD(X, Y) __android_log_print(ANDROID_LOG_DEBUG, TAG, X, Y)\r
+#define LOGD2(X, Y, Z) __android_log_print(ANDROID_LOG_DEBUG, TAG, X, Y, Z)\r
+#define LOGE(X, Y) __android_log_print(ANDROID_LOG_ERROR, TAG, X, Y)\r
+#define LOGE3(X, Y, Z, W) __android_log_print(ANDROID_LOG_ERROR, TAG, X, Y, Z, W)\r
+#define LOGW(X, Y) __android_log_print(ANDROID_LOG_WARN, TAG, X, Y)\r
+#define LOGI(X, Y) __android_log_print(ANDROID_LOG_INFO, TAG, X, Y)\r
+\r
+\r
+/* Uncomment the next line if you want to debug */\r
+/* #define DROID_EXTREME_LOGS */\r
+\r
+typedef struct\r
+{\r
+ JNIEnv* env;\r
+\r
+ jobject mtrack;\r
+\r
+ u32 num_buffers;\r
+\r
+ u32 delay, total_length_ms;\r
+\r
+ Bool force_config;\r
+ u32 cfg_num_buffers, cfg_duration;\r
+\r
+ u32 sampleRateInHz;\r
+ u32 channelConfig; //AudioFormat.CHANNEL_OUT_MONO\r
+ u32 audioFormat; //AudioFormat.ENCODING_PCM_16BIT\r
+ s32 mbufferSizeInBytes;\r
+ u32 volume;\r
+ u32 pan;\r
+ jarray buff;\r
+} DroidContext;\r
+\r
+//----------------------------------------------------------------------\r
+//----------------------------------------------------------------------\r
+// Called by the main thread\r
+static GF_Err WAV_Setup(GF_AudioOutput *dr, void *os_handle, u32 num_buffers, u32 total_duration)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ JNIEnv* env = GetEnv();\r
+ int channels;\r
+ int bytes;\r
+ LOGV("[Android Audio] Setup for %d buffers", num_buffers);\r
+\r
+ ctx->force_config = (num_buffers && total_duration) ? 1 : 0;\r
+ ctx->cfg_num_buffers = num_buffers;\r
+ if (ctx->cfg_num_buffers <= 1) ctx->cfg_num_buffers = 2;\r
+ ctx->cfg_duration = total_duration;\r
+ if (!ctx->force_config) ctx->num_buffers = 1;\r
+ ctx->volume = 100;\r
+ ctx->pan = 50;\r
+\r
+ if (!cAudioTrack){\r
+ cAudioTrack = (*env)->FindClass(env, "android/media/AudioTrack");\r
+ if (!cAudioTrack) {\r
+ return GF_NOT_SUPPORTED;\r
+ }\r
+\r
+ cAudioTrack = (*env)->NewGlobalRef(env, cAudioTrack);\r
+\r
+ mAudioTrack = (*env)->GetMethodID(env, cAudioTrack, "<init>", "(IIIIII)V");\r
+ mGetMinBufferSize = (*env)->GetStaticMethodID(env, cAudioTrack, "getMinBufferSize", "(III)I");\r
+ mPlay = (*env)->GetMethodID(env, cAudioTrack, "play", "()V");\r
+ mStop = (*env)->GetMethodID(env, cAudioTrack, "stop", "()V");\r
+ mRelease = (*env)->GetMethodID(env, cAudioTrack, "release", "()V");\r
+ mWrite = (*env)->GetMethodID(env, cAudioTrack, "write", "([BII)I");\r
+ mFlush = (*env)->GetMethodID(env, cAudioTrack, "flush", "()V");\r
+ setStereoVolume = (*env)->GetMethodID(env, cAudioTrack, "setStereoVolume", "(FF)I");\r
+ }\r
+\r
+ return GF_OK;\r
+}\r
+//----------------------------------------------------------------------\r
+// Called by the audio thread\r
+static void WAV_Shutdown(GF_AudioOutput *dr)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ JNIEnv* env = ctx->env;\r
+\r
+ (*env)->CallNonvirtualVoidMethod(env, mtrack, cAudioTrack, mStop);\r
+ (*env)->CallNonvirtualVoidMethod(env, mtrack, cAudioTrack, mRelease);\r
+\r
+ (*env)->PopLocalFrame(env, NULL);\r
+\r
+ (*GetJavaVM())->DetachCurrentThread(GetJavaVM());\r
+}\r
+\r
+\r
+/*we assume what was asked is what we got*/\r
+/* Called by the audio thread */\r
+static GF_Err WAV_ConfigureOutput(GF_AudioOutput *dr, u32 *SampleRate, u32 *NbChannels, u32 *nbBitsPerSample, u32 channel_cfg)\r
+{\r
+ JNIEnv* env = NULL;\r
+ u32 i;\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+\r
+ LOGI("[Android Audio] Configure Output for %u channels...", *NbChannels);\r
+\r
+ if (!ctx) return GF_BAD_PARAM;\r
+\r
+ ctx->sampleRateInHz = *SampleRate;\r
+ ctx->channelConfig = (*NbChannels == 1) ? CHANNEL_CONFIGURATION_MONO : CHANNEL_CONFIGURATION_STEREO; //AudioFormat.CHANNEL_CONFIGURATION_MONO\r
+ ctx->audioFormat = (*nbBitsPerSample == 8)? ENCODING_PCM_8BIT : ENCODING_PCM_16BIT; //AudioFormat.ENCODING_PCM_16BIT\r
+\r
+ // Get the java environment in the new thread\r
+ (*GetJavaVM())->AttachCurrentThread(GetJavaVM(), &env, NULL);\r
+ ctx->env = env;\r
+ LOGV("[Android Audio] SampleRate : %d",ctx->sampleRateInHz);\r
+ LOGV("[Android Audio] BitPerSample : %d", *nbBitsPerSample);\r
+\r
+ (*env)->PushLocalFrame(env, 2);\r
+\r
+ ctx->num_buffers = 1;\r
+ ctx->mbufferSizeInBytes = (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ ctx->sampleRateInHz, ctx->channelConfig, ctx->audioFormat);\r
+\r
+ i = 1;\r
+ if ( ctx->channelConfig == CHANNEL_CONFIGURATION_STEREO )\r
+ i *= 2;\r
+ if ( ctx->audioFormat == ENCODING_PCM_16BIT )\r
+ i *= 2;\r
+\r
+ ctx->total_length_ms = 1000 * ctx->num_buffers * ctx->mbufferSizeInBytes / i / ctx->sampleRateInHz;\r
+\r
+ /*initial delay is full buffer size*/\r
+ ctx->delay = ctx->total_length_ms;\r
+\r
+ mtrack = (*env)->NewObject(env, cAudioTrack, mAudioTrack, STREAM_MUSIC, ctx->sampleRateInHz,\r
+ ctx->channelConfig, ctx->audioFormat, ctx->mbufferSizeInBytes, MODE_STREAM); //AudioTrack.MODE_STREAM\r
+ if (mtrack){\r
+ mtrack = (*env)->NewGlobalRef(env, mtrack);\r
+ ctx->mtrack = mtrack;\r
+ (*env)->CallNonvirtualVoidMethod(env, mtrack, cAudioTrack, mPlay);\r
+ } else {\r
+ LOGV("[Android Audio] mtrack = %p", mtrack);\r
+ return GF_NOT_SUPPORTED;\r
+ }\r
+\r
+ ctx->buff = (*env)->NewByteArray(env, ctx->mbufferSizeInBytes);\r
+ LOGV("[Android Audio] ConfigureOutput DONE.", *NbChannels);\r
+ return GF_OK;\r
+}\r
+\r
+/* Called by the audio thread */\r
+static void WAV_WriteAudio(GF_AudioOutput *dr)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ if (!ctx)\r
+ return;\r
+ JNIEnv* env = ctx->env;\r
+ u32 written;\r
+ void* pBuffer;\r
+ if (!env)\r
+ return;\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOGV("[Android Audio] WAV_WriteAudio() : entering",ctx->sampleRateInHz);\r
+#endif /* DROID_EXTREME_LOGS */\r
+ pBuffer = (*env)->GetPrimitiveArrayCritical(env, ctx->buff, NULL);\r
+ if (pBuffer)\r
+ {\r
+ written = dr->FillBuffer(dr->audio_renderer, pBuffer, ctx->mbufferSizeInBytes);\r
+ (*env)->ReleasePrimitiveArrayCritical(env, ctx->buff, pBuffer, 0);\r
+ if (written)\r
+ {\r
+ (*env)->CallNonvirtualIntMethod(env, mtrack, cAudioTrack, mWrite, ctx->buff, 0, ctx->mbufferSizeInBytes);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ LOGV("[Android Audio] Failed to get pointer to array bytes = %p", pBuffer);\r
+ }\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOGV("[Android Audio] WAV_WriteAudio() : done",ctx->sampleRateInHz);\r
+#endif /* DROID_EXTREME_LOGS */\r
+}\r
+\r
+/* Called by the main thread */\r
+static void WAV_Play(GF_AudioOutput *dr, u32 PlayType)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ JNIEnv* env = GetEnv();\r
+\r
+ LOGV("[Android Audio] Play: %d\n", PlayType);\r
+\r
+ switch ( PlayType )\r
+ {\r
+ case 0:\r
+ // Stop playing\r
+ (*env)->CallNonvirtualVoidMethod(env, mtrack, cAudioTrack, mStop);\r
+ // Clear the internal buffers\r
+ (*env)->CallNonvirtualVoidMethod(env, mtrack, cAudioTrack, mFlush);\r
+ break;\r
+ case 1:\r
+ case 2:\r
+ (*env)->CallNonvirtualVoidMethod(env, mtrack, cAudioTrack, mPlay);\r
+ break;\r
+ default:\r
+ LOGW("[Android Audio] Unknown Play method=%d.\n", PlayType);\r
+ }\r
+ LOGV("[Android Audio] Play DONE (%d).\n", PlayType);\r
+}\r
+\r
+static void WAV_UpdateVolume(DroidContext *ctx){\r
+ float lV, rV;\r
+ JNIEnv* env = GetEnv();\r
+ if (!ctx)\r
+ return;\r
+ if (ctx->pan > 100)\r
+ ctx->pan = 100;\r
+ lV =rV = ctx->volume / 100.0;\r
+ if (ctx->pan > 50){\r
+ float m = (100 - ctx->pan) / 50.0;\r
+ lV*=m;\r
+ } else if (ctx->pan < 50){\r
+ float m = ctx->pan / 50.0;\r
+ rV*=m;\r
+ }\r
+ if (env && setStereoVolume && mtrack && cAudioTrack){\r
+ int success;\r
+ if (0!= (success=((*env)->CallNonvirtualIntMethod(env, mtrack, cAudioTrack, setStereoVolume, lV, rV))))\r
+ LOGE3("SetVolume(%f,%f) returned Error code %d", lV, rV, success );\r
+ } else {\r
+ LOGD2("SetVolume(%f,%f)", lV, rV );\r
+ }\r
+}\r
+\r
+static void WAV_SetVolume(GF_AudioOutput *dr, u32 Volume) {\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ ctx->volume = Volume;\r
+ WAV_UpdateVolume(ctx);\r
+}\r
+\r
+static void WAV_SetPan(GF_AudioOutput *dr, u32 Pan)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ WAV_UpdateVolume(ctx);\r
+}\r
+\r
+/* Called by the audio thread */\r
+static GF_Err WAV_QueryOutputSampleRate(GF_AudioOutput *dr, u32 *desired_samplerate, u32 *NbChannels, u32 *nbBitsPerSample)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+ JNIEnv* env = ctx->env;\r
+ u32 sampleRateInHz, channelConfig, audioFormat;\r
+\r
+ LOGV("Query sample=%d", *desired_samplerate );\r
+\r
+#ifdef TEST_QUERY_SAMPLE\r
+ sampleRateInHz = *desired_samplerate;\r
+ channelConfig = (*NbChannels == 1) ? CHANNEL_CONFIGURATION_MONO : CHANNEL_CONFIGURATION_STEREO;\r
+ audioFormat = (*nbBitsPerSample == 8)? ENCODING_PCM_8BIT : ENCODING_PCM_16BIT;\r
+\r
+ LOGV3("[Android Audio] Query: SampleRate ChannelConfig AudioFormat: %d %d %d \n",\r
+ sampleRateInHz,\r
+ (channelConfig == CHANNEL_CONFIGURATION_MONO)? 1 : 2,\r
+ (ctx->audioFormat == ENCODING_PCM_8BIT)? 8 : 16);\r
+\r
+ switch (*desired_samplerate) {\r
+ case 11025:\r
+ *desired_samplerate = 11025;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ case 22050:\r
+ *desired_samplerate = 22050;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ break;\r
+ case 8000:\r
+ *desired_samplerate = 8000;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ case 16000:\r
+ *desired_samplerate = 16000;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ case 32000:\r
+ *desired_samplerate = 32000;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ break;\r
+ case 24000:\r
+ *desired_samplerate = 24000;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ case 48000:\r
+ *desired_samplerate = 48000;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ break;\r
+ case 44100:\r
+ *desired_samplerate = 44100;\r
+ if ( (*env)->CallStaticIntMethod(env, cAudioTrack, mGetMinBufferSize,\r
+ *desired_samplerate, channelConfig, audioFormat) > 0 )\r
+ return GF_OK;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+#endif\r
+\r
+ return GF_OK;\r
+}\r
+\r
+static u32 WAV_GetAudioDelay(GF_AudioOutput *dr)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+\r
+ return ctx->delay;\r
+}\r
+\r
+static u32 WAV_GetTotalBufferTime(GF_AudioOutput *dr)\r
+{\r
+ DroidContext *ctx = (DroidContext *)dr->opaque;\r
+\r
+ return ctx->total_length_ms;\r
+}\r
+\r
+//----------------------------------------------------------------------\r
+void *NewWAVRender()\r
+{\r
+ DroidContext *ctx;\r
+ GF_AudioOutput *driv;\r
+ ctx = gf_malloc(sizeof(DroidContext));\r
+ memset(ctx, 0, sizeof(DroidContext));\r
+ ctx->num_buffers = 1;\r
+ ctx->pan = 50;\r
+ ctx->volume = 100;\r
+ driv = gf_malloc(sizeof(GF_AudioOutput));\r
+ memset(driv, 0, sizeof(GF_AudioOutput));\r
+ GF_REGISTER_MODULE_INTERFACE(driv, GF_AUDIO_OUTPUT_INTERFACE, "Android Audio Output", "gpac distribution")\r
+\r
+ driv->opaque = ctx;\r
+\r
+ driv->SelfThreaded = 0;\r
+ driv->Setup = WAV_Setup;\r
+ driv->Shutdown = WAV_Shutdown;\r
+ driv->ConfigureOutput = WAV_ConfigureOutput;\r
+ driv->GetAudioDelay = WAV_GetAudioDelay;\r
+ driv->GetTotalBufferTime = WAV_GetTotalBufferTime;\r
+ driv->SetVolume = WAV_SetVolume;\r
+ driv->SetPan = WAV_SetPan;\r
+ driv->Play = WAV_Play;\r
+ driv->QueryOutputSampleRate = WAV_QueryOutputSampleRate;\r
+ driv->WriteAudio = WAV_WriteAudio;\r
+ return driv;\r
+}\r
+//----------------------------------------------------------------------\r
+void DeleteWAVRender(void *ifce)\r
+{\r
+ GF_AudioOutput *dr = (GF_AudioOutput *) ifce;\r
+ if (!ifce)\r
+ return;\r
+ gf_free(dr);\r
+}\r
+//----------------------------------------------------------------------\r
+const u32 *QueryInterfaces()\r
+{\r
+ static u32 si [] = {\r
+ GF_AUDIO_OUTPUT_INTERFACE,\r
+ 0\r
+ };\r
+ return si;\r
+}\r
+\r
+GF_BaseInterface *LoadInterface(u32 InterfaceType)\r
+{\r
+ if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) return NewWAVRender();\r
+ return NULL;\r
+}\r
+\r
+void ShutdownInterface(GF_BaseInterface *ifce)\r
+{\r
+ switch (ifce->InterfaceType) {\r
+ case GF_AUDIO_OUTPUT_INTERFACE:\r
+ DeleteWAVRender((GF_AudioOutput *) ifce);\r
+ break;\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by Arsov Ivica / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#include "javaenv.h"\r
+\r
+static JavaVM* javaVM = 0;\r
+\r
+//----------------------------------------------------------------------\r
+jint JNI_OnLoad(JavaVM* vm, void* reserved)\r
+{\r
+ javaVM = vm;\r
+ return JNI_VERSION_1_2;\r
+}\r
+//----------------------------------------------------------------------\r
+JNIEnv* GetEnv()\r
+{\r
+ JNIEnv* env = 0;\r
+ //if (javaVM) javaVM->GetEnv((void**)&env, JNI_VERSION_1_2);\r
+ if (javaVM) (*javaVM)->GetEnv(javaVM, (void**)&env, JNI_VERSION_1_2);\r
+ return env;\r
+}\r
+//----------------------------------------------------------------------\r
+JavaVM* GetJavaVM()\r
+{\r
+ return javaVM;\r
+}\r
+//----------------------------------------------------------------------\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by Arsov Ivica / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#ifndef JAVA_ENV\r
+#define JAVA_ENV\r
+\r
+#include <jni.h>\r
+\r
+JavaVM* GetJavaVM();\r
+JNIEnv* GetEnv();\r
+\r
+#endif //JAVA_ENV\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen, Ivica ARSOV / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+\r
+/*driver interfaces*/\r
+#include <gpac/modules/video_out.h>\r
+#include <gpac/list.h>\r
+#include <gpac/constants.h>\r
+\r
+#include <gpac/setup.h>\r
+\r
+#include <android/bitmap.h>\r
+\r
+typedef struct\r
+{\r
+ JNIEnv * env;\r
+ jobject * bitmap;\r
+ u32 width, height;\r
+ void * locked_data;\r
+} AndroidContext;\r
+\r
+\r
+#define RAW_OUT_PIXEL_FORMAT GF_PIXEL_RGB_32\r
+#define NBPP 4\r
+\r
+#define RAWCTX AndroidContext *rc = (AndroidContext *)dr->opaque\r
+\r
+static GF_Err raw_resize(GF_VideoOutput *dr, u32 w, u32 h)\r
+{\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout raw_resize\n"));\r
+ return GF_OK;\r
+}\r
+\r
+GF_Err RAW_Setup(GF_VideoOutput *dr, void *os_handle, void *os_display, u32 init_flags)\r
+{\r
+ AndroidBitmapInfo info;\r
+ RAWCTX;\r
+ void * pixels;\r
+ int ret;\r
+ \r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout RAW_Setup\n"));\r
+ \r
+ if (!rc->width)\r
+ {\r
+ rc->env = (JNIEnv *)os_handle;\r
+ rc->bitmap = (jobject *)os_display;\r
+ \r
+ AndroidBitmap_getInfo(rc->env, *(rc->bitmap), &info);\r
+ rc->width = info.width;\r
+ rc->height = info.height;\r
+ rc->locked_data = NULL;\r
+ }\r
+ else\r
+ {\r
+ rc->env = (JNIEnv *)os_handle;\r
+ rc->bitmap = (jobject *)os_display;\r
+ }\r
+ \r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout rc dims: %d:%d\n", rc->height, rc->width));\r
+ \r
+ return GF_OK;\r
+}\r
+\r
+\r
+static void RAW_Shutdown(GF_VideoOutput *dr)\r
+{\r
+ RAWCTX;\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout RAW_Shutdown\n"));\r
+ rc->bitmap = NULL;\r
+}\r
+\r
+\r
+static GF_Err RAW_Flush(GF_VideoOutput *dr, GF_Window *dest)\r
+{\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout RAW_Flush\n"));\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err RAW_LockBackBuffer(GF_VideoOutput *dr, GF_VideoSurface *vi, Bool do_lock)\r
+{\r
+ RAWCTX;\r
+ int ret;\r
+ void * pixels;\r
+ \r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout RAW_LockBackBuffer: %d\n", do_lock));\r
+ if (do_lock) {\r
+ if (!vi) return GF_BAD_PARAM;\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout locked_data: %d\n", rc->locked_data));\r
+ if (!rc->locked_data)\r
+ {\r
+ if ((ret = AndroidBitmap_lockPixels(rc->env, *(rc->bitmap), &pixels)) < 0) {\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout lock failed\n"));\r
+ }\r
+ rc->locked_data = pixels;\r
+ }\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout rc dims: %d:%d\n", rc->height, rc->width));\r
+ vi->height = rc->height;\r
+ vi->width = rc->width;\r
+ vi->video_buffer = rc->locked_data;\r
+ vi->is_hardware_memory = 0;\r
+ vi->pitch_x = NBPP;\r
+ vi->pitch_y = NBPP * vi->width;\r
+ vi->pixel_format = RAW_OUT_PIXEL_FORMAT;\r
+ }\r
+ else\r
+ {\r
+ if (rc->locked_data)\r
+ {\r
+ AndroidBitmap_unlockPixels(rc->env, *(rc->bitmap));\r
+ rc->locked_data = NULL;\r
+ }\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err RAW_ProcessEvent(GF_VideoOutput *dr, GF_Event *evt)\r
+{\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout RAW_ProcessEvent\n"));\r
+ if (evt) {\r
+ switch (evt->type) {\r
+ case GF_EVENT_SIZE:\r
+ //if (evt->setup.opengl_mode) return GF_OK;\r
+ return raw_resize(dr, evt->setup.width, evt->setup.height);\r
+ case GF_EVENT_VIDEO_SETUP:\r
+ return GF_OK;\r
+ }\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+GF_VideoOutput *NewRawVideoOutput()\r
+{\r
+ AndroidContext *pCtx;\r
+ GF_VideoOutput *driv = (GF_VideoOutput *) gf_malloc(sizeof(GF_VideoOutput));\r
+ memset(driv, 0, sizeof(GF_VideoOutput));\r
+ GF_REGISTER_MODULE_INTERFACE(driv, GF_VIDEO_OUTPUT_INTERFACE, "Android Video Output", "gpac distribution")\r
+\r
+ pCtx = gf_malloc(sizeof(AndroidContext));\r
+ memset(pCtx, 0, sizeof(AndroidContext));\r
+\r
+ driv->opaque = pCtx;\r
+\r
+ driv->Flush = RAW_Flush;\r
+ driv->LockBackBuffer = RAW_LockBackBuffer;\r
+ driv->Setup = RAW_Setup;\r
+ driv->Shutdown = RAW_Shutdown;\r
+ driv->ProcessEvent = RAW_ProcessEvent;\r
+ \r
+ driv->hw_caps = GF_VIDEO_HW_OPENGL;\r
+ \r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout init\n"));\r
+ return (void *)driv;\r
+}\r
+\r
+void DeleteVideoOutput(void *ifce)\r
+{\r
+ AndroidContext *rc;\r
+ GF_VideoOutput *driv = (GF_VideoOutput *) ifce;\r
+\r
+ RAW_Shutdown(driv);\r
+ rc = (AndroidContext *)driv->opaque;\r
+ gf_free(rc);\r
+ gf_free(driv);\r
+ \r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout deinit\n"));\r
+}\r
+\r
+/*interface query*/\r
+GF_EXPORT\r
+const u32 *QueryInterfaces() \r
+{\r
+ static u32 si [] = {\r
+ GF_VIDEO_OUTPUT_INTERFACE,\r
+ 0\r
+ };\r
+ return si; \r
+}\r
+/*interface create*/\r
+GF_BaseInterface *LoadInterface(u32 InterfaceType)\r
+{\r
+ if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return (GF_BaseInterface *) NewRawVideoOutput();\r
+ return NULL;\r
+}\r
+/*interface destroy*/\r
+void ShutdownInterface(GF_BaseInterface *ifce)\r
+{\r
+ switch (ifce->InterfaceType) {\r
+ case GF_VIDEO_OUTPUT_INTERFACE:\r
+ DeleteVideoOutput((GF_VideoOutput *)ifce);\r
+ break;\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) ENST 2009-\r
+ * Authors: Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * Created by NGO Van Luyen, Ivica ARSOV / ARTEMIS / Telecom SudParis /Institut TELECOM on Oct, 2010\r
+ *\r
+ * This file is part of GPAC / Wrapper\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ */\r
+\r
+/*driver interfaces*/\r
+#include <gpac/modules/video_out.h>\r
+#include <gpac/list.h>\r
+#include <gpac/constants.h>\r
+\r
+#include <gpac/setup.h>\r
+\r
+#include <GLES/gl.h>\r
+#include <GLES/glext.h>\r
+\r
+#include <android/log.h>\r
+\r
+#define TAG "DROID_VIDEO"\r
+\r
+#define LOG __android_log_print\r
+\r
+#ifdef PI\r
+#undef PI\r
+#endif\r
+\r
+#define PI 3.1415926535897932f\r
+\r
+/* Uncomment the next line if you want to debug */\r
+/* #define DROID_EXTREME_LOGS */\r
+\r
+typedef struct\r
+{\r
+ u32 width, height;\r
+ void * locked_data;\r
+ u8 out_3d_type;\r
+\r
+ u32 tex_width, tex_height;\r
+\r
+ GLuint texID;\r
+ GLuint framebuff;\r
+ GLuint depthbuff;\r
+\r
+ GLubyte* texData;\r
+\r
+ u8 draw_texture;\r
+ u8 non_power_two;\r
+} AndroidContext;\r
+\r
+\r
+#define RAW_OUT_PIXEL_FORMAT GF_PIXEL_RGBA\r
+#define NBPP 4\r
+\r
+#define RAWCTX AndroidContext *rc = (AndroidContext *)dr->opaque\r
+\r
+//#define GLES_FRAMEBUFFER_TEST\r
+\r
+#ifdef GLES_FRAMEBUFFER_TEST\r
+#warning "Using FrameBuffer"\r
+#endif\r
+\r
+void initGL(AndroidContext *rc)\r
+{\r
+ char* ext;\r
+\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android InitGL");\r
+\r
+ ext = (char*)glGetString(GL_VENDOR);\r
+ LOG( ANDROID_LOG_INFO, TAG, "OpenGL ES Vendor: %s", ext);\r
+\r
+ ext = (char*)glGetString(GL_RENDERER);\r
+ LOG( ANDROID_LOG_INFO, TAG, "OpenGL ES Renderer: %s", ext);\r
+\r
+ ext = (char*)glGetString(GL_VERSION);\r
+ LOG( ANDROID_LOG_INFO, TAG, "OpenGL ES Version: %s", ext);\r
+\r
+ ext = (char*)glGetString(GL_EXTENSIONS);\r
+ LOG( ANDROID_LOG_INFO, TAG, "OpenGL ES Extensions: %s", ext);\r
+\r
+ if ( strstr(ext, "GL_OES_draw_texture") )\r
+ {\r
+ rc->draw_texture = 1;\r
+ LOG( ANDROID_LOG_INFO, TAG, "Using GL_OES_draw_texture");\r
+ }\r
+ if ( strstr(ext, "GL_ARB_texture_non_power_of_two") )\r
+ {\r
+ rc->non_power_two = 0;\r
+ LOG( ANDROID_LOG_INFO, TAG, "Using GL_ARB_texture_non_power_of_two");\r
+ }\r
+\r
+ /* Enable smooth shading */\r
+ glShadeModel(GL_SMOOTH);\r
+\r
+ /* Set the background black */\r
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);\r
+\r
+ /* Depth buffer setup */\r
+ glClearDepthf(1.0f);\r
+\r
+ /* Enables Depth Testing */\r
+ glEnable(GL_DEPTH_TEST);\r
+\r
+ /* The Type Of Depth Test To Do */\r
+ glDepthFunc(GL_LEQUAL);\r
+\r
+ /* Really Nice Perspective Calculations */\r
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);\r
+\r
+ glDisable(GL_CULL_FACE | GL_NORMALIZE | GL_LIGHTING | GL_BLEND | GL_FOG | GL_COLOR_MATERIAL | GL_TEXTURE_2D);\r
+}\r
+\r
+void gluPerspective(GLfloat fovy, GLfloat aspect,\r
+ GLfloat zNear, GLfloat zFar)\r
+{\r
+ GLfloat xmin, xmax, ymin, ymax;\r
+\r
+ ymax = zNear * (GLfloat)tan(fovy * PI / 360);\r
+ ymin = -ymax;\r
+ xmin = ymin * aspect;\r
+ xmax = ymax * aspect;\r
+\r
+ glFrustumx((GLfixed)(xmin * 65536), (GLfixed)(xmax * 65536),\r
+ (GLfixed)(ymin * 65536), (GLfixed)(ymax * 65536),\r
+ (GLfixed)(zNear * 65536), (GLfixed)(zFar * 65536));\r
+}\r
+\r
+void resizeWindow(AndroidContext *rc)\r
+{\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "resizeWindow : start");\r
+ /* Height / width ration */\r
+ GLfloat ratio;\r
+\r
+ /* Protect against a divide by zero */\r
+ if (rc->height==0)\r
+ {\r
+ rc->height=1;\r
+ }\r
+\r
+ ratio=(GLfloat)rc->width/(GLfloat)rc->height;\r
+\r
+ /* Setup our viewport. */\r
+ glViewport(0, 0, (GLsizei)rc->width, (GLsizei)rc->height);\r
+\r
+ /* change to the projection matrix and set our viewing volume. */\r
+ glMatrixMode(GL_PROJECTION);\r
+ glLoadIdentity();\r
+\r
+ /* Set our perspective */\r
+ glOrthox(0, INT2FIX(rc->width), 0, INT2FIX(rc->height), INT2FIX(-1), INT2FIX(1));\r
+\r
+ /* Make sure we're chaning the model view and not the projection */\r
+ glMatrixMode(GL_MODELVIEW);\r
+\r
+ /* Reset The View */\r
+ glLoadIdentity();\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "resizeWindow : end");\r
+}\r
+\r
+void drawGLScene(AndroidContext *rc)\r
+{\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "drawGLScene : start");\r
+#endif /* DROID_EXTREME_LOGS */\r
+ GLfloat vertices[4][3];\r
+ GLfloat texcoord[4][2];\r
+// int i, j;\r
+\r
+ float rgba[4];\r
+\r
+#ifdef GLES_FRAMEBUFFER_TEST\r
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);\r
+#endif\r
+\r
+ // Reset states\r
+ rgba[0] = rgba[1] = rgba[2] = 0.f;\r
+ rgba[0] = 1.f;\r
+ glColor4f(1.f, 1.f, 1.f, 1.f);\r
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, rgba);\r
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, rgba);\r
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, rgba);\r
+ glDisable(GL_CULL_FACE | GL_NORMALIZE | GL_LIGHTING | GL_BLEND | GL_FOG | GL_COLOR_MATERIAL | GL_TEXTURE_2D);\r
+\r
+ /* Clear The Screen And The Depth Buffer */\r
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\r
+\r
+ //glEnable(GL_BLEND);\r
+ //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\r
+\r
+ glEnable(GL_TEXTURE_2D);\r
+ glBindTexture( GL_TEXTURE_2D, rc->texID);\r
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);\r
+ glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\r
+\r
+// for ( i = 0; i < rc->height/2; i++ )\r
+// for ( j = 0; j < rc->width; j++ )\r
+// rc->texData[ i*rc->width*NBPP + j*NBPP + 3] = 200;\r
+\r
+// memset(rc->texData, 255, 4 * rc->width * rc->height );\r
+#ifndef GLES_FRAMEBUFFER_TEST\r
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, rc->tex_width, rc->tex_height, 0,\r
+ GL_RGBA, GL_UNSIGNED_BYTE, rc->texData );\r
+#endif\r
+\r
+ if ( rc->draw_texture )\r
+ {\r
+ int cropRect[4] = {0,rc->height,rc->width,-rc->height};\r
+ glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);\r
+\r
+ glDrawTexsOES(0, 0, 0, rc->width, rc->height);\r
+ }\r
+ else\r
+ {\r
+ /* Enable VERTEX array */\r
+ glEnableClientState(GL_VERTEX_ARRAY);\r
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);\r
+\r
+ /* Setup pointer to VERTEX array */\r
+ glVertexPointer(3, GL_FLOAT, 0, vertices);\r
+ glTexCoordPointer(2, GL_FLOAT, 0, texcoord);\r
+\r
+ /* Move Left 1.5 Units And Into The Screen 6.0 */\r
+ glLoadIdentity();\r
+ //glTranslatef(0.0f, 0.0f, -3.3f);\r
+ //glTranslatef(0.0f, 0.0f, -2.3f);\r
+\r
+ /* Top Right Of The Quad */\r
+ vertices[0][0]=rc->tex_width; vertices[0][1]=rc->tex_height; vertices[0][2]=0.0f;\r
+ texcoord[0][0]=1.f; texcoord[0][1]=0.f;\r
+ /* Top Left Of The Quad */\r
+ vertices[1][0]=0.f; vertices[1][1]=rc->tex_height; vertices[1][2]=0.0f;\r
+ texcoord[1][0]=0.f; texcoord[1][1]=0.f;\r
+ /* Bottom Left Of The Quad */\r
+ vertices[2][0]=rc->tex_width; vertices[2][1]=0.f; vertices[2][2]=0.0f;\r
+ texcoord[2][0]=1.f; texcoord[2][1]=1.f;\r
+ /* Bottom Right Of The Quad */\r
+ vertices[3][0]=0.f; vertices[3][1]=0.f; vertices[3][2]=0.0f;\r
+ texcoord[3][0]=0.f; texcoord[3][1]=1.f;\r
+\r
+ /* Drawing using triangle strips, draw triangles using 4 vertices */\r
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\r
+\r
+ /* Disable vertex array */\r
+ glDisableClientState(GL_VERTEX_ARRAY);\r
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);\r
+ }\r
+\r
+ glDisable(GL_TEXTURE_2D);\r
+\r
+ /* Flush all drawings */\r
+ glFinish();\r
+#ifdef GLES_FRAMEBUFFER_TEST\r
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, rc->framebuff);\r
+#endif\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "drawGLScene : end");\r
+#endif /* DROID_EXTREME_LOGS */\r
+}\r
+\r
+int releaseTexture(AndroidContext *rc)\r
+{\r
+ if (!rc)\r
+ return 0;\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android Delete Texture");\r
+\r
+ if ( rc->texID >= 0 )\r
+ {\r
+ glDeleteTextures(1, &(rc->texID));\r
+ rc->texID = -1;\r
+ }\r
+ if (rc->texData)\r
+ {\r
+ gf_free(rc->texData);\r
+ rc->texData = NULL;\r
+ }\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Delete Texture DONE");\r
+ return 0;\r
+}\r
+\r
+int createTexture(AndroidContext *rc)\r
+{\r
+ if (!rc)\r
+ return 0;\r
+ if ( rc->texID >= 0 )\r
+ releaseTexture(rc);\r
+\r
+ LOG( ANDROID_LOG_INFO, TAG, "Android Create Texture Size: WxH: %dx%d",\r
+ rc->tex_width, rc->tex_height);\r
+\r
+ glGenTextures( 1, &(rc->texID) );\r
+\r
+ rc->texData = (GLubyte*)gf_malloc( 4 * rc->tex_width * rc->tex_height );\r
+ memset(rc->texData, 255, 4 * rc->tex_width * rc->tex_height );\r
+ //memset(data, 0, 4 * width * height/2 );\r
+\r
+ glBindTexture( GL_TEXTURE_2D, rc->texID);\r
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);\r
+ glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\r
+\r
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, rc->tex_width, rc->tex_height, 0,\r
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL/*rc->texData*/ );\r
+\r
+ glBindTexture( GL_TEXTURE_2D, 0);\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Create Texture DONE");\r
+ return 0;\r
+}\r
+\r
+#ifdef GLES_FRAMEBUFFER_TEST\r
+\r
+int releaseFrameBuffer(AndroidContext *rc)\r
+{\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android Delete FrameBuffer");\r
+\r
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);\r
+\r
+ if ( rc->framebuff >= 0 )\r
+ {\r
+ glDeleteFramebuffersOES(1, &(rc->framebuff));\r
+ rc->framebuff = -1;\r
+ }\r
+ if ( rc->depthbuff >= 0 )\r
+ {\r
+ glDeleteRenderbuffersOES(1, &(rc->depthbuff));\r
+ rc->depthbuff = -1;\r
+ }\r
+}\r
+\r
+int createFrameBuffer(AndroidContext *rc)\r
+{\r
+ int backingWidth;\r
+ int backingHeight;\r
+ int res;\r
+\r
+ if ( rc->framebuff >= 0 )\r
+ releaseFrameBuffer(rc);\r
+\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android Create FrameBuffer"));\r
+\r
+ glGenFramebuffersOES(1, &(rc->framebuff));\r
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, rc->framebuff);\r
+\r
+// glGenRenderbuffersOES(1, &(rc->depthbuff));\r
+// glBindRenderbufferOES(GL_RENDERBUFFER_OES, rc->depthbuff);\r
+\r
+// glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);\r
+// glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);\r
+\r
+// LOG( ANDROID_LOG_ERROR, TAG, "Android Depth Buffer Size: %dx%d\n", backingWidth, backingHeight));\r
+\r
+// glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, rc->width, rc->height);\r
+\r
+// glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES,\r
+// GL_RENDERBUFFER_OES, rc->depthbuff);\r
+\r
+ glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES,\r
+ GL_TEXTURE_2D, rc->texID, 0);\r
+\r
+ if ( (res=(int)glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)) != GL_FRAMEBUFFER_COMPLETE_OES )\r
+ {\r
+ LOG( ANDROID_LOG_ERROR, TAG, "Android failed to make complete framebuffer object:");\r
+ switch (res)\r
+ {\r
+ case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES:\r
+ LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES");\r
+ break;\r
+ case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES:\r
+ LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES");\r
+ break;\r
+ case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES:\r
+ LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES");\r
+ break;\r
+ case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES:\r
+ LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES");\r
+ break;\r
+ case GL_FRAMEBUFFER_UNSUPPORTED_OES:\r
+ LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_UNSUPPORTED_OES");\r
+ break;\r
+ default :\r
+ LOG( ANDROID_LOG_ERROR, TAG, "Unknown error: %d", res);\r
+ break;\r
+ }\r
+\r
+ return 1;\r
+ }\r
+\r
+ //glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);\r
+\r
+ return 0;\r
+}\r
+\r
+#endif\r
+\r
+u32 find_pow_2(u32 num)\r
+{\r
+ u32 res = 1;\r
+ while (res < num)\r
+ res *= 2;\r
+ return res;\r
+}\r
+\r
+static GF_Err droid_Resize(GF_VideoOutput *dr, u32 w, u32 h)\r
+{\r
+ RAWCTX;\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android Resize: %dx%d", w, h);\r
+\r
+ rc->width = w;\r
+ rc->height = h;\r
+\r
+ if ( rc->non_power_two )\r
+ {\r
+ rc->tex_width = rc->width;\r
+ rc->tex_height = rc->height;\r
+ }\r
+ else\r
+ {\r
+ rc->tex_width = find_pow_2(rc->width);\r
+ rc->tex_height = find_pow_2(rc->height);\r
+ }\r
+\r
+ resizeWindow(rc);\r
+\r
+ if ( rc->out_3d_type == 0 )\r
+ {\r
+ createTexture(rc);\r
+#ifdef GLES_FRAMEBUFFER_TEST\r
+ createFrameBuffer(rc);\r
+#endif\r
+ }\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Resize DONE", w, h);\r
+ return GF_OK;\r
+}\r
+\r
+GF_Err droid_Setup(GF_VideoOutput *dr, void *os_handle, void *os_display, u32 init_flags)\r
+{\r
+ RAWCTX;\r
+ void * pixels;\r
+ int ret;\r
+\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android Setup: %d", init_flags);\r
+\r
+#ifndef GLES_FRAMEBUFFER_TEST\r
+ if ( rc->out_3d_type == 0 )\r
+#endif\r
+ initGL(rc);\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Setup DONE");\r
+ return GF_OK;\r
+}\r
+\r
+\r
+static void droid_Shutdown(GF_VideoOutput *dr)\r
+{\r
+ RAWCTX;\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android Shutdown\n");\r
+\r
+ releaseTexture(rc);\r
+#ifdef GLES_FRAMEBUFFER_TEST\r
+ releaseFrameBuffer(rc);\r
+#endif\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Shutdown DONE");\r
+}\r
+\r
+\r
+static GF_Err droid_Flush(GF_VideoOutput *dr, GF_Window *dest)\r
+{\r
+ RAWCTX;\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Flush\n");\r
+#endif /* DROID_EXTREME_LOGS */\r
+\r
+#ifndef GLES_FRAMEBUFFER_TEST\r
+ if ( rc->out_3d_type == 0 )\r
+#endif\r
+ drawGLScene(rc);\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android Flush DONE");\r
+#endif /* DROID_EXTREME_LOGS */\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err droid_LockBackBuffer(GF_VideoOutput *dr, GF_VideoSurface *vi, Bool do_lock)\r
+{\r
+ RAWCTX;\r
+ int ret;\r
+ void * pixels;\r
+ int i,j,t;\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android LockBackBuffer: %d", do_lock);\r
+#endif /* DROID_EXTREME_LOGS */\r
+ if (do_lock) {\r
+ if (!vi) return GF_BAD_PARAM;\r
+\r
+ if ( rc->out_3d_type != 0 )\r
+ return GF_NOT_SUPPORTED;\r
+\r
+ vi->height = rc->height;\r
+ vi->width = rc->width;\r
+ vi->video_buffer = rc->texData;\r
+ vi->is_hardware_memory = 0;\r
+ vi->pitch_x = NBPP;\r
+ vi->pitch_y = NBPP * rc->tex_width;\r
+ vi->pixel_format = RAW_OUT_PIXEL_FORMAT;\r
+ }\r
+ else\r
+ {\r
+ if (rc->locked_data)\r
+ {\r
+ //glBindTexture( GL_TEXTURE_2D, rc->texID);\r
+ //glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);\r
+ //glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);\r
+\r
+ //glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, rc->width, rc->height, 0,\r
+ // GL_RGBA, GL_UNSIGNED_BYTE, rc->locked_data );\r
+ }\r
+ }\r
+#ifdef DROID_EXTREME_LOGS\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "Android LockBackBuffer DONE");\r
+#endif /* DROID_EXTREME_LOGS */\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err droid_ProcessEvent(GF_VideoOutput *dr, GF_Event *evt)\r
+{\r
+ RAWCTX;\r
+\r
+ if (evt) {\r
+ switch (evt->type) {\r
+ case GF_EVENT_SIZE:\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "GF_EVENT_SIZE( %d x %d)",\r
+ evt->setup.width, evt->setup.height);\r
+ //if (evt->setup.opengl_mode) return GF_OK;\r
+ return droid_Resize(dr, evt->setup.width, evt->setup.height);\r
+ case GF_EVENT_VIDEO_SETUP:\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android OpenGL mode: %d", evt->setup.opengl_mode);\r
+ switch (evt->setup.opengl_mode)\r
+ {\r
+ case 0:\r
+ rc->out_3d_type = 0;\r
+// initGL(rc);\r
+ droid_Resize(dr, evt->setup.width, evt->setup.height);\r
+ return GF_OK;\r
+ case 1:\r
+ rc->out_3d_type = 1;\r
+ droid_Resize(dr, evt->setup.width, evt->setup.height);\r
+ return GF_OK;\r
+ case 2:\r
+ rc->out_3d_type = 2;\r
+ droid_Resize(dr, evt->setup.width, evt->setup.height);\r
+ return GF_OK;\r
+ case GF_EVENT_SET_CURSOR:\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "GF_EVENT_SET_CURSOR");\r
+ return GF_OK;\r
+ case GF_EVENT_SET_CAPTION:\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "GF_EVENT_SET_CAPTION");\r
+ return GF_OK;\r
+ case GF_EVENT_SHOWHIDE:\r
+ LOG( ANDROID_LOG_VERBOSE, TAG, "GF_EVENT_SHOWHIDE");\r
+ return GF_OK;\r
+ default:\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Process Unknown Event: %d", evt->type);\r
+ return GF_OK;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+GF_VideoOutput *NewRawVideoOutput()\r
+{\r
+ AndroidContext *pCtx;\r
+ GF_VideoOutput *driv = (GF_VideoOutput *) gf_malloc(sizeof(GF_VideoOutput));\r
+ LOG( ANDROID_LOG_INFO, TAG, "Android Video Initialization in progress...");\r
+ memset(driv, 0, sizeof(GF_VideoOutput));\r
+ GF_REGISTER_MODULE_INTERFACE(driv, GF_VIDEO_OUTPUT_INTERFACE, "Android Video Output", "gpac distribution")\r
+\r
+ pCtx = gf_malloc(sizeof(AndroidContext));\r
+ memset(pCtx, 0, sizeof(AndroidContext));\r
+\r
+ pCtx->texID = -1;\r
+ pCtx->framebuff = -1;\r
+ pCtx->depthbuff = -1;\r
+ driv->opaque = pCtx;\r
+\r
+ driv->Flush = droid_Flush;\r
+ driv->LockBackBuffer = droid_LockBackBuffer;\r
+ driv->Setup = droid_Setup;\r
+ driv->Shutdown = droid_Shutdown;\r
+ driv->ProcessEvent = droid_ProcessEvent;\r
+\r
+ driv->max_screen_width = 1024;\r
+ driv->max_screen_height = 1024;\r
+\r
+ driv->hw_caps = GF_VIDEO_HW_OPENGL;// | GF_VIDEO_HW_OPENGL_OFFSCREEN_ALPHA;//GF_VIDEO_HW_DIRECT_ONLY;//\r
+\r
+ LOG( ANDROID_LOG_INFO, TAG, "Android Video Init Done.\n");\r
+ return (void *)driv;\r
+}\r
+\r
+void DeleteVideoOutput(void *ifce)\r
+{\r
+ AndroidContext *rc;\r
+ GF_VideoOutput *driv = (GF_VideoOutput *) ifce;\r
+ if (!ifce)\r
+ return;\r
+ droid_Shutdown(driv);\r
+ rc = (AndroidContext *)driv->opaque;\r
+ if (rc)\r
+ gf_free(rc);\r
+ driv->opaque = NULL;\r
+ gf_free(driv);\r
+ LOG( ANDROID_LOG_DEBUG, TAG, "Android vout deinit\n");\r
+}\r
+\r
+/*interface query*/\r
+GF_EXPORT\r
+const u32 *QueryInterfaces()\r
+{\r
+ static u32 si [] = {\r
+ GF_VIDEO_OUTPUT_INTERFACE,\r
+ 0\r
+ };\r
+ return si;\r
+}\r
+/*interface create*/\r
+GF_BaseInterface *LoadInterface(u32 InterfaceType)\r
+{\r
+ if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return (GF_BaseInterface *) NewRawVideoOutput();\r
+ return NULL;\r
+}\r
+/*interface destroy*/\r
+void ShutdownInterface(GF_BaseInterface *ifce)\r
+{\r
+ switch (ifce->InterfaceType) {\r
+ case GF_VIDEO_OUTPUT_INTERFACE:\r
+ DeleteVideoOutput((GF_VideoOutput *)ifce);\r
+ break;\r
+ }\r
+}\r
vpath %.c $(SRC_PATH)/modules/dummy_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
return 0;
}
+static const char * DC_MIME_TYPES[] = {
+/* "application/x-xmta", "xmta xmta.gz xmtaz", "MPEG-4 Text (XMT)" */
+ "application/x-bt", "bt bt.gz btz", "MPEG-4 Text (BT)",
+ "application/x-xmt", "xmt xmt.gz xmtz", "MPEG-4 Text (XMT)",
+ "model/vrml", "wrl wrl.gz", "VRML World",
+ "x-model/x-vrml", "wrl wrl.gz", "VRML World",
+ "model/x3d+vrml", "x3dv x3dv.gz x3dvz", "X3D/VRML World",
+ "model/x3d+xml", "x3d x3d.gz x3dz", "X3D/XML World",
+ "application/x-shockwave-flash", "swf", "Macromedia Flash Movie",
+ "image/svg+xml", "svg svg.gz svgz", "SVG Document",
+ "image/x-svgm", "svgm", "SVGM Document",
+ "application/x-LASeR+xml", "xsr", "LASeR Document",
+ "application/widget", "wgt", "W3C Widget Package",
+ "application/x-mpegu-widget", "mgt", "MPEG-U Widget Package",
+ NULL
+};
+
+
+static u32 DC_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i;
+ if (!plug)
+ return 0;
+ for (i = 0 ; DC_MIME_TYPES[i] ; i+=3)
+ gf_term_register_mime_type(plug, DC_MIME_TYPES[i], DC_MIME_TYPES[i+1], DC_MIME_TYPES[i+2]);
+ return i / 3;
+}
+
Bool DC_CanHandleURL(GF_InputService *plug, const char *url)
{
- char *sExt = strrchr(url, '.');
+ char *sExt;
+ if (!plug || !url)
+ return 0;
+ sExt = strrchr(url, '.');
if (sExt) {
- Bool ok;
+ Bool ok = 0;
char *cgi_par;
if (!strnicmp(sExt, ".gz", 3)) sExt = strrchr(sExt, '.');
if (!strnicmp(url, "rtsp://", 7)) return 0;
- cgi_par = strchr(sExt, '?');
+ cgi_par = strchr(sExt, '?');
if (cgi_par) cgi_par[0] = 0;
-
- /*the mpeg-4 mime types for bt/xmt are NOT registered at all :)*/
- ok = gf_term_check_extension(plug, "application/x-bt", "bt bt.gz btz", "MPEG-4 Text (BT)", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "application/x-xmt", "xmt xmt.gz xmtz", "MPEG-4 Text (XMT)", sExt);;
- //if (!ok) ok = gf_term_check_extension(plug, "application/x-xmta", "xmta xmta.gz xmtaz", "MPEG-4 Text (XMT)", sExt);
- /*but all these ones are*/
- if (!ok) ok = gf_term_check_extension(plug, "model/vrml", "wrl wrl.gz", "VRML World", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "x-model/x-vrml", "wrl wrl.gz", "VRML World", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "model/x3d+vrml", "x3dv x3dv.gz x3dvz", "X3D/VRML World", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "model/x3d+xml", "x3d x3d.gz x3dz", "X3D/XML World", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "application/x-shockwave-flash", "swf", "Macromedia Flash Movie", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "image/svg+xml", "svg svg.gz svgz", "SVG Document", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "image/x-svgm", "svgm", "SVGM Document", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "application/x-LASeR+xml", "xsr", "LASeR Document", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "application/widget", "wgt", "W3C Widget Package", sExt);
- if (!ok) ok = gf_term_check_extension(plug, "application/x-mpegu-widget", "mgt", "MPEG-U Widget Package", sExt);
-
+ {
+ u32 i;
+ for (i = 0 ; DC_MIME_TYPES[i] ; i+=3)
+ if (0 != (ok = gf_term_check_extension(plug, DC_MIME_TYPES[i], DC_MIME_TYPES[i+1], DC_MIME_TYPES[i+2], sExt)))
+ break;
+ }
if (cgi_par) cgi_par[0] = '?';
if (ok) return 1;
}
+ if (!strncmp(url, "\\\\", 2)) return 0;
+
if (!strnicmp(url, "file://", 7) || !strstr(url, "://")) {
char *rtype = gf_xml_get_root_type(url, NULL);
if (rtype) {
ext = anext;
}
read->service = serv;
-
+
if (ext) {
char *cgi_par = NULL;
ext += 1;
if (ext) {
tmp = strchr(ext, '#'); if (tmp) tmp[0] = 0;
- /* Warning the '?' sign should not be present in local files but it is convenient to have it
+ /* Warning the '?' sign should not be present in local files but it is convenient to have it
to test web content locally */
cgi_par = strchr(ext, '?'); if (cgi_par) cgi_par[0] = 0;
}
- if (!stricmp(ext, "bt") || !stricmp(ext, "btz") || !stricmp(ext, "bt.gz")
- || !stricmp(ext, "xmta")
- || !stricmp(ext, "xmt") || !stricmp(ext, "xmt.gz") || !stricmp(ext, "xmtz")
- || !stricmp(ext, "wrl") || !stricmp(ext, "wrl.gz")
- || !stricmp(ext, "x3d") || !stricmp(ext, "x3d.gz") || !stricmp(ext, "x3dz")
- || !stricmp(ext, "x3dv") || !stricmp(ext, "x3dv.gz") || !stricmp(ext, "x3dvz")
+ if (!stricmp(ext, "bt") || !stricmp(ext, "btz") || !stricmp(ext, "bt.gz")
+ || !stricmp(ext, "xmta")
+ || !stricmp(ext, "xmt") || !stricmp(ext, "xmt.gz") || !stricmp(ext, "xmtz")
+ || !stricmp(ext, "wrl") || !stricmp(ext, "wrl.gz")
+ || !stricmp(ext, "x3d") || !stricmp(ext, "x3d.gz") || !stricmp(ext, "x3dz")
+ || !stricmp(ext, "x3dv") || !stricmp(ext, "x3dv.gz") || !stricmp(ext, "x3dvz")
|| !stricmp(ext, "swf")
- )
+ )
read->oti = GPAC_OTI_PRIVATE_SCENE_GENERIC;
else if (!stricmp(ext, "svg") || !stricmp(ext, "svgz") || !stricmp(ext, "svg.gz")) {
{
u32 ESID;
DCReader *read = (DCReader *) plug->priv;
-
- sscanf(url, "ES_ID=%d", &ESID);
+
+ sscanf(url, "ES_ID=%ud", &ESID);
if (!ESID) {
gf_term_on_connect(read->service, channel, GF_STREAM_NOT_FOUND);
} else {
}
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
GF_NET_CLIENT_INTERFACE,
if (InterfaceType != GF_NET_CLIENT_INTERFACE) return NULL;
GF_SAFEALLOC(plug, GF_InputService);
+ memset(plug, 0, sizeof(GF_InputService));
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC Dummy Loader", "gpac distribution")
+ plug->RegisterMimeTypes = DC_RegisterMimeTypes;
plug->CanHandleURL = DC_CanHandleURL;
plug->ConnectService = DC_ConnectService;
plug->CloseService = DC_CloseService;
vpath %.c $(SRC_PATH)/modules/dx_hw
#DIRECTSOUND_VERSION is needed for GCC compil..
-CFLAGS= $(OPTFLAGS) -w -I$(SRC_PATH)/include -DDIRECTSOUND_VERSION=0x0500
+CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include" -DDIRECTSOUND_VERSION=0x0500
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
$(LIB): $(OBJS)
- windres $(SRC_PATH)/modules/dx_hw/dx_hw.rc dw_hw.o
+ windres "$(SRC_PATH)/modules/dx_hw/dx_hw.rc" dw_hw.o
$(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) dw_hw.o $(LDFLAGS_DX) -L../../bin/gcc -lgpac $(EXTRALIBS)
case GF_PIXEL_RGB_565:
return 2;
case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
case GF_PIXEL_BGR_24:
return 3;
case GF_PIXEL_RGB_32:
case GF_PIXEL_BGR_32:
case GF_PIXEL_ARGB:
+ case GF_PIXEL_RGBAS:
+ case GF_PIXEL_RGBD:
+ case GF_PIXEL_RGBDS:
return 4;
}
return 0;
}
return;
}
- /*nope get all pixels*/
- for (i=0; i<src_wnd->h; i++) {
- dst = vs->video_buffer + i*vs->pitch_y;
- cur = src + i*src_stride;
- for (j=0; j<src_wnd->w; j++) {
- switch (src_pf) {
- case GF_PIXEL_RGB_24:
+ switch (src_pf) {
+ case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
+ /*nope get all pixels*/
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
r = *cur++;
g = *cur++;
b = *cur++;
* ((unsigned short *)dst) = GF_COL_555(r, g, b);
dst += 2;
- break;
}
}
- }
+ break;
+ }
}
void rgb_to_565(GF_VideoSurface *vs, unsigned char *src, u32 src_stride, u32 src_w, u32 src_h, u32 src_pf, const GF_Window *src_wnd)
return;
}
/*nope get all pixels*/
- for (i=0; i<src_wnd->h; i++) {
- dst = vs->video_buffer + i*vs->pitch_y;
- cur = src + i*src_stride;
- for (j=0; j<src_wnd->w; j++) {
- switch (src_pf) {
- case GF_PIXEL_RGB_24:
+ switch (src_pf) {
+ case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
r = *cur++;
g = *cur++;
b = *cur++;
* ((unsigned short *)dst) = GF_COL_565(r, g, b);
dst += 2;
- break;
}
}
+ break;
}
}
/*get all pixels*/
isBGR = vs->pixel_format==GF_PIXEL_BGR_32;
if (isBGR) {
- for (i=0; i<src_wnd->h; i++) {
- dst = vs->video_buffer + i*vs->pitch_y;
- cur = src + i*src_stride;
- for (j=0; j<src_wnd->w; j++) {
- switch (src_pf) {
- case GF_PIXEL_RGB_24:
+ switch (src_pf) {
+ case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
+ dst[0] = *cur++;
+ dst[1] = *cur++;
+ dst[2] = *cur++;
+ dst += 4;
+ }
+ }
+ break;
+ case GF_PIXEL_RGBDS:
+ case GF_PIXEL_RGBD:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
dst[0] = *cur++;
dst[1] = *cur++;
dst[2] = *cur++;
+ cur++;
dst += 4;
- break;
- case GF_PIXEL_BGR_24:
+ }
+ }
+ break;
+ case GF_PIXEL_BGR_24:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
dst[2] = *cur++;
dst[1] = *cur++;
dst[0] = *cur++;
dst += 4;
- break;
}
}
+ break;
}
} else {
- for (i=0; i<src_wnd->h; i++) {
- dst = vs->video_buffer + i*vs->pitch_y;
- cur = src + i*src_stride;
- for (j=0; j<src_wnd->w; j++) {
- switch (src_pf) {
- case GF_PIXEL_RGB_24:
+ switch (src_pf) {
+ case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
+ dst[2] = *cur++;
+ dst[1] = *cur++;
+ dst[0] = *cur++;
+ dst += 4;
+ }
+ }
+ break;
+ case GF_PIXEL_RGBD:
+ case GF_PIXEL_RGBDS:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
dst[2] = *cur++;
dst[1] = *cur++;
dst[0] = *cur++;
+ cur++;
dst += 4;
- break;
- case GF_PIXEL_BGR_24:
+ }
+ }
+ break;
+ case GF_PIXEL_BGR_24:
+ for (i=0; i<src_wnd->h; i++) {
+ dst = vs->video_buffer + i*vs->pitch_y;
+ cur = src + i*src_stride;
+ for (j=0; j<src_wnd->w; j++) {
dst[0] = *cur++;
dst[1] = *cur++;
dst[2] = *cur++;
dst += 4;
- break;
}
}
+ break;
}
}
}
rgb_to_565(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
break;
case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
case GF_PIXEL_BGR_24:
rgb_to_24(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
break;
case GF_PIXEL_RGB_32:
+ case GF_PIXEL_RGBD:
+ case GF_PIXEL_RGBDS:
case GF_PIXEL_BGR_32:
rgb_to_32(dst_s, src_s->video_buffer, src_s->pitch_y, src_s->width, src_s->height, src_s->pixel_format, src_wnd);
break;
DDCONTEXT;
+ opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "HardwareMemory");
+ if (use_system_memory) {
+ if (opt && !strcmp(opt, "Always")) use_system_memory = 0;
+ } else {
+ if (opt && !strcmp(opt, "Never")) use_system_memory = 1;
+ }
force_reinit = 0;
if (use_system_memory && !dd->systems_memory) force_reinit = 1;
if (dd->systems_memory==2) {
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
} else {
- opt = NULL;
- if (use_system_memory) {
- opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "UseHardwareMemory");
- if (opt && !strcmp(opt, "yes")) use_system_memory = 0;
- }
if (!use_system_memory) {
dd->systems_memory = 0;
ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
if (!dd->systems_memory) {
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
- dd->systems_memory = 1;
- if (opt && !strcmp(opt, "yes")) {
- gf_modules_set_option((GF_BaseInterface *)dr, "Video", "UseHardwareMemory", "no");
+ dd->systems_memory = 2;
+ GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[DX Out] Hardware Video not available for backbuffer)\n"));
- GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[DX Out] Hardware Video not available for backbuffer)\n"));
- }
#ifdef USE_DX_3
hr = IDirectDraw_CreateSurface(dd->pDD, &ddsd, &dd->pBack, NULL );
#else
dd->video_bpp = 24;
break;
case 32:
- /*i always have color pbs in 32 bpp !!!*/
- if ((pixelFmt.dwRBitMask == 0x0000FF) && (pixelFmt.dwGBitMask == 0x00FF00) && (pixelFmt.dwBBitMask == 0xFF0000))
- dd->pixelFormat = GF_PIXEL_BGR_32;
- else if ((pixelFmt.dwRBitMask == 0xFF0000) && (pixelFmt.dwGBitMask == 0x00FF00) && (pixelFmt.dwBBitMask == 0x0000FF))
- dd->pixelFormat = GF_PIXEL_RGB_32;
+ if ((pixelFmt.dwRBitMask == 0x0000FF) && (pixelFmt.dwGBitMask == 0x00FF00) && (pixelFmt.dwBBitMask == 0xFF0000)) {
+ dd->pixelFormat = dd->force_alpha ? GF_PIXEL_RGBA : GF_PIXEL_BGR_32;
+ } else if ((pixelFmt.dwRBitMask == 0xFF0000) && (pixelFmt.dwGBitMask == 0x00FF00) && (pixelFmt.dwBBitMask == 0x0000FF)) {
+ dd->pixelFormat = dd->force_alpha ? GF_PIXEL_ARGB : GF_PIXEL_RGB_32;
+ }
dd->video_bpp = 32;
break;
default:
col = GF_COL_ARGB(0xFF, key->r, key->g, key->b);
ck.dwColorSpaceHighValue = ck.dwColorSpaceLowValue = col;
hr = IDirectDrawSurface_SetColorKey(src->pSurface, DDCKEY_SRCBLT, &ck);
- if (FAILED(hr)) return GF_IO_ERR;
+ if (FAILED(hr))
+ return GF_IO_ERR;
}
if ((dst_w==src_w) && (dst_h==src_h)) {
if (key) flags |= DDBLT_KEYSRC;
hr = IDirectDrawSurface_Blt(dd->pBack, dst_wnd ? &r_dst : NULL, src->pSurface, src_wnd ? &r_src : NULL, flags, NULL);
}
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DX Out] Hardware blit result: %s\n", gf_error_to_string(FAILED(hr) ? GF_IO_ERR : GF_OK ) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[DX Out] Hardware blit result: %d (%08x)\n", hr, hr));
return FAILED(hr) ? GF_IO_ERR : GF_OK;
}
//if (video_src->pixel_format==GF_PIXEL_YUVD) return GF_NOT_SUPPORTED;
if (video_src->pixel_format==GF_PIXEL_YUVD) video_src->pixel_format=GF_PIXEL_YV12;
pool = DD_GetSurface(dr, w, h, video_src->pixel_format);
- if (!pool) return GF_IO_ERR;
+ if (!pool)
+ return GF_IO_ERR;
temp_surf.pixel_format = pool->format;
e = DD_LockSurface(dd, &temp_surf, pool->pSurface);
SAFE_DD_RELEASE(dd->yuv_pool.pSurface);
memset(&dd->yuv_pool, 0, sizeof(DDSurface));
}
- opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "UseHardwareMemory");
- if (opt && !strcmp(opt, "never")) num_yuv = 0;
+ opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "HardwareMemory");
+ if (opt && !strcmp(opt, "Never")) num_yuv = 0;
/*too bad*/
if (!num_yuv) {
void DD_SetupDDraw(GF_VideoOutput *driv)
{
- driv->hw_caps |= GF_VIDEO_HW_HAS_RGB;
+ driv->hw_caps |= GF_VIDEO_HW_HAS_RGB | GF_VIDEO_HW_HAS_STRETCH;
driv->Blit = DD_Blit;
driv->LockBackBuffer = DD_LockBackBuffer;
driv->LockOSContext = LockOSContext;
Bool yuv_init;
Bool fullscreen;
Bool systems_memory;
+ Bool force_alpha;
u32 width, height;
u32 fs_width, fs_height;
u32 fs_store_width, fs_store_height;
u32 store_width, store_height;
-
+ LONG backup_styles;
+ Bool alt_down, ctrl_down;
+ Bool on_secondary_screen;
u32 pixelFormat;
u32 video_bpp;
/*cursors*/
HCURSOR curs_normal, curs_hand, curs_collide;
u32 cursor_type;
+ Bool is_setup;
/*gl*/
#ifndef GPAC_DISABLE_3D
DWORD orig_wnd_proc;
u32 last_mouse_move, timer, cursor_type_backup;
- Bool windowless;
+ Bool windowless, hidden;
} DDContext;
void DD_SetupWindow(GF_VideoOutput *dr, Bool hide);
#include <gpac/user.h>
+
#ifdef _WIN32_WCE
#ifdef GPAC_USE_OGL_ES
#endif
-
#ifndef GPAC_DISABLE_3D
#define WGL_RED_BITS_ARB 0x2015
if (dd->NeedRestore) RestoreWindow(dd);
/*destroy all objects*/
- DestroyObjects(dd);
+ if (dd->os_hwnd!=dd->fs_hwnd) DestroyObjects(dd);
if (dd->timer) KillTimer(dd->cur_hwnd, dd->timer);
dd->timer = 0;
- ShowWindow(dd->cur_hwnd, SW_HIDE);
- dd->cur_hwnd = dd->fullscreen ? dd->fs_hwnd : dd->os_hwnd;
- ShowWindow(dd->cur_hwnd, SW_SHOW);
+ if (dd->os_hwnd != dd->fs_hwnd) {
+ ShowWindow(dd->cur_hwnd, SW_HIDE);
+ dd->cur_hwnd = dd->fullscreen ? dd->fs_hwnd : dd->os_hwnd;
+ ShowWindow(dd->cur_hwnd, SW_SHOW);
+ } else {
+ ShowWindow(dd->cur_hwnd, SW_HIDE);
+ SetWindowLong(dd->os_hwnd, GWL_STYLE, dd->fullscreen ? WS_POPUP : dd->backup_styles);
+ ShowWindow(dd->cur_hwnd, SW_SHOW);
+ }
#ifndef GPAC_DISABLE_3D
if (dd->output_3d_type==1) {
- DEVMODE settings;
e = GF_OK;
+ dd->on_secondary_screen = 0;
/*Setup FS*/
if (dd->fullscreen) {
+ int X = 0;
+ int Y = 0;
+#if(WINVER >= 0x0500)
+ HMONITOR hMonitor;
+ MONITORINFOEX minfo;
+ /*get monitor our windows is on*/
+ hMonitor = MonitorFromWindow(dd->os_hwnd, MONITOR_DEFAULTTONEAREST);
+ if (hMonitor) {
+ memset(&minfo, 0, sizeof(MONITORINFOEX));
+ minfo.cbSize = sizeof(MONITORINFOEX);
+ /*get monitor top-left for fullscreen switch, and adjust width and height*/
+ GetMonitorInfo(hMonitor, (LPMONITORINFO) &minfo);
+ dd->fs_width = minfo.rcWork.right - minfo.rcWork.left;
+ dd->fs_height = minfo.rcWork.bottom - minfo.rcWork.top;
+ X = minfo.rcWork.left;
+ Y = minfo.rcWork.top;
+ if (!(minfo.dwFlags & MONITORINFOF_PRIMARY)) dd->on_secondary_screen = 1;
+ }
+#endif
+
/*change display mode*/
if ((MaxWidth && (dd->fs_width >= MaxWidth)) || (MaxHeight && (dd->fs_height >= MaxHeight)) ) {
dd->fs_width = MaxWidth;
dd->fs_height = MaxHeight;
}
- SetWindowPos(dd->cur_hwnd, NULL, 0, 0, dd->fs_width, dd->fs_height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_ASYNCWINDOWPOS);
+ SetWindowPos(dd->cur_hwnd, NULL, X, Y, dd->fs_width, dd->fs_height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_ASYNCWINDOWPOS);
+
+//#ifndef _WIN32_WCE
+ /*commented out since it causes problem on multiple monitors*/
+#if 0
+ {
+ DEVMODE settings;
-#ifndef _WIN32_WCE
memset(&settings, 0, sizeof(DEVMODE));
settings.dmSize = sizeof(DEVMODE);
settings.dmPelsWidth = dd->fs_width;
settings.dmPelsHeight = dd->fs_height;
settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
+
if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL ) {
GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[DirectDraw] cannot change display settings\n"));
e = GF_IO_ERR;
}
+ }
dd->NeedRestore = 1;
#endif
dd->fs_store_width = dd->fs_width;
dd->fs_store_height = dd->fs_height;
+ } else if (dd->os_hwnd==dd->fs_hwnd) {
+ SetWindowPos(dd->os_hwnd, NULL, 0, 0, dd->store_width+dd->off_w, dd->store_height+dd->off_h, SWP_NOZORDER | SWP_NOMOVE | SWP_ASYNCWINDOWPOS);
}
+
if (!e) e = DD_SetupOpenGL(dr, 0, 0);
} else
#endif
{
+
+ if (!dd->fullscreen && (dd->os_hwnd==dd->fs_hwnd)) {
+ SetWindowPos(dd->os_hwnd, NULL, 0, 0, dd->width+dd->off_w, dd->height+dd->off_h, SWP_NOZORDER | SWP_NOMOVE | SWP_ASYNCWINDOWPOS);
+ }
e = InitDirectDraw(dr, dd->width, dd->height);
}
case VK_INSERT: evt->key_code = GF_KEY_INSERT; break;
case VK_DELETE: evt->key_code = GF_KEY_DEL; break;
case VK_HELP: evt->key_code = GF_KEY_HELP; break;
+
+#if !defined(_WIN32_WCE) && !defined(__GNUC__)
case VK_OEM_PLUS: evt->key_code = GF_KEY_PLUS; break;
case VK_OEM_MINUS: evt->key_code = GF_KEY_PLUS; break;
+#endif
#ifndef _WIN32_WCE
case VK_NONCONVERT: evt->key_code = GF_KEY_NONCONVERT; break;
switch (msg) {
case WM_SIZE:
/*always notify GPAC since we're not sure the owner of the window is listening to these events*/
- evt.type = GF_EVENT_SIZE;
- evt.size.width = LOWORD(lParam);
- evt.size.height = HIWORD(lParam);
- vout->on_event(vout->evt_cbk_hdl, &evt);
+ if (wParam==SIZE_MINIMIZED) {
+ evt.type = GF_EVENT_SHOWHIDE;
+ evt.show.show_type = 0;
+ ctx->hidden = 1;
+ vout->on_event(vout->evt_cbk_hdl, &evt);
+ } else {
+ if (ctx->hidden && wParam==SIZE_RESTORED) {
+ ctx->hidden = 0;
+ evt.type = GF_EVENT_SHOWHIDE;
+ evt.show.show_type = 1;
+ vout->on_event(vout->evt_cbk_hdl, &evt);
+ }
+ evt.type = GF_EVENT_SIZE;
+ evt.size.width = LOWORD(lParam);
+ evt.size.height = HIWORD(lParam);
+ vout->on_event(vout->evt_cbk_hdl, &evt);
+ }
break;
case WM_MOVE:
evt.type = GF_EVENT_MOVE;
ctx->orig_wnd_proc = 0L;
}
break;
+
case WM_ACTIVATE:
- if (ctx->fullscreen && (LOWORD(wParam)==WA_INACTIVE)
+ if (!ctx->on_secondary_screen && ctx->fullscreen && (LOWORD(wParam)==WA_INACTIVE)
&& (hWnd==ctx->fs_hwnd)
#ifndef GPAC_DISABLE_3D
&& (ctx->output_3d_type!=2)
vout->on_event(vout->evt_cbk_hdl, &evt);
}
/*fallthrough*/
+#ifndef _WIN32_WCE
case WM_ACTIVATEAPP:
+#endif
if (hWnd==ctx->os_hwnd) {
ctx->has_focus = 1;
SetFocus(hWnd);
case WM_ERASEBKGND:
/*the erasebkgnd message causes flickering when resizing the window, we discard it*/
- break;
+ if (ctx->is_setup) {
+ break;
+ }
case WM_PAINT:
if (ctx->cur_hwnd==hWnd) {
evt.type = GF_EVENT_REFRESH;
}
/*this avoids 100% cpu usage in Firefox*/
return DefWindowProc (hWnd, msg, wParam, lParam);
-
+
case WM_SETCURSOR:
if (ctx->cur_hwnd==hWnd) DD_SetCursor(vout, ctx->cursor_type);
break;
mouse_start_timer(ctx, hWnd, vout);
}
break;
+ case WM_HSCROLL:
+ if (ctx->cur_hwnd==hWnd) {
+ DD_SetCursor(vout, (ctx->cursor_type==GF_CURSOR_HIDE) ? ctx->cursor_type_backup : ctx->cursor_type);
+ evt.type = GF_EVENT_MOUSEWHEEL;
+ evt.mouse.button = 1;
+ switch (LOWORD(wParam)) {
+ case SB_LEFT: evt.mouse.wheel_pos = -1; break;
+ case SB_RIGHT: evt.mouse.wheel_pos = +1; break;
+ case SB_LINELEFT: evt.mouse.wheel_pos = -5; break;
+ case SB_LINERIGHT: evt.mouse.wheel_pos = +5; break;
+ case SB_PAGELEFT: evt.mouse.wheel_pos = -10; break;
+ case SB_PAGERIGHT: evt.mouse.wheel_pos = +10; break;
+ default:
+ break;
+ }
+ ret = vout->on_event(vout->evt_cbk_hdl, &evt);
+ mouse_start_timer(ctx, hWnd, vout);
+ }
+ break;
/*there's a bug on alt state (we miss one event)*/
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
w32_translate_key(wParam, lParam, &evt.key);
evt.type = ((msg==WM_SYSKEYDOWN) || (msg==WM_KEYDOWN)) ? GF_EVENT_KEYDOWN : GF_EVENT_KEYUP;
+ if (evt.key.key_code==GF_KEY_ALT) ctx->alt_down = (evt.type==GF_EVENT_KEYDOWN) ? 1 : 0;
+ if (evt.key.key_code==GF_KEY_CONTROL) ctx->ctrl_down = (evt.type==GF_EVENT_KEYDOWN) ? 1 : 0;
+ if ((ctx->os_hwnd==ctx->fs_hwnd) && ctx->alt_down && (evt.key.key_code==GF_KEY_F4)) {
+ evt.type = GF_EVENT_QUIT;
+ }
+ else if (ctx->ctrl_down && (evt.type==GF_EVENT_KEYUP) && (evt.key.key_code==GF_KEY_V)) {
+ HGLOBAL hglbCopy;
+ if (!IsClipboardFormatAvailable(CF_TEXT)) break;
+ if (!OpenClipboard(ctx->cur_hwnd)) break;
+
+ hglbCopy = GetClipboardData(CF_TEXT);
+ if (hglbCopy) {
+ LPTSTR lptstrCopy = (char *) GlobalLock(hglbCopy);
+ evt.type = GF_EVENT_PASTE_TEXT;
+ evt.message.message = lptstrCopy;
+ ret = vout->on_event(vout->evt_cbk_hdl, &evt);
+ GlobalUnlock(hglbCopy);
+ }
+ CloseClipboard();
+ break;
+ }
+ else if (ctx->ctrl_down && (evt.type==GF_EVENT_KEYUP) && (evt.key.key_code==GF_KEY_C)) {
+ evt.type = GF_EVENT_COPY_TEXT;
+ if ((vout->on_event(vout->evt_cbk_hdl, &evt)==GF_OK) && evt.message.message) {
+ u32 len;
+ HGLOBAL hglbCopy;
+ LPTSTR lptstrCopy;
+ if (!IsClipboardFormatAvailable(CF_TEXT)) break;
+ if (!OpenClipboard(ctx->cur_hwnd)) break;
+ EmptyClipboard();
+
+ len = strlen(evt.message.message);
+ if (!len) break;
+
+ hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(char));
+ lptstrCopy = (char *) GlobalLock(hglbCopy);
+ memcpy(lptstrCopy, evt.message.message, len * sizeof(char));
+ lptstrCopy[len] = 0;
+ GlobalUnlock(hglbCopy);
+ SetClipboardData(CF_TEXT, hglbCopy);
+ CloseClipboard();
+ break;
+ }
+ }
ret = vout->on_event(vout->evt_cbk_hdl, &evt);
break;
case WM_CHAR:
- evt.type = GF_EVENT_TEXTINPUT;
- evt.character.unicode_char = wParam;
- ret = vout->on_event(vout->evt_cbk_hdl, &evt);
+ if (wParam>=32) {
+ evt.type = GF_EVENT_TEXTINPUT;
+ evt.character.unicode_char = wParam;
+ ret = vout->on_event(vout->evt_cbk_hdl, &evt);
+ }
break;
/*
case WM_CANCELMODE:
Bool DD_InitWindows(GF_VideoOutput *vout, DDContext *ctx)
{
u32 flags;
+ Bool use_fs_wnd = 1;
#ifndef _WIN32_WCE
RECT rc;
#endif
flags = ctx->switch_res;
ctx->switch_res = 0;
+ ctx->force_alpha = (flags & GF_TERM_WINDOW_TRANSPARENT) ? 1 : 0;
if (!ctx->os_hwnd) {
u32 styles;
#ifdef _WIN32_WCE
ctx->os_hwnd = CreateWindow(_T("GPAC DirectDraw Output"), _T("GPAC DirectDraw Output"), WS_POPUP, 0, 0, 120, 100, NULL, NULL, hInst, NULL);
#else
- styles = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
- styles |= ctx->windowless ? WS_POPUP : WS_OVERLAPPEDWINDOW;
+
+ if (flags & GF_TERM_WINDOW_NO_DECORATION) {
+ styles = WS_POPUP | WS_THICKFRAME;
+ } else if (ctx->windowless) {
+ styles = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
+ } else {
+ styles = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW;
+ }
+ use_fs_wnd=0;
ctx->os_hwnd = CreateWindow("GPAC DirectDraw Output", "GPAC DirectDraw Output", styles, 0, 0, 120, 100, NULL, NULL, hInst, NULL);
+ ctx->backup_styles = styles;
#endif
if (ctx->os_hwnd == NULL) {
return 0;
ShowWindow(ctx->os_hwnd, SW_HIDE);
} else {
SetForegroundWindow(ctx->os_hwnd);
- ShowWindow(ctx->os_hwnd, SW_SHOWNORMAL);
+ ShowWindow(ctx->os_hwnd, SW_SHOW);
}
/*get border & title bar sizes*/
#else
rc.left = rc.top = 0;
rc.right = rc.bottom = 100;
- AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, 0);
+ AdjustWindowRect(&rc, styles, 0);
ctx->off_w = rc.right - rc.left - 100;
ctx->off_h = rc.bottom - rc.top - 100;
#endif
if (ctx->windowless) SetWindowless(vout, ctx->os_hwnd);
}
+ if (use_fs_wnd) {
#ifdef _WIN32_WCE
- ctx->fs_hwnd = CreateWindow(_T("GPAC DirectDraw Output"), _T("GPAC DirectDraw FS Output"), WS_POPUP, 0, 0, 120, 100, NULL, NULL, hInst, NULL);
+ ctx->fs_hwnd = CreateWindow(_T("GPAC DirectDraw Output"), _T("GPAC DirectDraw FS Output"), WS_POPUP, 0, 0, 120, 100, NULL, NULL, hInst, NULL);
#else
- ctx->fs_hwnd = CreateWindow("GPAC DirectDraw Output", "GPAC DirectDraw FS Output", WS_POPUP, 0, 0, 120, 100, NULL, NULL, hInst, NULL);
+ ctx->fs_hwnd = CreateWindow("GPAC DirectDraw Output", "GPAC DirectDraw FS Output", WS_POPUP, 0, 0, 120, 100, NULL, NULL, hInst, NULL);
#endif
- if (!ctx->fs_hwnd) {
- return 0;
- }
- ShowWindow(ctx->fs_hwnd, SW_HIDE);
+ if (!ctx->fs_hwnd) {
+ return 0;
+ }
+ ShowWindow(ctx->fs_hwnd, SW_HIDE);
+ SetWindowLong(ctx->fs_hwnd, GWL_USERDATA, (LONG) vout);
+ } else {
+ ctx->fs_hwnd = ctx->os_hwnd;
+ }
/*if visible set focus*/
if (!ctx->switch_res) SetFocus(ctx->os_hwnd);
ctx->switch_res = 0;
SetWindowLong(ctx->os_hwnd, GWL_USERDATA, (LONG) vout);
- SetWindowLong(ctx->fs_hwnd, GWL_USERDATA, (LONG) vout);
/*load cursors*/
ctx->curs_normal = LoadCursor(NULL, IDC_ARROW);
GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[DirectXOutput] Entering thread ID %d\n", gf_th_id() ));
if (DD_InitWindows(vout, ctx)) {
+ s32 msg_ok=1;
ctx->th_state = 1;
- while (GetMessage (&(msg), NULL, 0, 0)) {
+ while (msg_ok) {
+ msg_ok = GetMessage (&(msg), NULL, 0, 0);
+ if (msg_ok == -1) msg_ok = 0;
+ if (msg.message == WM_DESTROY) PostQuitMessage(0); //WM_DESTROY: exit
TranslateMessage (&(msg));
DispatchMessage (&(msg));
}
}
ctx->switch_res = flags;
- if (flags & GF_TERM_NO_THREAD) {
+ if (flags & GF_TERM_WINDOW_NO_THREAD) {
DD_InitWindows(dr, ctx);
} else {
/*create event thread*/
ctx->orig_wnd_proc = 0L;
}
- dd_closewindow(ctx->fs_hwnd);
+ if (ctx->fs_hwnd != ctx->os_hwnd) {
+ dd_closewindow(ctx->fs_hwnd);
+ SetWindowLong(ctx->fs_hwnd, GWL_USERDATA, (LONG) NULL);
+ SetWindowLong(ctx->fs_hwnd, GWL_WNDPROC, (DWORD) DefWindowProc);
+ }
+
#ifndef GPAC_DISABLE_3D
if (ctx->gl_hwnd) dd_closewindow(ctx->gl_hwnd);
#endif
/*special care for Firefox: the windows created by our NP plugin may still be called
after the shutdown of the plugin !!*/
SetWindowLong(ctx->os_hwnd, GWL_USERDATA, (LONG) NULL);
- SetWindowLong(ctx->fs_hwnd, GWL_USERDATA, (LONG) NULL);
- SetWindowLong(ctx->fs_hwnd, GWL_WNDPROC, (DWORD) DefWindowProc);
#ifdef _WIN32_WCE
UnregisterClass(_T("GPAC DirectDraw Output"), GetModuleHandle(_T("gm_dx_hw.dll")) );
return ((DDContext*)the_video_output->opaque)->os_hwnd;
}
+u32 get_sys_col(int idx)
+{
+ u32 res;
+ DWORD val = GetSysColor(idx);
+ res = (val)&0xFF; res<<=8;
+ res |= (val>>8)&0xFF; res<<=8;
+ res |= (val>>16)&0xFF;
+ return res;
+}
+
+
/*Note: all calls to SetWindowPos are made in a non-blocking way using SWP_ASYNCWINDOWPOS. This avoids deadlocks
when the compositor request a size change and the DX window thread has grabbed the main compositor mutex.
This typically happens when switching playlist items as fast as possible*/
break;
/*HW setup*/
case GF_EVENT_VIDEO_SETUP:
+ ctx->is_setup=1;
switch (evt->setup.opengl_mode) {
case 0:
#ifndef GPAC_DISABLE_3D
return GF_NOT_SUPPORTED;
#endif
}
+ case GF_EVENT_SYS_COLORS:
+ evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
+ evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION);
+ evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE);
+ evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND);
+ evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE);
+ evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT);
+ evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW);
+ evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT);
+ evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT);
+ evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT);
+ evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT);
+ evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT);
+ evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER);
+ evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION);
+ evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT);
+ evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK);
+ evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT);
+ evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU);
+ evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT);
+ evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR);
+ evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW);
+ evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE);
+ evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT);
+ evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT);
+ evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW);
+ evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW);
+ evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME);
+ evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT);
+ return GF_OK;
}
return GF_OK;
}
return ctx->codec_name;
}
-static Bool EDEC_CanHandleStream(GF_BaseDecoder *ifcg, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool EDEC_CanHandleStream(GF_BaseDecoder *ifcg, u32 StreamType, GF_ESD *esd, u8 PL)
{
+ char *dsi;
GF_M4ADecSpecInfo a_cfg;
EPOCCodec *ctx = (EPOCCodec *)ifcg->privateStack;
/*audio decs*/
if (StreamType == GF_STREAM_AUDIO) {
- switch (ObjectType) {
+ /*media type query*/
+ if (!esd) return 1;
+ dsi = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data : NULL;
+ switch (esd->decoderConfig->objectTypeIndication) {
/*MPEG2 aac*/
case GPAC_OTI_AUDIO_AAC_MPEG2_MP:
case GPAC_OTI_AUDIO_AAC_MPEG2_LCP:
case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP:
/*MPEG4 aac*/
case GPAC_OTI_AUDIO_AAC_MPEG4:
- if (!decSpecInfoSize || !decSpecInfo) return 0;
- if (gf_m4a_get_config(decSpecInfo, decSpecInfoSize, &a_cfg) != GF_OK) return 0;
+ if (!dsi) return 0;
+ if (gf_m4a_get_config(dsi, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg) != GF_OK) return 0;
switch (a_cfg.base_object_type) {
/*only LTP and LC supported*/
case GF_M4A_AAC_LC:
break;
/*non-mpeg4 codecs*/
case GPAC_OTI_MEDIA_GENERIC:
- if (!decSpecInfoSize || !decSpecInfo) return 0;
- if (decSpecInfoSize<4) return 0;
- if (!strnicmp(decSpecInfo, "samr", 4) || !strnicmp(decSpecInfo, "amr ", 4)) {
+ if (!dsi) return 0;
+ if (esd->decoderConfig->decoderSpecificInfo->data < 4) return 0;
+ if (!strnicmp(dsi, "samr", 4) || !strnicmp(dsi, "amr ", 4)) {
if (ctx->caps & GF_EPOC_HAS_AMR) return 1;
}
- if (!strnicmp(decSpecInfo, "sawb", 4)) {
+ if (!strnicmp(dsi, "sawb", 4)) {
if (ctx->caps & GF_EPOC_HAS_AMR_WB) return 1;
}
break;
- /*cap query*/
- case 0:
- return 1;
default:
return 0;
}
vpath %.c $(SRC_PATH)/modules/ffmpeg_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#local ffmpeg lib
ifeq ($(CONFIG_FFMPEG), local)
LOCAL_LIB=-L../../extra_lib/lib/gcc
-CFLAGS+= -I$(LOCAL_INC_PATH)
+CFLAGS+= -I"$(LOCAL_INC_PATH)"
endif
ifeq ($(CONFIG_ZLIB), local)
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include "ffmpeg_in.h"
#include <gpac/avparse.h>
#ifndef FFMPEG_OLD_HEADERS
+
#if (LIBAVCODEC_VERSION_MAJOR <= 52) && (LIBAVCODEC_VERSION_MINOR <= 20)
-#define USE_AVCODEC2 0
+#undef USE_AVCODEC2
#else
#define USE_AVCODEC2 1
#endif
+
#else
-#define USE_AVCODEC2 0
+#undef USE_AVCODEC2
#endif
+
+/**
+ * Allocates data for FFMPEG decoding
+ * \param oldBuffer The oldBuffer (freed if not NULL)
+ * \param size Size to allocate (will use extra padding for real size)
+ * \return The newly allocated buffer
+ */
+static char * ffmpeg_realloc_buffer(char * oldBuffer, u32 size){
+ char * buffer;
+ /* Size of buffer must be larger, see avcodec_decode_video2 documentation */
+ u32 allocatedSz = sizeof( char ) * (FF_INPUT_BUFFER_PADDING_SIZE + size);
+ if (oldBuffer)
+ gf_free(oldBuffer);
+ buffer = gf_malloc( allocatedSz );
+ if (buffer)
+ memset( buffer, 0, allocatedSz);
+ return buffer;
+}
+
+
static AVCodec *ffmpeg_get_codec(u32 codec_4cc)
{
char name[5];
/*demuxer is ffmpeg, extra data can be copied directly*/
if (from_ff_demux) {
- gf_free(ctx->extradata);
+ if (ctx->extradata)
+ gf_free(ctx->extradata);
ctx->extradata_size = dsi_size;
- ctx->extradata = (uint8_t*) gf_malloc(sizeof(char)*ctx->extradata_size);
+ ctx->extradata = ffmpeg_realloc_buffer(ctx->extradata, ctx->extradata_size);
gf_bs_read_data(bs, ctx->extradata, ctx->extradata_size);
return;
}
/*there should be an 'SMI' entry*/
at_type = gf_bs_read_u32(bs);
if (at_type == GF_4CC('S', 'M', 'I', ' ')) {
- gf_free(ctx->extradata);
+ if (ctx->extradata)
+ gf_free(ctx->extradata);
ctx->extradata_size = 0x5a + size;
- ctx->extradata = (uint8_t*) gf_malloc(sizeof(char)*ctx->extradata_size);
+ ctx->extradata = ffmpeg_realloc_buffer(ctx->extradata, ctx->extradata_size);
strcpy(ctx->extradata, "SVQ3");
gf_bs_read_data(bs, (unsigned char *)ctx->extradata + 0x5a, size);
}
}
break;
default:
- gf_free(ctx->extradata);
+ if (ctx->extradata)
+ gf_free(ctx->extradata);
ctx->extradata_size = dsi_size;
- ctx->extradata = (uint8_t*) gf_malloc(sizeof(char)*ctx->extradata_size);
+ ctx->extradata = ffmpeg_realloc_buffer(ctx->extradata, ctx->extradata_size);
gf_bs_read_data(bs, ctx->extradata, ctx->extradata_size);
break;
}
codec = &ffd->base_codec;
frame = &ffd->base_frame;
}
- *ctx = avcodec_alloc_context();
+ if (!(*ctx)){
+ *ctx = avcodec_alloc_context();
+ }
/*private FFMPEG DSI*/
if (ffd->oti == GPAC_OTI_MEDIA_FFMPEG) {
bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
codec_id = gf_bs_read_u32(bs);
if (ffd->st==GF_STREAM_AUDIO) {
- (*ctx)->codec_type = CODEC_TYPE_AUDIO;
+ (*ctx)->codec_type = AVMEDIA_TYPE_AUDIO;
(*ctx)->sample_rate = gf_bs_read_u32(bs);
(*ctx)->channels = gf_bs_read_u16(bs);
(*ctx)->frame_size = gf_bs_read_u16(bs);
/*ffmpeg specific*/
(*ctx)->block_align = gf_bs_read_u16(bs);
} else if (ffd->st==GF_STREAM_VISUAL) {
- (*ctx)->codec_type = CODEC_TYPE_VIDEO;
+ (*ctx)->codec_type = AVMEDIA_TYPE_VIDEO;
(*ctx)->width = gf_bs_read_u16(bs);
(*ctx)->height = gf_bs_read_u16(bs);
}
*codec = avcodec_find_decoder(codec_id);
FFDEC_LoadDSI(ffd, bs, *codec, *ctx, 1);
gf_bs_del(bs);
- }
+ }
/*private QT DSI*/
else if (ffd->oti == GPAC_OTI_MEDIA_GENERIC) {
bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
codec_id = gf_bs_read_u32(bs);
if (ffd->st==GF_STREAM_AUDIO) {
- (*ctx)->codec_type = CODEC_TYPE_AUDIO;
+ (*ctx)->codec_type = AVMEDIA_TYPE_AUDIO;
(*ctx)->sample_rate = gf_bs_read_u32(bs);
(*ctx)->channels = gf_bs_read_u16(bs);
(*ctx)->frame_size = gf_bs_read_u16(bs);
(*ctx)->frame_size = 160;
}
} else if (ffd->st==GF_STREAM_VISUAL) {
- (*ctx)->codec_type = CODEC_TYPE_VIDEO;
+ (*ctx)->codec_type = AVMEDIA_TYPE_VIDEO;
(*ctx)->width = gf_bs_read_u16(bs);
(*ctx)->height = gf_bs_read_u16(bs);
}
else {
u32 codec_id = 0;
if (ffd->st==GF_STREAM_VISUAL) {
- (*ctx)->codec_type = CODEC_TYPE_VIDEO;
+ (*ctx)->codec_type = AVMEDIA_TYPE_VIDEO;
switch (ffd->oti) {
case GPAC_OTI_VIDEO_MPEG4_PART2:
codec_id = CODEC_ID_MPEG4;
break;
}
} else if (ffd->st==GF_STREAM_AUDIO) {
- (*ctx)->codec_type = CODEC_TYPE_AUDIO;
+ (*ctx)->codec_type = AVMEDIA_TYPE_AUDIO;
switch (ffd->oti) {
case GPAC_OTI_AUDIO_MPEG2_PART3:
case GPAC_OTI_AUDIO_MPEG1:
}
/*setup dsi for FFMPEG context BEFORE attaching decoder (otherwise not proper init)*/
- (*ctx)->extradata = gf_malloc(sizeof(char)*esd->decoderConfig->decoderSpecificInfo->dataLength);
- memcpy((*ctx)->extradata, esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);
- (*ctx)->extradata_size = esd->decoderConfig->decoderSpecificInfo->dataLength;
+ (*ctx)->extradata = ffmpeg_realloc_buffer((*ctx)->extradata, esd->decoderConfig->decoderSpecificInfo->dataLength);
+ if ((*ctx)->extradata){
+ memcpy((*ctx)->extradata, esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);
+ (*ctx)->extradata_size = esd->decoderConfig->decoderSpecificInfo->dataLength;
+ } else {
+ /* out of mem ? */
+ (*ctx)->extradata_size = 0;
+ }
}
}
*frame = avcodec_alloc_frame();
#if (LIBAVCODEC_VERSION_INT > ((51<<16)+(20<<8)+0) )
case CODEC_ID_GIF:
#endif
- ffd->pix_fmt = GF_PIXEL_RGB_24;
+ ffd->pix_fmt = GF_PIXEL_RGB_24;
break;
case CODEC_ID_DVD_SUBTITLE:
*frame = avcodec_alloc_frame();
+#ifdef USE_AVCODEC2
+ {
+ AVPacket pkt;
+ av_init_packet(&pkt);
+ pkt.data = esd->decoderConfig->decoderSpecificInfo->data;
+ pkt.size = esd->decoderConfig->decoderSpecificInfo->dataLength;
+ avcodec_decode_video2((*ctx), *frame, &gotpic, &pkt);
+ }
+#else
avcodec_decode_video((*ctx), *frame, &gotpic, esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);
- ffd->pix_fmt = GF_PIXEL_YV12;
+#endif
+ ffd->pix_fmt = GF_PIXEL_YV12;
break;
default:
- ffd->pix_fmt = GF_PIXEL_YV12;
+ ffd->pix_fmt = GF_PIXEL_YV12;
break;
}
if (*ctx) {
if ((*ctx)->extradata) gf_free((*ctx)->extradata);
+ (*ctx)->extradata = NULL;
avcodec_close((*ctx));
*ctx = NULL;
}
*codec = NULL;
#ifdef FFMPEG_SWSCALE
- if (*sws) {
- sws_freeContext(*sws);
+ if (*sws) {
+ sws_freeContext(*sws);
*sws = NULL;
}
#endif
capability->cap.valueInt = GF_AUDIO_CH_FRONT_LEFT | GF_AUDIO_CH_FRONT_RIGHT;
}
break;
+
+ case GF_CODEC_PADDING_BYTES:
+ capability->cap.valueInt = FF_INPUT_BUFFER_PADDING_SIZE;
+ break;
default:
capability->cap.valueInt = 0;
break;
}
}
-static GF_Err FFDEC_ProcessData(GF_MediaDecoder *plug,
+static GF_Err FFDEC_ProcessData(GF_MediaDecoder *plug,
char *inBuffer, u32 inBufferLength,
u16 ES_ID,
char *outBuffer, u32 *outBufferLength,
u8 PaddingBits, u32 mmlevel)
{
-
+#ifdef USE_AVCODEC2
AVPacket pkt;
+#endif
AVPicture pict;
u32 pix_out;
s32 w, h, gotpic;
AVCodec **codec;
AVFrame *frame;
#ifdef FFMPEG_SWSCALE
- struct SwsContext **sws;
+ struct SwsContext **cached_sws;
#endif
FFDec *ffd = plug->privateStack;
-
+#ifdef FFMPEG_SWSCALE
+ cached_sws = &(ffd->base_sws);
+#endif
if (!ES_ID || (ffd->base_ES_ID==ES_ID)) {
ctx = ffd->base_ctx;
codec = &ffd->base_codec;
frame = ffd->base_frame;
-#ifdef FFMPEG_SWSCALE
- sws = &ffd->base_sws;
-#endif
} else if (ffd->depth_ES_ID==ES_ID) {
ctx = ffd->depth_ctx;
codec = &ffd->depth_codec;
frame = ffd->depth_frame;
-#ifdef FFMPEG_SWSCALE
- sws = &ffd->depth_sws;
-#endif
} else {
return GF_BAD_PARAM;
}
}
#endif
+#ifdef USE_AVCODEC2
+ av_init_packet(&pkt);
+ pkt.data = inBuffer;
+ pkt.size = inBufferLength;
+#endif
/*audio stream*/
if (ffd->st==GF_STREAM_AUDIO) {
s32 len;
redecode:
gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+#ifdef USE_AVCODEC2
+ len = avcodec_decode_audio3(ctx, (short *)ffd->audio_buf, &gotpic, &pkt);
+#else
len = avcodec_decode_audio2(ctx, (short *)ffd->audio_buf, &gotpic, inBuffer + ffd->frame_start, inBufferLength - ffd->frame_start);
-
+#endif
if (len<0) { ffd->frame_start = 0; return GF_NON_COMPLIANT_BITSTREAM; }
if (gotpic<0) { ffd->frame_start = 0; return GF_OK; }
- ctx->hurry_up = 0;
-
/*first config*/
if (!ffd->out_size) {
if (ctx->channels * ctx->frame_size* 2 < gotpic) ctx->frame_size = gotpic / 2 * ctx->channels;
return GF_BUFFER_TOO_SMALL;
}
if (ffd->out_size > buf_size) {
- /*don't use too small output chunks otherwise we'll never have enough when mixing - we could
+ /*don't use too small output chunks otherwise we'll never have enough when mixing - we could
also request more slots in the composition memory but let's not waste mem*/
if (ffd->out_size < (u32) 576*ctx->channels) ffd->out_size=ctx->channels*576;
(*outBufferLength) = ffd->out_size;
return GF_BUFFER_TOO_SMALL;
}
-
+
/*we're sure to have at least gotpic bytes available in output*/
memcpy(outBuffer, ffd->audio_buf, sizeof(char) * gotpic);
(*outBufferLength) += gotpic;
/*more frames in the current sample*/
return GF_PACKED_FRAMES;
- }
+ }
/*visual stream*/
w = ctx->width;
h = ctx->height;
if (ffd->check_h264_isma) {
- /*for AVC bitstreams after ISMA decryption, in case (as we do) the decryption DRM tool
+ /*for AVC bitstreams after ISMA decryption, in case (as we do) the decryption DRM tool
doesn't put back nalu size, do it ourselves...*/
if (inBuffer && !inBuffer[0] && !inBuffer[1] && !inBuffer[2] && (inBuffer[3]==0x01)) {
u32 nalu_size;
- u32 remain = inBufferLength;
- char *start, *end;
+ char *start, *end, *bufferEnd;
start = inBuffer;
end = inBuffer + 4;
- while (remain>4) {
+ bufferEnd = inBuffer + inBufferLength;
+ /* FIXME : SOUCHAY : not sure of exact behaviour, but old one was reading non-allocated memory */
+ while ((end+3) < bufferEnd) {
if (!end[0] && !end[1] && !end[2] && (end[3]==0x01)) {
nalu_size = end - start - 4;
start[0] = (nalu_size>>24)&0xFF;
continue;
}
end++;
- remain--;
}
nalu_size = (inBuffer+inBufferLength) - start - 4;
start[0] = (nalu_size>>24)&0xFF;
}
}
- av_init_packet(&pkt);
- pkt.data = inBuffer;
- pkt.size = inBufferLength;
-
-
-#if USE_AVCODEC2
+#ifdef USE_AVCODEC2
if (avcodec_decode_video2(ctx, frame, &gotpic, &pkt) < 0) {
#else
if (avcodec_decode_video(ctx, frame, &gotpic, inBuffer, inBufferLength) < 0) {
avcodec_close(ctx);
*codec = avcodec_find_decoder(CODEC_ID_H263);
if (! (*codec) || (avcodec_open(ctx, *codec)<0)) return GF_NON_COMPLIANT_BITSTREAM;
+#if USE_AVCODEC2
+ if (avcodec_decode_video2(ctx, frame, &gotpic, &pkt) < 0) {
+#else
if (avcodec_decode_video(ctx, frame, &gotpic, inBuffer, inBufferLength) < 0) {
+#endif
/*nope, stay in MPEG-4*/
avcodec_close(ctx);
*codec = avcodec_find_decoder(old_codec);
}
}
}
- ctx->hurry_up = 0;
/*some streams use odd width/height frame values*/
if (ffd->out_pix_fmt == GF_PIXEL_YV12) {
inBuffer[3] = 1;
}
#ifdef FFMPEG_SWSCALE
- if (*sws) {
- sws_freeContext(*sws);
- *sws = NULL;
+ if (*cached_sws) {
+ sws_freeContext(*cached_sws);
+ *cached_sws = NULL;
}
#endif
return GF_BUFFER_TOO_SMALL;
pYD = outBuffer;
pUD = outBuffer + ctx->width * ctx->height;
pVD = outBuffer + 5 * ctx->width * ctx->height / 4;
-
+
for (i=0; i<ctx->height; i++) {
memcpy(pYD, pYO, sizeof(char) * ctx->width);
#ifndef FFMPEG_SWSCALE
img_convert(&pict, pix_out, (AVPicture *) frame, ctx->pix_fmt, ctx->width, ctx->height);
#else
- if (! (*sws))
- (*sws) = sws_getContext(ctx->width, ctx->height,
- ctx->pix_fmt, ctx->width, ctx->height, pix_out, SWS_BICUBIC,
- NULL, NULL, NULL);
-
- if ((*sws))
- sws_scale((*sws), frame->data, frame->linesize, 0, ctx->height, pict.data, pict.linesize);
-
+ *cached_sws = sws_getCachedContext(*cached_sws,
+ ctx->width, ctx->height, ctx->pix_fmt,
+ ctx->width, ctx->height, pix_out,
+ SWS_BICUBIC, NULL, NULL, NULL);
+ if ((*cached_sws)){
+ int sz = sws_scale((*cached_sws), (const uint8_t * const*)frame->data, frame->linesize, 0, ctx->height, pict.data, pict.linesize);
+ assert( sz > 0 );
+ }
#endif
*outBufferLength = ffd->out_size;
return GF_OK;
}
-static Bool FFDEC_CanHandleStream(GF_BaseDecoder *plug, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool FFDEC_CanHandleStream(GF_BaseDecoder *plug, u32 StreamType, GF_ESD *esd, u8 PL)
{
GF_BitStream *bs;
u32 codec_id;
Bool check_4cc;
FFDec *ffd = plug->privateStack;
- if (!ObjectType) {
+ /*media type query*/
+ if (!esd) {
if ((StreamType==GF_STREAM_VISUAL) || (StreamType==GF_STREAM_AUDIO)) return 1;
return 0;
}
/*store types*/
- ffd->oti = ObjectType;
+ ffd->oti = esd->decoderConfig->objectTypeIndication;
ffd->st = StreamType;
codec_id = 0;
check_4cc = 0;
-
+
/*private from FFMPEG input*/
- if (ObjectType == GPAC_OTI_MEDIA_FFMPEG) {
- bs = gf_bs_new(decSpecInfo, decSpecInfoSize, GF_BITSTREAM_READ);
+ if (ffd->oti == GPAC_OTI_MEDIA_FFMPEG) {
+ bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
codec_id = gf_bs_read_u32(bs);
gf_bs_del(bs);
}
/*private from IsoMedia input*/
- else if (ObjectType == GPAC_OTI_MEDIA_GENERIC) {
- bs = gf_bs_new(decSpecInfo, decSpecInfoSize, GF_BITSTREAM_READ);
+ else if (ffd->oti == GPAC_OTI_MEDIA_GENERIC) {
+ bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
codec_id = gf_bs_read_u32(bs);
check_4cc = 1;
gf_bs_del(bs);
}
else if (StreamType==GF_STREAM_AUDIO) {
/*std MPEG-2 audio*/
- if ((ObjectType==GPAC_OTI_AUDIO_MPEG2_PART3) || (ObjectType==GPAC_OTI_AUDIO_MPEG1)) codec_id = CODEC_ID_MP2;
+ if ((ffd->oti==GPAC_OTI_AUDIO_MPEG2_PART3) || (ffd->oti==GPAC_OTI_AUDIO_MPEG1)) codec_id = CODEC_ID_MP2;
/*std AC3 audio*/
- //if (ObjectType==0xA5) codec_id = CODEC_ID_AC3;
- }
-
+ //if (ffd->oti==0xA5) codec_id = CODEC_ID_AC3;
+ }
+
/*std MPEG-4 visual*/
else if (StreamType==GF_STREAM_VISUAL) {
- switch (ObjectType) {
+ switch (ffd->oti) {
/*MPEG-4 v1 simple profile*/
case GPAC_OTI_VIDEO_MPEG4_PART2: codec_id = CODEC_ID_MPEG4; break;
/*H264 (not std OTI, just the way we use it internally)*/
case GPAC_OTI_IMAGE_JPEG:
// return 0; /*I'm having troubles with ffmpeg & jpeg, it appears to crash randomly*/
codec_id = CODEC_ID_MJPEG;
- fprintf(stdout, "bla");
- break;
+ //break;
+ /* SOUCHAY : the JPEG handler has some issues with some JPEG files,
+ * since GPAC also has img_in plugin for images, do not use FFMPEG one
+ */
+ return 0;
default:
return 0;
}
}
/*NeroDigital DVD subtitles*/
- else if ((StreamType==GF_STREAM_ND_SUBPIC) && (ObjectType==0xe0))
+ else if ((StreamType==GF_STREAM_ND_SUBPIC) && (ffd->oti==0xe0))
return 1;
if (!codec_id) return 0;
static const char *FFDEC_GetCodecName(GF_BaseDecoder *dec)
{
- FFDec *ffd = dec->privateStack;
- if (ffd->base_codec) {
+ FFDec *ffd;
+ if (!dec)
+ return NULL;
+ ffd = dec->privateStack;
+ if (ffd && ffd->base_codec) {
sprintf(ffd->szCodec, "FFMPEG %s", ffd->base_codec->name ? ffd->base_codec->name : "unknown");
return ffd->szCodec;
}
GF_MediaDecoder *ptr;
FFDec *priv;
- avcodec_init();
+ /* Note for valgrind : those two functions cause a leak in valgrind */
+ GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, ("[FFMPEG Decoder] Registering all ffmpeg codecs...\n") );
+ avcodec_init();
avcodec_register_all();
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[FFMPEG Decoder] Done registering all ffmpeg codecs.\n") );
+
GF_SAFEALLOC(ptr , GF_MediaDecoder);
GF_SAFEALLOC(priv , FFDec);
void FFDEC_Delete(void *ifce)
{
GF_BaseDecoder *dec = ifce;
- FFDec *ffd = dec->privateStack;
-
- if (ffd->base_ctx) avcodec_close(ffd->base_ctx);
- if (ffd->depth_ctx) avcodec_close(ffd->depth_ctx);
+ FFDec *ffd;
+ if (!ifce)
+ return;
+ ffd = dec->privateStack;
+ if (ffd){
+ if (ffd->base_ctx) avcodec_close(ffd->base_ctx);
+ ffd->base_ctx = NULL;
+ if (ffd->depth_ctx) avcodec_close(ffd->depth_ctx);
+ ffd->depth_ctx = NULL;
#ifdef FFMPEG_SWSCALE
- if (ffd->base_sws) sws_freeContext(ffd->base_sws);
- if (ffd->depth_sws) sws_freeContext(ffd->base_sws);
+ if (ffd->base_sws) sws_freeContext(ffd->base_sws);
+ ffd->base_sws = NULL;
+ if (ffd->depth_sws) sws_freeContext(ffd->base_sws);
+ ffd->depth_sws = NULL;
#endif
- gf_free(ffd);
+ gf_free(ffd);
+ }
+ dec->privateStack = NULL;
gf_free(dec);
-
}
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / FFMPEG module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include "ffmpeg_in.h"
+#ifndef DISABLE_FFMPEG_DEMUX
+
/*default buffer is 200 ms per channel*/
#define FFD_DATA_BUFFER 800
+//#define FFMPEG_DEMUX_ENABLE_MPEG2TS
+
//#if defined(__DARWIN__) || defined(__APPLE__)
#if !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
#include <errno.h>
memset(&map, 0, sizeof(GF_NetworkCommand));
map.command_type = GF_NET_CHAN_MAP_TIME;
-
+
memset(&com, 0, sizeof(GF_NetworkCommand));
com.command_type = GF_NET_CHAN_BUFFER_QUERY;
if (ffd->seekable && (ffd->audio_st>=0)) seek_audio = (u64) (s64) (ffd->seek_time*ffd->audio_tscale.den);
if (ffd->seekable && (ffd->video_st>=0)) seek_video = (u64) (s64) (ffd->seek_time*ffd->video_tscale.den);
- /*it appears that ffmpeg has trouble resyncing on some mpeg files - we trick it by restarting to 0 to get the
+ /*it appears that ffmpeg has trouble resyncing on some mpeg files - we trick it by restarting to 0 to get the
first video frame, and only then seek*/
if (ffd->seekable) av_seek_frame(ffd->ctx, -1, video_init ? seek_to : 0, AVSEEK_FLAG_BACKWARD);
do_seek = !video_init;
slh.decodingTimeStamp = slh.compositionTimeStamp = seek_audio;
}
gf_term_on_sl_packet(ffd->service, ffd->audio_ch, pkt.data, pkt.size, &slh, GF_OK);
- }
+ }
else if (ffd->video_ch && (pkt.stream_index == ffd->video_st)) {
slh.compositionTimeStamp *= ffd->video_tscale.num;
slh.decodingTimeStamp *= ffd->video_tscale.num;
if (com.buffer.occupancy < ffd->data_buffer_ms) break;
}
gf_sleep(10);
-
+
/*escape if disconnect*/
if (!ffd->audio_run && !ffd->video_run) break;
}
return 0;
}
+static const char * FFD_MIME_TYPES[] = {
+ "video/x-mpeg", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies",
+ "video/x-mpeg-systems", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies",
+ "audio/basic", "snd au", "Basic Audio",
+ "audio/x-wav", "wav", "WAV Audio",
+ "audio/vnd.wave", "wav", "WAV Audio",
+ "video/x-ms-asf", "asf wma wmv asx asr", "WindowsMedia Movies",
+ "video/x-ms-wmv", "asf wma wmv asx asr", "WindowsMedia Movies",
+ "video/x-msvideo", "avi", "AVI Movies",
+ "video/x-ms-video", "avi", "AVI Movies",
+ "video/avi", "avi", "AVI Movies",
+ "video/vnd.avi", "avi", "AVI Movies",
+ "video/H263", "h263 263", "H263 Video",
+ "video/H264", "h264 264", "H264 Video",
+ "video/MPEG4", "cmp", "MPEG-4 Video",
+/* We let ffmpeg handle mov because some QT files with uncompressed or adpcm audio use 1 audio sample
+ per MP4 sample which is a killer for our MP4 lib, whereas ffmpeg handles these as complete audio chunks
+ moreover ffmpeg handles cmov, we don't */
+ "video/quicktime", "mov qt", "QuickTime Movies",
+/* Supported by latest versions of FFMPEG */
+ "video/webm", "webm", "Google WebM Movies",
+ "audio/webm", "webm", "Google WebM Music",
+#ifdef FFMPEG_DEMUX_ENABLE_MPEG2TS
+ "video/mp2t", "ts", "MPEG 2 TS",
+#endif
+ NULL
+};
+
+static u32 FFD_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i;
+ for (i = 0 ; FFD_MIME_TYPES[i]; i+=3)
+ gf_term_register_mime_type(plug, FFD_MIME_TYPES[i], FFD_MIME_TYPES[i+1], FFD_MIME_TYPES[i+2]);
+ return i/3;
+}
+
+
static Bool FFD_CanHandleURL(GF_InputService *plug, const char *url)
{
Bool has_audio, has_video;
Bool ret = 0;
char *ext, szName[1000], szExt[20];
const char *szExtList;
-
+ if (!plug || !url)
+ return 0;
/*disable RTP/RTSP from ffmpeg*/
if (!strnicmp(url, "rtsp://", 7)) return 0;
if (!strnicmp(url, "rtspu://", 8)) return 0;
if (ext) ext[0] = 0;
ext = strrchr(szName, '.');
- if (ext) {
+ if (ext && strlen(ext) > 1) {
strcpy(szExt, &ext[1]);
strlwr(szExt);
+#ifndef FFMPEG_DEMUX_ENABLE_MPEG2TS
if (!strcmp(szExt, "ts")) return 0;
-
+#endif
/*note we forbid ffmpeg to handle files we support*/
- if (!strcmp(szExt, "mp4") || !strcmp(szExt, "mpg4") || !strcmp(szExt, "m4a") || !strcmp(szExt, "m21")
- || !strcmp(szExt, "m4v") || !strcmp(szExt, "m4a")
- || !strcmp(szExt, "3gp") || !strcmp(szExt, "3gpp") || !strcmp(szExt, "3gp2") || !strcmp(szExt, "3g2")
- || !strcmp(szExt, "mp3")
- || !strcmp(szExt, "ac3")
- || !strcmp(szExt, "amr")
- || !strcmp(szExt, "bt") || !strcmp(szExt, "wrl") || !strcmp(szExt, "x3dv")
- || !strcmp(szExt, "xmt") || !strcmp(szExt, "xmta") || !strcmp(szExt, "x3d")
-
- || !strcmp(szExt, "jpg") || !strcmp(szExt, "jpeg") || !strcmp(szExt, "png")
+ if (!strcmp(szExt, "mp4") || !strcmp(szExt, "mpg4") || !strcmp(szExt, "m4a") || !strcmp(szExt, "m21")
+ || !strcmp(szExt, "m4v") || !strcmp(szExt, "m4a")
+ || !strcmp(szExt, "3gp") || !strcmp(szExt, "3gpp") || !strcmp(szExt, "3gp2") || !strcmp(szExt, "3g2")
+ || !strcmp(szExt, "mp3")
+ || !strcmp(szExt, "ac3")
+ || !strcmp(szExt, "amr")
+ || !strcmp(szExt, "bt") || !strcmp(szExt, "wrl") || !strcmp(szExt, "x3dv")
+ || !strcmp(szExt, "xmt") || !strcmp(szExt, "xmta") || !strcmp(szExt, "x3d")
+
+ || !strcmp(szExt, "jpg") || !strcmp(szExt, "jpeg") || !strcmp(szExt, "png")
) return 0;
/*check any default stuff that should work with ffmpeg*/
- if (gf_term_check_extension(plug, "video/mpeg", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/x-mpeg", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/x-mpeg-systems", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "audio/basic", "snd au", "Basic Audio", ext)) return 1;
- if (gf_term_check_extension(plug, "audio/x-wav", "wav", "WAV Audio", ext)) return 1;
- if (gf_term_check_extension(plug, "audio/vnd.wave", "wav", "WAV Audio", ext)) return 1;
- if (gf_term_check_extension(plug, "video/x-ms-asf", "asf wma wmv asx asr", "WindowsMedia Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/x-ms-wmv", "asf wma wmv asx asr", "WindowsMedia Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/x-msvideo", "avi", "AVI Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/x-ms-video", "avi", "AVI Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/avi", "avi", "AVI Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "video/vnd.avi", "avi", "AVI Movies", ext)) return 1;
-
- if (gf_term_check_extension(plug, "video/H263", "h263 263", "H263 Video", ext)) return 1;
- if (gf_term_check_extension(plug, "video/H264", "h264 264", "H264 Video", ext)) return 1;
- if (gf_term_check_extension(plug, "video/MPEG4", "cmp", "MPEG-4 Video", ext)) return 1;
- /*we let ffmpeg handle mov because some QT files with uncompressed or adpcm audio use 1 audio sample
- per MP4 sample which is a killer for our MP4 lib, whereas ffmpeg handles these as complete audio chunks
- moreover ffmpeg handles cmov, we don't*/
- if (gf_term_check_extension(plug, "video/quicktime", "mov qt", "QuickTime Movies", ext)) return 1;
+ {
+ u32 i;
+ for (i = 0 ; FFD_MIME_TYPES[i]; i+=3){
+ if (gf_term_check_extension(plug, FFD_MIME_TYPES[0], FFD_MIME_TYPES[i+1], FFD_MIME_TYPES[i+2], ext))
+ return 1;
+ }
+ }
}
ctx = NULL;
if (!ctx || av_find_stream_info(ctx) <0) goto exit;
/*figure out if we can use codecs or not*/
has_video = has_audio = 0;
- for(i = 0; i < ctx->nb_streams; i++) {
+ for(i = 0; i < (s32)ctx->nb_streams; i++) {
AVCodecContext *enc = ctx->streams[i]->codec;
switch(enc->codec_type) {
- case CODEC_TYPE_AUDIO:
+ case AVMEDIA_TYPE_AUDIO:
if (!has_audio) has_audio = 1;
break;
- case CODEC_TYPE_VIDEO:
+ case AVMEDIA_TYPE_VIDEO:
if (!has_video) has_video= 1;
break;
default:
}
if (!has_audio && !has_video) goto exit;
ret = 1;
-
+#if LIBAVFORMAT_VERSION_MAJOR < 53 && LIBAVFORMAT_VERSION_MINOR < 45
fmt_out = guess_stream_format(NULL, url, NULL);
+#else
+ fmt_out = av_guess_format(NULL, url, NULL);
+#endif
if (fmt_out) gf_term_register_mime_type(plug, fmt_out->mime_type, fmt_out->extensions, fmt_out->name);
else {
ext = strrchr(szName, '.');
esd->decoderConfig->streamType = for_audio ? GF_STREAM_AUDIO : GF_STREAM_VISUAL;
esd->decoderConfig->avgBitrate = esd->decoderConfig->maxBitrate = 0;
- /*remap std object types - depending on input formats, FFMPEG may not have separate DSI from initial frame.
+ /*remap std object types - depending on input formats, FFMPEG may not have separate DSI from initial frame.
In this case we have no choice but using FFMPEG decoders*/
if (for_audio) {
AVCodecContext *dec = ffd->ctx->streams[ffd->audio_st]->codec;
esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_AAC_MPEG4;
esd->decoderConfig->decoderSpecificInfo->dataLength = dec->extradata_size;
esd->decoderConfig->decoderSpecificInfo->data = gf_malloc(sizeof(char)*dec->extradata_size);
- memcpy(esd->decoderConfig->decoderSpecificInfo->data,
- dec->extradata,
+ memcpy(esd->decoderConfig->decoderSpecificInfo->data,
+ dec->extradata,
sizeof(char)*dec->extradata_size);
break;
default:
esd->decoderConfig->objectTypeIndication = (dec->codec_id==CODEC_ID_H264) ? GPAC_OTI_VIDEO_AVC : GPAC_OTI_VIDEO_MPEG4_PART2;
esd->decoderConfig->decoderSpecificInfo->dataLength = dec->extradata_size;
esd->decoderConfig->decoderSpecificInfo->data = gf_malloc(sizeof(char)*dec->extradata_size);
- memcpy(esd->decoderConfig->decoderSpecificInfo->data,
- dec->extradata,
+ memcpy(esd->decoderConfig->decoderSpecificInfo->data,
+ dec->extradata,
sizeof(char)*dec->extradata_size);
break;
case CODEC_ID_MPEG1VIDEO:
GF_ESD *esd;
GF_ObjectDescriptor *od;
u32 audio_esid = 0;
-
+
if ((ffd->audio_st>=0) && (ffd->service_type != 1)) {
od = (GF_ObjectDescriptor *) gf_odf_desc_new(GF_ODF_OD_TAG);
esd = FFD_GetESDescriptor(ffd, 1);
full_size = 0;
if (ffd->buffer_used) {
- if (ffd->buffer_used>size) {
+ if (ffd->buffer_used > (u32) size) {
ffd->buffer_used-=size;
memcpy(ffd->buffer, ffd->buffer+size, sizeof(char)*ffd->buffer_used);
#ifdef FFMPEG_DUMP_REMOTE
if (ffd->outdbg) fwrite(buf, size, 1, ffd->outdbg);
#endif
return size;
- }
+ }
full_size += ffd->buffer_used;
buf += ffd->buffer_used;
size -= ffd->buffer_used;
s32 res;
Bool is_local;
const char *sOpt;
- char *ext, szName[1000];
+ char *ext, szName[1024];
FFDemux *ffd = plug->priv;
AVInputFormat *av_in = NULL;
char szExt[20];
if (ffd->ctx) return GF_SERVICE_ERROR;
+ assert( url && strlen(url) < 1024);
strcpy(szName, url);
ext = strrchr(szName, '#');
ffd->service_type = 0;
/*setup wraper for FFMPEG I/O*/
ffd->buffer_size = 8192;
- sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "FFMPEG", "IOBufferSize");
+ sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "FFMPEG", "IOBufferSize");
if (sOpt) ffd->buffer_size = atoi(sOpt);
ffd->buffer = gf_malloc(sizeof(char)*ffd->buffer_size);
#ifdef FFMPEG_DUMP_REMOTE
for (i = 0; i < ffd->ctx->nb_streams; i++) {
AVCodecContext *enc = ffd->ctx->streams[i]->codec;
switch(enc->codec_type) {
- case CODEC_TYPE_AUDIO:
+ case AVMEDIA_TYPE_AUDIO:
if ((ffd->audio_st<0) && (ffd->service_type!=1)) {
ffd->audio_st = i;
ffd->audio_tscale = ffd->ctx->streams[i]->time_base;
}
break;
- case CODEC_TYPE_VIDEO:
+ case AVMEDIA_TYPE_VIDEO:
if ((ffd->video_st<0) && (ffd->service_type!=2)) {
ffd->video_st = i;
ffd->video_tscale = ffd->ctx->streams[i]->time_base;
}
- sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "FFMPEG", "DataBufferMS");
+ sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "FFMPEG", "DataBufferMS");
ffd->data_buffer_ms = 0;
if (sOpt) ffd->data_buffer_ms = atoi(sOpt);
if (!ffd->data_buffer_ms) ffd->data_buffer_ms = FFD_DATA_BUFFER;
e = GF_NOT_SUPPORTED;
goto exit;
}
- sscanf(url, "ES_ID=%d", &ESID);
+ sscanf(url, "ES_ID=%u", &ESID);
if ((s32) ESID == 1 + ffd->audio_st) {
if (ffd->audio_ch) {
gf_mx_p(ffd->mx);
ffd->seek_time = (com->play.start_range>=0) ? com->play.start_range : 0;
-
+
if (ffd->audio_ch==com->base.on_channel) ffd->audio_run = 1;
else if (ffd->video_ch==com->base.on_channel) ffd->video_run = 1;
if (ffd->audio_ch==com->base.on_channel) ffd->audio_run = 0;
else if (ffd->video_ch==com->base.on_channel) ffd->video_run = 0;
return GF_OK;
- /*note we don't handle PAUSE/RESUME/SET_SPEED, this is automatically handled by the demuxing thread
+ /*note we don't handle PAUSE/RESUME/SET_SPEED, this is automatically handled by the demuxing thread
through buffer occupancy queries*/
default:
static Bool FFD_CanHandleURLInService(GF_InputService *plug, const char *url)
{
char szURL[2048], *sep;
- FFDemux *ffd = (FFDemux *)plug->priv;
- const char *this_url = gf_term_get_service_url(ffd->service);
- if (!this_url || !url) return 0;
+ FFDemux *ffd;
+ const char *this_url;
+ if (!plug || !url)
+ return 0;
+ ffd = (FFDemux *)plug->priv;
+ this_url = gf_term_get_service_url(ffd->service);
+ if (!this_url)
+ return 0;
strcpy(szURL, this_url);
sep = strrchr(szURL, '#');
return 0;
}
-void *New_FFMPEG_Demux()
+void *New_FFMPEG_Demux()
{
FFDemux *priv;
GF_InputService *ffd = gf_malloc(sizeof(GF_InputService));
priv = gf_malloc(sizeof(FFDemux));
memset(priv, 0, sizeof(FFDemux));
- /* register all codecs, demux and protocols */
- av_register_all();
-
+ GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, ("[FFMPEG Demuxer] Registering all ffmpeg plugins...\n") );
+ /* register all codecs, demux and protocols */
+ av_register_all();
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[FFMPEG Demuxer] Registering all ffmpeg plugins DONE.\n") );
+
+ ffd->RegisterMimeTypes = FFD_RegisterMimeTypes;
ffd->CanHandleURL = FFD_CanHandleURL;
ffd->CloseService = FFD_CloseService;
ffd->ConnectChannel = FFD_ConnectChannel;
{
FFDemux *ffd;
GF_InputService *ptr = (GF_InputService *)ifce;
-
+ if (!ptr)
+ return;
ffd = ptr->priv;
-
- gf_th_del(ffd->thread);
- gf_mx_del(ffd->mx);
-
- gf_free(ffd);
+ if (ffd){
+ if (ffd->thread)
+ gf_th_del(ffd->thread);
+ ffd->thread = NULL;
+ if (ffd->mx)
+ gf_mx_del(ffd->mx);
+ ffd->mx = NULL;
+ gf_free(ffd);
+ ptr->priv = NULL;
+ }
gf_free(ptr);
}
+#endif
#include <gpac/constants.h>
#include <gpac/thread.h>
+
+//#define DISABLE_FFMPEG_DEMUX
+
#if defined(WIN32) && !defined(__MINGW32__)
#define EMULATE_INTTYPES
/*include FFMPEG APIs*/
+#ifdef _WIN32_WCE
+#define inline __inline
+#endif
+
+
+#if defined(WIN32)
+# define INT64_C(x) (x ## i64)
+# define UINT64_C(x) (x ## Ui64)
+#endif
+
#ifdef FFMPEG_OLD_HEADERS
#include <ffmpeg/avformat.h>
#endif
#endif
+
+
+#if LIBAVUTIL_VERSION_MAJOR<51
+#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+#endif
+
+
+
+
/*FFMPEG decoder module */
typedef struct
{
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include "ffmpeg_in.h"
-#if defined(_WIN32_WCE) && !defined(__GNUC__)
+
+#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(__GNUC__)
+
+#if defined(_WIN32_WCE)
#pragma comment(lib, "toolhelp")
#pragma comment(lib, "winsock")
#endif
+#define _TOSTR(_val) #_val
+#define TOSTR(_val) _TOSTR(_val)
+
+#pragma comment(lib, "avcodec-"TOSTR(LIBAVCODEC_VERSION_MAJOR) )
+#pragma comment(lib, "avformat-"TOSTR(LIBAVFORMAT_VERSION_MAJOR) )
+#pragma comment(lib, "avutil-"TOSTR(LIBAVUTIL_VERSION_MAJOR) )
+#pragma comment(lib, "swscale-"TOSTR(LIBSWSCALE_VERSION_MAJOR) )
+
+#endif
+
+
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
GF_MEDIA_DECODER_INTERFACE,
+#ifndef DISABLE_FFMPEG_DEMUX
GF_NET_CLIENT_INTERFACE,
- 0
+#endif
+ 0
};
return si;
}
GF_EXPORT
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
{
if (InterfaceType == GF_MEDIA_DECODER_INTERFACE) return FFDEC_Load();
+#ifndef DISABLE_FFMPEG_DEMUX
if (InterfaceType == GF_NET_CLIENT_INTERFACE) return New_FFMPEG_Demux();
+#endif
return NULL;
}
case GF_MEDIA_DECODER_INTERFACE:
FFDEC_Delete(ifce);
break;
+#ifndef DISABLE_FFMPEG_DEMUX
case GF_NET_CLIENT_INTERFACE:
Delete_FFMPEG_Demux(ifce);
break;
+#endif
}
}
vpath %.c $(SRC_PATH)/modules/ft_font
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include $(FT_CFLAGS)
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(FT_CFLAGS)
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
char *font_serif, *font_sans, *font_fixed;
} FTBuilder;
+static const char * BEST_FIXED_FONTS[] = {
+ "Courier New",
+ "Courier",
+ "Monaco",
+ "Bitstream Vera Monospace",
+ "Droid Sans Mono",
+ NULL
+};
+
+static const char * BEST_SERIF_FONTS[] = {
+ "Times New Roman",
+ "Bitstream Vera",
+ "Times",
+ "Droid Serif",
+ NULL
+};
+
+static const char * BEST_SANS_FONTS[] = {
+ "Arial",
+ "Tahoma",
+ "Verdana",
+ "Helvetica",
+ "Bitstream Vera Sans",
+ "Frutiger",
+ "Droid Sans",
+ NULL
+};
+
+/**
+ * Choose the best font in the list of fonts
+ */
+static Bool isBestFontFor(const char * listOfFonts[], const char * currentBestFont, const char * fontName) {
+ u32 i;
+ assert( fontName );
+ assert( listOfFonts );
+ for (i = 0 ; listOfFonts[i]; i++){
+ const char * best = listOfFonts[i];
+ if (!stricmp(best, fontName))
+ return 1;
+ if (currentBestFont && !stricmp(best, currentBestFont))
+ return 0;
+ }
+ /* Nothing has been found, the font is the best if none has been choosen before */
+ return currentBestFont == NULL;
+}
+
+void setBestFont(const char * listOfFonts[], char ** currentBestFont, const char * fontName){
+ if (isBestFontFor(listOfFonts, *currentBestFont, fontName)){
+ if (*currentBestFont)
+ gf_free(*currentBestFont);
+ *currentBestFont = NULL;
+ }
+ if (! (*currentBestFont))
+ *currentBestFont = gf_strdup(fontName);
+}
static Bool ft_enum_fonts(void *cbck, char *file_name, char *file_path)
{
/*try to assign default fixed fonts*/
if (!bold && !italic) {
- Bool store = 0;
strcpy(szfont, face->family_name);
strlwr(szfont);
- if (!ftpriv->font_fixed) {
- if (face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) store = 1;
- else if (!strnicmp(face->family_name, "Courier", 15)) store = 1;
- else if (strstr(szfont, "sans") || strstr(szfont, "serif")) store = 0;
- else if (strstr(szfont, "monospace")) store = 1;
-
- if (store) ftpriv->font_fixed = gf_strdup(face->family_name);
- }
- if (!store && !ftpriv->font_sans) {
- if (!strnicmp(face->family_name, "Arial", 5)) store = 1;
- else if (!strnicmp(face->family_name, "Verdana", 7)) store = 1;
- else if (strstr(szfont, "serif") || strstr(szfont, "fixed")) store = 0;
- else if (strstr(szfont, "sans")) store = 1;
-
- if (store) ftpriv->font_sans = gf_strdup(face->family_name);
- }
-
- if (!strnicmp(face->family_name, "Times New Roman", 15)) {
- if (ftpriv->font_serif) gf_free(ftpriv->font_serif);
- ftpriv->font_serif = gf_strdup(face->family_name);
- }
- else if (!store && !ftpriv->font_serif) {
- if (!strnicmp(face->family_name, "Times New Roman", 15))
- store = 1;
- else if (strstr(szfont, "sans") || strstr(szfont, "fixed")) store = 0;
- else if (strstr(szfont, "serif")) store = 1;
-
- if (store)
- ftpriv->font_serif = gf_strdup(face->family_name);
+ if (face->face_flags & FT_FACE_FLAG_FIXED_WIDTH){
+ setBestFont(BEST_FIXED_FONTS, &(ftpriv->font_fixed), face->family_name);
}
+ setBestFont(BEST_SERIF_FONTS, &(ftpriv->font_serif), face->family_name);
+ setBestFont(BEST_SANS_FONTS, &(ftpriv->font_sans), face->family_name);
}
gf_free(szfont);
}
if (font_default) gf_free(font_default);
+ /* We try these fonts in this order */
+
+
gf_modules_set_option((GF_BaseInterface *)dr, "FontEngine", "FontFixed", ftpriv->font_fixed);
gf_modules_set_option((GF_BaseInterface *)dr, "FontEngine", "FontSerif", ftpriv->font_serif);
gf_modules_set_option((GF_BaseInterface *)dr, "FontEngine", "FontSans", ftpriv->font_sans);
return e;
}
+u32 get_sys_col(int idx)
+{
+ u32 res;
+ DWORD val = GetSysColor(idx);
+ res = (val)&0xFF; res<<=8;
+ res |= (val>>8)&0xFF; res<<=8;
+ res |= (val>>16)&0xFF;
+ return res;
+}
static GF_Err GAPI_ProcessEvent(GF_VideoOutput *dr, GF_Event *evt)
{
return GF_NOT_SUPPORTED;
#endif
}
+ case GF_EVENT_SYS_COLORS:
+ evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
+ evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION);
+ evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE);
+ evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND);
+ evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE);
+ evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT);
+ evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW);
+ evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT);
+ evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT);
+ evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT);
+ evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT);
+ evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT);
+ evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER);
+ evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION);
+ evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT);
+ evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK);
+ evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT);
+ evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU);
+ evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT);
+ evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR);
+ evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW);
+ evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE);
+ evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT);
+ evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT);
+ evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW);
+ evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW);
+ evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME);
+ evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT);
+ return GF_OK;
}
return GF_OK;
}
vpath %.c $(SRC_PATH)/modules/gpac_js
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
/*base SVG type*/
#include <gpac/nodes_svg.h>
+#include <gpac/nodes_mpeg4.h>
+#include <gpac/nodes_x3d.h>
/*dom events*/
#include <gpac/events.h>
#if !defined(__GNUC__)
-# if defined(_WIN32_WCE)
-# pragma comment(lib, "js")
-# elif defined (WIN32)
# pragma comment(lib, "js32")
-# endif
#endif
#include <gpac/internal/scenegraph_dev.h>
-#include <jsapi.h>
+#include <gpac/internal/smjs_api.h>
#include <gpac/modules/js_usr.h>
#include <gpac/internal/terminal_dev.h>
typedef struct
{
+ u32 nb_loaded;
+ GF_Terminal *term;
+
JSClass gpacClass;
-} GF_GPACJSExt;
+ JSClass gpacEvtClass;
+ JSClass anyClass;
+ jsval evt_fun;
+ GF_TermEventFilter evt_filter;
+ GF_Event *evt;
+
+ JSContext *c;
+ JSObject *obj, *evt_obj;
+} GF_GPACJSExt;
-#define _SETUP_CLASS(the_class, cname, flag, getp, setp, fin) \
- memset(&the_class, 0, sizeof(the_class)); \
- the_class.name = cname; \
- the_class.flags = flag; \
- the_class.addProperty = JS_PropertyStub; \
- the_class.delProperty = JS_PropertyStub; \
- the_class.getProperty = getp; \
- the_class.setProperty = setp; \
- the_class.enumerate = JS_EnumerateStub; \
- the_class.resolve = JS_ResolveStub; \
- the_class.convert = JS_ConvertStub; \
- the_class.finalize = fin;
+static GF_Terminal *gpac_get_term(JSContext *c, JSObject *obj)
+{
+ GF_GPACJSExt *ext = (GF_GPACJSExt *)JS_GetPrivate(c, obj);
+ return ext ? ext->term : NULL;
+}
-static JSBool gpac_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool gpac_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
const char *res;
char *prop_name;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!term) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (!strcmp(prop_name, "last_working_directory")) {
res = gf_cfg_get_key(term->user->config, "General", "LastWorkingDir");
if (!res) res = gf_cfg_get_key(term->user->config, "General", "ModulesDirectory");
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(c, res));
- return JS_TRUE;
}
- if (!strcmp(prop_name, "scale_x")) {
+ else if (!strcmp(prop_name, "scale_x")) {
*vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(term->compositor->scale_x)) );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "scale_y")) {
+ else if (!strcmp(prop_name, "scale_y")) {
*vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(term->compositor->scale_y)) );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "translation_x")) {
+ else if (!strcmp(prop_name, "translation_x")) {
*vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(term->compositor->trans_x)) );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "translation_y")) {
+ else if (!strcmp(prop_name, "translation_y")) {
*vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(term->compositor->trans_y)) );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "rectangular_textures")) {
+ else if (!strcmp(prop_name, "rectangular_textures")) {
Bool any_size = 0;
#ifndef GPAC_DISABLE_3D
if (term->compositor->gl_caps.npot_texture || term->compositor->gl_caps.rect_texture)
any_size = 1;
#endif
*vp = BOOLEAN_TO_JSVAL( any_size ? JS_TRUE : JS_FALSE );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "batteryOn")) {
+ else if (!strcmp(prop_name, "batteryOn")) {
Bool on_battery = 0;
gf_sys_get_battery_state(&on_battery, NULL, NULL, NULL, NULL);
*vp = BOOLEAN_TO_JSVAL( on_battery ? JS_TRUE : JS_FALSE );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "batteryCharging")) {
+ else if (!strcmp(prop_name, "batteryCharging")) {
Bool on_charge = 0;
gf_sys_get_battery_state(NULL, &on_charge, NULL, NULL, NULL);
*vp = BOOLEAN_TO_JSVAL( on_charge ? JS_TRUE : JS_FALSE );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "batteryPercent")) {
+ else if (!strcmp(prop_name, "batteryPercent")) {
u32 level = 0;
gf_sys_get_battery_state(NULL, NULL, &level, NULL, NULL);
*vp = INT_TO_JSVAL( level );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "batteryLifeTime")) {
+ else if (!strcmp(prop_name, "batteryLifeTime")) {
u32 level = 0;
gf_sys_get_battery_state(NULL, NULL, NULL, &level, NULL);
*vp = INT_TO_JSVAL( level );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "batteryFullLifeTime")) {
+ else if (!strcmp(prop_name, "batteryFullLifeTime")) {
u32 level = 0;
gf_sys_get_battery_state(NULL, NULL, NULL, NULL, &level);
*vp = INT_TO_JSVAL( level );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "hostname")) {
+ else if (!strcmp(prop_name, "hostname")) {
char hostname[100];
gf_sk_get_host_name((char*)hostname);
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(c, hostname));
- return JS_TRUE;
}
- if (!strcmp(prop_name, "fullscreen")) {
+ else if (!strcmp(prop_name, "fullscreen")) {
*vp = BOOLEAN_TO_JSVAL( term->compositor->fullscreen ? JS_TRUE : JS_FALSE);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "current_path")) {
+ else if (!strcmp(prop_name, "current_path")) {
char *url = gf_url_concatenate(term->root_scene->root_od->net_service->url, "");
- if (!url) url = strdup("");
+ if (!url) url = gf_strdup("");
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(c, url));
- free(url);
- return JS_TRUE;
+ gf_free(url);
+ }
+ else if (!strcmp(prop_name, "volume")) {
+ *vp = INT_TO_JSVAL( gf_term_get_option(term, GF_OPT_AUDIO_VOLUME));
+ }
+ else if (!strcmp(prop_name, "navigation")) {
+ *vp = INT_TO_JSVAL( gf_term_get_option(term, GF_OPT_NAVIGATION));
}
+ else if (!strcmp(prop_name, "navigation_type")) {
+ *vp = INT_TO_JSVAL( gf_term_get_option(term, GF_OPT_NAVIGATION_TYPE) );
+ }
+ else if (!strcmp(prop_name, "hardware_yuv")) {
+ *vp = INT_TO_JSVAL( (term->compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_YUV) ? 1 : 0 );
+ }
+ else if (!strcmp(prop_name, "hardware_rgb")) {
+ *vp = INT_TO_JSVAL( (term->compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_RGB) ? 1 : 0 );
+ }
+ else if (!strcmp(prop_name, "hardware_rgba")) {
+ *vp = INT_TO_JSVAL( (term->compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_RGBA) ? 1 : 0 );
+ }
+ else if (!strcmp(prop_name, "hardware_stretch")) {
+ *vp = INT_TO_JSVAL( (term->compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_STRETCH) ? 1 : 0 );
+ }
+
+
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool gpac_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool gpac_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
char *prop_name, *prop_val;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!term) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!strcmp(prop_name, "last_working_directory")) {
- if (!JSVAL_IS_STRING(*vp)) return JS_FALSE;
- prop_val = JS_GetStringBytes(JSVAL_TO_STRING(*vp));
+ if (!JSVAL_IS_STRING(*vp)) {
+ SMJS_FREE(c, prop_name);
+ return JS_FALSE;
+ }
+ prop_val = SMJS_CHARS(c, *vp);
gf_cfg_set_key(term->user->config, "General", "LastWorkingDir", prop_val);
- return JS_TRUE;
+ SMJS_FREE(c, prop_val);
}
- if (!strcmp(prop_name, "caption")) {
+ else if (!strcmp(prop_name, "caption")) {
GF_Event evt;
- if (!JSVAL_IS_STRING(*vp)) return JS_FALSE;
+ if (!JSVAL_IS_STRING(*vp)) {
+ SMJS_FREE(c, prop_name);
+ return JS_FALSE;
+ }
evt.type = GF_EVENT_SET_CAPTION;
- evt.caption.caption = JS_GetStringBytes(JSVAL_TO_STRING(*vp));
+ evt.caption.caption = SMJS_CHARS(c, *vp);
gf_term_user_event(term, &evt);
- return JS_TRUE;
+ SMJS_FREE(c, (char*)evt.caption.caption);
}
- if (!strcmp(prop_name, "fullscreen")) {
+ else if (!strcmp(prop_name, "fullscreen")) {
Bool res = (JSVAL_TO_BOOLEAN(*vp)==JS_TRUE) ? 1 : 0;
if (term->compositor->fullscreen != res) {
gf_term_set_option(term, GF_OPT_FULLSCREEN, res);
}
- return JS_TRUE;
}
-
+ else if (!strcmp(prop_name, "volume")) {
+ if (JSVAL_IS_NUMBER(*vp)) {
+ jsdouble d;
+ JS_ValueToNumber(c, *vp, &d);
+ gf_term_set_option(term, GF_OPT_AUDIO_VOLUME, (u32) d);
+ } else if (JSVAL_IS_INT(*vp)) {
+ gf_term_set_option(term, GF_OPT_AUDIO_VOLUME, JSVAL_TO_INT(*vp));
+ }
+ }
+ else if (!strcmp(prop_name, "navigation")) {
+ gf_term_set_option(term, GF_OPT_NAVIGATION, JSVAL_TO_INT(*vp) );
+ }
+ else if (!strcmp(prop_name, "navigation_type")) {
+ gf_term_set_option(term, GF_OPT_NAVIGATION_TYPE, 0);
+ }
+ else if (!strcmp(prop_name, "disable_hardware_blit")) {
+ term->compositor->disable_hardware_blit = JSVAL_TO_INT(*vp) ? 1 : 0;
+ gf_sc_set_option(term->compositor, GF_OPT_REFRESH, 0);
+ }
+ else if (!strcmp(prop_name, "disable_composite_blit")) {
+ Bool new_val = JSVAL_TO_INT(*vp) ? 1 : 0;
+ if (new_val != term->compositor->disable_composite_blit) {
+ term->compositor->disable_composite_blit = new_val;
+ term->compositor->rebuild_offscreen_textures = 1;
+ gf_sc_set_option(term->compositor, GF_OPT_REFRESH, 0);
+ }
+ }
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool gpac_getOption(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_getOption)
{
- const char *opt, *sec_name;
- JSString *js_sec_name, *js_key_name, *s;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ const char *opt;
+ char *sec_name, *key_name;
+ JSString *s;
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!term) return JS_FALSE;
- if (argc < 2) return JSVAL_FALSE;
+ if (argc < 2) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[0])) return JSVAL_FALSE;
- js_sec_name = JSVAL_TO_STRING(argv[0]);
+ if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
+ if (!JSVAL_IS_STRING(argv[1])) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[1])) return JSVAL_FALSE;
- js_key_name = JSVAL_TO_STRING(argv[1]);
+ sec_name = SMJS_CHARS(c, argv[0]);
+ key_name = SMJS_CHARS(c, argv[1]);
- sec_name = JS_GetStringBytes(js_sec_name);
if (!stricmp(sec_name, "audiofilters")) {
- if (!term->compositor->audio_renderer->filter_chain.enable_filters) return JS_TRUE;
- if (!term->compositor->audio_renderer->filter_chain.filters->filter->GetOption) return JS_TRUE;
- opt = term->compositor->audio_renderer->filter_chain.filters->filter->GetOption(term->compositor->audio_renderer->filter_chain.filters->filter, JS_GetStringBytes(js_key_name));
+ if (!term->compositor->audio_renderer->filter_chain.enable_filters
+ || !term->compositor->audio_renderer->filter_chain.filters->filter->GetOption) {
+ SMJS_FREE(c, key_name);
+ SMJS_FREE(c, sec_name);
+ return JS_TRUE;
+ }
+ opt = term->compositor->audio_renderer->filter_chain.filters->filter->GetOption(term->compositor->audio_renderer->filter_chain.filters->filter, key_name);
} else {
- opt = gf_cfg_get_key(term->user->config, sec_name, JS_GetStringBytes(js_key_name));
+ opt = gf_cfg_get_key(term->user->config, sec_name, key_name);
}
+ SMJS_FREE(c, key_name);
+ SMJS_FREE(c, sec_name);
+
s = JS_NewStringCopyZ(c, opt ? opt : "");
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
return JS_TRUE;
}
-static JSBool gpac_setOption(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_setOption)
{
- char *js_sec_name, *js_key_name, *js_key_val;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ char *sec_name, *key_name, *key_val;
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!term) return JS_FALSE;
- if (argc < 3) return JSVAL_FALSE;
+ if (argc < 3) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[0])) return JSVAL_FALSE;
- js_sec_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
+ if (!JSVAL_IS_STRING(argv[1])) return JS_FALSE;
+ if (!JSVAL_IS_STRING(argv[2])) return JS_FALSE;
+ sec_name = SMJS_CHARS(c, argv[0]);
+ key_name = SMJS_CHARS(c, argv[1]);
+ key_val = SMJS_CHARS(c, argv[2]);
- if (!JSVAL_IS_STRING(argv[1])) return JSVAL_FALSE;
- js_key_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
-
-
- if (!JSVAL_IS_STRING(argv[2])) return JSVAL_FALSE;
- js_key_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
-
- if (!stricmp(js_sec_name, "audiofilters")) {
- if (!term->compositor->audio_renderer->filter_chain.enable_filters) return JS_TRUE;
- if (!term->compositor->audio_renderer->filter_chain.filters->filter->SetOption) return JS_TRUE;
- term->compositor->audio_renderer->filter_chain.filters->filter->SetOption(term->compositor->audio_renderer->filter_chain.filters->filter, js_key_name, js_key_val);
+ if (!stricmp(sec_name, "audiofilters")) {
+ if (term->compositor->audio_renderer->filter_chain.enable_filters
+ && term->compositor->audio_renderer->filter_chain.filters->filter->SetOption) {
+ term->compositor->audio_renderer->filter_chain.filters->filter->SetOption(term->compositor->audio_renderer->filter_chain.filters->filter, key_name, key_val);
+ }
} else {
- gf_cfg_set_key(term->user->config, js_sec_name, js_key_name, js_key_val);
- if (!strcmp(js_sec_name, "Audio") && !strcmp(js_key_name, "Filter")) {
+ gf_cfg_set_key(term->user->config, sec_name, key_name, key_val);
+ if (!strcmp(sec_name, "Audio") && !strcmp(key_name, "Filter")) {
gf_sc_reload_audio_filters(term->compositor);
}
}
- return JSVAL_TRUE;
+ SMJS_FREE(c, sec_name);
+ SMJS_FREE(c, key_name);
+ SMJS_FREE(c, key_val);
+ return JS_TRUE;
}
typedef struct
return 0;
}
-static JSBool gpac_enum_directory(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_enum_directory)
{
GF_Err err;
enum_dir_cbk cbk;
char *url = NULL;
- char *dir = "D:";
+ char *dir = NULL;
char *filter = NULL;
Bool dir_only = 0;
Bool browse_root = 0;
+ SMJS_OBJ
+ SMJS_ARGS
if ((argc >= 1) && JSVAL_IS_STRING(argv[0])) {
- JSString *js_dir = JSVAL_TO_STRING(argv[0]);
- dir = JS_GetStringBytes(js_dir);
+ dir = SMJS_CHARS(c, argv[0]);
if (!strcmp(dir, "/")) browse_root = 1;
}
if ((argc >= 2) && JSVAL_IS_STRING(argv[1])) {
- JSString *js_fil = JSVAL_TO_STRING(argv[1]);
- filter = JS_GetStringBytes(js_fil);
+ filter = SMJS_CHARS(c, argv[1]);
if (!strcmp(filter, "dir")) {
dir_only = 1;
filter = NULL;
- } else if (!strlen(filter)) filter=NULL;
+ } else if (!strlen(filter)) {
+ SMJS_FREE(c, filter);
+ filter=NULL;
+ }
}
if ((argc >= 3) && JSVAL_IS_BOOLEAN(argv[2])) {
if (JSVAL_TO_BOOLEAN(argv[2])==JS_TRUE) {
}
}
- if (!strlen(dir) && (!url || !strlen(url))) browse_root = 1;
+ if ( (!dir || !strlen(dir) ) && (!url || !strlen(url))) browse_root = 1;
if (browse_root) {
cbk.c = c;
cbk.array = JS_NewArrayObject(c, 0, 0);
cbk.is_dir = 1;
gf_enum_directory("/", 1, enum_dir_fct, &cbk, NULL);
- *rval = OBJECT_TO_JSVAL(cbk.array);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(cbk.array) );
if (url) gf_free(url);
+ SMJS_FREE(c, dir);
+ SMJS_FREE(c, filter);
return JS_TRUE;
}
cbk.is_dir = 1;
err = gf_enum_directory(url ? url : dir, 1, enum_dir_fct, &cbk, NULL);
if (err==GF_IO_ERR) {
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ GF_Terminal *term = gpac_get_term(c, obj);
/*try to concatenate with service url*/
char *an_url = gf_url_concatenate(term->root_scene->root_od->net_service->url, url ? url : dir);
gf_free(url);
cbk.is_dir = 0;
err = gf_enum_directory(url ? url : dir, 0, enum_dir_fct, &cbk, filter);
if (dir_only && (err==GF_IO_ERR)) {
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ GF_Terminal *term = gpac_get_term(c, obj);
/*try to concatenate with service url*/
char *an_url = gf_url_concatenate(term->root_scene->root_od->net_service->url, url ? url : dir);
gf_free(url);
}
}
- *rval = OBJECT_TO_JSVAL(cbk.array);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(cbk.array) );
if (url) gf_free(url);
+ SMJS_FREE(c, dir);
+ SMJS_FREE(c, filter);
return JS_TRUE;
}
-static JSBool gpac_set_size(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_set_size)
{
Bool override_size_info = 0;
u32 w, h;
jsdouble d;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!term) return JS_FALSE;
w = h = 0;
return JS_TRUE;
}
-static JSBool gpac_get_horizontal_dpi(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_get_horizontal_dpi)
{
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
- if (term) *rval = INT_TO_JSVAL(term->compositor->video_out->dpi_x);
+ SMJS_OBJ
+ GF_Terminal *term = gpac_get_term(c, obj);
+ if (term) SMJS_SET_RVAL( INT_TO_JSVAL(term->compositor->video_out->dpi_x) );
return JS_TRUE;
}
-static JSBool gpac_get_vertical_dpi(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_get_vertical_dpi)
{
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
- if (term) *rval = INT_TO_JSVAL(term->compositor->video_out->dpi_y);
+ SMJS_OBJ
+ GF_Terminal *term = gpac_get_term(c, obj);
+ if (term) SMJS_SET_RVAL( INT_TO_JSVAL(term->compositor->video_out->dpi_y) );
return JS_TRUE;
}
-static JSBool gpac_get_screen_width(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_get_screen_width)
{
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
- *rval = INT_TO_JSVAL(term->compositor->video_out->max_screen_width);
+ SMJS_OBJ
+ GF_Terminal *term = gpac_get_term(c, obj);
+ SMJS_SET_RVAL( INT_TO_JSVAL(term->compositor->video_out->max_screen_width));
return JS_TRUE;
}
-static JSBool gpac_get_screen_height(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_get_screen_height)
{
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
- *rval = INT_TO_JSVAL(term->compositor->video_out->max_screen_height);
+ SMJS_OBJ
+ GF_Terminal *term = gpac_get_term(c, obj);
+ SMJS_SET_RVAL( INT_TO_JSVAL(term->compositor->video_out->max_screen_height));
return JS_TRUE;
}
-static JSBool gpac_exit(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_exit)
{
GF_Event evt;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ SMJS_OBJ
+ GF_Terminal *term = gpac_get_term(c, obj);
evt.type = GF_EVENT_QUIT;
gf_term_send_event(term, &evt);
return JS_TRUE;
}
-static JSBool gpac_set_3d(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_set_3d)
{
u32 type_3d = 0;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Terminal *term = gpac_get_term(c, obj);
if (argc && JSVAL_IS_INT(argv[0])) type_3d = JSVAL_TO_INT(argv[0]);
if (term->compositor->inherit_type_3d != type_3d) {
term->compositor->inherit_type_3d = type_3d;
return JS_TRUE;
}
-static JSBool gpac_get_scene_time(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_move_window)
+{
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Event evt;
+ GF_Terminal *term = gpac_get_term(c, obj);
+ if (argc < 2) return JS_TRUE;
+ if (!JSVAL_IS_INT(argv[0]) || !JSVAL_IS_INT(argv[1])) return JS_TRUE;
+
+ evt.type = GF_EVENT_MOVE;
+ evt.move.relative = 1;
+ evt.move.x = JSVAL_TO_INT(argv[0]);
+ evt.move.y = JSVAL_TO_INT(argv[1]);
+ term->compositor->video_out->ProcessEvent(term->compositor->video_out, &evt);
+
+ return JS_TRUE;
+}
+
+
+static JSBool SMJS_FUNCTION(gpac_error_string)
{
+ const char *str;
+ SMJS_ARGS
+
+ if (argc < 1) return JS_TRUE;
+ if (!JSVAL_IS_INT(argv[0]) ) return JS_TRUE;
+ str = gf_error_to_string(JSVAL_TO_INT(argv[0]));
+
+ SMJS_SET_RVAL( STRING_TO_JSVAL(JS_NewStringCopyZ(c, str)) );
+ return JS_TRUE;
+}
+
+static JSBool SMJS_FUNCTION(gpac_get_scene_time)
+{
+ SMJS_OBJ
+ SMJS_ARGS
GF_SceneGraph *sg = NULL;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!argc || !JSVAL_IS_OBJECT(argv[0])) {
sg = term->root_scene->graph;
} else {
GF_Node *n = gf_sg_js_get_node(c, JSVAL_TO_OBJECT(argv[0]));
sg = n ? n->sgprivate->scenegraph : term->root_scene->graph;
}
- *rval = DOUBLE_TO_JSVAL( JS_NewDouble(c, sg->GetSceneTime(sg->userpriv) ) );
+ SMJS_SET_RVAL( DOUBLE_TO_JSVAL( JS_NewDouble(c, sg->GetSceneTime(sg->userpriv) ) ) );
return JS_TRUE;
}
-static JSBool gpac_migrate_url(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(gpac_migrate_url)
{
char *url;
u32 i, count;
GF_NetworkCommand com;
- GF_Terminal *term = (GF_Terminal *)JS_GetPrivate(c, obj);
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Terminal *term = gpac_get_term(c, obj);
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_FALSE;
- url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ url = SMJS_CHARS(c, argv[0]);
if (!url) return JS_FALSE;
count = gf_list_count(term->root_scene->resources);
com.base.command_type = GF_NET_SERVICE_MIGRATION_INFO;
odm->net_service->ifce->ServiceCommand(odm->net_service->ifce, &com);
if (com.migrate.data) {
- *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(c, com.migrate.data));
+ SMJS_SET_RVAL( STRING_TO_JSVAL(JS_NewStringCopyZ(c, com.migrate.data)) );
} else {
- *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(c, odm->net_service->url));
+ SMJS_SET_RVAL( STRING_TO_JSVAL(JS_NewStringCopyZ(c, odm->net_service->url)) );
}
break;
}
+ SMJS_FREE(c, url);
return JS_TRUE;
}
+static JSBool gpacevt_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
+{
+ GF_GPACJSExt *gjs = JS_GetPrivate(c, obj);
+ GF_Event *evt = gjs->evt;
+ if (!evt) return 0;
+
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0:
+ *vp = INT_TO_JSVAL(evt->type);
+ break;
+ case 1:
+ *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(c, gf_dom_get_key_name(evt->key.key_code) ));
+ break;
+ case 2:
+ *vp = INT_TO_JSVAL(evt->mouse.x);
+ break;
+ case 3:
+ *vp = INT_TO_JSVAL(evt->mouse.y);
+ break;
+ case 4:
+ if (gjs->term->compositor->hit_appear) *vp = BOOLEAN_TO_JSVAL(JS_TRUE);
+ else if (gf_list_count(gjs->term->compositor->previous_sensors) ) *vp = BOOLEAN_TO_JSVAL(JS_TRUE);
+ else if (gjs->term->compositor->text_selection) *vp = BOOLEAN_TO_JSVAL(JS_TRUE);
+ else *vp = BOOLEAN_TO_JSVAL(JS_FALSE);
+ break;
+ case 5:
+ *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->mouse.wheel_pos)) );
+ break;
+ case 6:
+ *vp = INT_TO_JSVAL( evt->mouse.button);
+ break;
+ }
+ } else if (SMJS_ID_IS_STRING(id)) {
+ char *name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
+ if (!strcmp(name, "target_url")) {
+ *vp = STRING_TO_JSVAL( JS_NewStringCopyZ(c, evt->navigate.to_url) );
+ }
+ SMJS_FREE(c, name);
+ }
+
+ return JS_TRUE;
+}
+
+static Bool gjs_event_filter(void *udta, GF_Event *evt, Bool consumed_by_compositor)
+{
+ Bool res;
+ jsval argv[1], rval;
+ GF_GPACJSExt *gjs = (GF_GPACJSExt *)udta;
+ if (consumed_by_compositor) return 0;
+
+ if (gjs->evt != NULL) return 0;
+ gf_sg_lock_javascript(gjs->c, 1);
+
+ rval = JSVAL_VOID;
+ gjs->evt = evt;
+ JS_SetPrivate(gjs->c, gjs->evt_obj, gjs);
+ argv[0] = OBJECT_TO_JSVAL(gjs->evt_obj);
+ JS_CallFunctionValue(gjs->c, gjs->obj, gjs->evt_fun, 1, argv, &rval);
+ JS_SetPrivate(gjs->c, gjs->evt_obj, NULL);
+ gjs->evt = NULL;
+
+ if (rval==JSVAL_VOID) {
+ res = 0;
+ } else if (JSVAL_IS_BOOLEAN(rval) ) {
+ res = (JSVAL_TO_BOOLEAN(rval)==JS_TRUE) ? 1 : 0;
+ } else if (JSVAL_IS_INT(rval) ) {
+ res = (JSVAL_TO_INT(rval)) ? 1 : 0;
+ }
+
+ gf_sg_lock_javascript(gjs->c, 0);
+ return res;
+}
+
+static JSBool SMJS_FUNCTION(gpac_set_event_filter)
+{
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_GPACJSExt *gjs = (GF_GPACJSExt *)JS_GetPrivate(c, obj);
+ if (!argc || !JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
+ if (gjs->evt_fun) return JS_TRUE;
+
+ gjs->evt_fun = argv[0];
+ gjs->obj = obj;
+ gjs->c = c;
+ gjs->evt_filter.udta = gjs;
+ gjs->evt_filter.on_event = gjs_event_filter;
+ gf_term_add_event_filter(gjs->term, &gjs->evt_filter);
+ return JS_TRUE;
+}
+
+static JSBool SMJS_FUNCTION(gpac_set_focus)
+{
+ GF_Node *elt;
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_Terminal *term = gpac_get_term(c, obj);
+ if (!argc) return JS_FALSE;
+
+ if (JSVAL_IS_STRING(argv[0])) {
+ char *focus_type = SMJS_CHARS(c, argv[0]);
+ if (!stricmp(focus_type, "previous")) {
+ gf_sc_focus_switch_ring(term->compositor, 1, NULL, 0);
+ }
+ else if (!stricmp(focus_type, "next")) {
+ gf_sc_focus_switch_ring(term->compositor, 0, NULL, 0);
+ }
+ SMJS_FREE(c, focus_type);
+ } else if (JSVAL_IS_OBJECT(argv[0])) {
+ elt = gf_sg_js_get_node(c, JSVAL_TO_OBJECT(argv[0]));
+ if (!elt) return JS_TRUE;
+
+ gf_sc_focus_switch_ring(term->compositor, 0, elt, 2);
+ }
+
+ return JS_TRUE;
+}
+
+static JSBool SMJS_FUNCTION(gpac_get_scene)
+{
+ GF_Node *elt;
+ u32 w, h;
+ JSObject *scene_obj;
+ GF_SceneGraph *sg;
+ GF_Scene *scene=NULL;
+ SMJS_OBJ
+ SMJS_ARGS
+ GF_GPACJSExt *gjs = (GF_GPACJSExt *)JS_GetPrivate(c, obj);
+ if (!gjs || !argc || !JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
+
+ elt = gf_sg_js_get_node(c, JSVAL_TO_OBJECT(argv[0]));
+ if (!elt) return JS_TRUE;
+ switch (elt->sgprivate->tag) {
+ case TAG_MPEG4_Inline:
+ case TAG_X3D_Inline:
+ scene = (GF_Scene *)gf_node_get_private(elt);
+ break;
+ case TAG_SVG_animation:
+ sg = gf_sc_animation_get_scenegraph(elt);
+ scene = (GF_Scene *)gf_sg_get_private(sg);
+ break;
+ default:
+ return JS_TRUE;
+ }
+ if (!scene) return JS_TRUE;
+
+
+ scene_obj = JS_NewObject(c, &gjs->anyClass, 0, 0);
+ JS_SetPrivate(c, scene_obj, scene);
+ gf_sg_get_scene_size_info(scene->graph, &w, &h);
+ JS_DefineProperty(c, scene_obj, "width", INT_TO_JSVAL(w), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
+ JS_DefineProperty(c, scene_obj, "height", INT_TO_JSVAL(h), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
+ JS_DefineProperty(c, scene_obj, "connected", BOOLEAN_TO_JSVAL(scene->graph ? JS_TRUE : JS_FALSE), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(scene_obj) );
+ return JS_TRUE;
+}
static void gjs_load(GF_JSUserExtension *jsext, GF_SceneGraph *scene, JSContext *c, JSObject *global, Bool unload)
{
GF_GPACJSExt *gjs;
JSObject *obj;
GF_JSAPIParam par;
+
+ JSPropertySpec gpacEvtClassProps[] = {
+ {"type", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"keycode", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"mouse_x", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"mouse_y", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"picked", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"wheel", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"button", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {0, 0, 0, 0, 0}
+ };
+ JSFunctionSpec gpacEvtClassFuncs[] = {
+ SMJS_FUNCTION_SPEC(0, 0, 0)
+ };
+
JSPropertySpec gpacClassProps[] = {
{0, 0, 0, 0, 0}
};
JSFunctionSpec gpacClassFuncs[] = {
- {"getOption", gpac_getOption, 3, 0, 0},
- {"setOption", gpac_setOption, 4, 0, 0},
- {"enum_directory", gpac_enum_directory, 1, 0, 0},
- {"set_size", gpac_set_size, 1, 0, 0},
- {"get_horizontal_dpi", gpac_get_horizontal_dpi, 0, 0, 0},
- {"get_vertical_dpi", gpac_get_vertical_dpi, 0, 0, 0},
- {"get_screen_width", gpac_get_screen_width, 0, 0, 0},
- {"get_screen_height", gpac_get_screen_height, 0, 0, 0},
- {"exit", gpac_exit, 0, 0, 0},
- {"set_3d", gpac_set_3d, 1, 0, 0},
- {"get_scene_time", gpac_get_scene_time, 1, 0, 0},
- {"migrate_url", gpac_migrate_url, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("getOption", gpac_getOption, 3),
+ SMJS_FUNCTION_SPEC("setOption", gpac_setOption, 4),
+ SMJS_FUNCTION_SPEC("enum_directory", gpac_enum_directory, 1),
+ SMJS_FUNCTION_SPEC("set_size", gpac_set_size, 1),
+ SMJS_FUNCTION_SPEC("get_horizontal_dpi", gpac_get_horizontal_dpi, 0),
+ SMJS_FUNCTION_SPEC("get_vertical_dpi", gpac_get_vertical_dpi, 0),
+ SMJS_FUNCTION_SPEC("get_screen_width", gpac_get_screen_width, 0),
+ SMJS_FUNCTION_SPEC("get_screen_height", gpac_get_screen_height, 0),
+ SMJS_FUNCTION_SPEC("exit", gpac_exit, 0),
+ SMJS_FUNCTION_SPEC("set_3d", gpac_set_3d, 1),
+ SMJS_FUNCTION_SPEC("move_window", gpac_move_window, 2),
+ SMJS_FUNCTION_SPEC("get_scene_time", gpac_get_scene_time, 1),
+ SMJS_FUNCTION_SPEC("migrate_url", gpac_migrate_url, 1),
+ SMJS_FUNCTION_SPEC("set_event_filter", gpac_set_event_filter, 1),
+ SMJS_FUNCTION_SPEC("set_focus", gpac_set_focus, 1),
+ SMJS_FUNCTION_SPEC("get_scene", gpac_get_scene, 1),
+ SMJS_FUNCTION_SPEC("error_string", gpac_error_string, 1),
+
+
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
+ gjs = jsext->udta;
/*nothing to do on unload*/
- if (unload) return;
+ if (unload) {
+ gjs->nb_loaded--;
+ if (!gjs->nb_loaded && gjs->evt_filter.udta) {
+ gf_term_remove_event_filter(gjs->term, &gjs->evt_filter);
+ }
+ return;
+ }
+ if (gjs->nb_loaded) {
+ gjs->nb_loaded++;
+ return;
+ }
+ gjs->nb_loaded++;
if (!scene) return;
- gjs = jsext->udta;
- _SETUP_CLASS(gjs->gpacClass, "GPAC", JSCLASS_HAS_PRIVATE, gpac_getProperty, gpac_setProperty, JS_FinalizeStub);
+ JS_SETUP_CLASS(gjs->gpacClass, "GPAC", JSCLASS_HAS_PRIVATE, gpac_getProperty, gpac_setProperty, JS_FinalizeStub);
JS_InitClass(c, global, 0, &gjs->gpacClass, 0, 0, gpacClassProps, gpacClassFuncs, 0, 0);
obj = JS_DefineObject(c, global, "gpac", &gjs->gpacClass, 0, 0);
if (scene->script_action) {
- if (!scene->script_action(scene->script_action_cbck, GF_JSAPI_OP_GET_TERM, scene->RootNode, &par))
- return;
- JS_SetPrivate(c, obj, par.term);
+ if (scene->script_action(scene->script_action_cbck, GF_JSAPI_OP_GET_TERM, scene->RootNode, &par)) {
+ gjs->term = par.term;
+ }
}
+ JS_SetPrivate(c, obj, gjs);
+
+
+ JS_SETUP_CLASS(gjs->gpacEvtClass, "GPACEVT", JSCLASS_HAS_PRIVATE, gpacevt_getProperty, JS_PropertyStub_forSetter, JS_FinalizeStub);
+ JS_InitClass(c, global, 0, &gjs->gpacEvtClass, 0, 0, gpacEvtClassProps, gpacEvtClassFuncs, 0, 0);
+ gjs->evt_obj = JS_DefineObject(c, global, "gpacevt", &gjs->gpacEvtClass, 0, 0);
+
+#define DECLARE_GPAC_CONST(name) \
+ JS_DefineProperty(c, global, #name, INT_TO_JSVAL(name), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
+
+ DECLARE_GPAC_CONST(GF_EVENT_CLICK);
+ DECLARE_GPAC_CONST(GF_EVENT_MOUSEUP);
+ DECLARE_GPAC_CONST(GF_EVENT_MOUSEDOWN);
+ DECLARE_GPAC_CONST(GF_EVENT_MOUSEMOVE);
+ DECLARE_GPAC_CONST(GF_EVENT_MOUSEWHEEL);
+ DECLARE_GPAC_CONST(GF_EVENT_KEYUP);
+ DECLARE_GPAC_CONST(GF_EVENT_KEYDOWN);
+ DECLARE_GPAC_CONST(GF_EVENT_TEXTINPUT);
+ DECLARE_GPAC_CONST(GF_EVENT_CONNECT);
+ DECLARE_GPAC_CONST(GF_EVENT_NAVIGATE_INFO);
+ DECLARE_GPAC_CONST(GF_EVENT_NAVIGATE);
+
+ DECLARE_GPAC_CONST(GF_NAVIGATE_NONE);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_WALK);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_FLY);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_PAN);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_GAME);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_SLIDE);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_EXAMINE);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_ORBIT);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_VR);
+
+ DECLARE_GPAC_CONST(GF_NAVIGATE_TYPE_NONE);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_TYPE_2D);
+ DECLARE_GPAC_CONST(GF_NAVIGATE_TYPE_3D);
+
+ JS_SETUP_CLASS(gjs->anyClass, "GPACOBJECT", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
+ JS_InitClass(c, global, 0, &gjs->anyClass, 0, 0, 0, 0, 0, 0);
}
vpath %.c $(SRC_PATH)/modules/img_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#local openjpeg lib
ifeq ($(CONFIG_JP2), local)
NEED_LOCAL_LIB="yes"
-CFLAGS+= -I$(LOCAL_INC_PATH)/openjpeg
+CFLAGS+= -I"$(LOCAL_INC_PATH)/openjpeg"
endif
endif
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / image format module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "img_in.h"
-static Bool DEC_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool DEC_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
if (StreamType != GF_STREAM_VISUAL) return 0;
+ /*media type query*/
+ if (!esd) return 1;
- switch (ObjectType) {
+ switch (esd->decoderConfig->objectTypeIndication) {
#ifdef GPAC_HAS_PNG
- case GPAC_OTI_IMAGE_PNG:
+ case GPAC_OTI_IMAGE_PNG:
return NewPNGDec(dec);
#endif
#ifdef GPAC_HAS_JPEG
- case GPAC_OTI_IMAGE_JPEG:
+ case GPAC_OTI_IMAGE_JPEG:
return NewJPEGDec(dec);
#endif
#ifdef GPAC_HAS_JP2
- case GPAC_OTI_IMAGE_JPEG_2000:
+ case GPAC_OTI_IMAGE_JPEG_2000:
return NewJP2Dec(dec);
#endif
case GPAC_BMP_OTI:
return NewBMPDec(dec);
- case 0:
- return 1;/*query for types*/
- default:
+
+ default:
#ifdef GPAC_HAS_JP2
- if ((decSpecInfoSize>=4) && (decSpecInfo[0]=='m') && (decSpecInfo[1]=='j') && (decSpecInfo[2]=='p') && (decSpecInfo[3]=='2'))
- return NewJP2Dec(dec);
+ {
+ char *dsi = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data : NULL;
+ if (dsi && (dsi[0]=='m') && (dsi[1]=='j') && (dsi[2]=='p') && (dsi[3]=='2'))
+ return NewJP2Dec(dec);
+ }
#endif
return 0;
}
void DeleteBaseDecoder(GF_BaseDecoder *ifcd)
{
- IMGDec *wrap = (IMGDec *)ifcd->privateStack;
+ IMGDec *wrap;
+ if (!ifcd)
+ return;
+ wrap = (IMGDec *)ifcd->privateStack;
+ if (!wrap)
+ return;
switch (wrap->type) {
case DEC_PNG:
DeletePNGDec(ifcd);
break;
}
gf_free(wrap);
+ ifcd->privateStack = NULL;
gf_free(ifcd);
}
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
GF_MEDIA_DECODER_INTERFACE,
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / image format module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
IMG_BMP,
IMG_PNGD,
IMG_PNGDS,
+ IMG_PNGS,
};
typedef struct
GF_ClientService *service;
/*service*/
u32 srv_type;
-
+
FILE *stream;
u32 img_type;
esd->decoderConfig->streamType = GF_STREAM_VISUAL;
esd->ESID = 1;
- if (read->img_type == IMG_BMP)
+ if (read->img_type == IMG_BMP)
esd->decoderConfig->objectTypeIndication = GPAC_BMP_OTI;
else {
u8 OTI;
((GF_AuxVideoDescriptor*)d)->aux_video_type = 2;
gf_list_add(esd->extensionDescriptors, d);
}
+ else if (read->img_type == IMG_PNGS) {
+ GF_Descriptor *d = gf_odf_desc_new(GF_ODF_AUX_VIDEO_DATA);
+ ((GF_AuxVideoDescriptor*)d)->aux_video_type = 3;
+ gf_list_add(esd->extensionDescriptors, d);
+ }
}
return esd;
}
+const char * IMG_MIME_TYPES[] = {
+ "image/jpeg", "jpeg jpg", "JPEG Images",
+ "image/jp2", "jp2", "JPEG2000 Images",
+ "image/png", "png", "PNG Images",
+ "image/bmp", "bmp", "MS Bitmap Images",
+ "image/x-png+depth", "pngd", "PNG+Depth Images",
+ "image/x-png+depth+mask", "pngds", "PNG+Depth+Mask Images",
+ "image/x-png+stereo", "pngs", "Stereo PNG Images",
+ NULL
+};
+
+static u32 IMG_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i;
+ if (!plug){
+ GF_LOG(GF_LOG_MEDIA, GF_LOG_ERROR, ("IMG_RegisterMimeTypes : plug is NULL !!\n"));
+ }
+ for (i = 0 ; IMG_MIME_TYPES[i]; i+=3)
+ gf_term_register_mime_type(plug, IMG_MIME_TYPES[i], IMG_MIME_TYPES[i+1], IMG_MIME_TYPES[i+2]);
+ return i/3;
+}
+
+
static Bool IMG_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ u32 i;
+ GF_LOG(GF_LOG_MEDIA, GF_LOG_INFO, ("IMG_CanHandleURL(%s)\n", url));
+ if (!plug || !url)
+ return 0;
sExt = strrchr(url, '.');
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "image/jpeg", "jpeg jpg", "JPEG Images", sExt)) return 1;
- if (gf_term_check_extension(plug, "image/jp2", "jp2", "JPEG2000 Images", sExt)) return 1;
- if (gf_term_check_extension(plug, "image/png", "png", "PNG Images", sExt)) return 1;
- if (gf_term_check_extension(plug, "image/bmp", "bmp", "MS Bitmap Images", sExt)) return 1;
- if (gf_term_check_extension(plug, "image/x-png+depth", "pngd", "PNG+Depth Images", sExt)) return 1;
- if (gf_term_check_extension(plug, "image/x-png+depth+mask", "pngds", "PNG+Depth+Mask Images", sExt)) return 1;
+ for (i = 0 ; IMG_MIME_TYPES[i]; i+=3){
+ if (gf_term_check_extension(plug, IMG_MIME_TYPES[i], IMG_MIME_TYPES[i+1], IMG_MIME_TYPES[i+2], sExt))
+ return 1;
+ }
return 0;
}
szCache = gf_dm_sess_get_cache_name(read->dnload);
if (!szCache) e = GF_IO_ERR;
else {
- read->stream = fopen((char *) szCache, "rb");
+ read->stream = gf_f64_open((char *) szCache, "rb");
if (!read->stream) e = GF_SERVICE_ERROR;
else {
e = GF_OK;
- fseek(read->stream, 0, SEEK_END);
- read->data_size = ftell(read->stream);
- fseek(read->stream, 0, SEEK_SET);
+ gf_f64_seek(read->stream, 0, SEEK_END);
+ read->data_size = (u32) gf_f64_tell(read->stream);
+ gf_f64_seek(read->stream, 0, SEEK_SET);
}
}
- }
+ }
/*OK confirm*/
gf_term_on_connect(read->service, NULL, e);
if (!e) IMG_SetupObject(read);
IMGLoader *read = (IMGLoader *)plug->priv;
read->service = serv;
-
+ if (!url)
+ return GF_BAD_PARAM;
sExt = strrchr(url, '.');
if (!stricmp(sExt, ".jpeg") || !stricmp(sExt, ".jpg")) read->img_type = IMG_JPEG;
else if (!stricmp(sExt, ".png")) read->img_type = IMG_PNG;
else if (!stricmp(sExt, ".pngd")) read->img_type = IMG_PNGD;
else if (!stricmp(sExt, ".pngds")) read->img_type = IMG_PNGDS;
+ else if (!stricmp(sExt, ".pngs")) read->img_type = IMG_PNGS;
else if (!stricmp(sExt, ".bmp")) read->img_type = IMG_BMP;
if (read->dnload) gf_term_download_del(read->dnload);
read->stream = fopen(url, "rb");
if (read->stream) {
- fseek(read->stream, 0, SEEK_END);
- read->data_size = ftell(read->stream);
- fseek(read->stream, 0, SEEK_SET);
+ gf_f64_seek(read->stream, 0, SEEK_END);
+ read->data_size = (u32) gf_f64_tell(read->stream);
+ gf_f64_seek(read->stream, 0, SEEK_SET);
}
gf_term_on_connect(serv, NULL, read->stream ? GF_OK : GF_URL_ERROR);
if (read->stream && read->is_inline) IMG_SetupObject(read);
static GF_Err IMG_CloseService(GF_InputService *plug)
{
- IMGLoader *read = (IMGLoader *)plug->priv;
+ IMGLoader *read;
+ if (!plug)
+ return GF_BAD_PARAM;
+ read = (IMGLoader *)plug->priv;
+ if (!read)
+ return GF_BAD_PARAM;
if (read->stream) fclose(read->stream);
read->stream = NULL;
if (read->dnload) gf_term_download_del(read->dnload);
read->dnload = NULL;
- gf_term_on_disconnect(read->service, NULL, GF_OK);
+ if (read->service)
+ gf_term_on_disconnect(read->service, NULL, GF_OK);
return GF_OK;
}
{
u32 ES_ID;
GF_Err e;
- IMGLoader *read = (IMGLoader *)plug->priv;
+ IMGLoader *read;
+ if (!plug)
+ return 0;
+ read = (IMGLoader *)plug->priv;
e = GF_SERVICE_ERROR;
if (read->ch==channel) goto exit;
-
+ if (!url)
+ goto exit;
e = GF_STREAM_NOT_FOUND;
if (strstr(url, "ES_ID")) {
- sscanf(url, "ES_ID=%d", &ES_ID);
+ sscanf(url, "ES_ID=%ud", &ES_ID);
}
/*URL setup*/
else if (!read->ch && IMG_CanHandleURL(plug, url)) ES_ID = 1;
return GF_OK;
}
*is_new_data = 1;
- fseek(read->stream, 0, SEEK_SET);
+ gf_f64_seek(read->stream, 0, SEEK_SET);
read->data = (char*) gf_malloc(sizeof(char) * (read->data_size + read->pad_bytes));
read->data_size = fread(read->data, sizeof(char), read->data_size, read->stream);
- fseek(read->stream, 0, SEEK_SET);
+ gf_f64_seek(read->stream, 0, SEEK_SET);
if (read->pad_bytes) memset(read->data + read->data_size, 0, sizeof(char) * read->pad_bytes);
}
GF_SAFEALLOC(plug, GF_InputService);
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC Image Reader", "gpac distribution")
+ plug->RegisterMimeTypes = IMG_RegisterMimeTypes;
plug->CanHandleURL = IMG_CanHandleURL;
plug->CanHandleURLInService = NULL;
plug->ConnectService = IMG_ConnectService;
void DeleteLoaderInterface(void *ifce)
{
+ IMGLoader *read;
GF_InputService *plug = (GF_InputService *) ifce;
- IMGLoader *read = (IMGLoader *)plug->priv;
- gf_free(read);
+ GF_LOG(GF_LOG_MEDIA, GF_LOG_ERROR, ("DeleteLoaderInterface : 1\n"));
+ if (!plug)
+ return;
+ read = (IMGLoader *)plug->priv;
+ if (read)
+ gf_free(read);
+ plug->priv = NULL;
gf_free(plug);
+ GF_LOG(GF_LOG_MEDIA, GF_LOG_ERROR, ("DeleteLoaderInterface : 2\n"));
}
JP2CTX();
if (esd->dependsOnESID || esd->decoderConfig->upstream) return GF_NOT_SUPPORTED;
+ if (!esd->decoderConfig->decoderSpecificInfo) return GF_OK;
+
if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_JPEG_2000) {
bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
ctx->height = gf_bs_read_u32(bs);
PNGCTX();
switch (capability->CapCode) {
case GF_CODEC_WIDTH:
- capability->cap.valueInt = ctx->width;
+ if (ctx->aux_type==3) {
+ capability->cap.valueInt = ctx->width/2;
+ } else {
+ capability->cap.valueInt = ctx->width;
+ }
break;
case GF_CODEC_HEIGHT:
capability->cap.valueInt = ctx->height;
switch (ctx->pixel_format) {
case GF_PIXEL_GREYSCALE: ctx->BPP = 1; break;
case GF_PIXEL_ALPHAGREY: ctx->BPP = 2; break;
- case GF_PIXEL_RGB_24: ctx->BPP = 3; break;
+ case GF_PIXEL_RGB_24:
+ ctx->BPP = 3;
+ if (ctx->aux_type==3) ctx->pixel_format = GF_PIXEL_RGBS;
+ break;
case GF_PIXEL_RGBA:
case GF_PIXEL_RGBD:
ctx->BPP = 4;
if (ctx->aux_type==1) ctx->pixel_format = GF_PIXEL_RGBD;
else if (ctx->aux_type==2) ctx->pixel_format = GF_PIXEL_RGBDS;
+ else if (ctx->aux_type==3) ctx->pixel_format = GF_PIXEL_RGBAS;
break;
}
ctx->out_size = *outBufferLength;
vpath %.c $(SRC_PATH)/modules/ismacryp
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/modules/isom_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
return 1;
}
+static const char * ISOR_MIME_TYPES[] = {
+ /* First one is specific because we probe */
+ "application/x-isomedia", "*", "IsoMedia Files",
+ "video/mp4", "mp4 mpg4", "MPEG-4 Movies",
+ "audio/mp4", "m4a mp4 mpg4", "MPEG-4 Music",
+ "application/mp4", "mp4 mpg4", "MPEG-4 Applications",
+ "video/3gpp", "3gp 3gpp", "3GPP/MMS Movies",
+ "audio/3gpp", "3gp 3gpp", "3GPP/MMS Music",
+ "video/3gpp2", "3g2 3gp2", "3GPP2/MMS Movies",
+ "audio/3gpp2", "3g2 3gp2", "3GPP2/MMS Music",
+ NULL
+};
+
+u32 ISOR_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i;
+ for (i = 0 ; ISOR_MIME_TYPES[i]; i+=3)
+ gf_term_register_mime_type(plug, ISOR_MIME_TYPES[i], ISOR_MIME_TYPES[i+1], ISOR_MIME_TYPES[i+2]);
+ return i/3;
+}
+
Bool ISOR_CanHandleURL(GF_InputService *plug, const char *url)
{
char *ext;
if (!strnicmp(url, "rtsp://", 7)) return 0;
ext = strrchr(url, '.');
- if (!ext) return 0;
-
- if (gf_term_check_extension(plug, "video/mp4", "mp4 mpg4", "MPEG-4 Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "audio/mp4", "m4a mp4 mpg4", "MPEG-4 Music", ext)) return 1;
- if (gf_term_check_extension(plug, "application/mp4", "mp4 mpg4", "MPEG-4 Applications", ext)) return 1;
- if (gf_term_check_extension(plug, "video/3gpp", "3gp 3gpp", "3GPP/MMS Movies", ext)) return 1;
- if (gf_term_check_extension(plug, "audio/3gpp", "3gp 3gpp", "3GPP/MMS Music",ext)) return 1;
- if (gf_term_check_extension(plug, "video/3gpp2", "3g2 3gp2", "3GPP2/MMS Movies",ext)) return 1;
- if (gf_term_check_extension(plug, "audio/3gpp2", "3g2 3gp2", "3GPP2/MMS Music",ext)) return 1;
-
- if (gf_isom_probe_file(url)) {
- gf_term_check_extension(plug, "application/x-isomedia", ext+1, "IsoMedia Files", ext);
+ {
+ u32 i;
+ /* We don't start at 0 since first one is specific */
+ for (i = 3 ; ISOR_MIME_TYPES[i]; i+=3)
+ if (gf_term_check_extension(plug, ISOR_MIME_TYPES[i], ISOR_MIME_TYPES[i+1], ISOR_MIME_TYPES[i+2], ext))
+ return 1;
+ }
+
+ if (ext && gf_isom_probe_file(url)) {
+ gf_term_check_extension(plug, ISOR_MIME_TYPES[0], ext+1, ISOR_MIME_TYPES[2], ext);
return 1;
}
return 0;
}
if (isor_is_local(szURL)) {
-// if (!read->mov) read->mov = gf_isom_open(szURL, GF_ISOM_OPEN_READ, NULL);
GF_Err e = gf_isom_open_progressive(szURL, &read->mov, &read->missing_bytes);
- if (!read->mov) {
- gf_term_on_connect(serv, NULL, gf_isom_last_error(NULL));
+ if (e != GF_OK){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[IsoMedia] : error while opening %s, error=%s\n", szURL, gf_error_to_string(e)));
+ gf_term_on_connect(serv, NULL, e);
return GF_OK;
}
read->frag_type = gf_isom_is_fragmented(read->mov) ? 1 : 0;
if (!read->mov) return GF_SERVICE_ERROR;
if (strstr(url, "ES_ID")) {
- sscanf(url, "ES_ID=%d", &ESID);
+ sscanf(url, "ES_ID=%ud", &ESID);
} else {
/*handle url like mypath/myfile.mp4#trackID*/
char *track_id = strrchr(url, '.');
GF_InputService *plug;
GF_SAFEALLOC(plug, GF_InputService);
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC IsoMedia Reader", "gpac distribution")
-
+ plug->RegisterMimeTypes = ISOR_RegisterMimeTypes;
plug->CanHandleURL = ISOR_CanHandleURL;
plug->ConnectService = ISOR_ConnectService;
plug->CloseService = ISOR_CloseService;
/*update current fragment if any*/
param.command_type = GF_NET_SERVICE_QUERY_NEXT;
if ((read->input->query_proxy(read->input, ¶m)==GF_OK) && param.url_query.next_url){
- GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("\nSegment switch detected - now playing %s\n", param.url_query.next_url));
gf_isom_open_segment(read->mov, param.url_query.next_url);
for (i=0; i<count; i++) {
vpath %.c $(SRC_PATH)/modules/jack
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include $(OSS_CFLAGS)
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(OSS_CFLAGS)
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/modules/laser_dec
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef GPAC_DISABLE_LASER
-typedef struct
+typedef struct
{
GF_Scene *pScene;
GF_Terminal *app;
if (priv->codec) return GF_BAD_PARAM;
priv->pScene = scene;
priv->app = scene->root_od->term;
-
+
priv->codec = gf_laser_decoder_new(scene->graph);
/*attach the clock*/
gf_laser_decoder_set_clock(priv->codec, gf_scene_get_time, scene);
return GF_OK;
}
-static GF_Err LSR_ProcessData(GF_SceneDecoder*plug, char *inBuffer, u32 inBufferLength,
+static GF_Err LSR_ProcessData(GF_SceneDecoder*plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 AU_time, u32 mmlevel)
{
GF_Err e = GF_OK;
return e;
}
-Bool LSR_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool LSR_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
- if ((StreamType==GF_STREAM_SCENE) && (ObjectType == GPAC_OTI_SCENE_LASER)) return 1;
+ if (StreamType!=GF_STREAM_SCENE) return 0;
+ /*media type query*/
+ if (!esd) return 1;
+ if (esd->decoderConfig->objectTypeIndication == GPAC_OTI_SCENE_LASER) return 1;
return 0;
}
void DeleteLSRDec(GF_BaseDecoder *plug)
{
- LSRPriv *priv = (LSRPriv *)plug->privateStack;
- /*in case something went wrong*/
- if (priv->codec) gf_laser_decoder_del(priv->codec);
- gf_free(priv);
+ LSRPriv *priv;
+ if (!plug)
+ return;
+ priv = (LSRPriv *)plug->privateStack;
+ if (priv){
+ /*in case something went wrong*/
+ if (priv->codec)
+ gf_laser_decoder_del(priv->codec);
+ priv->codec = NULL;
+ gf_free(priv);
+ plug->privateStack = NULL;
+ }
gf_free(plug);
}
{
LSRPriv *priv;
GF_SceneDecoder *tmp;
-
+
GF_SAFEALLOC(tmp, GF_SceneDecoder);
if (!tmp) return NULL;
GF_SAFEALLOC(priv, LSRPriv);
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_LASER
#endif
0
};
- return si;
+ return si;
}
GF_EXPORT
--- /dev/null
+include ../../config.mak\r
+\r
+vpath %.c $(SRC_PATH)/modules/libplayer\r
+\r
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"\r
+\r
+ifeq ($(DEBUGBUILD), yes)\r
+CFLAGS+=-g\r
+LDFLAGS+=-g\r
+endif\r
+\r
+ifeq ($(GPROFBUILD), yes)\r
+CFLAGS+=-pg\r
+LDFLAGS+=-pg\r
+endif\r
+\r
+#common obj\r
+OBJS= libplayer.o\r
+\r
+SRCS := $(OBJS:.o=.c) \r
+\r
+LIB=gm_libplayer.$(DYN_LIB_SUFFIX)\r
+\r
+\r
+all: $(LIB)\r
+\r
+\r
+$(LIB): $(OBJS)\r
+ $(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac\r
+\r
+%.o: %.c\r
+ $(CC) $(CFLAGS) -c -o $@ $< \r
+\r
+\r
+clean: \r
+ rm -f $(OBJS) ../../bin/gcc/$(LIB)\r
+\r
+dep: depend\r
+\r
+depend:\r
+ rm -f .depend \r
+ $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend\r
+\r
+distclean: clean\r
+ rm -f Makefile.bak .depend\r
+\r
+\r
+\r
+# include dependency files if they exist\r
+#\r
+ifneq ($(wildcard .depend),)\r
+include .depend\r
+endif\r
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / Dummy input module
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include <gpac/modules/service.h>
+#include <gpac/modules/codec.h>
+/*for GF_STREAM_PRIVATE_SCENE definition*/
+#include <gpac/constants.h>
+#include <gpac/download.h>
+
+#define TEST_LIBPLAYER
+
+#ifndef TEST_LIBPLAYER
+
+#ifdef WIN32
+typedef u32 uint32_t;
+typedef u8 uint8_t;
+typedef s8 int8_t;
+typedef s32 off_t;
+#endif
+
+#include "player.h"
+
+
+#endif
+
+
+typedef struct
+{
+ /*the service we're responsible for*/
+ GF_ClientService *service;
+ u32 state;
+
+#ifndef TEST_LIBPLAYER
+ player_t *player;
+#endif
+
+} LibPlayerIn;
+
+
+static const char * LIBPLAYER_MIME_TYPES[] = {
+ "video/x-mpeg", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies",
+ "video/x-mpeg-systems", "mpg mpeg mp2 mpa mpe mpv2", "MPEG 1/2 Movies",
+ "audio/basic", "snd au", "Basic Audio",
+ "audio/x-wav", "wav", "WAV Audio",
+ "audio/vnd.wave", "wav", "WAV Audio",
+ "video/x-ms-asf", "asf wma wmv asx asr", "WindowsMedia Movies",
+ "video/x-ms-wmv", "asf wma wmv asx asr", "WindowsMedia Movies",
+ "video/x-msvideo", "avi", "AVI Movies",
+ "video/x-ms-video", "avi", "AVI Movies",
+ "video/avi", "avi", "AVI Movies",
+ "video/vnd.avi", "avi", "AVI Movies",
+ "video/H263", "h263 263", "H263 Video",
+ "video/H264", "h264 264", "H264 Video",
+ "video/MPEG4", "cmp", "MPEG-4 Video",
+/* We let ffmpeg handle mov because some QT files with uncompressed or adpcm audio use 1 audio sample
+ per MP4 sample which is a killer for our MP4 lib, whereas ffmpeg handles these as complete audio chunks
+ moreover ffmpeg handles cmov, we don't */
+ "video/quicktime", "mov qt", "QuickTime Movies",
+/* Supported by latest versions of FFMPEG */
+ "video/webm", "webm", "Google WebM Movies",
+ "audio/webm", "webm", "Google WebM Music",
+ NULL
+};
+
+
+static u32 LIBPLAYER_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i;
+ if (!plug)
+ return 0;
+ for (i = 0 ; LIBPLAYER_MIME_TYPES[i] ; i+=3)
+ gf_term_register_mime_type(plug, LIBPLAYER_MIME_TYPES[i], LIBPLAYER_MIME_TYPES[i+1], LIBPLAYER_MIME_TYPES[i+2]);
+ return i / 3;
+}
+
+Bool LIBPLAYER_CanHandleURL(GF_InputService *plug, const char *url)
+{
+ char *sExt = strrchr(url, '.');
+ if (sExt) {
+ u32 i;
+ Bool ok = 0;
+ char *cgi_par;
+ if (!strnicmp(sExt, ".gz", 3)) sExt = strrchr(sExt, '.');
+ if (!strnicmp(url, "rtsp://", 7)) return 0;
+ sExt++;
+
+ cgi_par = strchr(sExt, '?');
+ if (cgi_par) cgi_par[0] = 0;
+
+ for (i = 0 ; LIBPLAYER_MIME_TYPES[i] ; i+=3) {
+ if (strstr(LIBPLAYER_MIME_TYPES[i+1], sExt)) {
+ ok=1;
+ break;
+ }
+ }
+ if (cgi_par) cgi_par[0] = '?';
+ if (ok) return 1;
+ }
+ return 0;
+}
+
+#ifndef TEST_LIBPLAYER
+
+static int on_libplayer_event(player_event_t e, void *data)
+{
+ fprintf(stdout, "Received event %d\n", e);
+
+ switch (e) {
+ case PLAYER_EVENT_FE_HAS_LOCK:
+ break;
+ case PLAYER_EVENT_FE_TIMEDOUT:
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+#endif
+
+GF_Err LIBPLAYER_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
+{
+ LibPlayerIn *read = (LibPlayerIn *) plug->priv;
+#ifndef TEST_LIBPLAYER
+ mrl_t *mrl = NULL;
+#endif
+
+ if (!read || !serv || !url) return GF_BAD_PARAM;
+
+#ifndef TEST_LIBPLAYER
+ if (!read->player) {
+ /* libplayer init */
+ read->player = player_init(PLAYER_TYPE_DUMMY, PLAYER_AO_AUTO, PLAYER_VO_AUTO, PLAYER_MSG_ERROR, 0, on_libplayer_event);
+ if (!read->player) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[LibPlayerIN] Failed to instanciate libplayer\n"));
+ gf_term_on_connect(serv, NULL, GF_REMOTE_SERVICE_ERROR);
+ return GF_OK;
+ }
+ }
+
+ mrl = NULL;
+ if (!strnicmp(url, "dvb://", 6)) {
+ }
+ else if (!strnicmp(url, "file://", 7) || !strstr(url, "://")) {
+ mrl_resource_local_args_t *mrl_args;
+ mrl_args = calloc(1, sizeof(mrl_resource_local_args_t));
+ if (!strnicmp(url, "file://", 7)) {
+ mrl_args->location = strdup(url + 7);
+ } else {
+ mrl_args->location = strdup(url);
+ }
+ mrl = mrl_new (read->player, MRL_RESOURCE_FILE, mrl_args);
+ }
+ else {
+ }
+
+ if (!mrl) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[LibPlayerIN] Failed to create MRL for url %s\n", url));
+ gf_term_on_connect(serv, NULL, GF_URL_ERROR);
+ return GF_OK;
+ }
+
+ player_mrl_set(read->player, mrl);
+#endif
+
+ read->state = 0;
+ read->service = serv;
+
+ /*ACK connection is OK*/
+ gf_term_on_connect(serv, NULL, GF_OK);
+
+
+ /*setup LIBPLAYER object descriptor*/
+ {
+ GF_ESD *esd;
+ GF_ObjectDescriptor *od = (GF_ObjectDescriptor *) gf_odf_desc_new(GF_ODF_OD_TAG);
+ od->objectDescriptorID = 1;
+
+ esd = gf_odf_desc_esd_new(0);
+ esd->ESID = 1;
+ esd->slConfig->timestampResolution = 1000;
+ esd->decoderConfig->streamType = GF_STREAM_PRIVATE_MEDIA;
+ esd->decoderConfig->objectTypeIndication = GPAC_OTI_PRIVATE_MEDIA_LIBPLAYER;
+#ifndef TEST_LIBPLAYER
+ esd->decoderConfig->decoderSpecificInfo->data = read->player;
+#endif
+
+ gf_list_add(od->ESDescriptors, esd);
+ gf_term_add_media(read->service, (GF_Descriptor*)od, 0);
+ }
+
+
+ return GF_OK;
+}
+
+GF_Err LIBPLAYER_CloseService(GF_InputService *plug)
+{
+ LibPlayerIn *read = (LibPlayerIn *) plug->priv;
+#ifndef TEST_LIBPLAYER
+ player_playback_stop(read->player);
+ player_uninit(read->player);
+ read->player = NULL;
+#endif
+ read->state = 0;
+ gf_term_on_disconnect(read->service, NULL, GF_OK);
+ return GF_OK;
+}
+
+/*Dummy input just send a file name, no multitrack to handle so we don't need to check sub_url nor expected type*/
+static GF_Descriptor *LIBPLAYER_GetServiceDesc(GF_InputService *plug, u32 expect_type, const char *sub_url)
+{
+ return NULL;
+}
+
+
+GF_Err LIBPLAYER_ServiceCommand(GF_InputService *plug, GF_NetworkCommand *com)
+{
+ LibPlayerIn *read = (LibPlayerIn *) plug->priv;
+
+ if (!com->base.on_channel) return GF_NOT_SUPPORTED;
+
+ switch (com->command_type) {
+ case GF_NET_CHAN_SET_PULL: return GF_NOT_SUPPORTED;
+ case GF_NET_CHAN_INTERACTIVE: return GF_OK;
+ /*since data is file-based, no padding is needed (decoder plugin will handle it itself)*/
+ case GF_NET_CHAN_SET_PADDING: return GF_OK;
+ case GF_NET_CHAN_BUFFER:
+ com->buffer.max = com->buffer.min = 0;
+ return GF_OK;
+ case GF_NET_CHAN_DURATION:
+ /*this module is not made for updates, use undefined duration*/
+ com->duration.duration = 0;
+ return GF_OK;
+ case GF_NET_CHAN_PLAY:
+ if (read->state==0) {
+#ifndef TEST_LIBPLAYER
+ player_playback_start(read->player);
+#endif
+ read->state = 1;
+ }
+ return GF_OK;
+ case GF_NET_CHAN_STOP:
+ if (read->state==1) {
+#ifndef TEST_LIBPLAYER
+ player_playback_pause(read->player);
+#endif
+ read->state = 0;
+ }
+ return GF_OK;
+ case GF_NET_CHAN_CONFIG: return GF_OK;
+ case GF_NET_CHAN_GET_DSI:
+ com->get_dsi.dsi = NULL;
+ com->get_dsi.dsi_len = 0;
+ return GF_OK;
+ }
+ return GF_OK;
+}
+
+GF_Err LIBPLAYER_ConnectChannel(GF_InputService *plug, LPNETCHANNEL channel, const char *url, Bool upstream)
+{
+ u32 ESID;
+ LibPlayerIn *read = (LibPlayerIn *) plug->priv;
+
+ sscanf(url, "ES_ID=%ud", &ESID);
+ if (ESID != 1) {
+ gf_term_on_connect(read->service, channel, GF_STREAM_NOT_FOUND);
+ } else {
+ gf_term_on_connect(read->service, channel, GF_OK);
+ }
+ return GF_OK;
+}
+
+GF_Err LIBPLAYER_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel)
+{
+ LibPlayerIn *read = (LibPlayerIn *) plug->priv;
+ gf_term_on_disconnect(read->service, channel, GF_OK);
+ return GF_OK;
+}
+
+
+
+Bool LIBPLAYER_CanHandleURLInService(GF_InputService *plug, const char *url)
+{
+ return 0;
+}
+
+static GF_Err LIBPLAYER_AttachStream(GF_BaseDecoder *dec, GF_ESD *esd)
+{
+ if (esd->ESID!=1) return GF_BAD_PARAM;
+ if (dec->privateStack) return GF_BAD_PARAM;
+ if (!esd->decoderConfig->decoderSpecificInfo) return GF_BAD_PARAM;
+#ifndef TEST_LIBPLAYER
+ if (!esd->decoderConfig->decoderSpecificInfo->data) return GF_BAD_PARAM;
+ dec->privateStack = esd->decoderConfig->decoderSpecificInfo->data;
+#endif
+ esd->decoderConfig->decoderSpecificInfo->data = NULL;
+ return GF_OK;
+}
+
+static GF_Err LIBPLAYER_DetachStream(GF_BaseDecoder *dec, u16 ES_ID)
+{
+ dec->privateStack = NULL;
+ return GF_OK;
+}
+static GF_Err LIBPLAYER_GetCapabilities(GF_BaseDecoder *dec, GF_CodecCapability *capability)
+{
+ switch (capability->CapCode) {
+ case GF_CODEC_WIDTH:
+ capability->cap.valueInt = 320;
+ break;
+ case GF_CODEC_HEIGHT:
+ capability->cap.valueInt = 240;
+ break;
+ }
+ return GF_OK;
+}
+static GF_Err LIBPLAYER_SetCapabilities(GF_BaseDecoder *dec, GF_CodecCapability capability)
+{
+ return GF_OK;
+}
+static Bool LIBPLAYER_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
+{
+ if (StreamType!=GF_STREAM_PRIVATE_MEDIA) return 0;
+ /*don't reply to media type queries*/
+ if (!esd) return 0;
+ if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_PRIVATE_MEDIA_LIBPLAYER) return 1;
+ return 0;
+}
+static const char *LIBPLAYER_GetName(GF_BaseDecoder *dec)
+{
+ return "LibPlayer decoder";
+}
+
+static GF_Err LIBPLAYER_Control(GF_PrivateMediaDecoder *dec, Bool mute, GF_Window *src, GF_Window *dst)
+{
+#ifndef TEST_LIBPLAYER
+ video_rect_t in, out;
+ player_t *player = dec->privateStack;
+
+ if (!player) return GF_OK;
+
+ in.x = src->x;
+ in.y = src->y;
+ in.w = src->w;
+ in.h = src->h;
+ out.x = dst->x;
+ out.y = dst->y;
+ out.w = dst->w;
+ out.h = dst->h;
+ player_video_io_windows_set(player, &in, &out);
+#endif
+
+// fprintf(stdout, "Repositioning video src %d %d %d %d - dest %d %d %d %d\n", src->x, src->y, src->w, src->h, dst->x, dst->y, dst->w, dst->h);
+ return GF_OK;
+}
+
+
+GF_EXPORT
+const u32 *QueryInterfaces()
+{
+ static u32 si [] = {
+ GF_NET_CLIENT_INTERFACE,
+ GF_PRIVATE_MEDIA_DECODER_INTERFACE,
+ 0
+ };
+ return si;
+}
+
+GF_EXPORT
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
+{
+ if (InterfaceType == GF_NET_CLIENT_INTERFACE) {
+ LibPlayerIn *read;
+ GF_InputService *plug;
+ GF_SAFEALLOC(plug, GF_InputService);
+ memset(plug, 0, sizeof(GF_InputService));
+ GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "LibPlayer Input", "gpac distribution")
+
+ plug->RegisterMimeTypes = LIBPLAYER_RegisterMimeTypes;
+ plug->CanHandleURL = LIBPLAYER_CanHandleURL;
+ plug->ConnectService = LIBPLAYER_ConnectService;
+ plug->CloseService = LIBPLAYER_CloseService;
+ plug->GetServiceDescriptor = LIBPLAYER_GetServiceDesc;
+ plug->ConnectChannel = LIBPLAYER_ConnectChannel;
+ plug->DisconnectChannel = LIBPLAYER_DisconnectChannel;
+ plug->ServiceCommand = LIBPLAYER_ServiceCommand;
+ plug->CanHandleURLInService = LIBPLAYER_CanHandleURLInService;
+
+ GF_SAFEALLOC(read, LibPlayerIn);
+ plug->priv = read;
+ return (GF_BaseInterface *)plug;
+
+ } else if (InterfaceType == GF_PRIVATE_MEDIA_DECODER_INTERFACE) {
+ GF_PrivateMediaDecoder *ifce;
+
+ GF_SAFEALLOC(ifce, GF_PrivateMediaDecoder);
+ GF_REGISTER_MODULE_INTERFACE(ifce, GF_PRIVATE_MEDIA_DECODER_INTERFACE, "LibPlayer Decoder", "gpac distribution")
+
+ /*setup our own interface*/
+ ifce->AttachStream = LIBPLAYER_AttachStream;
+ ifce->DetachStream = LIBPLAYER_DetachStream;
+ ifce->GetCapabilities = LIBPLAYER_GetCapabilities;
+ ifce->SetCapabilities = LIBPLAYER_SetCapabilities;
+ ifce->Control = LIBPLAYER_Control;
+ ifce->CanHandleStream = LIBPLAYER_CanHandleStream;
+ ifce->GetName = LIBPLAYER_GetName;
+ return (GF_BaseInterface *) ifce;
+ }
+ return NULL;
+}
+
+GF_EXPORT
+void ShutdownInterface(GF_BaseInterface *bi)
+{
+ if (bi->InterfaceType==GF_NET_CLIENT_INTERFACE) {
+ GF_InputService *ifcn = (GF_InputService*)bi;
+ LibPlayerIn *read = (LibPlayerIn*)ifcn->priv;
+ gf_free(read);
+ gf_free(bi);
+ } else if (bi->InterfaceType == GF_PRIVATE_MEDIA_DECODER_INTERFACE) {
+ gf_free(bi);
+ }
+}
+++ /dev/null
-include ../../config.mak
-
-vpath %.c $(SRC_PATH)/modules/m3u8_in
-
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include -g -Wall -pedantic
-
-ifeq ($(DEBUGBUILD), yes)
-CFLAGS+=-g
-LDFLAGS+=-g
-endif
-
-ifeq ($(GPROFBUILD), yes)
-CFLAGS+=-pg
-LDFLAGS+=-pg
-endif
-
-#common obj
-OBJS= m3u8_in.o m3u8_in_load.o playlist.o m3u8_parser.o
-
-SRCS := $(OBJS:.o=.c)
-
-NEED_LOCAL_LIB="no"
-LOCAL_LIB=../../bin/gcc
-LINKLIBS= -lgpac
-
-ifeq ($(CONFIG_OGG), local)
-NEED_LOCAL_LIB="yes"
-endif
-
-
-#add local lib path
-ifeq ($(NEED_LOCAL_LIB), "yes")
-LOCAL_LIB+=-L../../extra_lib/lib/gcc
-endif
-
-
-LIB=gm_m3u8_in.$(DYN_LIB_SUFFIX)
-ifeq ($(CONFIG_WIN32),yes)
-#LDFLAGS+=-export-symbols m3u8_in.def
-endif
-
-
-all: $(LIB)
-
-
-$(LIB): $(OBJS)
- $(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L$(LOCAL_LIB) $(LINKLIBS)
-
-
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-tests: all test.o
- $(CC) $(LDFLAGS) -o test $(OBJS) test.o $(EXTRALIBS) -L$(LOCAL_LIB) $(LINKLIBS) && ./test
-clean:
- rm -f $(OBJS) test test.o ../../bin/gcc/$(LIB)
-
-dep: depend
-
-depend:
- rm -f .depend
- GS)
-
-distclean: clean
- rm -f Makefile.bak .depend
-
-
-
-# include dependency files if they exist
-#
-ifneq ($(wildcard .depend),)
-include .depend
-endif
+++ /dev/null
-/**
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written by Pierre Souchay for VizionR SAS
- *
- */
-
-#include <gpac/modules/service.h>
-#include <gpac/internal/terminal_dev.h>
-#include <gpac/thread.h>
-#include <gpac/network.h>
-#include "m3u8_in.h"
-#include <gpac/list.h>
-#include "m3u8_parser.h"
-
-#define MYLOG(xx) GF_LOG( GF_LOG_INFO, GF_LOG_NETWORK, xx )
-
-
-typedef struct s_M3UREADER
-{
- GF_ClientService *service;
- char * rootURL;
- GF_DownloadSession * dnload;
- char is_remote;
- char needs_connection;
- VariantPlaylist * playlist;
- u32 preferredBitrate;
-
- PlaylistElement *ple;
-
- /* Service really managing the media */
- GF_InputService *media_ifce;
- GF_Thread *dl_thread;
-
-} M3U8Reader;
-
-
-static Bool M3U8_CanHandleURL(GF_InputService *plug, const char *url)
-{
- char *sExt;
- MYLOG(("***** M3U8_CanHandleURL %s\n", url));
- sExt = strrchr(url, '.');
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "application/vnd.apple.mpegurl", "m3u8", "M3U8 Playlist", sExt))
- return 1;
- if (gf_term_check_extension(plug, "application/x-mpegURL", "m3u8", "M3U8 Playlist", sExt))
- return 1;
- if (gf_term_check_extension(plug, "text/plain", "m3u8", "M3U8 Playlist", sExt))
- return 1;
- return 0;
-}
-
-static Bool m3u8_is_local(const char *url)
-{
- if (!strnicmp(url, "file://", 7)) return 1;
- if (strstr(url, "://")) return 0;
- return 1;
-}
-
-
-PlaylistElement * findNextPlaylistElementToPlay(M3U8Reader *read){
- VariantPlaylist * pl;
- Program * p;
- PlaylistElement * toPlay;
- assert( read );
- assert( read->playlist);
- pl = read->playlist;
- p = variant_playlist_get_current_program(pl);
- if (p == NULL)
- return NULL;
- toPlay = gf_list_get( p->bitrates, 0);
- if (toPlay == NULL)
- return NULL;
- switch (toPlay->elementType){
- case TYPE_PLAYLIST:
- return gf_list_get(toPlay->element.playlist.elements, 0);
- case TYPE_UNKNOWN:
- /* We have to download the file ! */
- case TYPE_STREAM:
- default:
- return toPlay;
- }
-
-}
-
-
-GF_Err M3U8_parseM3U8File(M3U8Reader * read){
- const char * szCache;
- GF_Err e;
- MYLOG(("***** M3U8_parseM3U8File\n"));
- szCache = gf_dm_sess_get_cache_name(read->dnload);
- if (!szCache){
- e = GF_CORRUPTED_DATA;
- goto end;
- }
-
- e = parse_root_playlist(szCache, & (read->playlist), read->rootURL);
- if (e){
- MYLOG(("***** Failed to parse root playlist : %s\n", szCache));
- } else {
- PlaylistElement * element = findNextPlaylistElementToPlay(read);
- if (element != NULL){
- MYLOG(("FOUND Program : %s\n", element->url));
- playlist_element_dump( element, 2 );
- }
- }
-end:
- gf_term_on_connect(read->service, NULL, e);
- gf_term_download_del(read->dnload);
- read->dnload = NULL;
- return e;
-}
-
-void M3U8_NetIO(void *cbk, GF_NETIO_Parameter *param)
-{
- M3U8Reader *read = (M3U8Reader *) cbk;
- MYLOG(("***** M3U8_NetIO %d\n", param->msg_type));
- gf_term_download_update_stats(read->dnload);
-
-}
-
-void M3U8_DownloadFile(GF_InputService *plug, const char *url)
-{
- GF_Err e;
- M3U8Reader *read = (M3U8Reader*) plug->priv;
- MYLOG(("***** M3U8_DownloadFile %s\n", url));
- read->dnload = gf_term_download_new(read->service, url, GF_NETIO_SESSION_NOT_THREADED, M3U8_NetIO, read);
- if (!read->dnload) {
- MYLOG(("***** M3U8_DownloadFile FAILED\n"));
- gf_term_on_connect(read->service, NULL, GF_NOT_SUPPORTED);
- }
- /* do the actual download (because not threaded )*/
- e = gf_dm_sess_process(read->dnload);
- if (e!=GF_OK) {
- gf_term_on_connect(read->service, NULL, GF_IO_ERR);
- }
-}
-
-static u32 download_media_files(void *par)
-{
- GF_Err e;
- M3U8Reader *read = (M3U8Reader*) par;
-
- /*
- while (1) {
- period = gf_list_get(mpdin->mpd.periods, mpdin->active_period_index);
- rep = &period->representations[mpdin->active_rep_index];
- new_seg_url = rep->segment_urls[mpdin->active_segment_index];
- if (rep->default_base_url) {
- new_base_seg_url = gf_url_concatenate(rep->default_base_url, new_seg_url);
- } else {
- new_base_seg_url = gf_strdup(new_seg_url);
- }
-
- gf_dm_setup_from_url(read->dnload, new_base_seg_url);
- gf_dm_sess_dash_reset(read->dnload);
- fprintf(stderr, "Downloading new media file: %s\n", new_base_seg_url);
- gf_free(new_base_seg_url);
-
- e = gf_dm_sess_process(read->dnload);
- if (e == GF_OK) {
- //signal the slave service the segment has been downloaded
- if (read->dnload) {
- }
-// if (mpdin->active_segment_index<10) {
- if (mpdin->active_segment_index<(rep->nb_segments-1)) {
- mpdin->active_segment_index++;
- } else {
- break;
- }
- } else {
- break;
- }
- gf_sleep(1000);
- }
- */
- gf_sleep(1000);
- return 0;
-}
-
-static GF_Err M3U8_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
-{
- char szURL[2048];
- GF_Err e;
- FILE * f;
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_ConnectService %s\n", url));
- if (read->rootURL){
- gf_free(read->rootURL);
- read->rootURL = NULL;
- }
- assert( url );
- read->rootURL = strdup(url);
- read->service = serv;
-
- if (read->dnload) gf_term_download_del(read->dnload);
- read->dnload = NULL;
-
- /*read->service_type = 0;*/
- strcpy(szURL, url);
-
- /*remote fetch*/
- read->is_remote = !m3u8_is_local(szURL);
- if (read->is_remote) {
- MYLOG(("***** M3U8_ConnectService Remote %s\n", url));
- read->needs_connection = 1;
- M3U8_DownloadFile(plug, szURL);
- } else {
- MYLOG(("***** M3U8_ConnectService local %s\n", url));
- f = fopen(szURL, "rb");
- if (!f) {
- e = GF_URL_ERROR;
- } else {
- e = GF_OK;
- }
- }
- e = M3U8_parseM3U8File( read );
- if (e){
- MYLOG(("***** Error while reading playlist %d\n", e));
- gf_term_on_connect(read->service, NULL, e);
- return GF_OK;
- } else {
- read->ple = findNextPlaylistElementToPlay(read);
-
- if (read->dnload) gf_term_download_del(read->dnload);
- read->dnload = gf_term_download_new(read->service, read->ple->url, GF_NETIO_SESSION_NOT_THREADED,
- M3U8_NetIO, read);
- if (!read->dnload) {
- gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
- return GF_OK;
- } else {
- e = gf_dm_sess_process(read->dnload);
- if (e!=GF_OK) {
- gf_term_on_connect(read->service, NULL, e);
- return GF_OK;
- } else {
- const char *local_url = gf_dm_sess_get_cache_name(read->dnload);
- /*load from mime type*/
- const char *sPlug = gf_cfg_get_key(read->service->term->user->config, "MimeTypes", "video/mp2t");
- if (sPlug) sPlug = strrchr(sPlug, '"');
- if (sPlug) {
- sPlug += 2;
- read->media_ifce = (GF_InputService *) gf_modules_load_interface_by_name(read->service->term->user->modules, sPlug, GF_NET_CLIENT_INTERFACE);
- if (read->media_ifce) {
-#if 1
- gf_th_run(read->dl_thread, download_media_files, read);
-#else
- e = download_media_files(read);
- if (e) {
- gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
- return GF_OK;
- }
-#endif
- /* Forward the ConnectService message to the appropriate service for this type of media */
- read->media_ifce->ConnectService(read->media_ifce, serv, local_url);
- } else {
- gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
- return GF_OK;
- }
- } else {
- gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
- return GF_OK;
- }
- }
- }
- }
-
- gf_term_on_connect(serv, NULL, e);
- return GF_OK;
-}
-
-static GF_Err M3U8_CloseService(GF_InputService *plug)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_CloseService %p\n", plug->priv));
- if (read == NULL)
- return GF_OK;
- if (read->media_ifce) {
- read->media_ifce->CloseService(read->media_ifce);
- }
- MYLOG(("***** M3U8_CloseService2\n"));
- gf_term_on_disconnect(read->service, NULL, GF_OK);
- if (read->dnload){
- MYLOG(("***** M3U8_CloseService : stopping download\n"));
- gf_term_download_del(read->dnload);
- read->dnload = NULL;
- }
-
- return GF_OK;
-}
-
-static Bool M3U8_CanHandleURLInService(GF_InputService *plug, const char *url)
-{
- MYLOG(("***** M3U8_CanHandleURLInService %s\n", url));
- return 0;
-}
-
-static GF_Descriptor *M3U8_GetServiceDesc(GF_InputService *plug, u32 expect_type, const char *sub_url)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_GetServiceDesc %s\n", sub_url));
- if (read->media_ifce) {
- return read->media_ifce->GetServiceDescriptor(read->media_ifce, expect_type, sub_url);
- } else {
- return NULL;
- }
-}
-
-static GF_Err M3U8_ConnectChannel(GF_InputService *plug, LPNETCHANNEL channel, const char *url, Bool upstream)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_ConnectChannel\n"));
- if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
- return read->media_ifce->ConnectChannel(read->media_ifce, channel, url, upstream);
-}
-
-static GF_Err M3U8_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_DisconnectChannel\n"));
- if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
- return read->media_ifce->DisconnectChannel(read->media_ifce, channel);
-}
-
-static GF_Err M3U8_ChannelGetSLP(GF_InputService *plug, LPNETCHANNEL channel, char **out_data_ptr, u32 *out_data_size, GF_SLHeader *out_sl_hdr, Bool *sl_compressed, GF_Err *out_reception_status, Bool *is_new_data)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_ChannelGetSLP\n"));
- if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
- return read->media_ifce->ChannelGetSLP(read->media_ifce, channel, out_data_ptr, out_data_size, out_sl_hdr, sl_compressed, out_reception_status, is_new_data);
-}
-
-static GF_Err M3U8_ChannelReleaseSLP(GF_InputService *plug, LPNETCHANNEL channel)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_ChannelReleaseSLP\n"));
- if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
- return read->media_ifce->ChannelReleaseSLP(read->media_ifce, channel);
-}
-
-
-static GF_Err M3U8_ServiceCommand(GF_InputService *plug, GF_NetworkCommand *com)
-{
- M3U8Reader *read = plug->priv;
- MYLOG(("***** M3U8_ServiceCommand %s\n", com));
- if (!plug || !plug->priv || !com || !read->media_ifce) return GF_SERVICE_ERROR;
-
- switch(com->command_type) {
- case GF_NET_SERVICE_INFO:
- /* defer to the real input service */
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_SERVICE_HAS_AUDIO:
- /* defer to the real input service */
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_SET_PADDING:
- /* for padding settings, the MPD level should not change anything */
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_SET_PULL:
- /* defer to the real input service */
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_INTERACTIVE:
- /* defer to the real input service */
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_BUFFER:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_BUFFER_QUERY:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_DURATION:
- /* Ignore the duration given by the input service and use the one given in the playlist */
- {
- Double duration;
- duration = (read->ple ? read->ple->durationInfo : 0);
- com->duration.duration = duration;
- return GF_OK;
- }
- break;
- case GF_NET_CHAN_PLAY:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_STOP:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_PAUSE:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_RESUME:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_SET_SPEED:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_CONFIG:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_GET_PIXEL_AR:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_GET_DSI:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_MAP_TIME:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_RECONFIG:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_DRM_CFG:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_CHAN_GET_ESD:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_BUFFER_QUERY:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_GET_STATS:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_IS_CACHABLE:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- case GF_NET_SERVICE_MIGRATION_INFO:
- return read->media_ifce->ServiceCommand(read->media_ifce, com);
- break;
- default:
- return GF_SERVICE_ERROR;
- }
-}
-
-GF_InputService *M3U8_LoadDemux()
-{
- M3U8Reader *reader;
- GF_InputService *plug = gf_malloc(sizeof(GF_InputService));
- memset(plug, 0, sizeof(GF_InputService));
- MYLOG(("Loading M3U8\n"));
- GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC M3U8 Reader", "gpac distribution")
- /* Yes, we handle this */
- plug->CanHandleURL = M3U8_CanHandleURL;
- /* Start read m3u8, we do */
- plug->ConnectService = M3U8_ConnectService;
- plug->CloseService = M3U8_CloseService;
-
- /* Foward to service, none of our business */
- plug->GetServiceDescriptor = M3U8_GetServiceDesc;
- plug->ConnectChannel = M3U8_ConnectChannel;
- plug->DisconnectChannel = M3U8_DisconnectChannel;
- plug->CanHandleURLInService = M3U8_CanHandleURLInService;
-
- /* To check for seeking / getTrackInfo... GF_NET_SERVICE_INFO */
- plug->ServiceCommand = M3U8_ServiceCommand;
-
- /* to transmit packets */
- plug->ChannelGetSLP = M3U8_ChannelGetSLP;
- plug->ChannelReleaseSLP = M3U8_ChannelReleaseSLP;
-
- reader = gf_malloc(sizeof(M3U8Reader));
- memset(reader, 0, sizeof(M3U8Reader));
- reader->playlist = NULL;
- reader->rootURL = NULL;
- plug->priv = reader;
- return plug;
-}
-
-void M3U8_DeleteDemux(void *ifce)
-{
- GF_InputService *plug = (GF_InputService *) ifce;
- M3U8Reader *read = plug->priv;
- if (read){
- if (read->rootURL)
- gf_free(read->rootURL);
- read->rootURL = NULL;
- gf_free(read);
- }
- gf_free(plug);
-}
+++ /dev/null
-/**
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written by Pierre Souchay for VizionR SAS
- *
- */
-
-#ifndef M3U8_IN_H
-#define M3U8_IN_H
-
-#include <gpac/modules/service.h>
-#include <gpac/modules/codec.h>
-#include <gpac/avparse.h>
-#include <gpac/constants.h>
-#include <gpac/thread.h>
-#include "playlist.h"
-
-GF_InputService *M3U8_LoadDemux();
-void M3U8_DeleteDemux(void *);
-
-#endif
-
+++ /dev/null
-/*
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include "m3u8_in.h"
-
-const u32 *QueryInterfaces()
-{
- static u32 si [] = {
- GF_NET_CLIENT_INTERFACE,
- 0
- };
- return si;
-}
-
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
-{
- if (InterfaceType == GF_NET_CLIENT_INTERFACE)
- return (GF_BaseInterface *)M3U8_LoadDemux();
- return NULL;
-}
-
-void ShutdownInterface(GF_BaseInterface *ifce)
-{
- switch (ifce->InterfaceType) {
- case GF_NET_CLIENT_INTERFACE:
- M3U8_DeleteDemux(ifce);
- break;
- }
-}
+++ /dev/null
-/**
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written by Pierre Souchay for VizionR SAS
- *
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include "m3u8_parser.h"
-//#include <inttypes.h>
-#include <gpac/network.h>
-
-/*#define MYLOG(xx) GF_LOG( GF_LOG_INFO, GF_LOG_CONTAINER, xx )*/
-//#define MYLOG(xx) printf xx
-#define MYLOG(xx)
-
-#ifdef WIN32
-#define bzero(a, b) memset(a, 0x0, b)
-#endif
-
-typedef struct _s_accumulated_attributes {
- char * title;
- int durationInSeconds;
- int bandwidth;
- int programId;
- char * codecs;
- int targetDurationInSeconds;
- int minMediaSequence;
- int currentMediaSequence;
- Bool isVariantPlaylist;
- Bool isPlaylistEnded;
-} s_accumulated_attributes;
-
-static Bool safe_start_equals(const char * attribute, const char * line){
- int len, atlen;
- if (line == NULL)
- return 0;
- len = strlen(line);
- atlen = strlen(attribute);
- if (len < atlen)
- return 0;
- return 0 == strncmp(attribute, line, atlen);
-}
-
-static char ** extractAttributes(const char * name, const char * line, const int numberOfAttributes){
- int sz, i, currentAttribute, start;
- char ** ret;
- int len = strlen(line);
- start = strlen(name);
- if (len <= start)
- return NULL;
- if (!safe_start_equals(name, line))
- return NULL;
- ret = calloc((numberOfAttributes + 1 ), sizeof(char*));
- currentAttribute = 0;
- for (i = start ; i <= len ; i++){
- if (line[i] == '\0' || line[i] == ','){
- sz = 1 + i - start;
- ret[currentAttribute] = calloc( (1+sz), sizeof(char));
- strncpy(ret[currentAttribute], &(line[start]), sz);
- currentAttribute++;
- start = i+1;
- if (start == len){
- return ret;
- }
- }
- }
- if (currentAttribute == 0){
- gf_free(ret);
- return NULL;
- }
- return ret;
-}
-
-/**
- * Parses the attributes and accumulate into the attributes structure
- */
-static char ** parseAttributes(const char * line, s_accumulated_attributes * attributes){
- int intValue, i;
- char ** ret;
- char * endPtr;
- char * utility;
- if (line == NULL)
- return NULL;
- if (!safe_start_equals("#EXT", line))
- return NULL;
- if (safe_start_equals("#EXT-X-ENDLIST", line)){
- attributes->isPlaylistEnded = 1;
- return NULL;
- }
- ret = extractAttributes("#EXT-X-TARGETDURATION:", line, 1);
- if (ret){
- /* #EXT-X-TARGETDURATION:<seconds> */
- if (ret[0]){
- intValue = strtol(ret[0], &endPtr, 10);
- if (endPtr != ret[0]){
- attributes->targetDurationInSeconds = intValue;
- }
- }
- return ret;
- }
- ret = extractAttributes("#EXT-X-MEDIA-SEQUENCE:", line, 1);
- if (ret){
- /* #EXT-X-MEDIA-SEQUENCE:<number> */
- if (ret[0]){
- intValue = strtol(ret[0], &endPtr, 10);
- if (endPtr != ret[0]){
- attributes->minMediaSequence = intValue;
- attributes->currentMediaSequence = intValue;
- }
- }
- return ret;
- }
- ret = extractAttributes("#EXTINF:", line, 2);
- if (ret){
- /* #EXTINF:<duration>,<title> */
- if (ret[0]){
- intValue = strtol(ret[0], &endPtr, 10);
- if (endPtr != ret[0]){
- attributes->durationInSeconds = intValue;
- }
- }
- if (ret[1]){
- attributes->title = strdup(ret[1]);
- }
- return ret;
- }
- ret = extractAttributes("#EXT-X-KEY:", line, 2);
- if (ret){
- /* #EXT-X-KEY:METHOD=<method>[,URI="<URI>"] */
- /* Not Supported for now */
- return ret;
- }
- ret = extractAttributes("#EXT-X-STREAM-INF:", line, 3);
- if (ret){
- /* #EXT-X-STREAM-INF:[attribute=value][,attribute=value]* */
- i = 0;
- attributes->isVariantPlaylist = 1;
- while (ret[i] != NULL){
- if (safe_start_equals("BANDWIDTH=", ret[i])){
- utility = &(ret[i][10]);
- intValue = strtol(utility, &endPtr, 10);
- if (endPtr != utility)
- attributes->bandwidth = intValue;
- } else if (safe_start_equals("PROGRAM-ID=", ret[i])){
- utility = &(ret[i][11]);
- intValue = strtol(utility, &endPtr, 10);
- if (endPtr != utility)
- attributes->programId = intValue;
- } else if (safe_start_equals("CODECS=\"", ret[i])){
- intValue = strlen(ret[i]);
- if (ret[i][intValue-1] == '"'){
- attributes->codecs = strdup(&(ret[i][7]));
- }
- }
- i++;
- }
- return ret;
- }
- return NULL;
-}
-
-#define M3U8_BUF_SIZE 2048
-
-static char * parse_next_line( char * data, char * buf, int * readPointer, int * remainingBytes){
- int i, pos;
- for (i = 0; i < *remainingBytes; i++){
- pos = *readPointer + i;
- if ('\n' == data[pos]){
- bzero(buf, M3U8_BUF_SIZE);
- memcpy(buf, data, pos);
- buf[pos] = 0;
- while (pos < *remainingBytes && (data[pos] == '\r' || data[pos] == '\n'))
- pos++;
- *remainingBytes = *remainingBytes - pos + *readPointer;
- memcpy(data, &(data[pos]), *remainingBytes);
- *readPointer = 0;
- return buf;
- }
- }
- /* OK, we did not find it, we discard this line if buffer is full */
- *readPointer+= *remainingBytes;
- if ((*readPointer) + 1 >= M3U8_BUF_SIZE )
- *readPointer = 0;
- return NULL;
-}
-
-
-GF_Err parse_root_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL)
-{
- return parse_sub_playlist(file, playlist, baseURL, NULL, NULL);
-}
-
-GF_Err parse_sub_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL, Program * in_program, PlaylistElement *sub_playlist)
-{
- int readen, readPointer, len, i, currentLineNumber;
- FILE * f;
- VariantPlaylist * pl;
- char data[M3U8_BUF_SIZE+1];
- char buf[M3U8_BUF_SIZE+1];
- char * currentLine;
- char ** attributes = NULL;
- s_accumulated_attributes attribs;
- f = fopen(file, "rb");
- if (!f){
- return GF_SERVICE_ERROR;
- }
- if (*playlist == NULL){
- *playlist = variant_playlist_new();
- }
- pl = *playlist;
- readen=0;
- readPointer = 0;
- currentLineNumber = 0;
- bzero(&attribs, sizeof(s_accumulated_attributes));
- attribs.bandwidth = 0;
- attribs.isVariantPlaylist = 0;
- attribs.isPlaylistEnded = 0;
- attribs.minMediaSequence = 0;
- attribs.currentMediaSequence = 0;
- do {
- readen = fread(data, 1, M3U8_BUF_SIZE - readPointer, f);
- if (readen > 0){
- do {
- currentLine = parse_next_line(data, buf, &readPointer, &readen);
- if (currentLine != NULL){
- currentLineNumber++;
- len = strlen( currentLine);
- if (len < 1)
- continue;
- if (currentLineNumber == 1){
- /* Playlist MUST start with #EXTM3U */
- if (len < 7 || strncmp("#EXTM3U", currentLine, 7)!=0){
- MYLOG(("Failed to parse M3U8 File, it should start with #EXTM3U, but was : %s\n", currentLine));
- return GF_STREAM_NOT_FOUND;
- }
- continue;
- }
- if (currentLine[0] == '#'){
- /* A comment or a directive */
- if (strncmp("#EXT", currentLine, 4)==0){
- attributes = parseAttributes(currentLine, &attribs);
- if (attributes == NULL){
- MYLOG(("Comment at line %d : %s\n", currentLineNumber, currentLine));
- } else {
- MYLOG(("Directive at line %d: \"%s\", attributes=", currentLineNumber, currentLine));
- i = 0;
- while (attributes[i] != NULL){
- MYLOG((" [%d]='%s'", i, attributes[i]));
- gf_free(attributes[i]);
- attributes[i] = NULL;
- i++;
- }
- MYLOG(("\n"));
- gf_free(attributes);
- attributes = NULL;
- }
- }
- } else {
- char * fullURL = currentLine;
- GF_List * currentBitrateList = NULL;
- //printf("Line %d: '%s'\n", currentLineNumber, currentLine);
-
- if (gf_url_is_local(currentLine)){
- /*
- if (gf_url_is_local(baseURL)){
- int num_chars = -1;
- if (baseURL[strlen(baseURL)-1] == '/'){
- num_chars = asprintf(&fullURL, "%s%s", baseURL, currentLine);
- } else {
- num_chars = asprintf(&fullURL, "%s/%s", baseURL, currentLine);
- }
- if (num_chars < 0 || fullURL == NULL){
- variant_playlist_del(*playlist);
- playlist = NULL;
- return GF_OUT_OF_MEM;
- }
- } else */{
- fullURL = gf_url_concatenate(baseURL, currentLine);
- }
- assert( fullURL );
- /*printf("*** calculated full path = %s from %s and %s\n", fullURL, currentLine, baseURL);*/
- }
- {
- u32 count;
- PlaylistElement * currentPlayList = sub_playlist;
- /* First, we have to find the matching program */
- Program * program = in_program;
- if (!in_program) program = variant_playlist_find_matching_program(pl, attribs.programId);
- /* We did not found the program, we create it */
- if (program == NULL){
- program = program_new(attribs.programId);
- if (program == NULL){
- /* OUT of memory */
- variant_playlist_del(*playlist);
- playlist = NULL;
- return GF_OUT_OF_MEM;
- }
- gf_list_add(pl->programs, program);
- if (pl->currentProgram < 0)
- pl->currentProgram = program->programId;
- }
-
- /* OK, we have a program, we have to choose the elements with same bandwidth */
- assert( program );
- assert( program->bitrates);
- count = gf_list_count( program->bitrates);
-
- if (!currentPlayList) {
- for (i = 0; i < count; i++){
- PlaylistElement * itPlayListElement = gf_list_get(program->bitrates, i);
- assert( itPlayListElement );
- if (itPlayListElement->bandwidth == attribs.bandwidth){
- currentPlayList = itPlayListElement;
- break;
- }
- }
- }
-
- if (attribs.isVariantPlaylist){
- /* We are the Variant Playlist */
- if (currentPlayList != NULL){
- /* should not happen, it means we redefine something previsouly added */
- //assert( 0 );
- }
- currentPlayList = playlist_element_new(
- TYPE_UNKNOWN,
- fullURL,
- attribs.title,
- attribs.durationInSeconds);
- if (currentPlayList == NULL){
- /* OUT of memory */
- variant_playlist_del(*playlist);
- playlist = NULL;
- return GF_OUT_OF_MEM;
- }
- assert( fullURL);
- currentPlayList->url = strdup(fullURL);
- currentPlayList->title = attribs.title ? strdup(attribs.title):NULL;
- gf_list_add(program->bitrates, currentPlayList);
- } else {
- /* Normal Playlist */
- assert( pl->programs);
- if (currentPlayList == NULL){
- /* This is in facts a "normal" playlist without any element in it */
- PlaylistElement * subElement;
- assert(baseURL);
- currentPlayList = playlist_element_new(
- TYPE_PLAYLIST,
- baseURL,
- attribs.title,
- attribs.durationInSeconds);
- if (currentPlayList == NULL){
- /* OUT of memory */
- variant_playlist_del(*playlist);
- playlist = NULL;
- return GF_OUT_OF_MEM;
- }
- assert(currentPlayList->element.playlist.elements);
- assert( fullURL);
- currentPlayList->url = strdup(baseURL);
- currentPlayList->title = strdup("NO_NAME");
- subElement = playlist_element_new(
- TYPE_UNKNOWN,
- fullURL,
- attribs.title,
- attribs.durationInSeconds);
- if (subElement == NULL){
- variant_playlist_del(*playlist);
- playlist_element_del(currentPlayList);
- playlist = NULL;
- return GF_OUT_OF_MEM;
- }
- gf_list_add(currentPlayList->element.playlist.elements, subElement);
- gf_list_add(program->bitrates, currentPlayList);
- assert( program );
- assert( program->bitrates);
- assert( currentPlayList);
-
- } else {
- PlaylistElement * subElement = playlist_element_new(
- TYPE_UNKNOWN,
- fullURL,
- attribs.title,
- attribs.durationInSeconds);
- if (currentPlayList->elementType != TYPE_PLAYLIST) {
- currentPlayList->elementType = TYPE_PLAYLIST;
- if (!currentPlayList->element.playlist.elements)
- currentPlayList->element.playlist.elements = gf_list_new();
- }
- if (subElement == NULL){
- variant_playlist_del(*playlist);
- playlist_element_del(currentPlayList);
- playlist = NULL;
- return GF_OUT_OF_MEM;
- }
- gf_list_add(currentPlayList->element.playlist.elements, subElement);
- }
- }
-
- currentPlayList->element.playlist.currentMediaSequence = attribs.currentMediaSequence ;
- if (attribs.targetDurationInSeconds > 0){
- currentPlayList->element.playlist.target_duration = attribs.targetDurationInSeconds;
- currentPlayList->durationInfo = attribs.targetDurationInSeconds;
- }
- if (attribs.durationInSeconds)
- currentPlayList->durationInfo = attribs.durationInSeconds;
-
- currentPlayList->element.playlist.mediaSequenceMin = attribs.minMediaSequence;
- currentPlayList->element.playlist.mediaSequenceMax = attribs.currentMediaSequence++;
- if (attribs.bandwidth > 1)
- currentPlayList->bandwidth = attribs.bandwidth;
- if (attribs.isPlaylistEnded)
- currentPlayList->element.playlist.is_ended = 1;
- }
- /* Cleanup all line-specific fields */
- if (attribs.title){
- gf_free(attribs.title);
- attribs.title = NULL;
- }
- attribs.durationInSeconds = 0;
- attribs.bandwidth = 0;
- attribs.programId = 0;
- if (attribs.codecs != NULL){
- gf_free(attribs.codecs);
- attribs.codecs = NULL;
- }
- if (fullURL != currentLine){
- gf_free(fullURL);
- }
- }
- }
- } while (currentLine != NULL);
- }
- } while (readen > 0);
- fclose(f);
- return GF_OK;
-}
+++ /dev/null
-/**
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written by Pierre Souchay for VizionR SAS
- *
- */
-#ifndef M3U8_PARSER_H
-#define M3U8_PARSER_H
-#include "playlist.h"
-
-/**
- * Parse the given playlist file
- * @param file The file from cache to parse
- * @param The playlist to fill. If argument is null, and file is valid, playlist will be allocated
- * @return GF_OK if playlist valid
- */
-GF_Err parse_root_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL);
-/**
- * Parse the given playlist file as a subplaylist of an existing playlist
- * @param file The file from cache to parse
- * @param The playlist to fill.
- * @param baseURL base URL of the playlist
- * @param program in which the playlist is parsed
- * @param sub_playlist existing subplaylist element in the @playlist in which the playlist is parsed
- * @return GF_OK if playlist valid
- */
-GF_Err parse_sub_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL, Program * in_program, PlaylistElement *sub_playlist);
-
-#endif /* M3U8_PARSER_H */
\ No newline at end of file
+++ /dev/null
-/**
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written by Pierre Souchay for VizionR SAS
- *
- */
-#include "playlist.h"
-#include <string.h>
-
-#ifdef WIN32
- #define bzero(a, b) memset(a, 0x0, b)
-#endif
-
-GF_Err cleanup_list_of_elements(GF_List * list){
- int i, count;
- GF_Err result = GF_OK;
- if (list == NULL)
- return result;
- count = gf_list_count(list);
- for (i = 0; i < count ; i++){
- PlaylistElement * pl = (PlaylistElement *) gf_list_get(list, i);
- if (pl)
- result |= playlist_element_del(pl);
- }
- gf_list_del(list);
- return result;
-}
-
-GF_Err playlist_element_del(PlaylistElement * e){
- GF_Err result = GF_OK;
- if (e == NULL)
- return result;
- if (e->title){
- gf_free(e->title);
- e->title = NULL;
- }
- assert( e->url);
- gf_free(e->url);
- e->url = NULL;
-
- switch (e->elementType) {
- case TYPE_UNKNOWN:
- case TYPE_STREAM:
- break;
- case TYPE_PLAYLIST:
- assert( e->element.playlist.elements);
- result |= cleanup_list_of_elements(e->element.playlist.elements);
- e->element.playlist.elements = NULL;
- default:
- break;
- }
- return result;
-}
-
-Program * program_new(int programId){
- Program * program = malloc(sizeof(Program));
- if (program == NULL){
- return NULL;
- }
- program->programId = programId;
- program->bitrates = gf_list_new();
- if (program->bitrates == NULL){
- gf_free(program);
- return NULL;
- }
- return program;
-}
-
-GF_Err program_del(Program * program){
- int count, i;
- GF_Err e = GF_OK;
- if (program == NULL)
- return e;
- assert( program->bitrates);
- count = gf_list_count(program->bitrates);
- for (i = 0 ; i < count; i++){
- e |= cleanup_list_of_elements(gf_list_get(program->bitrates, i));
- }
- gf_list_del(program->bitrates);
- program->bitrates = NULL;
- return e;
-}
-
-/*
-GF_Err playlist_del(Playlist * pl){
- GF_Err result = GF_OK;
- if (pl == NULL)
- return result;
- if (pl->elements){
- result|= cleanup_list_of_elements(pl->elements);
- pl->elements = NULL;
- }
- gf_free(pl);
- return result;
-}*/
-
-PlaylistElement * playlist_element_new(PlaylistElementType elementType, const char * url, const char * title, int durationInfo){
- PlaylistElement * e = malloc(sizeof(PlaylistElement));
- bzero(e, sizeof(PlaylistElement));
- assert( url );
- if (e == NULL)
- return NULL;
- e->durationInfo = durationInfo;
- e->title = (title ? strdup(title) : NULL);
- assert( url);
- e->url = strdup(url);
- e->bandwidth = 0;
- e->elementType = elementType;
- if (elementType == TYPE_PLAYLIST){
- e->element.playlist.is_ended = 0;
- e->element.playlist.target_duration = durationInfo;
- e->element.playlist.currentMediaSequence = 0;
- e->element.playlist.mediaSequenceMin = 0;
- e->element.playlist.mediaSequenceMax = 0;
- e->element.playlist.elements = gf_list_new();
- if (NULL == (e->element.playlist.elements)){
- if (e->title)
- gf_free(e->title);
- if (e->url)
- gf_free(e->url);
- e->url = NULL;
- e->title = NULL;
- gf_free(e);
- return NULL;
- }
- } else {
- /* Nothing to do, stream is an empty structure */
- }
- assert(e->bandwidth == 0);
- assert(e->url);
- return e;
-}
-/*
-Playlist * playlist_new(){
- Playlist * pl = malloc(sizeof(Playlist));
- if (pl == NULL)
- return NULL;
- pl->currentMediaSequence = 1;
- pl->target_duration = 0;
- pl->mediaSequenceMin = 0;
- pl->mediaSequenceMax = 0;
- pl->is_ended = 0;
- pl->elements = gf_list_new();
- if (pl->elements == NULL){
- gf_free(pl);
- return NULL;
- }
- return pl;
-}
- */
-
-VariantPlaylist * variant_playlist_new ()
-{
- VariantPlaylist * pl = malloc( sizeof(VariantPlaylist) );
- if (pl == NULL)
- return NULL;
- pl->programs = gf_list_new();
- if (! pl->programs){
- gf_free( pl );
- return NULL;
- }
- pl->currentProgram = -1;
- return pl;
-}
-
-GF_Err variant_playlist_del (VariantPlaylist * playlist){
- int count, i, count2, j;
- Program * p;
- if (playlist == NULL)
- return GF_OK;
- assert( playlist->programs);
- count = gf_list_count(playlist->programs);
- for (i = 0; i < count ; i++){
- p = gf_list_get(playlist->programs, i);
- assert(p);
- count2 = gf_list_count( p->bitrates );
- for (j = 0; j < count2; j++){
- PlaylistElement * pl = gf_list_get(p->bitrates, j);
- playlist_element_del(pl);
- }
- gf_list_del(p->bitrates);
- p->bitrates = NULL;
- }
- gf_list_del(playlist->programs);
- playlist->programs = NULL;
- gf_free(playlist);
- return GF_OK;
-}
-
-GF_Err playlist_element_dump(const PlaylistElement * e, int indent){
- int i;
- GF_Err r = GF_OK;
- for (i = 0 ; i < indent; i++)
- printf(" ");
- if (e == NULL){
- printf("NULL PlaylistElement\n");
- return r;
- }
- printf("PlayListElement[%p, title=%s, duration=%d, bandwidth=%d, url=%s, type=%s]\n",
- (void*)e,
- e->title,
- e->durationInfo,
- e->bandwidth,
- e->url,
- e->elementType == TYPE_STREAM ? "stream" : "playlist");
- if (TYPE_PLAYLIST == e->elementType){
- int sz;
- assert( e->element.playlist.elements);
- sz = gf_list_count(e->element.playlist.elements);
- indent+=2;
- for (i = 0 ; i < sz ; i++){
- PlaylistElement * el = gf_list_get(e->element.playlist.elements, i);
- assert( el);
- r|= playlist_element_dump( el, indent);
- }
- }
- return r;
-}
-
-GF_Err variant_playlist_dump(const VariantPlaylist * pl){
- int i, count;
- GF_Err e = GF_OK;
- if (pl == NULL){
- printf("VariantPlaylist = NULL\n");
- return e;
- }
- printf("VariantPlaylist = {\n");
- assert( pl->programs);
- count = gf_list_count( pl->programs);
- for (i = 0 ; i < count ; i++){
- int j, countj;
- Program * p = gf_list_get(pl->programs, i);
- assert( p );
- printf(" program[programId=%d]{\n", p->programId);
- assert( p->bitrates );
- countj = gf_list_count(p->bitrates);
- for (j = 0; j < countj; j++){
- PlaylistElement * el = gf_list_get(p->bitrates, j);
- assert(el);
- e |= playlist_element_dump( el, 4);
- }
- printf(" }\n");
- }
- printf("}\n");
- return e;
-}
-
-Program * variant_playlist_find_matching_program(const VariantPlaylist * pl, const u32 programId){
- u32 count, i;
- assert( pl);
- assert( pl->programs);
- assert(programId >= 0);
- count = gf_list_count(pl->programs);
- for (i = 0 ; i < count ; i++){
- Program * cur = gf_list_get(pl->programs, i);
- assert( cur );
- if (programId == cur->programId){
- /* We found the program */
- return cur;
- }
- }
- return NULL;
-}
-
-Program * variant_playlist_get_current_program(const VariantPlaylist * pl){
- assert( pl );
- return variant_playlist_find_matching_program(pl, pl->currentProgram);
-}
+++ /dev/null
-/**
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Jean Le Feuvre 2000-2005
- * All rights reserved
- *
- * This file is part of GPAC
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written by Pierre Souchay for VizionR SAS
- *
- */
-#ifndef M3U8_PLAYLIST_H
-#define M3U8_PLAYLIST_H
-#include <gpac/tools.h>
-#include <gpac/list.h>
-
-/**
- * Global Structure
- *
- * For a stream with multiple bandwidths and multiple programs
- *
- * VariantPlayList
- * |
- * |_ program id 1
- * | |
- * | |_ bandwidth X : playlistElement1
- * | |- bandwidth Y : playlistElement2
- * |
- * |- program id 2
- * |
- * |_ bandwidth Z : playlistElement
- *
- * For a "normal" playlist
- *
- * VariantPlayList
- * |
- * |_ program id 1
- * |
- * |_ bandwidth 0 : playlistElement1
- *
- * Where PlaylistElement can be :
- * - a stream (real resource)
- * - a playlist (list of PlaylistElements itself)
- */
-
-/**
- * Basic Stream structure
- */
-typedef struct s_stream{
- u8 i;
-} Stream;
-
-/**
- * The playlist contains a list of elements to play
- */
-typedef struct s_playList {
- int currentMediaSequence;
- int target_duration;
- int mediaSequenceMin;
- int mediaSequenceMax;
- char is_ended;
- GF_List * elements;
-} Playlist;
-
-typedef enum e_playlistElementType { TYPE_PLAYLIST, TYPE_STREAM, TYPE_UNKNOWN} PlaylistElementType;
-
-/**
- * The Structure containing the playlist element
- */
-typedef struct s_playlistElement{
- int durationInfo;
- int bandwidth;
- char * title;
- char * url;
- PlaylistElementType elementType;
- union { Playlist playlist; Stream stream; } element;
-
-} PlaylistElement;
-
-typedef struct s_program{
- int programId;
- GF_List * bitrates;
- int currentBitrateIndex;
-} Program;
-
-
-/**
- * The root playlist, can contains several PlaylistElements structures
- */
-typedef struct s_variantPlaylist {
- GF_List * programs;
- int currentProgram;
-} VariantPlaylist;
-
-/**
- * Creates a new playlist
- * @return NULL if playlist could not be allocated
- *
-Playlist * playlist_new();
-*/
-/**
- * Deletes a given playlist and all of its sub elements
- *
-GF_Err playlist_del(Playlist *);
-*/
-
-/**
- * Deletes an Playlist element
- */
-GF_Err playlist_element_del(PlaylistElement *);
-
-/**
- * Creates a new program properly initialized
- */
-Program * program_new(int programId);
-
-/**
- * Deletes the specified program
- */
-GF_Err program_del(Program * program);
-
-/**
- * Creates an Playlist element.
- * This element can be either a playlist of a stream according to first parameter.
- * @return NULL if element could not be created. Element deletion will be deleted recusivly by #playlist_del(Playlist*)
- */
-PlaylistElement * playlist_element_new(PlaylistElementType elementType, const char * url, const char * title, int durationInfo);
-
-/**
- * Creates a new VariantPlaylist
- * @return NULL if VariantPlaylist element could not be allocated
- */
-VariantPlaylist * variant_playlist_new ();
-
-/**
- * Deletes the given VariantPlaylist and all of its sub elements
- */
-GF_Err variant_playlist_del(VariantPlaylist *);
-
-GF_Err playlist_element_dump(const PlaylistElement * e, int indent);
-
-GF_Err variant_playlist_dump(const VariantPlaylist *);
-
-Program * variant_playlist_find_matching_program(const VariantPlaylist *, const u32 programId);
-
-Program * variant_playlist_get_current_program(const VariantPlaylist *);
-
-#endif /* M3U8_PLAYLIST_H */
-
+++ /dev/null
-#include "playlist.h"
-#include "m3u8_parser.h"
-
-const char * files[] = {
- "tests/spec_simple_playlist.m3u8",
- "tests/relative_playlist.m3u8",
- "tests/direct8.m3u8",
- "tests/spec_sliding_window_playlist.m3u8",
- "tests/spec_encrypted_media.m3u8",
- "tests/spec_variant_playlist.m3u8",
- "tests/spec_multiple_files.m3u8",
- NULL
-};
-
-int main(int argc, char ** argv){
- int i = 0;
- while (files[i] != NULL){
- VariantPlaylist * pl = NULL;
- printf("Testing %s...\n", files[i]);
- if (parse_root_playlist(files[i], &pl, "tests/")){
- printf("**** Error while reading playlist %s !\n", files[i]);
- }
- i++;
- printf("DONE, now dumping...\n\n");
- variant_playlist_dump(pl);
- printf("DONE, now deleting...\n\n");
- variant_playlist_del( pl );
- }
- printf("Finished\n");
- return 0;
-}
+++ /dev/null
-#EXTM3U
-#EXTINF:0,
-http://tv.freebox.fr/stream_direct8
+++ /dev/null
-#EXTM3U
-#EXTINF:15,Relative Track
-relativeURL/test.ts
+++ /dev/null
-#EXTM3U
-#EXT-X-MEDIA-SEQUENCE:7794
-#EXT-X-TARGETDURATION:15
-
-#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52"
-
-#EXTINF:15,
-http://media.example.com/fileSequence7794.ts
-#EXTINF:15,
-http://media.example.com/fileSequence7795.ts
-#EXTINF:15,
-http://media.example.com/fileSequence7796.ts
-
-#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53"
-
-#EXTINF:15,
-http://media.example.com/fileSequence7797.ts
-
+++ /dev/null
-#EXTM3U
-# Taken from http://developer.apple.com/iphone/library/documentation/networkinginternet/conceptual/streamingmediaguide/HTTPStreamingArchitecture/HTTPStreamingArchitecture.html
-#EXT-X-MEDIA-SEQUENCE:0
-
-#EXT-X-TARGETDURATION:10
-
-#EXTINF:10,
-
-http://media.example.com/segment1.ts
-
-#EXTINF:10,
-
-http://media.example.com/segment2.ts
-
-#EXTINF:10,
-
-http://media.example.com/segment3.ts
-
-#EXT-X-ENDLIST
+++ /dev/null
-#EXTM3U
-#EXT-X-TARGETDURATION:10
-#EXTINF:5220,
-http://media.example.com/entire.ts
-#EXT-X-ENDLIST
+++ /dev/null
-#EXTM3U
-#EXT-X-TARGETDURATION:8
-#EXT-X-MEDIA-SEQUENCE:2680
-
-#EXTINF:8,
-https://priv.example.com/fileSequence2680.ts
-#EXTINF:8,
-https://priv.example.com/fileSequence2681.ts
-#EXTINF:8,
-https://priv.example.com/fileSequence2682.ts
-
+++ /dev/null
-#EXTM3U
-#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000
-http://example.com/low.m3u8
-#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000
-http://example.com/mid.m3u8
-#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000
-http://example.com/hi.m3u8
-#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS="mp4a.40.5"
-http://example.com/audio-only.m3u8
-
vpath %.c $(SRC_PATH)/modules/mp3_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#local mad lib
ifeq ($(CONFIG_MAD), local)
EXTRALIBS+=-L../../extra_lib/lib/gcc
-CFLAGS+= -I$(LOCAL_INC_PATH)/mad
+CFLAGS+= -I"$(LOCAL_INC_PATH)/mad"
endif
EXTRALIBS+= -lmad
endif
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/constants.h>
#if defined(_WIN32_WCE) || defined(__SYMBIAN32__)
-#ifndef FPM_DEFAULT
-#define FPM_DEFAULT
+#ifndef FPM_DEFAULT
+#define FPM_DEFAULT
#endif
#endif
} MADDec;
-
-#define MADCTX() MADDec *ctx = (MADDec *) ifcg->privateStack
-
+#define MADCTX() MADDec *ctx = NULL; if (ifcg) { ctx = (MADDec *) ifcg->privateStack; }
static GF_Err MAD_AttachStream(GF_BaseDecoder *ifcg, GF_ESD *esd)
{
mad_frame_init(&ctx->frame);
mad_synth_init(&ctx->synth);
ctx->configured = 1;
-
+
ctx->buffer = gf_malloc(sizeof(char) * 2*MAD_BUFFER_MDLEN);
-
+
/*we need a frame to init, so use default values*/
ctx->num_samples = 1152;
ctx->num_channels = 0;
chan = -MAD_F_ONE; \
ret = chan >> (MAD_F_FRACBITS + 1 - 16); \
-static GF_Err MAD_ProcessData(GF_MediaDecoder *ifcg,
+static GF_Err MAD_ProcessData(GF_MediaDecoder *ifcg,
char *inBuffer, u32 inBufferLength,
u16 ES_ID,
char *outBuffer, u32 *outBufferLength,
/*check not using scalabilty*/
assert(ctx->ES_ID == ES_ID);
- if (ctx->ES_ID != ES_ID)
+ if (ctx->ES_ID != ES_ID)
return GF_BAD_PARAM;
/*if late or seeking don't decode*/
GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("[MAD] decoder initialized - MP3 sample rate %d - %d channel(s)", ctx->sample_rate, ctx->num_channels));
return GF_BUFFER_TOO_SMALL;
}
-
+
if (ctx->stream.next_frame) {
ctx->len = &ctx->buffer[ctx->len] - ctx->stream.next_frame;
memmove(ctx->buffer, ctx->stream.next_frame, ctx->len);
}
-
+
mad_synth_frame(&ctx->synth, &ctx->frame);
num = ctx->synth.pcm.length;
MAD_VERSION;
}
-static Bool MAD_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool MAD_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
- /*audio decs*/
+ /*audio decs*/
if (StreamType != GF_STREAM_AUDIO) return 0;
+ /*media type query*/
+ if (!esd) return 1;
- switch (ObjectType) {
+ switch (esd->decoderConfig->objectTypeIndication) {
/*MPEG1 audio*/
case GPAC_OTI_AUDIO_MPEG2_PART3:
/*MPEG2 audio*/
case GPAC_OTI_AUDIO_MPEG1:
return 1;
- /*cap query*/
- case 0:
- return 1;
}
return 0;
}
{
GF_MediaDecoder *ifce;
MADDec *dec;
-
+
GF_SAFEALLOC(ifce, GF_MediaDecoder);
GF_SAFEALLOC(dec, MADDec);
GF_REGISTER_MODULE_INTERFACE(ifce, GF_MEDIA_DECODER_INTERFACE, "MAD Decoder", "gpac distribution")
dec->cb_size = 12;
dec->cb_trig = 4;
- /*setup our own interface*/
+ /*setup our own interface*/
ifce->AttachStream = MAD_AttachStream;
ifce->DetachStream = MAD_DetachStream;
ifce->GetCapabilities = MAD_GetCapabilities;
void DeleteMADDec(GF_MediaDecoder *ifcg)
{
- MADCTX();
- if (ctx->configured) {
+ MADDec *ctx;
+ if (!ifcg)
+ return;
+ ctx = (MADDec *) ifcg->privateStack;
+ if (ctx){
+ if (ctx->configured) {
mad_stream_finish(&ctx->stream);
mad_frame_finish(&ctx->frame);
mad_synth_finish(&ctx->synth);
+ }
+ ctx->configured = 0;
+ ctx->sample_rate = ctx->out_size = ctx->num_samples = 0;
+ ctx->num_channels = 0;
+ gf_free(ctx);
}
- gf_free(ctx);
- gf_free(ifcg);
+ ifcg->privateStack = NULL;
+ gf_free(ifcg);
}
#endif
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include <gpac/modules/service.h>
u32 needs_connection;
Bool is_remote;
-
+
FILE *stream;
u32 duration;
GF_DownloadSession * dnload;
Bool is_live;
+ char * liveDataCopy;
+ u32 liveDataCopySize;
char prev_data[1000];
u32 prev_size;
-
+
char *icy_name;
char *icy_genre;
char *icy_track_name;
} MP3Reader;
+static const char * MP3_MIME_TYPES[] = { "audio/mpeg", "audio/x-mpeg", "audio/mp3", NULL};
+
+static const char * MP3_EXTENSIONS = "mp2 mp3 mpga mpega";
+
+static const char * MP3_DESC = "MP3 Music";
+
+
+static u32 MP3_RegisterMimeTypes(const GF_InputService *plug)
+{
+ u32 i;
+ for (i =0 ; MP3_MIME_TYPES[i] ; i++)
+ gf_term_register_mime_type(plug, MP3_MIME_TYPES[i], MP3_EXTENSIONS, MP3_DESC);
+ return i;
+}
+
static Bool MP3_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ if (!plug || !url)
+ return 0;
sExt = strrchr(url, '.');
- if (!strnicmp(url, "rtsp://", 7)) return 0;
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "audio/mpeg", "mp2 mp3 mpga mpega", "MP3 Music", sExt)) return 1;
- if (gf_term_check_extension(plug, "audio/x-mpeg", "mp2 mp3 mpga mpega", "MP3 Music", sExt)) return 1;
+ if (!strnicmp(url, "rtsp://", 7)) return 0;
+ {
+ u32 i;
+ for (i =0 ; MP3_MIME_TYPES[i] ; i++)
+ if (gf_term_check_extension(plug, MP3_MIME_TYPES[i], MP3_EXTENSIONS, MP3_DESC, sExt))
+ return 1;
+ }
return 0;
}
read->data_size += data_size;
if (!read->ch) return;
-
+
data = read->data;
data_size = read->data_size;
} else {
return;
}
- }
+ }
else if (param->msg_type==GF_NETIO_PARSE_HEADER) {
if (!strcmp(param->name, "icy-name")) {
if (read->icy_name) gf_free(read->icy_name);
if (!strcmp(param->name, "icy-meta")) {
GF_NetworkCommand com;
char *meta;
- if (read->icy_track_name) gf_free(read->icy_track_name);
- read->icy_track_name = NULL;
meta = param->value;
while (meta && meta[0]) {
char *sep = strchr(meta, ';');
if (sep) sep[0] = 0;
-
+
if (!strnicmp(meta, "StreamTitle=", 12)) {
+ if (read->icy_track_name) gf_free(read->icy_track_name);
+ read->icy_track_name = NULL;
read->icy_track_name = gf_strdup(meta+12);
+ if (!strcmp(read->icy_track_name, "''")){
+ /* On some servers, '' means not track name */
+ gf_free(read->icy_track_name);
+ read->icy_track_name = NULL;
+ }
}
if (!sep) break;
sep[0] = ';';
}
/*looks like a live stream*/
if (read->is_live) {
- if (!e) MP3_OnLiveData(read, param->data, param->size);
- return;
+ if (read->liveDataCopySize < param->size){
+ read->liveDataCopy = gf_realloc(read->liveDataCopy, param->size);
+ }
+ memcpy(read->liveDataCopy, param->data, param->size);
+ if (!e) MP3_OnLiveData(read, read->liveDataCopy, param->size);
+ return;
}
if (read->stream) return;
if (read->data) gf_free(read->data);
read->data = NULL;
+ if (read->liveDataCopy){
+ gf_free(read->liveDataCopy);
+ read->liveDataCopy = NULL;
+ read->liveDataCopySize = 0;
+ }
+ if (read->icy_name)
+ gf_free(read->icy_name);
+ read->icy_name = NULL;
+ if (read->icy_genre)
+ gf_free(read->icy_genre);
+ read->icy_genre = NULL;
+ if (read->icy_track_name)
+ gf_free(read->icy_track_name);
+ read->icy_track_name = NULL;
gf_term_on_disconnect(read->service, NULL, GF_OK);
return GF_OK;
}
/*override default*/
if (expect_type==GF_MEDIA_OBJECT_UNDEF) expect_type=GF_MEDIA_OBJECT_AUDIO;
-
+
/*audio object*/
if (expect_type==GF_MEDIA_OBJECT_AUDIO) {
GF_ObjectDescriptor *od = (GF_ObjectDescriptor *) gf_odf_desc_new(GF_ODF_OD_TAG);
e = GF_STREAM_NOT_FOUND;
if (strstr(url, "ES_ID")) {
- sscanf(url, "ES_ID=%d", &ES_ID);
+ sscanf(url, "ES_ID=%ud", &ES_ID);
}
/*URL setup*/
else if (!read->ch && MP3_CanHandleURL(plug, url)) ES_ID = 1;
read->current_time = 0;
if (read->stream) gf_f64_seek(read->stream, 0, SEEK_SET);
- if (read->ch == com->base.on_channel) {
- read->done = 0;
+ if (read->ch == com->base.on_channel) {
+ read->done = 0;
/*PLAY after complete download, estimate duration*/
if (!read->is_remote && !read->duration) {
MP3_ConfigureFromFile(read);
u32 hdr, start_from;
MP3Reader *read = plug->priv;
- if (read->ch != channel)
+ if (read->ch != channel)
return GF_STREAM_NOT_FOUND;
*out_reception_status = GF_OK;
GF_InputService *plug = gf_malloc(sizeof(GF_InputService));
memset(plug, 0, sizeof(GF_InputService));
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC MP3 Reader", "gpac distribution")
-
plug->CanHandleURL = MP3_CanHandleURL;
plug->ConnectService = MP3_ConnectService;
plug->CloseService = MP3_CloseService;
plug->ConnectChannel = MP3_ConnectChannel;
plug->DisconnectChannel = MP3_DisconnectChannel;
plug->ServiceCommand = MP3_ServiceCommand;
+ plug->RegisterMimeTypes = MP3_RegisterMimeTypes;
/*we do support pull mode*/
plug->ChannelGetSLP = MP3_ChannelGetSLP;
plug->ChannelReleaseSLP = MP3_ChannelReleaseSLP;
void MP3_Delete(void *ifce)
{
+ MP3Reader *read;
GF_InputService *plug = (GF_InputService *) ifce;
- MP3Reader *read = plug->priv;
- gf_free(read);
+ if (!plug)
+ return;
+ read = plug->priv;
+ if (read)
+ gf_free(read);
+ plug->priv = NULL;
gf_free(plug);
}
#endif
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_AV_PARSERS
#endif
0
};
- return si;
+ return si;
}
GF_EXPORT
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
{
#ifndef GPAC_DISABLE_AV_PARSERS
if (InterfaceType == GF_NET_CLIENT_INTERFACE) return (GF_BaseInterface *)MP3_Load();
--- /dev/null
+include ../../config.mak\r
+\r
+vpath %.c $(SRC_PATH)/modules/mpd_in\r
+\r
+CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include" -Wall\r
+\r
+\r
+ifeq ($(DEBUGBUILD), yes)\r
+CFLAGS+=-g -DDEBUG\r
+LDFLAGS+=-g\r
+endif\r
+\r
+ifeq ($(GPROFBUILD), yes)\r
+CFLAGS+=-pg\r
+LDFLAGS+=-pg\r
+endif\r
+\r
+#common obj\r
+OBJS=mpd_in.o\r
+\r
+SRCS := $(OBJS:.o=.c) \r
+\r
+LIB=gm_mpd_in.$(DYN_LIB_SUFFIX)\r
+\r
+all: $(LIB)\r
+\r
+\r
+$(LIB): $(OBJS)\r
+ $(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac\r
+ifeq ($(STATICBUILD),yes)\r
+ $(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/gm_mpegts_in-static.so $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac_static\r
+endif\r
+\r
+\r
+%.o: %.c\r
+ $(CC) $(CFLAGS) -c -o $@ $< \r
+\r
+\r
+clean: \r
+ rm -f $(OBJS) ../../bin/gcc/$(LIB)\r
+\r
+dep: depend\r
+\r
+depend:\r
+ rm -f .depend \r
+ $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend\r
+\r
+distclean: clean\r
+ rm -f Makefile.bak .depend\r
+\r
+\r
+\r
+# include dependency files if they exist\r
+#\r
+ifneq ($(wildcard .depend),)\r
+include .depend\r
+endif\r
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Authors: Cyril Concolato
+ * Copyright (c) Telecom ParisTech 2010-
+ * All rights reserved
+ *
+ * This file is part of GPAC / 3GPP/MPEG Media Presentation Description input module
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <gpac/modules/service.h>
+#include <gpac/internal/terminal_dev.h>
+#include <gpac/thread.h>
+#include <gpac/network.h>
+#include <gpac/crypt.h>
+#include <gpac/internal/mpd.h>
+#include <gpac/internal/m3u8.h>
+#include <string.h>
+
+
+/*!
+ * All the possible Mime-types for MPD files
+ */
+static const char * MPD_MIME_TYPES[] = { "video/vnd.3gpp.mpd", "audio/vnd.3gpp.mpd", NULL };
+
+/*!
+ * All the possible Mime-types for M3U8 files
+ */
+static const char * M3U8_MIME_TYPES[] = { "video/x-mpegurl", "audio/x-mpegurl", "application/x-mpegurl", "application/vnd.apple.mpegurl", NULL};
+
+typedef struct
+{
+ char *cache;
+ char *url;
+} segment_cache_entry;
+
+typedef struct __mpd_module {
+ /* GPAC Service object (i.e. how this module is seen by the terminal)*/
+ GF_ClientService *service;
+ /* URL to which this service is connected
+ Used to detect when audio service connection request is made on the same URL as video */
+ char *url;
+ Bool is_service_connected;
+ /* number of time the service has been connected */
+ u32 nb_service_connections;
+ u32 nb_connected_channels;
+ u32 nb_playing_or_paused_channels;
+
+ /* Download of the MPD */
+ volatile Bool is_mpd_in_download;
+
+ GF_DownloadSession *mpd_dnload;
+ char * urlToDeleteNext;
+ volatile u32 max_cached, nb_cached;
+ u32 option_max_cached;
+ segment_cache_entry *cached;
+
+ /* MPD and active informations */
+ GF_MPD *mpd;
+ u32 active_period_index;
+ u32 active_rep_index;
+ u32 download_segment_index;
+
+ /* playback status */
+ Double playback_speed;
+ Double playback_start_range, playback_end_range;
+
+ /* For Segment downloads */
+ GF_DownloadSession *seg_dnload;
+ const char *seg_local_url;
+ GF_Thread *dl_thread;
+ GF_Mutex *dl_mutex;
+
+ /* 0 not started, 1 download in progress */
+ Bool is_dl_segments;
+ Bool dl_stop_request;
+
+ /* Service really managing the segments */
+ GF_InputService *seg_ifce;
+
+ u32 reload_count;
+ volatile u32 last_update_time;
+
+ u32 nb_segs_done;
+ Bool auto_switch;
+ u8 lastMPDSignature[20];
+ Bool segment_must_be_streamed;
+ char * mimeTypeForM3U8Segments;
+} GF_MPD_In;
+
+static void dumpStatus( GF_MPD_In *mpdin) {
+ u32 i;
+ for (i = 0 ; i < mpdin->nb_cached; i++) {
+ printf("\t[%u] - %s\t:\t%s\n", i, mpdin->cached[i].cache, mpdin->cached[i].url);
+ }
+ printf("\t***********\n\n");
+}
+
+
+static Bool MPD_CheckRootType(const char *local_url)
+{
+ if (local_url) {
+ char *rtype = gf_xml_get_root_type(local_url, NULL);
+ if (rtype) {
+ Bool handled = 0;
+ if (!strcmp(rtype, "MPD")) {
+ handled = 1;
+ }
+ gf_free(rtype);
+ return handled;
+ }
+ }
+ return 0;
+}
+
+/**
+ * NET IO for MPD, we don't need this anymore since mime-type can be given by session
+ */
+void MPD_NetIO_Segment(void *cbk, GF_NETIO_Parameter *param)
+{
+ GF_Err e;
+ GF_MPD_In *mpdin = (GF_MPD_In*) cbk;
+
+ /*handle service message*/
+ gf_term_download_update_stats(mpdin->seg_dnload);
+ e = param->error;
+ if (param->msg_type == GF_NETIO_PARSE_REPLY) {
+ if (! gf_dm_sess_can_be_cached_on_disk(mpdin->seg_dnload)) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE,
+ ("[MPD_IN] Segment %s cannot be cached on disk, will use direct streaming\n", gf_dm_sess_get_resource_name(mpdin->seg_dnload)));
+ mpdin->segment_must_be_streamed = 1;
+ gf_dm_sess_abort(mpdin->seg_dnload);
+ } else {
+ mpdin->segment_must_be_streamed = 0;
+ }
+ }
+}
+
+/*!
+ * Returns true if given mime type is a MPD file
+ * \param mime the mime-type to check
+ * \return true if mime-type if MPD-OK
+ */
+static Bool MPD_is_MPD_mime(const char * mime) {
+ u32 i;
+ if (!mime)
+ return 0;
+ for (i = 0 ; MPD_MIME_TYPES[i] ; i++){
+ if ( !stricmp(mime, MPD_MIME_TYPES[i]))
+ return 1;
+ }
+ return 0;
+}
+
+/*!
+ * Returns true if mime type is an M3U8 mime-type
+ * \param mime The mime-type to check
+ * \return true if mime-type is OK for M3U8
+ */
+static Bool MPD_isM3U8_mime(const char * mime) {
+ u32 i;
+ if (!mime)
+ return 0;
+ for (i = 0 ; M3U8_MIME_TYPES[i] ; i++) {
+ if ( !stricmp(mime, M3U8_MIME_TYPES[i]))
+ return 1;
+ }
+ return 0;
+}
+
+static Bool MPD_segments_are_equals(GF_MPD_SegmentInfo * info1, GF_MPD_SegmentInfo * info2) {
+ assert( info1 );
+ assert( info2 );
+ return info1->byterange_end == info2->byterange_end &&
+ info1->byterange_start == info2->byterange_start &&
+ info1->use_byterange == info2->use_byterange &&
+ (info1->url == info2->url || !strcmp(info1->url, info2->url));
+}
+
+void MPD_NetIO(void *cbk, GF_NETIO_Parameter *param)
+{
+ GF_Err e;
+ GF_MPD_In *mpdin = (GF_MPD_In*) cbk;
+
+ /*handle service message*/
+ gf_term_download_update_stats(mpdin->mpd_dnload);
+ e = param->error;
+}
+
+GF_Err MPD_downloadWithRetry( GF_ClientService * service, GF_DownloadSession ** sess, const char *url, gf_dm_user_io user_io, void *usr_cbk);
+static GF_Err MPD_UpdatePlaylist(GF_MPD_In *mpdin)
+{
+ GF_Err e;
+ u32 i, j, rep_idx;
+ Bool seg_found = 0;
+ GF_DOMParser *mpd_parser;
+ GF_MPD_Period *period, *new_period;
+ GF_MPD_Representation *rep, *new_rep;
+ GF_List *segs;
+ const char *local_url;
+ char mime[128];
+ char * purl;
+ Bool is_m3u8 = 0;
+ u32 oldUpdateTime = mpdin->mpd->min_update_time;
+ /*reset update time - if any error occurs, we will no longer attempt to update the MPD*/
+ mpdin->mpd->min_update_time = 0;
+
+ if (!mpdin->mpd_dnload) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: missing downloader\n"));
+ return GF_BAD_PARAM;
+ }
+
+ local_url = gf_dm_sess_get_cache_name(mpdin->mpd_dnload);
+ if (!local_url) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: wrong cache file %s\n", local_url));
+ return GF_IO_ERR;
+ }
+ gf_delete_file(local_url);
+ purl = gf_strdup(gf_dm_sess_get_resource_name(mpdin->mpd_dnload));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Updating Playlist %s...\n", purl));
+ e = MPD_downloadWithRetry(mpdin->service, &(mpdin->mpd_dnload), purl, MPD_NetIO, mpdin);
+ if (e!=GF_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: download problem %s for MPD file\n", gf_error_to_string(e)));
+ gf_free(purl);
+ return gf_dm_sess_last_error(mpdin->mpd_dnload);
+ } else {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Playlist %s updated with success\n", purl));
+ }
+ strncpy(mime, gf_dm_sess_mime_type(mpdin->mpd_dnload), sizeof(mime));
+ strlwr(mime);
+
+ /*in case the session has been restarted, local_url may have been destroyed - get it back*/
+ local_url = gf_dm_sess_get_cache_name(mpdin->mpd_dnload);
+
+ /* Some servers, for instance http://tv.freebox.fr, serve m3u8 as text/plain */
+ if (MPD_isM3U8_mime(mime) || strstr(purl, ".m3u8")) {
+ gf_m3u8_to_mpd(mpdin->service, local_url, purl, NULL, mpdin->reload_count, mpdin->mimeTypeForM3U8Segments);
+ } else if (!MPD_is_MPD_mime(mime)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] mime '%s' should be m3u8 or mpd\n", mime));
+ gf_term_on_connect(mpdin->service, NULL, GF_BAD_PARAM);
+ gf_free(purl);
+ purl = NULL;
+ return GF_BAD_PARAM;
+ }
+
+ gf_free(purl);
+ purl = NULL;
+
+ if (!MPD_CheckRootType(local_url)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: MPD file type is not correct %s\n", local_url));
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
+ {
+ u8 signature[sizeof(mpdin->lastMPDSignature)];
+ if (gf_sha1_file( local_url, signature)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] : cannot SHA1 file %s\n", local_url));
+ } else {
+ if (! memcmp( signature, mpdin->lastMPDSignature, sizeof(mpdin->lastMPDSignature))) {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] MPD file did not change\n"));
+ mpdin->reload_count++;
+ mpdin->mpd->min_update_time = oldUpdateTime;
+ } else {
+ GF_MPD *new_mpd;
+ GF_MPD_SegmentInfo *info1;
+ mpdin->reload_count = 0;
+ memccpy(mpdin->lastMPDSignature, signature, sizeof(char), sizeof(mpdin->lastMPDSignature));
+
+ /* It means we have to reparse the file ... */
+ /* parse the MPD */
+ mpd_parser = gf_xml_dom_new();
+ e = gf_xml_dom_parse(mpd_parser, local_url, NULL, NULL);
+ if (e != GF_OK) {
+ gf_xml_dom_del(mpd_parser);
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: error in XML parsing %s\n", gf_error_to_string(e)));
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
+ new_mpd = gf_mpd_new();
+ e = gf_mpd_init_from_dom(gf_xml_dom_get_root(mpd_parser), new_mpd);
+ gf_xml_dom_del(mpd_parser);
+ if (e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: error in MPD creation %s\n", gf_error_to_string(e)));
+ gf_mpd_del(new_mpd);
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
+
+ /*TODO - check periods are the same*/
+ period = gf_list_get(mpdin->mpd->periods, mpdin->active_period_index);
+ new_period = gf_list_get(new_mpd->periods, mpdin->active_period_index);
+ if (!new_period) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: missing period\n"));
+ gf_mpd_del(new_mpd);
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
+
+ if (gf_list_count(period->representations) != gf_list_count(new_period->representations)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: missing representation\n"));
+ gf_mpd_del(new_mpd);
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
+
+ rep = gf_list_get(period->representations, mpdin->active_rep_index);
+ info1 = gf_list_get(rep->segments, mpdin->download_segment_index - 1);
+
+ for (rep_idx = 0; rep_idx<gf_list_count(period->representations); rep_idx++) {
+ rep = gf_list_get(period->representations, rep_idx);
+ new_rep = gf_list_get(new_period->representations, rep_idx);
+ if (!new_rep) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot update playlist: missing representation in period\n"));
+ gf_mpd_del(new_mpd);
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
+ /*merge init segment*/
+ if (new_rep->init_url) {
+ seg_found = 0;
+
+ if (!strcmp(new_rep->init_url, rep->init_url)) {
+ seg_found = 1;
+ } else {
+ for (j=0; j<gf_list_count(rep->segments); j++) {
+ GF_MPD_SegmentInfo *seg = gf_list_get(rep->segments, j);
+ if (!strcmp(new_rep->init_url, seg->url)) {
+ seg_found = 1;
+ break;
+ }
+ }
+ }
+ /*remove from new list and push to old one*/
+ if (!seg_found) {
+ GF_MPD_SegmentInfo *new_seg;
+ GF_SAFEALLOC(new_seg, GF_MPD_SegmentInfo);
+ new_seg->url = gf_strdup(new_rep->init_url);
+ new_seg->use_byterange = new_rep->init_use_range;
+ new_seg->byterange_start = new_rep->init_byterange_start;
+ new_seg->byterange_end = new_rep->init_byterange_end;
+ gf_list_add(rep->segments, new_seg);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Representation #%d: Adding new segment from initialization segment %s\n", rep_idx+1, new_seg->url));
+ }
+ }
+
+ /*merge segment list*/
+ for (i=0; i<gf_list_count(new_rep->segments); i++) {
+ GF_MPD_SegmentInfo *new_seg = gf_list_get(new_rep->segments, i);
+ assert( new_seg );
+ assert( new_seg->url);
+ seg_found = 0;
+ for (j=0; j<gf_list_count(rep->segments); j++) {
+ GF_MPD_SegmentInfo *seg = gf_list_get(rep->segments, j);
+ assert( seg );
+ assert( seg->url);
+ if (!strcmp(new_seg->url, seg->url)) {
+ seg_found = 1;
+ break;
+ }
+ }
+ /*remove from new list and push to old one*/
+ if (!seg_found) {
+ gf_list_rem(new_rep->segments, i);
+ gf_list_add(rep->segments, new_seg);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Representation #%d: Adding new segment %s\n", rep_idx+1, new_seg->url));
+ i--;
+ }
+ }
+ /*swap lists*/
+ {
+ GF_MPD_SegmentInfo *info2;
+ segs = new_rep->segments;
+ new_rep->segments = rep->segments;
+ rep->segments = segs;
+ info2 = gf_list_get(rep->segments, mpdin->download_segment_index);
+ }
+ }
+
+ /*swap representations - we don't need to update download_segment_index as it still points to the right entry in the merged list*/
+ if (mpdin->mpd)
+ gf_mpd_del(mpdin->mpd);
+ mpdin->mpd = new_mpd;
+ mpdin->last_update_time = gf_sys_clock();
+ }
+ }
+ }
+
+ return GF_OK;
+}
+
+static GF_Err MPD_ClientQuery(GF_InputService *ifce, GF_NetworkCommand *param)
+{
+ if (!param || !ifce || !ifce->proxy_udta) return GF_BAD_PARAM;
+ if (param->command_type==GF_NET_SERVICE_QUERY_NEXT) {
+ u32 timer = gf_sys_clock();
+ GF_MPD_In *mpdin = (GF_MPD_In *) ifce->proxy_udta;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Service Query Next request from terminal\n"));
+ gf_mx_p(mpdin->dl_mutex);
+ /* Wait until no file is scheduled to be downloaded */
+ while (mpdin->is_dl_segments && mpdin->nb_cached<2) {
+ gf_mx_v(mpdin->dl_mutex);
+ gf_sleep(16);
+ gf_mx_p(mpdin->dl_mutex);
+ }
+ if (mpdin->nb_cached<2) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] No more file in cache, EOS\n"));
+ gf_mx_v(mpdin->dl_mutex);
+ return GF_EOS;
+ } else {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Had to wait for %u ms for the only cache file to be downloaded\n", (gf_sys_clock() - timer)));
+ }
+ if (mpdin->cached[0].cache) {
+ if (mpdin->urlToDeleteNext) {
+ gf_dm_delete_cached_file_entry_session(mpdin->mpd_dnload, mpdin->urlToDeleteNext);
+ gf_free( mpdin->urlToDeleteNext);
+ mpdin->urlToDeleteNext = NULL;
+ }
+ assert( mpdin->cached[0].url );
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] deleting cache file %s : %s\n", mpdin->cached[0].url, mpdin->cached[0].cache));
+ mpdin->urlToDeleteNext = gf_strdup( mpdin->cached[0].url );
+ gf_free(mpdin->cached[0].cache);
+ gf_free(mpdin->cached[0].url);
+ mpdin->cached[0].url = NULL;
+ mpdin->cached[0].cache = NULL;
+ }
+ memmove(&mpdin->cached[0], &mpdin->cached[1], sizeof(segment_cache_entry)*(mpdin->nb_cached-1));
+ memset(&(mpdin->cached[mpdin->nb_cached-1]), 0, sizeof(segment_cache_entry));
+ mpdin->nb_cached--;
+ param->url_query.next_url = mpdin->cached[0].cache;
+ gf_mx_v(mpdin->dl_mutex);
+ {
+ u32 timer2 = gf_sys_clock() - timer ;
+ if (timer2 > 1000) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MODULE, ("[MPD_IN] We were stuck waiting for download to end during too much time : %u ms !\n", timer2));
+ }
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] Switching segment playback to \n\tURL: %s in %u ms\n\tCache: %s\n\tElements in cache: %u/%u\n", mpdin->cached[0].url, timer2, mpdin->cached[0].cache, mpdin->nb_cached, mpdin->max_cached));
+ }
+ } else {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Client Query request (%d) from terminal\n", param->command_type));
+ }
+ return GF_OK;
+}
+
+static GF_Err MPD_LoadMediaService(GF_MPD_In *mpdin, const char *mime)
+{
+ const char *sPlug;
+ /* Check MIME type to start the right InputService (ISOM or MPEG-2) */
+ sPlug = gf_cfg_get_key(mpdin->service->term->user->config, "MimeTypes", mime);
+ if (sPlug) sPlug = strrchr(sPlug, '"');
+ if (sPlug) {
+ sPlug += 2;
+ mpdin->seg_ifce = (GF_InputService *) gf_modules_load_interface_by_name(mpdin->service->term->user->modules, sPlug, GF_NET_CLIENT_INTERFACE);
+ if (mpdin->seg_ifce) {
+ mpdin->seg_ifce->proxy_udta = mpdin;
+ mpdin->seg_ifce->query_proxy = MPD_ClientQuery;
+ } else {
+ goto exit;
+ }
+ } else {
+ goto exit;
+ }
+ return GF_OK;
+exit:
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error locating plugin for segment mime type: %s\n", mime));
+ return GF_CODEC_NOT_FOUND;
+}
+
+/*!
+ * Download a file with possible retry if GF_IP_CONNECTION_FAILURE|GF_IP_NETWORK_FAILURE
+ * (I discovered that with my WIFI connection, I had many issues with BFM-TV downloads)
+ * Similar to gf_term_download_new() and gf_dm_sess_process().
+ * Parameters are identical to the ones of gf_term_download_new.
+ * \see gf_term_download_new()
+ */
+GF_Err MPD_downloadWithRetry( GF_ClientService * service, GF_DownloadSession ** sess, const char *url, gf_dm_user_io user_io, void *usr_cbk)
+{
+ GF_Err e;
+ if (*sess) {
+ gf_term_download_del(*sess);
+ *sess = NULL;
+ }
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Downloading %s...\n", url));
+ *sess = gf_term_download_new(service, url, GF_NETIO_SESSION_NOT_THREADED, user_io, usr_cbk);
+ if (!(*sess)){
+ assert(0);
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Cannot try to download %s... OUT of memory ?\n", url));
+ return GF_OUT_OF_MEM;
+ }
+ e = gf_dm_sess_process(*sess);
+ switch (e) {
+ case GF_IP_CONNECTION_FAILURE:
+ case GF_IP_NETWORK_FAILURE:
+ {
+ gf_term_download_del(*sess);
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MODULE,
+ ("[MPD_IN] failed to download, retrying once with %s...\n", url));
+ *sess = gf_term_download_new(service, url, GF_NETIO_SESSION_NOT_THREADED, user_io, usr_cbk);
+ if (!(*sess)){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Cannot retry to download %s... OUT of memory ?\n", url));
+ return GF_OUT_OF_MEM;
+ }
+ e = gf_dm_sess_process(*sess);
+ if (e != GF_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE,
+ ("[MPD_IN] two consecutive failures, aborting the download %s.\n", url));
+ }
+ return e;
+ }
+ case GF_OK:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] OK, Download %s complete\n", url));
+ return e;
+ default:
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] FAILED to download %s = %s...\n", url, gf_error_to_string(e)));
+ return e;
+ }
+}
+
+
+static GF_Err MPD_DownloadInitSegment(GF_MPD_In *mpdin, GF_MPD_Period *period)
+{
+ GF_Err e;
+ char *base_init_url;
+ char * url_to_dl;
+ GF_MPD_Representation *rep;
+ /* This variable is 0 if there is a initURL, the index of first segment downloaded otherwise */
+ u32 firstSegment = 0;
+ if (!mpdin || !period)
+ return GF_BAD_PARAM;
+ gf_mx_p(mpdin->dl_mutex);
+ assert( period->representations );
+ rep = gf_list_get(period->representations, mpdin->active_rep_index);
+ if (!rep) {
+ gf_mx_v(mpdin->dl_mutex);
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Unable to find any representation, aborting.\n"));
+ return GF_IO_ERR;
+ }
+ if (!rep->init_url) {
+ GF_MPD_SegmentInfo * seg = gf_list_get(rep->segments, 0);
+ /* No init URL provided, we have to download the first segment then */
+ if (!seg->url) {
+ mpdin->dl_stop_request = 1;
+ gf_mx_v(mpdin->dl_mutex);
+ return GF_BAD_PARAM;
+ }
+ firstSegment = 1;
+ url_to_dl = seg->url;
+ } else {
+ url_to_dl = rep->init_url;
+ }
+ if (rep->default_base_url) {
+ base_init_url = gf_url_concatenate(rep->default_base_url, url_to_dl);
+ } else {
+ base_init_url = gf_strdup(url_to_dl);
+ }
+ e = MPD_downloadWithRetry(mpdin->service, &(mpdin->seg_dnload), base_init_url, MPD_NetIO_Segment, mpdin);
+ if (e == GF_URL_ERROR && !base_init_url) { /* We have a 404 and started with segments */
+ /* It is possible that the first segment has been deleted while we made the first request...
+ * so we try with the next segment on some M3U8 servers */
+ GF_MPD_SegmentInfo * seg = gf_list_get(rep->segments, 1);
+ gf_free(base_init_url);
+ if (!seg || !seg->url) {
+ gf_mx_v(mpdin->dl_mutex);
+ return e;
+ }
+ if (rep->default_base_url) {
+ base_init_url = gf_url_concatenate(rep->default_base_url, seg->url);
+ } else {
+ base_init_url = gf_strdup(seg->url);
+ }
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MODULE, ("Download of first segment failed... retrying with second one : %s\n", base_init_url));
+ firstSegment = 2;
+ e = MPD_downloadWithRetry(mpdin->service, &(mpdin->seg_dnload), base_init_url, MPD_NetIO_Segment, mpdin);
+ } /* end of 404 */
+
+ if (e!= GF_OK && !mpdin->segment_must_be_streamed) {
+ mpdin->dl_stop_request = 1;
+ gf_mx_v(mpdin->dl_mutex);
+ gf_free(base_init_url);
+ return e;
+ } else {
+ char mime[128];
+ GF_MPD_Representation *rep = gf_list_get(period->representations, mpdin->active_rep_index);
+ u32 count = gf_list_count(rep->segments) + 1;
+ if (count < mpdin->max_cached) {
+ if (count < 1) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] 0 representations, aborting\n"));
+ gf_free(base_init_url);
+ return GF_BAD_PARAM;
+ }
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] Resizing to %u max_cached elements instead of %u.\n", count, mpdin->max_cached));
+ /* OK, we have a problem, it may ends download */
+ mpdin->max_cached = count;
+ }
+ e = gf_dm_sess_process(mpdin->seg_dnload);
+ /* Mime-Type check */
+ strncpy(mime, gf_dm_sess_mime_type(mpdin->seg_dnload), sizeof(mime));
+ strlwr(mime);
+ if (mime && mpdin->seg_ifce == NULL) {
+ GF_Err e;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Searching a decoder for mime type : %s...\n", mime));
+ gf_free( mpdin->mimeTypeForM3U8Segments);
+ mpdin->mimeTypeForM3U8Segments = gf_strdup( mime );
+ gf_free( rep->mime);
+ rep->mime = gf_strdup( mime );
+ e = MPD_LoadMediaService(mpdin, mime);
+ if (e != GF_OK)
+ return e;
+ }
+ if (!mime || (stricmp(mime, rep->mime))) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Mime '%s' is not correct for '%s', it should be '%s'\n", mime, base_init_url, rep->mime));
+ mpdin->dl_stop_request = 0;
+ gf_mx_v(mpdin->dl_mutex);
+ gf_free(base_init_url);
+ base_init_url = NULL;
+ return GF_BAD_PARAM;
+ }
+ if (mpdin->segment_must_be_streamed ) {
+ mpdin->seg_local_url = gf_dm_sess_get_resource_name(mpdin->seg_dnload);
+ e = GF_OK;
+ } else {
+ mpdin->seg_local_url = rep->init_use_range ? gf_cache_get_cache_filename_range(mpdin->seg_dnload, rep->init_byterange_start, rep->init_byterange_end ) : gf_dm_sess_get_cache_name(mpdin->seg_dnload);
+ }
+
+ if ((e!=GF_OK) || !mpdin->seg_local_url) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error with initialization segment: download result:%s, cache file:%s\n", gf_error_to_string(e), mpdin->seg_local_url));
+ mpdin->dl_stop_request = 1;
+ gf_mx_v(mpdin->dl_mutex);
+ gf_free(base_init_url);
+ return GF_BAD_PARAM;
+ } else {
+#ifndef DONT_USE_TERMINAL_MODULE_API
+ GF_NetworkCommand com;
+#endif
+ assert(!mpdin->nb_cached);
+ mpdin->cached[0].cache = gf_strdup(mpdin->seg_local_url);
+ mpdin->cached[0].url = gf_strdup(gf_dm_sess_get_resource_name(mpdin->seg_dnload));
+ mpdin->nb_cached = 1;
+ mpdin->download_segment_index = firstSegment;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Adding initialization segment %s to cache: %s\n", mpdin->seg_local_url, mpdin->cached[0].url ));
+ gf_mx_v(mpdin->dl_mutex);
+ gf_free(base_init_url);
+#ifndef DONT_USE_TERMINAL_MODULE_API
+ com.base.command_type = GF_NET_SERVICE_INFO;
+ gf_term_on_command(mpdin->service, &com, GF_OK);
+#endif
+ return GF_OK;
+ }
+ }
+}
+
+
+
+static u32 download_segments(void *par)
+{
+ GF_Err e;
+ GF_MPD_In *mpdin = (GF_MPD_In*) par;
+ GF_MPD_Period *period;
+ GF_MPD_Representation *rep;
+ GF_MPD_SegmentInfo *seg;
+ char *new_base_seg_url;
+ assert(mpdin);
+ if (!mpdin->mpd){
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MODULE, ("[MPD_IN] Incorrect state, no mpdin->mpd for URL=%s, already stopped ?\n", mpdin->seg_local_url));
+ return 1;
+ }
+ /* Setting the download status in exclusive code */
+ gf_mx_p(mpdin->dl_mutex);
+ mpdin->is_dl_segments = 1;
+ gf_mx_v(mpdin->dl_mutex);
+
+ period = gf_list_get(mpdin->mpd->periods, mpdin->active_period_index);
+ e = MPD_DownloadInitSegment(mpdin, period);
+ mpdin->dl_stop_request=0;
+ if (e != GF_OK) {
+ gf_term_on_connect(mpdin->service, NULL, e);
+ return 1;
+ }
+ if (!mpdin->is_service_connected) mpdin->is_service_connected = 1;
+
+ mpdin->last_update_time = gf_sys_clock();
+ /* Forward the ConnectService message to the appropriate service for this type of segment */
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] Connecting initial service... %s\n", mpdin->seg_local_url));
+ mpdin->seg_ifce->ConnectService(mpdin->seg_ifce, mpdin->service, mpdin->seg_local_url);
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] Connecting initial service DONE\n", mpdin->seg_local_url));
+ while (1) {
+ /*wait until next segment is needed*/
+ gf_mx_p(mpdin->dl_mutex);
+ while (!mpdin->dl_stop_request && (mpdin->nb_cached==mpdin->max_cached)) {
+ u32 timer = gf_sys_clock() - mpdin->last_update_time;
+ Bool shouldParsePlaylist = mpdin->mpd->min_update_time && (timer > mpdin->mpd->min_update_time);
+ gf_mx_v(mpdin->dl_mutex);
+ if (shouldParsePlaylist) {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Next segment in cache, but it is time to update the playlist (%u ms/%u)\n", timer, mpdin->mpd->min_update_time));
+ e = MPD_UpdatePlaylist(mpdin);
+ if (e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error updating MDP %s\n", gf_error_to_string(e)));
+ }
+ } else {
+ gf_sleep(16);
+ }
+ gf_mx_p(mpdin->dl_mutex);
+ }
+
+ /* stop the thread if requested */
+ if (mpdin->dl_stop_request) {
+ mpdin->is_dl_segments = 0;
+ gf_mx_v(mpdin->dl_mutex);
+ break;
+ }
+ gf_mx_v(mpdin->dl_mutex);
+
+ /* Continue the processing (no stop request) */
+ period = gf_list_get(mpdin->mpd->periods, mpdin->active_period_index);
+ rep = gf_list_get(period->representations, mpdin->active_rep_index);
+
+ /* if the index of the segment to be downloaded is greater or equal to the last segment (as seen in the playlist),
+ we need to check if a new playlist is ready */
+ if (mpdin->download_segment_index>=gf_list_count(rep->segments)) {
+ u32 timer = gf_sys_clock() - mpdin->last_update_time;
+ /* update of the playlist, only if indicated */
+ if (mpdin->mpd->min_update_time && timer > mpdin->mpd->min_update_time) {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Last segment in current playlist downloaded, checking updates after %u ms\n", timer));
+ e = MPD_UpdatePlaylist(mpdin);
+ if (e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error updating MDP %s\n", gf_error_to_string(e)));
+ }
+ period = gf_list_get(mpdin->mpd->periods, mpdin->active_period_index);
+ rep = gf_list_get(period->representations, mpdin->active_rep_index);
+ } else {
+ gf_sleep(16);
+ }
+ /* Now that the playlist is up to date, we can check again */
+ if (mpdin->download_segment_index>=gf_list_count(rep->segments)) {
+ if (mpdin->mpd->min_update_time) {
+ /* if there is a specified update period, we redo the whole process */
+ continue;
+ } else {
+ /* if not, we are really at the end of the playlist, we can quit */
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] End of playlist reached... downloading remaining elements..."));
+ break;
+ }
+ }
+ }
+ gf_mx_p(mpdin->dl_mutex);
+ /* At this stage, there are some segments left to be downloaded */
+ seg = gf_list_get(rep->segments, mpdin->download_segment_index);
+ gf_mx_v(mpdin->dl_mutex);
+
+ if (rep->default_base_url) {
+ new_base_seg_url = gf_url_concatenate(rep->default_base_url, seg->url);
+ } else {
+ new_base_seg_url = gf_strdup(seg->url);
+ }
+ if (seg->use_byterange) {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Downloading new segment: %s (range: %d-%d)\n", new_base_seg_url, seg->byterange_start, seg->byterange_end));
+ }
+ e = MPD_downloadWithRetry(mpdin->service, &(mpdin->seg_dnload), new_base_seg_url, MPD_NetIO_Segment, mpdin);
+ if (e == GF_OK || mpdin->segment_must_be_streamed) {
+ gf_mx_p(mpdin->dl_mutex);
+ mpdin->cached[mpdin->nb_cached].cache = gf_strdup(mpdin->segment_must_be_streamed?
+ gf_dm_sess_get_resource_name(mpdin->seg_dnload) :
+ (rep->init_use_range ? gf_cache_get_cache_filename_range(mpdin->seg_dnload, rep->init_byterange_start, rep->init_byterange_end ) : gf_dm_sess_get_cache_name(mpdin->seg_dnload)));
+ mpdin->cached[mpdin->nb_cached].url = gf_strdup( gf_dm_sess_get_resource_name(mpdin->seg_dnload));
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[MPD_IN] Added file to cache\n\tURL: %s\n\tCache: %s\n\tElements in cache: %u/%u\n", mpdin->cached[mpdin->nb_cached].url, mpdin->cached[mpdin->nb_cached].cache, mpdin->nb_cached+1, mpdin->max_cached));
+ mpdin->nb_cached++;
+ gf_mx_v(mpdin->dl_mutex);
+ mpdin->download_segment_index++;
+ if (mpdin->auto_switch) {
+ mpdin->nb_segs_done++;
+ if (mpdin->nb_segs_done==1) {
+ mpdin->nb_segs_done=0;
+ mpdin->active_rep_index++;
+ if (mpdin->active_rep_index>=gf_list_count(period->representations)) mpdin->active_rep_index=0;
+ }
+ }
+ }
+ if (e != GF_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error in downloading new segment: %s %s\n", new_base_seg_url, gf_error_to_string(e)));
+ gf_free(new_base_seg_url);
+ new_base_seg_url = NULL;
+ break;
+ } else {
+ gf_free(new_base_seg_url);
+ new_base_seg_url = NULL;
+ }
+ }
+
+ /* Signal that the download thread has ended */
+ gf_mx_p(mpdin->dl_mutex);
+ mpdin->is_dl_segments = 0;
+ gf_mx_v(mpdin->dl_mutex);
+ return 0;
+}
+
+const char * MPD_MPD_DESC = "HTTP MPD Streaming";
+
+const char * MPD_MPD_EXT = "3gm mdp";
+
+const char * MPD_M3U8_DESC = "HTTP M3U8 Playlist Streaming";
+
+const char * MPD_M3U8_EXT = "m3u8 m3u";
+
+static u32 MPD_RegisterMimeTypes(const GF_InputService *plug)
+{
+ u32 i, c;
+ for (i = 0 ; MPD_MIME_TYPES[i]; i++)
+ gf_term_register_mime_type (plug, MPD_MIME_TYPES[i], MPD_MPD_EXT, MPD_MPD_DESC);
+ c = i;
+ for (i = 0 ; M3U8_MIME_TYPES[i]; i++)
+ gf_term_register_mime_type(plug, M3U8_MIME_TYPES[i], MPD_M3U8_EXT, MPD_M3U8_DESC);
+ return c+i;
+}
+
+Bool MPD_CanHandleURL(GF_InputService *plug, const char *url)
+{
+ u32 i;
+ char *sExt;
+ if (!plug || !url)
+ return 0;
+ sExt = strrchr(url, '.');
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Can Handle URL request from terminal for %s\n", url));
+ for (i = 0 ; MPD_MIME_TYPES[i]; i++) {
+ if (gf_term_check_extension(plug, MPD_MIME_TYPES[i], MPD_MPD_EXT, MPD_MPD_DESC, sExt))
+ return 1;
+ }
+ for (i = 0 ; M3U8_MIME_TYPES[i]; i++) {
+ if (gf_term_check_extension(plug, M3U8_MIME_TYPES[i], MPD_M3U8_EXT, MPD_M3U8_DESC, sExt))
+ return 1;
+ }
+ return MPD_CheckRootType(url);
+}
+
+GF_Err MPD_ConnectChannel(GF_InputService *plug, LPNETCHANNEL channel, const char *url, Bool upstream)
+{
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ GF_Err e;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Channel Connection (0x%x) request from terminal for %s\n", channel, url));
+ if (!plug || !plug->priv || !mpdin->seg_ifce) return GF_SERVICE_ERROR;
+ e = mpdin->seg_ifce->ConnectChannel(mpdin->seg_ifce, channel, url, upstream);
+ if (e == GF_OK) {
+ mpdin->nb_connected_channels++;
+ }
+ return e;
+}
+
+GF_Err MPD_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel)
+{
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ GF_Err e;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Disconnect channel (0x%x) request from terminal \n", channel));
+ if (!plug || !plug->priv || !mpdin->seg_ifce) return GF_SERVICE_ERROR;
+ e = mpdin->seg_ifce->DisconnectChannel(mpdin->seg_ifce, channel);
+ if (e == GF_OK) {
+ mpdin->nb_connected_channels--;
+ }
+ return e;
+}
+
+static u32 MPD_GetPeriodIndexFromTime(GF_MPD_In *mpdin, u32 time)
+{
+ u32 i, count;
+ GF_MPD_Period *period;
+ count = gf_list_count(mpdin->mpd->periods);
+ for (i = 0; i<count; i++) {
+ period = gf_list_get(mpdin->mpd->periods, i);
+ if (period->start > time) {
+ break;
+ }
+ }
+ return (i-1 >= 0 ? (i-1) : 0);
+}
+
+static void MPD_DownloadStop(GF_MPD_In *mpdin)
+{
+ /* stop the download thread */
+ gf_mx_p(mpdin->dl_mutex);
+ if (mpdin->is_dl_segments == 1) {
+ mpdin->dl_stop_request = 1;
+ gf_mx_v(mpdin->dl_mutex);
+ while (1) {
+ /* waiting for the download thread to stop */
+ gf_sleep(16);
+ gf_mx_p(mpdin->dl_mutex);
+ if (mpdin->is_dl_segments == 0) {
+ /* it's stopped we can continue */
+ gf_mx_v(mpdin->dl_mutex);
+ break;
+ }
+ gf_mx_v(mpdin->dl_mutex);
+ }
+ } else {
+ gf_mx_v(mpdin->dl_mutex);
+ }
+}
+
+static GF_Err MPD_SegmentsProcessStart(GF_MPD_In *mpdin, u32 time)
+{
+ GF_Err e;
+ u32 rep_i;
+ GF_MPD_Period *period;
+ GF_MPD_Representation *rep;
+
+ e = GF_BAD_PARAM;
+
+#if 1
+ MPD_DownloadStop(mpdin);
+#endif
+
+ /* Get the right period from the given time */
+ mpdin->active_period_index = MPD_GetPeriodIndexFromTime(mpdin, time);
+ period = gf_list_get(mpdin->mpd->periods, mpdin->active_period_index);
+ if (!period || !gf_list_count(period->representations) ) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot start: not enough periods or representations in MPD\n"));
+ goto exit;
+ }
+
+ /* Select the appropriate representation in the given period */
+ mpdin->active_rep_index = 0;
+ for (rep_i = 0; rep_i < gf_list_count(period->representations); rep_i++) {
+ GF_MPD_Representation *rep = gf_list_get(period->representations, rep_i);
+ GF_MPD_Representation *rep_sel = gf_list_get(period->representations, mpdin->active_rep_index);
+ if (rep->qualityRanking > rep_sel->qualityRanking) {
+ mpdin->active_rep_index = rep_i;
+ } else if (rep->bandwidth < rep_sel->bandwidth) {
+ mpdin->active_rep_index = rep_i;
+ }
+ }
+
+ /* TODO: Generate segment names if urltemplates are used */
+ rep = gf_list_get(period->representations, mpdin->active_rep_index);
+ if (!gf_list_count(rep->segments) || !rep->mime) {
+ if (!rep->mime) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot start: missing mime\n"));
+ } else {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot start: missing segments\n"));
+ }
+ goto exit;
+ }
+
+ mpdin->seg_ifce = NULL;
+ if (strcmp(M3U8_UNKOWN_MIME_TYPE, rep->mime)) {
+ e = MPD_LoadMediaService(mpdin, rep->mime);
+ if (e != GF_OK)
+ goto exit;
+ } else {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Ignoring mime type %s, wait for first file...\n", rep->mime));
+ }
+ gf_th_run(mpdin->dl_thread, download_segments, mpdin);
+ return GF_OK;
+
+exit:
+ gf_term_on_connect(mpdin->service, NULL, e);
+ return e;
+}
+
+GF_Err MPD_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
+{
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ const char *local_url, *opt;
+ GF_Err e;
+ GF_DOMParser *mpd_parser;
+ Bool is_m3u8 = 0;
+
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Service Connection request (0x%x) from terminal for %s\n", serv, url));
+
+ if (!mpdin|| !serv || !url) return GF_BAD_PARAM;
+
+ /* If the service is reused on a different URL while already connected this is a problem
+ The service should only be reused for audio/video in the same stream
+ WARNING: should check fragment identifiers */
+ if (mpdin->is_service_connected) {
+ if (strcmp(mpdin->url, url)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot connect service with different url when already connected: %s / %s \n", mpdin->url, url));
+ return GF_BAD_PARAM;
+ } else {
+ mpdin->nb_service_connections++;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Reusing Service\n"));
+ return GF_OK;
+ }
+ }
+
+ mpdin->nb_service_connections = 1;
+ mpdin->service = serv;
+ memset( mpdin->lastMPDSignature, 0, sizeof(mpdin->last_update_time));
+ mpdin->reload_count = 0;
+ if (mpdin->url)
+ gf_free(mpdin->url);
+ mpdin->url = gf_strdup(url);
+ mpdin->option_max_cached = 0;
+ mpdin->max_cached = 0;
+ mpdin->urlToDeleteNext = NULL;
+ opt = gf_modules_get_option((GF_BaseInterface *)plug, "DASH", "MaxCachedSegments");
+ if (!opt) gf_modules_set_option((GF_BaseInterface *)plug, "DASH", "MaxCachedSegments", "5");
+ if (opt) mpdin->option_max_cached = atoi(opt);
+ if (mpdin->option_max_cached < 3)
+ mpdin->option_max_cached = 3;
+ mpdin->max_cached = mpdin->option_max_cached;
+ mpdin->cached = gf_malloc(sizeof(segment_cache_entry)*mpdin->max_cached);
+ memset(mpdin->cached, 0, sizeof(segment_cache_entry)*mpdin->max_cached);
+
+ mpdin->auto_switch = 0;
+ opt = gf_modules_get_option((GF_BaseInterface *)plug, "DASH", "AutoSwitch");
+ if (!opt) gf_modules_set_option((GF_BaseInterface *)plug, "DASH", "AutoSwitch", "no");
+ if (opt && !strcmp(opt, "yes")) mpdin->auto_switch = 1;
+
+ if (mpdin->mpd_dnload) gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+
+ if (!strnicmp(url, "file://", 7)) {
+ local_url = url + 7;
+ if (strstr(url, ".m3u8")) {
+ is_m3u8 = 1;
+ }
+ } else if (strstr(url, "://")) {
+ e = MPD_downloadWithRetry(mpdin->service, &(mpdin->mpd_dnload), url, MPD_NetIO, mpdin);
+ if (e!=GF_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot connect service: MPD downloading problem %s for %s\n", gf_error_to_string(e), url));
+ gf_term_on_connect(mpdin->service, NULL, GF_IO_ERR);
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ return e;
+ }
+ {
+ const char *url;
+ char mime[128];
+ strncpy(&(mime[0]), gf_dm_sess_mime_type(mpdin->mpd_dnload), sizeof(mime));
+ strlwr(mime);
+ url = gf_dm_sess_get_resource_name(mpdin->mpd_dnload);
+ /* Some servers, for instance http://tv.freebox.fr, serve m3u8 as text/plain */
+ if (MPD_isM3U8_mime(mime) || strstr(url, ".m3u8")) {
+ is_m3u8 = 1;
+ } else if (!MPD_is_MPD_mime(mime)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] mime '%s' for '%s' should be m3u8 or mpd\n", mime, url));
+ gf_term_on_connect(mpdin->service, NULL, GF_BAD_PARAM);
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ return GF_CODEC_NOT_FOUND;
+ }
+ }
+ local_url = gf_dm_sess_get_cache_name(mpdin->mpd_dnload);
+ if (!local_url) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot connect service: cache problem %s\n", local_url));
+ gf_term_on_connect(mpdin->service, NULL, GF_IO_ERR);
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ return GF_OK;
+ }
+ } else {
+ local_url = url;
+ }
+
+ if (is_m3u8) {
+ gf_m3u8_to_mpd(mpdin->service, local_url, url, NULL, mpdin->reload_count, mpdin->mimeTypeForM3U8Segments);
+ }
+
+ if (!MPD_CheckRootType(local_url)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot connect service: wrong file type %s\n", local_url));
+ gf_term_on_connect(mpdin->service, NULL, GF_BAD_PARAM);
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ return GF_OK;
+ }
+
+ /* parse the MPD */
+ mpd_parser = gf_xml_dom_new();
+ e = gf_xml_dom_parse(mpd_parser, local_url, NULL, NULL);
+ if (e != GF_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot connect service: MPD parsing problem %s\n", gf_error_to_string(e)));
+ gf_xml_dom_del(mpd_parser);
+ gf_term_on_connect(mpdin->service, NULL, e);
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ return GF_OK;
+ }
+ if (mpdin->mpd)
+ gf_mpd_del(mpdin->mpd);
+ mpdin->mpd = gf_mpd_new();
+ if (!mpdin->mpd) {
+ e = GF_OUT_OF_MEM;
+ } else {
+ e = gf_mpd_init_from_dom(gf_xml_dom_get_root(mpd_parser), mpdin->mpd);
+ }
+ gf_xml_dom_del(mpd_parser);
+ if (e != GF_OK) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot connect service: MPD creation problem %s\n", gf_error_to_string(e)));
+ gf_term_on_connect(mpdin->service, NULL, e);
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ if (mpdin->mpd)
+ gf_mpd_del(mpdin->mpd);
+ mpdin->mpd = NULL;
+ return e;
+ }
+
+ e = MPD_SegmentsProcessStart(mpdin, 0);
+ return e;
+}
+
+static GF_Descriptor *MPD_GetServiceDesc(GF_InputService *plug, u32 expect_type, const char *sub_url)
+{
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Service Description request from terminal for %s\n", sub_url));
+ if (mpdin->seg_ifce) {
+ return mpdin->seg_ifce->GetServiceDescriptor(mpdin->seg_ifce, expect_type, sub_url);
+ } else {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD_IN] Error - cannot provide service description: no segment service hanlder created\n"));
+ return NULL;
+ }
+}
+
+void MPD_Stop(GF_MPD_In *mpdin)
+{
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Stopping service 0x%x\n", mpdin->service));
+ MPD_DownloadStop(mpdin);
+ if (mpdin->urlToDeleteNext) {
+ gf_dm_delete_cached_file_entry_session(mpdin->mpd_dnload, mpdin->urlToDeleteNext);
+ gf_free( mpdin->urlToDeleteNext);
+ mpdin->urlToDeleteNext = NULL;
+ }
+ if (mpdin->mpd_dnload) {
+ gf_term_download_del(mpdin->mpd_dnload);
+ mpdin->mpd_dnload = NULL;
+ }
+ if (mpdin->seg_dnload) {
+ gf_term_download_del(mpdin->seg_dnload);
+ mpdin->seg_dnload = NULL;
+ }
+ while (mpdin->nb_cached) {
+ mpdin->nb_cached --;
+ gf_delete_file(mpdin->cached[mpdin->nb_cached].cache);
+ gf_free(mpdin->cached[mpdin->nb_cached].cache);
+ gf_free(mpdin->cached[mpdin->nb_cached].url);
+ }
+ if (mpdin->mpd)
+ gf_mpd_del(mpdin->mpd);
+ mpdin->mpd = NULL;
+}
+
+GF_Err MPD_CloseService(GF_InputService *plug)
+{
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Close Service (0x%x) request from terminal (#%d connections)\n", mpdin->service, mpdin->nb_service_connections));
+ mpdin->nb_service_connections--;
+ if (mpdin->nb_service_connections == 0) {
+ if (mpdin->seg_ifce && mpdin->is_service_connected) {
+ mpdin->seg_ifce->CloseService(mpdin->seg_ifce);
+ mpdin->is_service_connected = 0;
+ mpdin->seg_ifce = NULL;
+ }
+ MPD_Stop(mpdin);
+ gf_term_on_disconnect(mpdin->service, NULL, GF_OK);
+ }
+ return GF_OK;
+}
+
+GF_Err MPD_ServiceCommand(GF_InputService *plug, GF_NetworkCommand *com)
+{
+ GF_Err e;
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ if (!plug || !plug->priv || !com || !mpdin->seg_ifce) return GF_SERVICE_ERROR;
+
+ switch (com->command_type) {
+ case GF_NET_SERVICE_INFO:
+ {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Info command from terminal on Service (0x%x)\n", mpdin->service));
+ /* defer to the real input service */
+ e = mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ if (e!= GF_OK || !com->info.name || 2 > strlen(com->info.name)) {
+ char * title = mpdin->mpd->title;
+ if (!title)
+ title = mpdin->cached[0].url;
+ com->info.name = title;
+ if (mpdin->mpd->source)
+ com->info.comment = mpdin->mpd->source;
+ }
+ return GF_OK;
+ }
+ case GF_NET_SERVICE_HAS_AUDIO:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Has Audio command from terminal on Service (0x%x)\n", mpdin->service));
+ /* defer to the real input service */
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_SET_PADDING:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Set Padding command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* for padding settings, the MPD level should not change anything */
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_SET_PULL:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Set Pull command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* defer to the real input service */
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_INTERACTIVE:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Interactive command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* we are interactive (that's the whole point of MPD) */
+ return GF_OK;
+
+ case GF_NET_CHAN_BUFFER:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Buffer query command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_BUFFER_QUERY:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received buffer query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_DURATION:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Duration query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* Ignore the duration given by the input service and use the one given in the MPD
+ Note: the duration of the initial segment will be 0 anyway (in MP4).*/
+ {
+ Double duration;
+ duration = (Double)mpdin->mpd->duration;
+ duration /= 1000;
+ com->duration.duration = duration;
+ return GF_OK;
+ }
+ break;
+ case GF_NET_CHAN_PLAY:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Play command (#%d playing) from terminal on channel 0x%x on Service (0x%x)\n", mpdin->nb_playing_or_paused_channels, com->base.on_channel, mpdin->service));
+ mpdin->playback_speed = com->play.speed;
+ mpdin->playback_start_range = com->play.start_range;
+ mpdin->playback_end_range = com->play.end_range;
+ e = mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ if (e == GF_OK) {
+ mpdin->nb_playing_or_paused_channels++;
+ }
+ return e;
+ break;
+ case GF_NET_CHAN_STOP:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Stop command (#%d playing) from terminal on channel 0x%x on Service (0x%x)\n", mpdin->nb_playing_or_paused_channels, com->base.on_channel, mpdin->service));
+ e = mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ if (e == GF_OK) {
+ mpdin->nb_playing_or_paused_channels--;
+ if (mpdin->nb_playing_or_paused_channels == 0) {
+// MPD_Stop(mpdin);
+ }
+ }
+ return e;
+ break;
+ case GF_NET_CHAN_PAUSE:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Pause command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ e = mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ return e;
+ break;
+ case GF_NET_CHAN_RESUME:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Resume command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ e = mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ return e;
+ break;
+ case GF_NET_CHAN_SET_SPEED:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Set Speed command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* recording the speed, to change the segment download speed */
+ mpdin->playback_speed = com->play.speed;
+ /* not supported in MP4 ?? */
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_CONFIG:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Set Config command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* defer to the real input service */
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_GET_PIXEL_AR:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Pixel Aspect Ratio query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ /* defer to the real input service */
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_GET_DSI:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Decoder Specific Info query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_MAP_TIME:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Map Time query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_RECONFIG:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Reconfig command from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_DRM_CFG:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received DRM query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_CHAN_GET_ESD:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Elementary Stream Descriptor query from terminal on channel 0x%x on Service (0x%x)\n", com->base.on_channel, mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_BUFFER_QUERY:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Global Buffer query from terminal on Service (0x%x)\n", mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_GET_STATS:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Statistics query from terminal on Service (0x%x)\n", mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_IS_CACHABLE:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Cachable query from terminal on Service (0x%x)\n", mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ case GF_NET_SERVICE_MIGRATION_INFO:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Migration info query from terminal on Service (0x%x)\n", mpdin->service));
+ return mpdin->seg_ifce->ServiceCommand(mpdin->seg_ifce, com);
+ break;
+ default:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received unknown command (%d) on Service (0x%x)\n",com->command_type, mpdin->service));
+ return GF_SERVICE_ERROR;
+ }
+}
+
+GF_Err MPD_ChannelGetSLP(GF_InputService *plug, LPNETCHANNEL channel, char **out_data_ptr, u32 *out_data_size, GF_SLHeader *out_sl_hdr, Bool *sl_compressed, GF_Err *out_reception_status, Bool *is_new_data)
+{
+ GF_Err e;
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ if (!plug || !plug->priv || !mpdin->seg_ifce) return GF_SERVICE_ERROR;
+
+ gf_mx_p(mpdin->dl_mutex);
+ e = mpdin->seg_ifce->ChannelGetSLP(mpdin->seg_ifce, channel, out_data_ptr, out_data_size, out_sl_hdr, sl_compressed, out_reception_status, is_new_data);
+ gf_mx_v(mpdin->dl_mutex);
+ return e;
+}
+
+GF_Err MPD_ChannelReleaseSLP(GF_InputService *plug, LPNETCHANNEL channel)
+{
+ GF_Err e;
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ if (!plug || !plug->priv || !mpdin->seg_ifce) return GF_SERVICE_ERROR;
+
+ gf_mx_p(mpdin->dl_mutex);
+ e = mpdin->seg_ifce->ChannelReleaseSLP(mpdin->seg_ifce, channel);
+ gf_mx_v(mpdin->dl_mutex);
+ return e;
+}
+
+Bool MPD_CanHandleURLInService(GF_InputService *plug, const char *url)
+{
+ GF_MPD_In *mpdin = (GF_MPD_In*) plug->priv;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD_IN] Received Can Handle URL In Service (0x%x) request from terminal for %s\n", mpdin->service, url));
+ if (!plug || !plug->priv || !mpdin->seg_ifce) return GF_SERVICE_ERROR;
+ if (!strcmp(mpdin->url, url)) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+GF_EXPORT
+const u32 *QueryInterfaces()
+{
+ static u32 si [] = {
+ GF_NET_CLIENT_INTERFACE,
+ 0
+ };
+ return si;
+}
+
+GF_EXPORT
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
+{
+ GF_MPD_In *mpdin;
+ GF_InputService *plug;
+ if (InterfaceType != GF_NET_CLIENT_INTERFACE) return NULL;
+
+ GF_SAFEALLOC(plug, GF_InputService);
+ GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC MPD Loader", "gpac distribution")
+ plug->RegisterMimeTypes = MPD_RegisterMimeTypes;
+ plug->CanHandleURL = MPD_CanHandleURL;
+ plug->ConnectService = MPD_ConnectService;
+ plug->CloseService = MPD_CloseService;
+ plug->GetServiceDescriptor = MPD_GetServiceDesc;
+ plug->ConnectChannel = MPD_ConnectChannel;
+ plug->DisconnectChannel = MPD_DisconnectChannel;
+ plug->ServiceCommand = MPD_ServiceCommand;
+ plug->CanHandleURLInService = MPD_CanHandleURLInService;
+ plug->ChannelGetSLP = MPD_ChannelGetSLP;
+ plug->ChannelReleaseSLP = MPD_ChannelReleaseSLP;
+ GF_SAFEALLOC(mpdin, GF_MPD_In);
+ memset(mpdin, 0, sizeof(GF_MPD_In));
+ plug->priv = mpdin;
+ mpdin->dl_thread = gf_th_new("MPD Segment Downloader Thread");
+ mpdin->dl_mutex = gf_mx_new("MPD Segment Downloader Mutex");
+ mpdin->mimeTypeForM3U8Segments = gf_strdup( M3U8_UNKOWN_MIME_TYPE );
+ return (GF_BaseInterface *)plug;
+}
+
+GF_EXPORT
+void ShutdownInterface(GF_BaseInterface *bi)
+{
+ GF_InputService *ifcn = (GF_InputService*)bi;
+ if (ifcn->InterfaceType==GF_NET_CLIENT_INTERFACE) {
+ GF_MPD_In *mpdin = (GF_MPD_In*)ifcn->priv;
+ if (mpdin->mpd)
+ gf_mpd_del(mpdin->mpd);
+ mpdin->mpd = NULL;
+ if (mpdin->url)
+ gf_free(mpdin->url);
+ mpdin->url = NULL;
+ gf_th_del(mpdin->dl_thread);
+ gf_mx_del(mpdin->dl_mutex);
+ gf_free(mpdin->mimeTypeForM3U8Segments);
+ gf_free(mpdin->cached);
+ gf_free(mpdin);
+ gf_free(bi);
+ }
+}
vpath %.c $(SRC_PATH)/modules/mpegts_in
-CFLAGS= $(OPTFLAGS) -w -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
#endif
+static const char * MIMES[] = { "video/mpeg-2", "video/mp2t", "video/mpeg", NULL};
#define UDP_BUFFER_SIZE 0x40000
typedef struct {
Bool epg_requested;
Bool has_eit;
LPNETCHANNEL eit_channel;
+
+ Bool mpeg4on2_scene_only;
+ char * network_buffer;
+ u32 network_buffer_size;
} M2TSIn;
#define M2TS_BUFFER_MAX 400
static Bool M2TS_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
-
+ if (!plug || !url)
+ return 0;
if (!strnicmp(url, "udp://", 6)
|| !strnicmp(url, "mpegts-udp://", 13)
|| !strnicmp(url, "mpegts-tcp://", 13)
}
sExt = strrchr(url, '.');
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "video/mpeg-2", "ts m2t", "MPEG-2 TS", sExt)) return 1;
- if (gf_term_check_extension(plug, "video/mp2t", "ts m2t", "MPEG-2 TS", sExt)) return 1;
+ {
+ int i=0;
+ for (i = 0 ; NULL != MIMES[i]; i++)
+ if (gf_term_check_extension(plug, MIMES[i], "ts m2t dmb", "MPEG-2 TS", sExt))
+ return 1;
+ }
return 0;
}
static Bool M2TS_CanHandleURLInService(GF_InputService *plug, const char *url)
{
Bool ret = 0;
- M2TSIn *m2ts = (M2TSIn *)plug->priv;
+ M2TSIn *m2ts;
+ if (!plug || !url)
+ return 0;
+ m2ts = (M2TSIn *)plug->priv;
+ if (!m2ts)
+ return 0;
#ifdef GPAC_HAS_LINUX_DVB
if (!stricmp(url, "dvb://EPG")) return 1;
/*create a stream description for this channel*/
esd = gf_odf_desc_esd_new(0);
- esd->ESID = stream->pid;
+ esd->ESID = stream->mpeg4_es_id ? stream->mpeg4_es_id : stream->pid;
switch (stream->stream_type) {
case GF_M2TS_VIDEO_MPEG1:
/*declare object to terminal*/
od = (GF_ObjectDescriptor*)gf_odf_desc_new(GF_ODF_OD_TAG);
gf_list_add(od->ESDescriptors, esd);
- od->objectDescriptorID = stream->pid;
+ od->objectDescriptorID = esd->ESID;
if (streamType) *streamType = esd->decoderConfig->streamType;
return od;
}
static void MP2TS_SetupProgram(M2TSIn *m2ts, GF_M2TS_Program *prog, Bool regenerate_scene, Bool no_declare)
{
u32 i, count;
+ Bool force_declare_ods = 0;
count = gf_list_count(prog->streams);
#ifdef GPAC_HAS_LINUX_DVB
#endif
if (m2ts->file || m2ts->dnload) m2ts->file_regulate = no_declare ? 0 : 1;
+ if (prog->pmt_iod && (prog->pmt_iod->tag==GF_ODF_IOD_TAG) && (((GF_InitialObjectDescriptor*)prog->pmt_iod)->OD_profileAndLevel==GPAC_MAGIC_OD_PROFILE_FOR_MPEG4_SIGNALING)) {
+ force_declare_ods = 1;
+ }
for (i=0; i<count; i++) {
GF_M2TS_ES *es = gf_list_get(prog->streams, i);
if (es->pid==prog->pmt_pid) continue;
/*move to skip mode for all ES until asked for playback*/
if (!es->user)
gf_m2ts_set_pes_framing((GF_M2TS_PES *)es, GF_M2TS_PES_FRAMING_SKIP);
- if (!prog->pmt_iod && !no_declare) MP2TS_DeclareStream(m2ts, (GF_M2TS_PES *)es, NULL, 0);
+
+ if (!prog->pmt_iod && !no_declare) {
+ MP2TS_DeclareStream(m2ts, (GF_M2TS_PES *)es, NULL, 0);
+ } else if (force_declare_ods) {
+ if ((es->stream_type!=GF_M2TS_SYSTEMS_MPEG4_PES) && (es->stream_type!=GF_M2TS_SYSTEMS_MPEG4_SECTIONS)) {
+ MP2TS_DeclareStream(m2ts, (GF_M2TS_PES *)es, NULL, 0);
+ }
+ }
}
/*force scene regeneration*/
memset(&slh, 0, sizeof(GF_SLHeader));
slh.accessUnitStartFlag = (pck->flags & GF_M2TS_PES_PCK_AU_START) ? 1 : 0;
if (slh.accessUnitStartFlag) {
+ slh.OCRflag = 1;
+ slh.objectClockReference = pck->stream->program->last_pcr_value/300;
slh.compositionTimeStampFlag = 1;
slh.compositionTimeStamp = pck->PTS;
if (pck->DTS) {
{
GF_SLHeader SLHeader, *slh = NULL;
u32 SLHdrLen = 0;
-
+
/*build a SL Header*/
if (((GF_M2TS_ES*)pck->stream)->slcfg) {
gf_sl_depacketize(((GF_M2TS_ES*)pck->stream)->slcfg, &SLHeader, pck->data, pck->data_len, &SLHdrLen);
{
GF_M2TS_PES_PCK *pck = (GF_M2TS_PES_PCK*)param;
if (!pck->stream->first_dts) {
- gf_m2ts_set_pes_framing(pck->stream, GF_M2TS_PES_FRAMING_SKIP);
+ gf_m2ts_set_pes_framing(pck->stream, GF_M2TS_PES_FRAMING_SKIP_NO_RESET);
MP2TS_DeclareStream(m2ts, pck->stream, pck->data, pck->data_len);
if (m2ts->file || m2ts->dnload) m2ts->file_regulate = 1;
pck->stream->first_dts=1;
GF_SLHeader slh;
memset(&slh, 0, sizeof(GF_SLHeader) );
slh.OCRflag = 1;
- slh.m2ts_pcr = 1;
+ slh.m2ts_pcr = ( ((GF_M2TS_PES_PCK *) param)->flags & GF_M2TS_PES_PCK_DISCONTINUITY) ? 2 : 1;
slh.objectClockReference = ((GF_M2TS_PES_PCK *) param)->PTS;
gf_term_on_sl_packet(m2ts->service, ((GF_M2TS_PES_PCK *) param)->stream->user, NULL, 0, &slh, GF_OK);
}
u64 pcr_diff = (pcr - m2ts->pcr_last);
pcr_diff /= 27000;
diff = (u32) pcr_diff - (stb - m2ts->stb_at_last_pcr);
- if (diff>0 && (diff<1000) ) {
+ if (diff<0) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[M2TS In] Demux not going fast enough according to PCR (drift %d, pcr: "LLD", last pcr: "LLD")\n", diff, pcr, m2ts->pcr_last));
+ } else if (diff>0) {
u32 sleep_for=50;
#ifndef GPAC_DISABLE_LOG
u32 nb_sleep=0;
/*query buffer level, don't sleep if too low*/
GF_NetworkCommand com;
com.command_type = GF_NET_BUFFER_QUERY;
- while (1) {
+ while (m2ts->run_state) {
gf_term_on_command(m2ts->service, &com, GF_OK);
- if (com.buffer.occupancy < M2TS_BUFFER_MAX)
+ if (com.buffer.occupancy < M2TS_BUFFER_MAX)
break;
/*We don't sleep for the entire buffer occupancy, because we would take
the risk of starving the audio chains. We try to keep buffers half full*/
m2ts->nb_pck = 0;
m2ts->pcr_last = pcr;
m2ts->stb_at_last_pcr = gf_sys_clock();
+ } else {
+ GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, ("[M2TS In] Demux drift according to PCR (drift %d, pcr: "LLD", last pcr: "LLD")\n", diff, pcr, m2ts->pcr_last));
}
} else {
m2ts->pcr_last = pcr;
/*m2ts chunks by chunks*/
size = fread(data, 1, 188, m2ts->file);
if (!size) break;
+ if (size != 188){
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[M2TS In] %u bytes read from file instead of 188.\n", size));
+ }
/*process chunk*/
gf_m2ts_process_data(m2ts->ts, data, size);
continue;
}
} else if (m2ts->file) {
- gf_sleep(1);
+ gf_sleep(0);
}
}
if (feof(m2ts->file) && m2ts->owner && m2ts->owner->query_proxy) {
GF_NetworkCommand param;
+ GF_Err query_ret;
fclose(m2ts->file);
m2ts->file = NULL;
param.command_type = GF_NET_SERVICE_QUERY_NEXT;
- if ((m2ts->owner->query_proxy(m2ts->owner, ¶m)==GF_OK) && param.url_query.next_url){
- GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("\nSegment switch detected - now playing %s\n", param.url_query.next_url));
+ param.url_query.next_url = NULL;
+ assert(m2ts->owner);
+ assert( m2ts->owner->query_proxy);
+ query_ret = m2ts->owner->query_proxy(m2ts->owner, ¶m);
+ if ((query_ret==GF_OK) && param.url_query.next_url){
m2ts->file = gf_f64_open(param.url_query.next_url, "rb");
- if (m2ts->file) goto restart_file;
+ if (m2ts->file) {
+ goto restart_file;
+ } else {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[M2TS In] Cannot open next file %s\n", param.url_query.next_url));
+ }
+ } else {
+ if (query_ret==GF_OK){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[M2TS In] Cannot query next file since no file was provided but no error was raised\n"));
+ } else
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[M2TS In] Cannot query next file: error: %s\n", gf_error_to_string(query_ret)));
}
}
- GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("\nEOS reached\n"));
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("\n[M2TS In]EOS reached, remaining segments=%u\n", m2ts->nb_playing));
if (m2ts->nb_playing) {
for (i=0; i<GF_M2TS_MAX_STREAMS; i++) {
GF_M2TS_PES *pes = (GF_M2TS_PES *)m2ts->ts->ess[i];
{
GF_Err e;
M2TSIn *m2ts = (M2TSIn *) cbk;
-
+ assert( m2ts );
/*handle service message*/
gf_term_download_update_stats(m2ts->dnload);
e = GF_EOS;
} else if (param->msg_type==GF_NETIO_DATA_EXCHANGE) {
e = GF_OK;
- /*process chunk*/
- gf_m2ts_process_data(m2ts->ts, param->data, param->size);
+ assert( m2ts->ts);
+ if (param->size > 0){
+ /*process chunk*/
+ assert(param->data);
+ if (m2ts->network_buffer_size < param->size){
+ m2ts->network_buffer = gf_realloc(m2ts->network_buffer, sizeof(char) * param->size);
+ m2ts->network_buffer_size = param->size;
+ }
+ assert( m2ts->network_buffer );
+ memcpy(m2ts->network_buffer, param->data, param->size);
+ gf_m2ts_process_data(m2ts->ts, m2ts->network_buffer, param->size);
+ }
/*if asked to regulate, wait until we get a play request*/
if (m2ts->run_state && !m2ts->nb_playing && m2ts->file_regulate) {
} else {
gf_sleep(1);
}
+ if (!m2ts->run_state){
+ if (m2ts->dnload)
+ gf_term_download_del( m2ts->dnload );
+ m2ts->dnload = NULL;
+ }
} else {
e = param->error;
}
- if (e<GF_OK) {
- /*error opening service*/
+ switch (e){
+ case GF_EOS:
+ gf_term_on_connect(m2ts->service, NULL, GF_OK);
+ return;
+ case GF_OK:
+ return;
+ default:
if (!m2ts->ts_setup) {
m2ts->ts_setup = 1;
- gf_term_on_connect(m2ts->service, NULL, e);
}
- return;
+ GF_LOG( GF_LOG_ERROR, GF_LOG_CONTAINER,
+ ("[MPEGTSIn] : Error while getting data : %s\n", gf_error_to_string(e)));
+ gf_term_on_connect(m2ts->service, NULL, e);
}
}
}
#endif
else if (!strnicmp(url, "http://", 7)) {
+
m2ts->dnload = gf_term_download_new(m2ts->service, url, GF_NETIO_SESSION_NOT_THREADED | GF_NETIO_SESSION_NOT_CACHED, m2ts_net_io, m2ts);
if (!m2ts->dnload) gf_term_on_connect(m2ts->service, NULL, GF_NOT_SUPPORTED);
else {
/*mark pcr as not initialized*/
if (pes->program->pcr_pid==pes->pid) pes->program->first_dts=0;
gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_DEFAULT);
- GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("Setting default reframing\n"));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[M2TSIn] Setting default reframing for PID %d\n", pes->pid));
/*this is a multplex, only trigger the play command for the first stream activated*/
if (!m2ts->nb_playing) {
m2ts->start_range = (u32) (com->play.start_range*1000);
}
return GF_STREAM_NOT_FOUND;
}
+
gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);
- assert(m2ts->nb_playing);
- m2ts->nb_playing--;
+ /* In case of EOS, we may receive a stop command after no one is playing */
+ if (m2ts->nb_playing)
+ m2ts->nb_playing--;
/*stop demuxer*/
if (!m2ts->nb_playing && (m2ts->run_state==1)) {
m2ts->run_state=0;
}
}
+static u32 M2TS_RegisterMimeTypes(const GF_InputService * service){
+ int i;
+ if (service == NULL)
+ return 0;
+ for (i = 0 ; MIMES[i]; i++)
+ gf_term_register_mime_type( service, MIMES[i], "ts m2t dmb", "MPEG-2 TS");
+ return i;
+}
+
GF_InputService *NewM2TSReader()
{
plug->ConnectChannel = M2TS_ConnectChannel;
plug->DisconnectChannel = M2TS_DisconnectChannel;
plug->ServiceCommand = M2TS_ServiceCommand;
+ plug->RegisterMimeTypes = M2TS_RegisterMimeTypes;
reader = gf_malloc(sizeof(M2TSIn));
memset(reader, 0, sizeof(M2TSIn));
void DeleteM2TSReader(void *ifce)
{
u32 i, count;
-
+ M2TSIn *m2ts;
GF_InputService *plug = (GF_InputService *) ifce;
- M2TSIn *m2ts = plug->priv;
-
- count = gf_list_count(m2ts->requested_progs);
- for (i = 0; i < count; i++) {
- M2TSIn_Prog *prog = gf_list_get(m2ts->requested_progs, i);
- gf_free(prog->fragment);
- gf_free(prog);
+ if (!ifce)
+ return;
+ m2ts = plug->priv;
+ if (!m2ts)
+ return;
+ if( m2ts->requested_progs ){
+ count = gf_list_count(m2ts->requested_progs);
+ for (i = 0; i < count; i++) {
+ M2TSIn_Prog *prog = gf_list_get(m2ts->requested_progs, i);
+ gf_free(prog->fragment);
+ gf_free(prog);
+ }
+ gf_list_del(m2ts->requested_progs);
}
- gf_list_del(m2ts->requested_progs);
- count = gf_list_count(m2ts->requested_pids);
- for (i = 0; i < count; i++) {
- M2TSIn_Prog *prog = gf_list_get(m2ts->requested_pids, i);
- gf_free(prog);
+ m2ts->requested_progs = NULL;
+ if( m2ts->requested_pids ){
+ count = gf_list_count(m2ts->requested_pids);
+ for (i = 0; i < count; i++) {
+ M2TSIn_Prog *prog = gf_list_get(m2ts->requested_pids, i);
+ gf_free(prog);
+ }
+ gf_list_del(m2ts->requested_pids);
}
- gf_list_del(m2ts->requested_pids);
+ m2ts->requested_pids = NULL;
+ if (m2ts->network_buffer)
+ gf_free(m2ts->network_buffer);
+ m2ts->network_buffer = NULL;
+ m2ts->network_buffer_size = 0;
+ m2ts->request_all_pids = 0;
gf_m2ts_demux_del(m2ts->ts);
+ m2ts->ts = NULL;
gf_mx_del(m2ts->mx);
+ m2ts->mx = NULL;
gf_free(m2ts);
+ plug->priv = NULL;
gf_free(plug);
}
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_MPEG2TS
#endif
0
};
- return si;
+ return si;
}
GF_BaseInterface *LoadInterface(u32 InterfaceType)
vpath %.c $(SRC_PATH)/modules/odf_dec
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / OD decoder module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/internal/terminal_dev.h>
#include <gpac/constants.h>
-typedef struct
+typedef struct
{
GF_Scene *scene;
u32 PL;
static GF_Err ODF_AttachScene(GF_SceneDecoder *plug, GF_Scene *scene, Bool is_inline_scene)
{
ODPriv *priv = (ODPriv *)plug->privateStack;
- if (!priv->scene) priv->scene = scene;
+ if (priv && !priv->scene) priv->scene = scene;
return GF_OK;
}
gf_list_rem(ESDs->ESDescriptors, 0);
count--;
}
- /*resetup object since a new ES has been inserted
+ /*resetup object since a new ES has been inserted
(typically an empty object first sent, then a stream added - cf how ogg demuxer works)*/
gf_scene_setup_object(priv->scene, odm);
return GF_OK;
}
-static GF_Err ODF_ProcessData(GF_SceneDecoder *plug, char *inBuffer, u32 inBufferLength,
+static GF_Err ODF_ProcessData(GF_SceneDecoder *plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 AU_time, u32 mmlevel)
{
GF_Err e;
GF_ODCom *com;
GF_ODCodec *oddec;
ODPriv *priv = (ODPriv *)plug->privateStack;
-
+
oddec = gf_odf_codec_new();
e = gf_odf_codec_set_au(oddec, inBuffer, inBufferLength);
}
-Bool ODF_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool ODF_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
ODPriv *priv = (ODPriv *)ifce->privateStack;
if (StreamType==GF_STREAM_OD) {
void DeleteODDec(GF_BaseDecoder *plug)
{
- ODPriv *priv = (ODPriv *)plug->privateStack;
- gf_free(priv);
+ ODPriv *priv;
+ if (!plug)
+ return;
+ priv = (ODPriv *)plug->privateStack;
+ if (priv){
+ gf_free(priv);
+ plug->privateStack = NULL;
+ }
gf_free(plug);
}
{
GF_SceneDecoder *tmp;
ODPriv *priv;
-
+
GF_SAFEALLOC(tmp, GF_SceneDecoder);
if (!tmp) return NULL;
GF_SAFEALLOC(priv, ODPriv);
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
GF_SCENE_DECODER_INTERFACE,
0
};
- return si;
+ return si;
}
GF_EXPORT
GF_EXPORT
void ShutdownInterface(GF_BaseInterface *ifce)
{
+ if (!ifce)
+ return;
switch (ifce->InterfaceType) {
case GF_SCENE_DECODER_INTERFACE:
DeleteODDec((GF_BaseDecoder *)ifce);
vpath %.c $(SRC_PATH)/modules/ogg
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
CFLAGS+=-DGPAC_HAS_VORBIS
ifeq ($(CONFIG_VORBIS), local)
NEED_LOCAL_LIB="yes"
-CFLAGS+= -I$(LOCAL_INC_PATH)
+CFLAGS+= -I"$(LOCAL_INC_PATH)"
endif
endif
CFLAGS+=-DGPAC_HAS_THEORA
ifeq ($(CONFIG_THEORA), local)
NEED_LOCAL_LIB="yes"
-CFLAGS+= -I$(LOCAL_INC_PATH)
+CFLAGS+= -I"$(LOCAL_INC_PATH)"
endif
endif
return has_stream;
}
+static const char * OGG_MIMES_AUDIO[] = {
+ "audio/ogg", "audio/x-ogg", "audio/x-vorbis+ogg", NULL
+};
+
+static const char * OGG_MIMES_AUDIO_EXT = "oga spx";
+
+static const char * OGG_MIMES_AUDIO_DESC = "Xiph.org OGG Music";
+
+static const char * OGG_MIMES_VIDEO[] = {
+ "application/ogg", "application/x-ogg", "video/ogg", "video/x-ogg", "video/x-ogm+ogg", NULL
+};
+
+static const char * OGG_MIMES_VIDEO_DESC = "Xiph.org OGG Movie";
+
+static const char * OGG_MIMES_VIDEO_EXT = "ogg ogv oggm";
+
+static u32 OGG_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i, c;
+ for (i = 0 ; OGG_MIMES_AUDIO[i]; i++)
+ gf_term_register_mime_type(plug, OGG_MIMES_AUDIO[i], OGG_MIMES_AUDIO_EXT, OGG_MIMES_AUDIO_DESC);
+ c = i;
+ for (i = 0 ; OGG_MIMES_VIDEO[i]; i++)
+ gf_term_register_mime_type(plug, OGG_MIMES_VIDEO[i], OGG_MIMES_VIDEO_EXT, OGG_MIMES_VIDEO_DESC);
+ return c+i;
+}
+
static Bool OGG_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ u32 i;
sExt = strrchr(url, '.');
- if (!sExt) return 0;
-
- if (gf_term_check_extension(plug, "application/ogg", "ogg", "Xiph.org OGG Movie", sExt)) return 1;
- if (gf_term_check_extension(plug, "application/x-ogg", "ogg", "Xiph.org OGG Movie", sExt)) return 1;
+ for (i = 0 ; OGG_MIMES_AUDIO[i]; i++){
+ if (gf_term_check_extension(plug, OGG_MIMES_AUDIO[i], OGG_MIMES_AUDIO_EXT, OGG_MIMES_AUDIO_DESC, sExt))
+ return 1;
+ }
+ for (i = 0 ; OGG_MIMES_VIDEO[i]; i++){
+ if (gf_term_check_extension(plug, OGG_MIMES_VIDEO[i], OGG_MIMES_VIDEO_EXT, OGG_MIMES_VIDEO_DESC, sExt))
+ return 1;
+ }
return 0;
}
e = GF_STREAM_NOT_FOUND;
if (strstr(url, "ES_ID")) {
- sscanf(url, "ES_ID=%d", &ES_ID);
+ sscanf(url, "ES_ID=%u", &ES_ID);
}
/*URL setup*/
// else if (!read->es_ch && OGG_CanHandleURL(plug, url)) ES_ID = 3;
GF_InputService *plug = gf_malloc(sizeof(GF_InputService));
memset(plug, 0, sizeof(GF_InputService));
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC OGG Reader", "gpac distribution")
-
+ plug->RegisterMimeTypes = OGG_RegisterMimeTypes;
plug->CanHandleURL = OGG_CanHandleURL;
plug->ConnectService = OGG_ConnectService;
plug->CloseService = OGG_CloseService;
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include "ogg_in.h"
-static Bool OGG_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool OGG_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
/*video decs*/
if (StreamType == GF_STREAM_VISUAL) {
- switch (ObjectType) {
+ char *dsi;
+ /*media type query*/
+ if (!esd) return 1;
+ dsi = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data : NULL;
+
+ switch (esd->decoderConfig->objectTypeIndication) {
#ifdef GPAC_HAS_THEORA
- case GPAC_OTI_MEDIA_OGG:
- if (decSpecInfo && (decSpecInfoSize>=9) && !strncmp((char *) &decSpecInfo[3], "theora", 6)) {
+ case GPAC_OTI_MEDIA_OGG:
+ if (dsi && (esd->decoderConfig->decoderSpecificInfo->dataLength>=9) && !strncmp((char *) &dsi[3], "theora", 6)) {
return NewTheoraDecoder(dec);
}
return 0;
- case 0: return 1;/*query for types*/
#endif
- default: return 0;
+ default:
+ return 0;
}
}
- /*audio decs*/
+ /*audio decs*/
if (StreamType == GF_STREAM_AUDIO) {
- switch (ObjectType) {
+ char *dsi;
+ /*media type query*/
+ if (!esd) return 1;
+ dsi = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data : NULL;
+
+ switch (esd->decoderConfig->objectTypeIndication) {
#ifdef GPAC_HAS_VORBIS
- case GPAC_OTI_MEDIA_OGG:
- if (decSpecInfo && (decSpecInfoSize>=9) && !strncmp((char *) &decSpecInfo[3], "vorbis", 6)) {
+ case GPAC_OTI_MEDIA_OGG:
+ if (dsi && (esd->decoderConfig->decoderSpecificInfo->dataLength>=9) && !strncmp((char *) &dsi[3], "vorbis", 6)) {
return NewVorbisDecoder(dec);
}
return 0;
- case 0: return 1;
#endif
- default: return 0;
+ default:
+ return 0;
}
}
return 0;
void DeleteOGGDecoder(GF_BaseDecoder *ifcd)
{
- OGGWraper *wrap = (OGGWraper *)ifcd->privateStack;
- switch (wrap->type) {
+ OGGWraper *wrap;
+ if (!ifcd)
+ return;
+ wrap = (OGGWraper *)ifcd->privateStack;
+ if (!wrap){
+ switch (wrap->type) {
#ifdef GPAC_HAS_VORBIS
- case OGG_VORBIS: DeleteVorbisDecoder(ifcd); break;
+ case OGG_VORBIS: DeleteVorbisDecoder(ifcd); break;
#endif
#ifdef GPAC_HAS_THEORA
- case OGG_THEORA: DeleteTheoraDecoder(ifcd); break;
+ case OGG_THEORA: DeleteTheoraDecoder(ifcd); break;
#endif
- default:
+ default:
break;
- }
- gf_free(wrap);
+ }
+ gf_free(wrap);
+ ifcd->privateStack = NULL;
+ }
gf_free(ifcd);
}
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#if !defined(GPAC_DISABLE_AV_PARSERS) && !defined(GPAC_DISABLE_OGG)
GF_MEDIA_DECODER_INTERFACE,
0
};
- return si;
+ return si;
}
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
{
#if !defined(GPAC_DISABLE_AV_PARSERS) && !defined(GPAC_DISABLE_OGG)
if (InterfaceType == GF_NET_CLIENT_INTERFACE) return (GF_BaseInterface *)OGG_LoadDemux();
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
VORBISCTX();
if (ctx->ES_ID) return GF_BAD_PARAM;
-
+
if (!esd->decoderConfig->decoderSpecificInfo || !esd->decoderConfig->decoderSpecificInfo->data) return GF_NON_COMPLIANT_BITSTREAM;
if (esd->decoderConfig->objectTypeIndication != GPAC_OTI_MEDIA_OGG) return GF_NON_COMPLIANT_BITSTREAM;
if ((esd->decoderConfig->decoderSpecificInfo->dataLength<9) || strncmp(&esd->decoderConfig->decoderSpecificInfo->data[3], "vorbis", 6)) return GF_NON_COMPLIANT_BITSTREAM;
gf_free(oggpacket.packet);
}
vorbis_synthesis_init(&ctx->vd, &ctx->vi);
- vorbis_block_init(&ctx->vd, &ctx->vb);
+ vorbis_block_init(&ctx->vd, &ctx->vb);
gf_bs_del(bs);
return GF_OK;
VORBISCTX();
if (ctx->ES_ID != ES_ID) return GF_BAD_PARAM;
- vorbis_block_clear(&ctx->vb);
+ vorbis_block_clear(&ctx->vb);
vorbis_dsp_clear(&ctx->vd);
vorbis_info_clear(&ctx->vi);
vorbis_comment_clear(&ctx->vc);
}
-static GFINLINE void vorbis_to_intern(u32 samples, Float **pcm, char *buf, u32 channels)
+static GFINLINE void vorbis_to_intern(u32 samples, Float **pcm, char *buf, u32 channels)
{
u32 i, j;
s32 val;
ogg_int16_t *ptr, *data = (ogg_int16_t*)buf ;
Float *mono;
-
+
for (i=0 ; i<channels ; i++) {
ptr = &data[i];
if (channels>2) {
}
mono = pcm[i];
- for (j=0; j<samples; j++) {
+ for (j=0; j<samples; j++) {
val = (s32) (mono[j] * 32767.f);
if (val > 32767) val = 32767;
if (val < -32768) val = -32768;
*ptr = val;
ptr += channels;
}
- }
+ }
}
-static GF_Err VORB_ProcessData(GF_MediaDecoder *ifcg,
+static GF_Err VORB_ProcessData(GF_MediaDecoder *ifcg,
char *inBuffer, u32 inBufferLength,
u16 ES_ID,
char *outBuffer, u32 *outBufferLength,
*outBufferLength = 0;
- if (vorbis_synthesis(&ctx->vb, &op) == 0)
+ if (vorbis_synthesis(&ctx->vb, &op) == 0)
vorbis_synthesis_blockin(&ctx->vd, &ctx->vb) ;
/*trust vorbis max block info*/
total_samples += samples;
vorbis_synthesis_read(&ctx->vd, samples);
}
- *outBufferLength = total_bytes;
+ *outBufferLength = total_bytes;
return GF_OK;
}
GF_SAFEALLOC(dec, VorbDec);
((OGGWraper *)ifcd->privateStack)->opaque = dec;
((OGGWraper *)ifcd->privateStack)->type = OGG_VORBIS;
- /*setup our own interface*/
+ /*setup our own interface*/
ifcd->AttachStream = VORB_AttachStream;
ifcd->DetachStream = VORB_DetachStream;
ifcd->GetCapabilities = VORB_GetCapabilities;
void DeleteVorbisDecoder(GF_BaseDecoder *ifcg)
{
- VORBISCTX();
- gf_free(ctx);
+ VorbDec *ctx;
+ if (!ifcg || !ifcg->privateStack)
+ return;
+ ctx = (VorbDec *) ((OGGWraper *)ifcg->privateStack)->opaque;
+ if (ctx){
+ gf_free(ctx);
+ ((OGGWraper *)ifcg->privateStack)->opaque = NULL;
+ }
}
#endif
vpath %.c $(SRC_PATH)/modules/opencv_is
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/modules/opensvc_dec
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
LDFLAGS+=-pg
endif
-LDFLAGS+=-lsvc
+LDFLAGS+=-lOpenSVCDec
#common obj
OBJS= opensvc_dec.o
-/*
- * GPAC - Multimedia Framework C SDK
- *
- * Copyright (c) Telecom ParisTech 2010-
- * Author(s): Jean Le Feuvre
- * All rights reserved
- *
- * This file is part of GPAC / OpenSVC Decoder module
- *
- * GPAC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GPAC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-
-#include <gpac/modules/codec.h>
-#include <gpac/avparse.h>
-#include <gpac/constants.h>
-
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) Telecom ParisTech 2010-\r
+ * Author(s): Jean Le Feuvre\r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / OpenSVC Decoder module\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+\r
+#include <gpac/modules/codec.h>\r
+#include <gpac/avparse.h>\r
+#include <gpac/constants.h>\r
+\r
+\r
+#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(__GNUC__)\r
+# pragma comment(lib, "OpenSVCDecoder")\r
+#endif\r
+\r
typedef struct{\r
int Width;\r
int Height;\r
\r
int SVCDecoder_init(void **PlayerStruct);\r
int SVCDecoder_close(void *PlayerStruct);\r
-int decodeNAL(void *PlayerStruct, unsigned char* nal, int nal_length, OPENSVCFRAME *Frame, int DqIdMax); \r
+//TODO\r
+int decodeNAL(void *PlayerStruct, unsigned char* nal, int nal_length, OPENSVCFRAME *Frame, int *LayerCommand); \r
/*ID vient du NAL type 14 et 20*/\r
-int setLayer(int num_layer);\r
+//TODO\r
+void SetCommandLayer(int *Command, int DqIdMax, int CurrDqId, int *TemporalCom, int TemporalId);\r
void ParseAuPlayers(void *PlayerStruct, const unsigned char *buf, int buf_size, int nal_length_size, int is_avc);\r
int GetDqIdMax(const unsigned char *buf, int buf_size, int nal_length_size, int *DqidTable, int is_avc);\r
-int Geth264NalSize(const unsigned char *buf, int buf_size, int *bufindex);\r
-void UpdateLayer(int *DqIdTable, int *CurrDqId, int MaxDqId, int Command);
-
-
-typedef struct
-{
- u16 ES_ID;
- u32 width, stride, height, out_size, pixel_ar, layer;
- Bool first_frame;
-
- u32 nalu_size_length;
-
- /*OpenSVC things*/
- void *codec;
+\r
+\r
+typedef struct\r
+{\r
+ u16 ES_ID;\r
+ u32 width, stride, height, out_size, pixel_ar, layer;\r
+ Bool first_frame;\r
+\r
+ u32 nalu_size_length;\r
+\r
+ /*OpenSVC things*/\r
+ void *codec;\r
int InitParseAU;\r
int svc_init_done;\r
int save_Width;\r
int CurrDqId;\r
int MaxDqId;\r
int DqIdTable [8];\r
-} OSVCDec;
-
-
-static GF_Err OSVC_AttachStream(GF_BaseDecoder *ifcg, GF_ESD *esd)
-{
- u32 i, count;
- s32 res;
+ int TemporalId;\r
+ int TemporalCom;\r
+} OSVCDec;\r
+\r
+static GF_Err OSVC_AttachStream(GF_BaseDecoder *ifcg, GF_ESD *esd)\r
+{\r
+ u32 i, count;\r
+ s32 res;\r
OPENSVCFRAME Picture;\r
- OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;
-
- /*not supported in this version*/
- if (esd->dependsOnESID) return GF_NOT_SUPPORTED;
-
- ctx->ES_ID = esd->ESID;
- ctx->width = ctx->height = ctx->out_size = 0;
-
- if (esd->decoderConfig->decoderSpecificInfo && esd->decoderConfig->decoderSpecificInfo->data) {
- GF_AVCConfig *cfg = gf_odf_avc_cfg_read(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);
- if (!cfg) return GF_NON_COMPLIANT_BITSTREAM;
- ctx->nalu_size_length = cfg->nal_unit_size;
+ int Layer[4];\r
+ OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;\r
+\r
+ /*not supported in this version*/\r
+ if (esd->dependsOnESID) return GF_NOT_SUPPORTED;\r
+ \r
+ ctx->ES_ID = esd->ESID;\r
+ ctx->width = ctx->height = ctx->out_size = 0;\r
+ \r
+ if (esd->decoderConfig->decoderSpecificInfo && esd->decoderConfig->decoderSpecificInfo->data) {\r
+ GF_AVCConfig *cfg = gf_odf_avc_cfg_read(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);\r
+ if (!cfg) return GF_NON_COMPLIANT_BITSTREAM;\r
+ ctx->nalu_size_length = cfg->nal_unit_size;\r
if (SVCDecoder_init(&ctx->codec) == SVC_STATUS_ERROR) return GF_IO_ERR;\r
\r
/*decode all NALUs*/\r
count = gf_list_count(cfg->sequenceParameterSets);\r
+ SetCommandLayer(Layer, 255, 0, &i, 0);//bufindex can be reset without pb\r
for (i=0; i<count; i++) {\r
u32 w, h, par_n, par_d;\r
- GF_AVCConfigSlot *slc = gf_list_get(cfg->sequenceParameterSets, i);
-
- gf_avc_get_sps_info(slc->data, slc->size, &w, &h, &par_n, &par_d);
- /*by default use the base layer*/
- if (!i) {
- if ((ctx->width<w) || (ctx->height<h)) {
- ctx->width = w;
- ctx->height = h;
- if ( ((s32)par_n>0) && ((s32)par_d>0) )
- ctx->pixel_ar = (par_n<<16) || par_d;
+ GF_AVCConfigSlot *slc = gf_list_get(cfg->sequenceParameterSets, i);\r
+\r
+ gf_avc_get_sps_info(slc->data, slc->size, &slc->id, &w, &h, &par_n, &par_d);\r
+ /*by default use the base layer*/\r
+ if (!i) {\r
+ if ((ctx->width<w) || (ctx->height<h)) {\r
+ ctx->width = w;\r
+ ctx->height = h;\r
+ if ( ((s32)par_n>0) && ((s32)par_d>0) )\r
+ ctx->pixel_ar = (par_n<<16) || par_d;\r
}\r
}\r
- res = decodeNAL(ctx->codec, slc->data, slc->size, &Picture, 0);\r
+ res = decodeNAL(ctx->codec, slc->data, slc->size, &Picture, Layer);\r
if (res<0) {\r
GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[SVC Decoder] Error decoding SPS %d\n", res));\r
}\r
\r
count = gf_list_count(cfg->pictureParameterSets);\r
for (i=0; i<count; i++) {\r
- GF_AVCConfigSlot *slc = gf_list_get(cfg->pictureParameterSets, i);
- res = decodeNAL(ctx->codec, slc->data, slc->size, &Picture, 0);\r
+ GF_AVCConfigSlot *slc = gf_list_get(cfg->pictureParameterSets, i);\r
+ res = decodeNAL(ctx->codec, slc->data, slc->size, &Picture, Layer);\r
if (res<0) {\r
GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[SVC Decoder] Error decoding PPS %d\n", res));\r
}\r
}\r
\r
gf_odf_avc_cfg_del(cfg);\r
- } else {
- ctx->nalu_size_length = 0;
+ } else {\r
+ ctx->nalu_size_length = 0;\r
if (SVCDecoder_init(&ctx->codec) == SVC_STATUS_ERROR) return GF_IO_ERR;\r
- }
- ctx->stride = ctx->width + 32;
- ctx->layer = 0;
- setLayer(ctx->layer);
- ctx->out_size = ctx->stride * ctx->height * 3 / 2;
- return GF_OK;
-}
-static GF_Err OSVC_DetachStream(GF_BaseDecoder *ifcg, u16 ES_ID)
-{
- OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;
-
- if (ctx->codec) SVCDecoder_close(ctx->codec);
- ctx->codec = NULL;
- ctx->width = ctx->height = ctx->out_size = 0;
- return GF_OK;
-}
-static GF_Err OSVC_GetCapabilities(GF_BaseDecoder *ifcg, GF_CodecCapability *capability)
-{
- OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;
-
- switch (capability->CapCode) {
- case GF_CODEC_RESILIENT:
- capability->cap.valueInt = 1;
- break;
- case GF_CODEC_WIDTH:
- capability->cap.valueInt = ctx->width;
- break;
- case GF_CODEC_HEIGHT:
- capability->cap.valueInt = ctx->height;
- break;
- case GF_CODEC_STRIDE:
- capability->cap.valueInt = ctx->stride;
- break;
- case GF_CODEC_PAR:
- capability->cap.valueInt = ctx->pixel_ar;
- break;
- case GF_CODEC_OUTPUT_SIZE:
- capability->cap.valueInt = ctx->out_size;
- break;
- case GF_CODEC_PIXEL_FORMAT:
- capability->cap.valueInt = GF_PIXEL_YV12;
- break;
- case GF_CODEC_BUFFER_MIN:
- capability->cap.valueInt = 1;
- break;
- case GF_CODEC_BUFFER_MAX:
- capability->cap.valueInt = 4;
- break;
- case GF_CODEC_PADDING_BYTES:
- capability->cap.valueInt = 32;
- break;
- case GF_CODEC_REORDER:
- capability->cap.valueInt = 1;
- break;
- /*not known at our level...*/
- case GF_CODEC_CU_DURATION:
- default:
- capability->cap.valueInt = 0;
- break;
- }
- return GF_OK;
-}
-static GF_Err OSVC_SetCapabilities(GF_BaseDecoder *ifcg, GF_CodecCapability capability)
-{
- OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;
- switch (capability.CapCode) {
- case GF_CODEC_MEDIA_SWITCH_QUALITY:
- if (capability.cap.valueInt) {
- if (ctx->layer<32) {
- ctx->layer += 8;
- setLayer(ctx->layer);
- }
- } else {
- if (ctx->layer>=8) {
- ctx->layer -= 8;
- setLayer(ctx->layer);
- }
- }
- return GF_OK;
- }
- /*return unsupported to avoid confusion by the player (like color space changing ...) */
- return GF_NOT_SUPPORTED;
-
-}
-
-static GF_Err OSVC_ProcessData(GF_MediaDecoder *ifcg,
- char *inBuffer, u32 inBufferLength,
- u16 ES_ID,
- char *outBuffer, u32 *outBufferLength,
- u8 PaddingBits, u32 mmlevel)
-{
-
- s32 got_pic;
+ }\r
+ ctx->stride = ctx->width + 32;\r
+ ctx->layer = 0;\r
+ ctx->CurrDqId = ctx->layer;\r
+ ctx->out_size = ctx->stride * ctx->height * 3 / 2;\r
+ return GF_OK;\r
+}\r
+static GF_Err OSVC_DetachStream(GF_BaseDecoder *ifcg, u16 ES_ID)\r
+{\r
+ OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;\r
+\r
+ if (ctx->codec) SVCDecoder_close(ctx->codec);\r
+ ctx->codec = NULL;\r
+ ctx->width = ctx->height = ctx->out_size = 0;\r
+ return GF_OK;\r
+}\r
+static GF_Err OSVC_GetCapabilities(GF_BaseDecoder *ifcg, GF_CodecCapability *capability)\r
+{\r
+ OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;\r
+\r
+ switch (capability->CapCode) {\r
+ case GF_CODEC_RESILIENT:\r
+ capability->cap.valueInt = 1;\r
+ break;\r
+ case GF_CODEC_WIDTH:\r
+ capability->cap.valueInt = ctx->width;\r
+ break;\r
+ case GF_CODEC_HEIGHT:\r
+ capability->cap.valueInt = ctx->height;\r
+ break;\r
+ case GF_CODEC_STRIDE:\r
+ capability->cap.valueInt = ctx->stride;\r
+ break;\r
+ case GF_CODEC_PAR:\r
+ capability->cap.valueInt = ctx->pixel_ar;\r
+ break;\r
+ case GF_CODEC_OUTPUT_SIZE:\r
+ capability->cap.valueInt = ctx->out_size;\r
+ break;\r
+ case GF_CODEC_PIXEL_FORMAT:\r
+ capability->cap.valueInt = GF_PIXEL_YV12;\r
+ break;\r
+ case GF_CODEC_BUFFER_MIN:\r
+ capability->cap.valueInt = 1;\r
+ break;\r
+ case GF_CODEC_BUFFER_MAX:\r
+ capability->cap.valueInt = 4;\r
+ break;\r
+ case GF_CODEC_PADDING_BYTES:\r
+ capability->cap.valueInt = 32;\r
+ break;\r
+ case GF_CODEC_REORDER:\r
+ capability->cap.valueInt = 1;\r
+ break;\r
+ /*not known at our level...*/\r
+ case GF_CODEC_CU_DURATION:\r
+ default:\r
+ capability->cap.valueInt = 0;\r
+ break;\r
+ }\r
+ return GF_OK;\r
+}\r
+static GF_Err OSVC_SetCapabilities(GF_BaseDecoder *ifcg, GF_CodecCapability capability)\r
+{\r
+ OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;\r
+ switch (capability.CapCode) {\r
+ case GF_CODEC_MEDIA_SWITCH_QUALITY:\r
+ if (capability.cap.valueInt) {\r
+ if (ctx->layer<32) {\r
+ ctx->layer += 8;\r
+ ctx->CurrDqId = ctx->layer;\r
+ }\r
+ } else {\r
+ if (ctx->layer>=8) {\r
+ ctx->layer -= 8;\r
+ ctx->CurrDqId = ctx->layer;\r
+ }\r
+ }\r
+ return GF_OK;\r
+ }\r
+ /*return unsupported to avoid confusion by the player (like color space changing ...) */\r
+ return GF_NOT_SUPPORTED;\r
+\r
+}\r
+\r
+static GF_Err OSVC_ProcessData(GF_MediaDecoder *ifcg, \r
+ char *inBuffer, u32 inBufferLength,\r
+ u16 ES_ID,\r
+ char *outBuffer, u32 *outBufferLength,\r
+ u8 PaddingBits, u32 mmlevel)\r
+{\r
+\r
+ s32 got_pic;\r
OPENSVCFRAME pic;\r
- OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;
-
- if (!ES_ID || (ES_ID!=ctx->ES_ID) || !ctx->codec) {
- *outBufferLength = 0;
- return GF_OK;
- }
- if (*outBufferLength < ctx->out_size) {
- *outBufferLength = ctx->out_size;
- return GF_BUFFER_TOO_SMALL;
- }
-
- got_pic = 0;
- if (ctx->nalu_size_length) {
- u32 i, nalu_size = 0;
- u8 *ptr = inBuffer;
-
+ int Layer[4];\r
+ OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;\r
+\r
+ if (!ES_ID || (ES_ID!=ctx->ES_ID) || !ctx->codec) {\r
+ *outBufferLength = 0;\r
+ return GF_OK;\r
+ }\r
+ if (*outBufferLength < ctx->out_size) {\r
+ *outBufferLength = ctx->out_size;\r
+ return GF_BUFFER_TOO_SMALL;\r
+ }\r
+\r
+ got_pic = 0;\r
+ if (ctx->nalu_size_length) {\r
+ u32 i, nalu_size = 0;\r
+ u8 *ptr = inBuffer;\r
+\r
ctx->MaxDqId = GetDqIdMax(inBuffer, inBufferLength, ctx->nalu_size_length, ctx->DqIdTable, 1);\r
if(!ctx->InitParseAU){\r
if (ctx->MaxDqId == -1) {\r
//AVC stream in a h264 file \r
ctx->MaxDqId = 0;\r
} else {\r
-// ChangeOfLayer(ctx->MaxDqId, 2);\r
-// ParseCmd(h); //mplayer pb with slice. Slice on the upper layer, end_of_slice is equal to 1 in the slice header of the 5. so no switch Layer\r
-// \r
//Firts time only, we parse the first AU to know the file configuration\r
//does not need to ba called again ever after, unless SPS or PPS changed\r
- UpdateLayer(ctx->DqIdTable, &ctx->CurrDqId, ctx->MaxDqId, 0);\r
ParseAuPlayers(ctx->codec, inBuffer, inBufferLength, ctx->nalu_size_length, 1);\r
}\r
ctx->InitParseAU = 1;\r
}\r
-
- while (inBufferLength) {
- for (i=0; i<ctx->nalu_size_length; i++) {
- nalu_size = (nalu_size<<8) + ptr[i];
- }
- ptr += ctx->nalu_size_length;
+ SetCommandLayer(Layer, ctx->MaxDqId, ctx->CurrDqId, &ctx->TemporalCom, ctx->TemporalId);\r
+\r
+ while (inBufferLength) {\r
+ for (i=0; i<ctx->nalu_size_length; i++) {\r
+ nalu_size = (nalu_size<<8) + ptr[i];\r
+ }\r
+ ptr += ctx->nalu_size_length;\r
\r
if (!got_pic) \r
- got_pic = decodeNAL(ctx->codec, ptr, nalu_size, &pic, ctx->MaxDqId);\r
+ got_pic = decodeNAL(ctx->codec, ptr, nalu_size, &pic, Layer);\r
else\r
- decodeNAL(ctx->codec, ptr, nalu_size, &pic, ctx->MaxDqId);\r
+ decodeNAL(ctx->codec, ptr, nalu_size, &pic, Layer);\r
\r
ptr += nalu_size;\r
if (inBufferLength < nalu_size + ctx->nalu_size_length) break;\r
\r
inBufferLength -= nalu_size + ctx->nalu_size_length;\r
- }
- } else {
- }
- if (got_pic!=1) return GF_OK;
-
- if ((pic.Width != ctx->width) || (pic.Height!=ctx->height)) {
- ctx->width = pic.Width;
- ctx->stride = pic.Width + 32;
- ctx->height = pic.Height;
- ctx->out_size = ctx->stride * ctx->height * 3 / 2;
-
- /*always force layer resize*/
- *outBufferLength = ctx->out_size;
- return GF_BUFFER_TOO_SMALL;
- }
- *outBufferLength = ctx->out_size;
- memcpy(outBuffer, pic.pY[0], ctx->stride*ctx->height);
- memcpy(outBuffer + ctx->stride * ctx->height, pic.pU[0], ctx->stride*ctx->height/4);
- memcpy(outBuffer + 5*ctx->stride * ctx->height/4, pic.pV[0], ctx->stride*ctx->height/4);
-
- return GF_OK;
-}
-
-static Bool OSVC_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
-{
- if (StreamType != GF_STREAM_VISUAL) return 0;
- switch (ObjectType) {
- case GPAC_OTI_VIDEO_AVC:
- return 1;
- /*cap query*/
- case 0:
- return 1;
- }
- return 0;
-}
-
-static const char *OSVC_GetCodecName(GF_BaseDecoder *dec)
-{
- return "OpenSVC Decoder";
-}
-
-GF_BaseDecoder *NewOSVCDec()
-{
- GF_MediaDecoder *ifcd;
- OSVCDec *dec;
-
- GF_SAFEALLOC(ifcd, GF_MediaDecoder);
- GF_SAFEALLOC(dec, OSVCDec);
- GF_REGISTER_MODULE_INTERFACE(ifcd, GF_MEDIA_DECODER_INTERFACE, "OpenSVC Decoder", "gpac distribution")
-
- ifcd->privateStack = dec;
-
- /*setup our own interface*/
- ifcd->AttachStream = OSVC_AttachStream;
- ifcd->DetachStream = OSVC_DetachStream;
- ifcd->GetCapabilities = OSVC_GetCapabilities;
- ifcd->SetCapabilities = OSVC_SetCapabilities;
- ifcd->GetName = OSVC_GetCodecName;
- ifcd->CanHandleStream = OSVC_CanHandleStream;
- ifcd->ProcessData = OSVC_ProcessData;
- return (GF_BaseDecoder *) ifcd;
-}
-
-void DeleteOSVCDec(GF_BaseDecoder *ifcg)
-{
- OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;
- gf_free(ctx);
- gf_free(ifcg);
-}
-
-const u32 *QueryInterfaces()
-{
- static u32 si [] = {
-#ifndef GPAC_DISABLE_AV_PARSERS
- GF_MEDIA_DECODER_INTERFACE,
-#endif
- 0
- };
- return si;
-}
-
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
-{
-#ifndef GPAC_DISABLE_AV_PARSERS
- if (InterfaceType == GF_MEDIA_DECODER_INTERFACE) return (GF_BaseInterface *)NewOSVCDec();
-#endif
- return NULL;
-}
-
-void ShutdownInterface(GF_BaseInterface *ifce)
-{
- switch (ifce->InterfaceType) {
-#ifndef GPAC_DISABLE_AV_PARSERS
- case GF_MEDIA_DECODER_INTERFACE:
- DeleteOSVCDec((GF_BaseDecoder*)ifce);
- break;
-#endif
- }
-}
+ }\r
+ } else {\r
+ }\r
+ if (got_pic!=1) return GF_OK;\r
+\r
+ if ((pic.Width != ctx->width) || (pic.Height!=ctx->height)) {\r
+ ctx->width = pic.Width;\r
+ ctx->stride = pic.Width + 32;\r
+ ctx->height = pic.Height;\r
+ ctx->out_size = ctx->stride * ctx->height * 3 / 2;\r
+\r
+ /*always force layer resize*/\r
+ *outBufferLength = ctx->out_size;\r
+ return GF_BUFFER_TOO_SMALL;\r
+ }\r
+ *outBufferLength = ctx->out_size;\r
+ memcpy(outBuffer, pic.pY[0], ctx->stride*ctx->height);\r
+ memcpy(outBuffer + ctx->stride * ctx->height, pic.pU[0], ctx->stride*ctx->height/4);\r
+ memcpy(outBuffer + 5*ctx->stride * ctx->height/4, pic.pV[0], ctx->stride*ctx->height/4);\r
+\r
+ return GF_OK;\r
+}\r
+\r
+static Bool OSVC_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)\r
+{\r
+ if (StreamType != GF_STREAM_VISUAL) return 0;\r
+\r
+ /*media type query*/\r
+ if (!esd) return 1;\r
+\r
+ switch (esd->decoderConfig->objectTypeIndication) {\r
+ case GPAC_OTI_VIDEO_AVC:\r
+ if (esd->decoderConfig->decoderSpecificInfo && esd->decoderConfig->decoderSpecificInfo->data) {\r
+ Bool is_svc = 0;\r
+ u32 i, count;\r
+ GF_AVCConfig *cfg = gf_odf_avc_cfg_read(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);\r
+ if (!cfg) return 0;\r
+\r
+ /*decode all NALUs*/\r
+ count = gf_list_count(cfg->sequenceParameterSets);\r
+ for (i=0; i<count; i++) {\r
+ GF_AVCConfigSlot *slc = gf_list_get(cfg->sequenceParameterSets, i);\r
+ u8 nal_type = slc->data[0] & 0x1F;\r
+\r
+ if (nal_type==GF_AVC_NALU_SVC_SUBSEQ_PARAM) {\r
+ is_svc = 1;\r
+ break;\r
+ }\r
+ }\r
+ gf_odf_avc_cfg_del(cfg);\r
+ return is_svc;\r
+ }\r
+ return 1;\r
+ }\r
+ return 0;\r
+}\r
+\r
+static const char *OSVC_GetCodecName(GF_BaseDecoder *dec)\r
+{\r
+ return "OpenSVC Decoder";\r
+}\r
+\r
+GF_BaseDecoder *NewOSVCDec()\r
+{\r
+ GF_MediaDecoder *ifcd;\r
+ OSVCDec *dec;\r
+ \r
+ GF_SAFEALLOC(ifcd, GF_MediaDecoder);\r
+ GF_SAFEALLOC(dec, OSVCDec);\r
+ GF_REGISTER_MODULE_INTERFACE(ifcd, GF_MEDIA_DECODER_INTERFACE, "OpenSVC Decoder", "gpac distribution")\r
+\r
+ ifcd->privateStack = dec;\r
+\r
+ /*setup our own interface*/ \r
+ ifcd->AttachStream = OSVC_AttachStream;\r
+ ifcd->DetachStream = OSVC_DetachStream;\r
+ ifcd->GetCapabilities = OSVC_GetCapabilities;\r
+ ifcd->SetCapabilities = OSVC_SetCapabilities;\r
+ ifcd->GetName = OSVC_GetCodecName;\r
+ ifcd->CanHandleStream = OSVC_CanHandleStream;\r
+ ifcd->ProcessData = OSVC_ProcessData;\r
+ return (GF_BaseDecoder *) ifcd;\r
+}\r
+\r
+void DeleteOSVCDec(GF_BaseDecoder *ifcg)\r
+{\r
+ OSVCDec *ctx = (OSVCDec*) ifcg->privateStack;\r
+ gf_free(ctx);\r
+ gf_free(ifcg);\r
+}\r
+\r
+const u32 *QueryInterfaces() \r
+{\r
+ static u32 si [] = {\r
+#ifndef GPAC_DISABLE_AV_PARSERS\r
+ GF_MEDIA_DECODER_INTERFACE,\r
+#endif\r
+ 0\r
+ };\r
+ return si; \r
+}\r
+\r
+GF_BaseInterface *LoadInterface(u32 InterfaceType) \r
+{\r
+#ifndef GPAC_DISABLE_AV_PARSERS\r
+ if (InterfaceType == GF_MEDIA_DECODER_INTERFACE) return (GF_BaseInterface *)NewOSVCDec();\r
+#endif\r
+ return NULL;\r
+}\r
+\r
+void ShutdownInterface(GF_BaseInterface *ifce)\r
+{\r
+ switch (ifce->InterfaceType) {\r
+#ifndef GPAC_DISABLE_AV_PARSERS\r
+ case GF_MEDIA_DECODER_INTERFACE: \r
+ DeleteOSVCDec((GF_BaseDecoder*)ifce);\r
+ break;\r
+#endif\r
+ }\r
+}\r
vpath %.c $(SRC_PATH)/modules/oss_audio
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include $(OSS_CFLAGS)
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(OSS_CFLAGS)
LDFLAGS+=$(OSS_LDFLAGS)
ifeq ($(DEBUGBUILD), yes)
return NPT_SUCCESS;
}
+void GPAC_MediaController::OnMRStateVariablesChanged(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars )
+{
+ u32 count;
+ u32 i;
+ s32 render_idx = -1;
+
+ count = gf_list_count(m_MediaRenderers);
+ for (i=0; i<count; i++) {
+ GPAC_MediaRendererItem *mr = (GPAC_MediaRendererItem *) gf_list_get(m_MediaRenderers, i);
+ if ( mr->m_device.AsPointer() == service->GetDevice() ) {
+ render_idx = i;
+ break;
+ }
+ }
+ if (render_idx < 0) return;
+
+ count = vars->GetItemCount();
+ for (i=0; i<count; i++) {
+ PLT_StateVariable *svar;
+ vars->Get(i, svar);
+ if (svar->GetName() == NPT_String("AbsoluteTimePosition")) {
+ u32 h, m, s;
+ if (sscanf((char *) svar->GetValue(), "%d:%d:%d", &h, &m, &s)==3) {
+ Double time = h*3600 + m*60 + s;
+ this->m_pUPnP->onTimeChanged(render_idx, time);
+ }
+ }
+ else if (svar->GetName() == NPT_String("CurrentTrackDuration")) {
+ u32 h, m, s;
+ if (sscanf((char *) svar->GetValue(), "%d:%d:%d", &h, &m, &s)==3) {
+ Double time = h*3600 + m*60 + s;
+ this->m_pUPnP->onDurationChanged(render_idx, time);
+ }
+ }
+
+ }
+}
+
+
void GPAC_MediaController::OnBrowseResult(NPT_Result res, PLT_DeviceDataReference& device, PLT_BrowseInfo* info, void* userdata)
{
NPT_COMPILER_UNUSED(device);
// PLT_MediaControllerDelegate
virtual bool OnMRAdded(PLT_DeviceDataReference& device);
virtual void OnMRRemoved(PLT_DeviceDataReference& device);
- virtual void OnMRStateVariablesChanged(PLT_Service* /* service */, NPT_List<PLT_StateVariable*>* /* vars */) {};
-
+ virtual void OnMRStateVariablesChanged(PLT_Service* /* service */, NPT_List<PLT_StateVariable*>* /* vars */);
//PLT_MediaBrowserDelegate
virtual bool OnMSAdded(PLT_DeviceDataReference& device);
#ifdef GPAC_HAS_SPIDERMONKEY
-#define _SETUP_CLASS(the_class, cname, flag, getp, setp, fin) \
- memset(&the_class, 0, sizeof(the_class)); \
- the_class.name = cname; \
- the_class.flags = flag; \
- the_class.addProperty = JS_PropertyStub; \
- the_class.delProperty = JS_PropertyStub; \
- the_class.getProperty = getp; \
- the_class.setProperty = setp; \
- the_class.enumerate = JS_EnumerateStub; \
- the_class.resolve = JS_ResolveStub; \
- the_class.convert = JS_ConvertStub; \
- the_class.finalize = fin;
-
#if !defined(__GNUC__)
-# if defined(_WIN32_WCE)
-# pragma comment(lib, "js")
-# elif defined (WIN32)
# pragma comment(lib, "js32")
-# endif
#endif
#endif
void GF_UPnP::LockJavascript(Bool do_lock)
{
- gf_sg_lock_javascript(do_lock);
+ gf_sg_lock_javascript(m_pJSCtx, do_lock);
}
void GF_UPnP::OnStop(const char *src_url)
if (JSVAL_IS_OBJECT(funval)) {
JS_CallFunctionValue(m_pJSCtx, m_pObj, funval, 0, NULL, &rval);
if (JSVAL_IS_STRING(rval)) {
- res = JS_GetStringBytes(JSVAL_TO_STRING(rval));
+ char *_res = SMJS_CHARS(m_pJSCtx, rval);
+ res = _res;
+ SMJS_FREE(m_pJSCtx, _res);
}
}
LockJavascript(0);
{
}
+void GF_UPnP::onTimeChanged(s32 renderer_idx, Double time)
+{
+ if (m_renderer_bound) {
+#ifdef GPAC_HAS_SPIDERMONKEY
+ jsval funval, rval;
+ if (!m_pJSCtx) return;
+ LockJavascript(1);
+ JS_LookupProperty(m_pJSCtx, m_pObj, "onMediaTimeChanged", &funval);
+ if (JSVAL_IS_OBJECT(funval)) {
+ jsval argv[2];
+ argv[0] = INT_TO_JSVAL( renderer_idx);
+ argv[1] = DOUBLE_TO_JSVAL( JS_NewDouble(m_pJSCtx, time) );
+ JS_CallFunctionValue(m_pJSCtx, m_pObj, funval, 2, argv, &rval);
+ }
+ LockJavascript(0);
+ }
+#endif
+}
+
+void GF_UPnP::onDurationChanged(s32 renderer_idx, Double dur)
+{
+ if (m_renderer_bound) {
+#ifdef GPAC_HAS_SPIDERMONKEY
+ jsval funval, rval;
+ if (!m_pJSCtx) return;
+ LockJavascript(1);
+ JS_LookupProperty(m_pJSCtx, m_pObj, "onMediaDurationChanged", &funval);
+ if (JSVAL_IS_OBJECT(funval)) {
+ jsval argv[2];
+ argv[0] = INT_TO_JSVAL( renderer_idx);
+ argv[1] = DOUBLE_TO_JSVAL( JS_NewDouble(m_pJSCtx, dur) );
+ JS_CallFunctionValue(m_pJSCtx, m_pObj, funval, 2, argv, &rval);
+ }
+ LockJavascript(0);
+ }
+#endif
+}
+
+
Bool GF_UPnP::ProcessEvent(GF_Event *evt)
{
if (!m_pMediaRenderer) return 0;
return 0;
}
+Bool upnp_on_term_event(void *udta, GF_Event *evt, Bool consumed)
+{
+ GF_UPnP *upnp = (GF_UPnP *) udta;
+ if (!consumed && upnp) return upnp->ProcessEvent(evt);
+ return 0;
+}
void GF_UPnP::Load(GF_Terminal *term)
{
m_pPlatinum->AddCtrlPoint(m_ctrlPtRef);
}
+
+
+ gf_term_add_event_filter(term, &evt_filter);
+
//start UPnP engine
m_pPlatinum->Start();
LockJavascript(0);
}
-static JSBool upnpdevice_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool upnpdevice_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
char *prop_name;
GPAC_DeviceItem *dev = (GPAC_DeviceItem *)JS_GetPrivate(c, obj);
if (!dev) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (!strcmp(prop_name, "Name")) {
*vp = STRING_TO_JSVAL( JS_NewStringCopyZ(c, dev->m_device->GetFriendlyName()) );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "UUID")) {
+ else if (!strcmp(prop_name, "UUID")) {
*vp = STRING_TO_JSVAL( JS_NewStringCopyZ(c, dev->m_device->GetUUID()) );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "PresentationURL")) {
+ else if (!strcmp(prop_name, "PresentationURL")) {
*vp = STRING_TO_JSVAL( JS_NewStringCopyZ(c, dev->m_device->m_PresentationURL) );
- return JS_TRUE;
}
-
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
static JSBool upnp_device_subscribe(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
PLT_Service* service;
- char *service_uuid = "";
+ char *service_uuid;
GPAC_DeviceItem *item = (GPAC_DeviceItem *)JS_GetPrivate(c, obj);
if (!item || (argc!=2) ) return JS_FALSE;
if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
if (!JSVAL_IS_OBJECT(argv[1])) return JS_FALSE;
- service_uuid = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ service_uuid = SMJS_CHARS(c, argv[0]);
if (item->m_device->FindServiceByType(service_uuid, service) == NPT_SUCCESS) {
item->m_pUPnP->m_pGenericController->m_CtrlPoint->Subscribe(service);
}
+ SMJS_FREE(c, service_uuid);
return JS_TRUE;
}
-static JSBool upnp_device_find_service(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_device_find_service)
{
- char *service_uuid = "";
+ char *service_uuid;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_DeviceItem *item = (GPAC_DeviceItem *)JS_GetPrivate(c, obj);
if (!item || !argc) return JS_FALSE;
- service_uuid = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ service_uuid = SMJS_CHARS(c, argv[0]);
GPAC_ServiceItem *serv = item->FindService(service_uuid);
+ SMJS_FREE(c, service_uuid);
if (!serv) {
- *rval = JSVAL_NULL;
+ SMJS_SET_RVAL( JSVAL_NULL );
return JS_TRUE;
}
- *rval = OBJECT_TO_JSVAL(serv->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(serv->obj) );
return JS_TRUE;
}
item->js_ctx = m_pJSCtx;
item->obj = JS_NewObject(m_pJSCtx, &upnpGenericDeviceClass, 0, 0);
item->m_pUPnP = this;
- gf_js_add_root(m_pJSCtx, &item->obj);
+ gf_js_add_root(m_pJSCtx, &item->obj, GF_JSGC_OBJECT);
JS_SetPrivate(item->js_ctx, item->obj, item);
}
LockJavascript(0);
}
-static JSBool upnp_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool upnp_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
char *prop_name;
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (!strcmp(prop_name, "MediaRendererEnabled")) {
*vp = BOOLEAN_TO_JSVAL( upnp->m_pMediaRenderer ? JS_TRUE : JS_FALSE );
- return JS_TRUE;
}
- if (!strcmp(prop_name, "MediaServerEnabled")) {
+ else if (!strcmp(prop_name, "MediaServerEnabled")) {
*vp = BOOLEAN_TO_JSVAL( upnp->m_pMediaServer ? JS_TRUE : JS_FALSE);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "MediaControlEnabled")) {
+ else if (!strcmp(prop_name, "MediaControlEnabled")) {
*vp = BOOLEAN_TO_JSVAL( upnp->m_pAVCtrlPoint ? JS_TRUE : JS_FALSE);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "MediaServersCount")) {
+ else if (!strcmp(prop_name, "MediaServersCount")) {
*vp = INT_TO_JSVAL( upnp->m_pAVCtrlPoint ? gf_list_count(upnp->m_pAVCtrlPoint->m_MediaServers) : 0);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "MediaRenderersCount")) {
+ else if (!strcmp(prop_name, "MediaRenderersCount")) {
*vp = INT_TO_JSVAL( upnp->m_pAVCtrlPoint ? gf_list_count(upnp->m_pAVCtrlPoint->m_MediaRenderers) : 0);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "DevicesCount")) {
+ else if (!strcmp(prop_name, "DevicesCount")) {
*vp = INT_TO_JSVAL( upnp->m_pGenericController ? gf_list_count(upnp->m_pGenericController->m_Devices) : 0);
- return JS_TRUE;
}
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool upnp_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool upnp_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
char *prop_name;
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (upnp->m_pMediaRenderer ) {
jsdouble d;
JS_ValueToNumber(c, *vp, &d);
upnp->m_pMediaRenderer->SetDuration(d, 1);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "MovieTime") && JSVAL_IS_DOUBLE(*vp)) {
+ else if (!strcmp(prop_name, "MovieTime") && JSVAL_IS_DOUBLE(*vp)) {
jsdouble d;
JS_ValueToNumber(c, *vp, &d);
upnp->m_pMediaRenderer->SetTime(d);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "MovieURL") && JSVAL_IS_STRING(*vp) ) {
- const char *url = JS_GetStringBytes(JSVAL_TO_STRING(*vp));
+ else if (!strcmp(prop_name, "MovieURL") && JSVAL_IS_STRING(*vp) ) {
+ char *url = SMJS_CHARS(c, *vp);
if (url) upnp->m_pMediaRenderer->SetConnected(url);
- return JS_TRUE;
+ SMJS_FREE(c, url);
}
}
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool upnp_get_device(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_get_device)
{
u32 idx;
GPAC_DeviceItem *device;
-
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || !argc || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE;
device->js_ctx = upnp->m_pJSCtx;
device->obj = JS_NewObject(upnp->m_pJSCtx, &upnp->upnpGenericDeviceClass, 0, 0);
device->m_pUPnP = upnp;
- gf_js_add_root(upnp->m_pJSCtx, &device->obj);
+ gf_js_add_root(upnp->m_pJSCtx, &device->obj, GF_JSGC_OBJECT);
JS_SetPrivate(device->js_ctx, device->obj, device);
}
- *rval = OBJECT_TO_JSVAL(device->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(device->obj) );
return JS_TRUE;
}
-
-static JSBool upnp_find_service(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_find_service)
{
- const char *dev_ip;
- const char *serv_name;
-
+ char *dev_ip;
+ char *serv_name;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc!=2) || !JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_STRING(argv[1]) ) return JS_FALSE;
- dev_ip = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- serv_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- *rval = JSVAL_NULL;
- if (!dev_ip || !serv_name || !upnp->m_pGenericController) return JS_TRUE;
+ dev_ip = SMJS_CHARS(c, argv[0]);
+ serv_name = SMJS_CHARS(c, argv[1]);
+ SMJS_SET_RVAL(JSVAL_NULL);
+ if (!dev_ip || !serv_name || !upnp->m_pGenericController) {
+ SMJS_FREE(c, dev_ip);
+ SMJS_FREE(c, serv_name);
+ return JS_TRUE;
+ }
u32 i, count = gf_list_count(upnp->m_pGenericController->m_Devices);
for (i=0; i<count; i++) {
GPAC_DeviceItem *item = (GPAC_DeviceItem *) gf_list_get(upnp->m_pGenericController->m_Devices, i);
- if (item->m_device->GetURLBase().GetHost() == dev_ip) {
+ if (item->m_device->GetURLBase().GetHost() == (const char *)dev_ip) {
GPAC_ServiceItem *serv = item->FindService(serv_name);
if (serv) {
- *rval = OBJECT_TO_JSVAL(serv->obj);
- return JS_TRUE;
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(serv->obj) );
+ break;
}
}
}
+ SMJS_FREE(c, dev_ip);
+ SMJS_FREE(c, serv_name);
return JS_TRUE;
}
static GPAC_MediaRendererItem *upnp_renderer_get_device(GF_UPnP *upnp , JSContext *c, JSObject *obj)
{
- const char *uuid;
+ char *uuid;
jsval val;
u32 i, count;
GPAC_MediaRendererItem *render;
if (!JS_LookupProperty(c, obj, "UUID", &val) || JSVAL_IS_NULL(val) || JSVAL_IS_VOID(val) )
return NULL;
- uuid = JS_GetStringBytes(JSVAL_TO_STRING(val));
+ uuid = SMJS_CHARS(c, val);
if (!uuid) return NULL;
count = gf_list_count(upnp->m_pAVCtrlPoint->m_MediaRenderers);
for (i=0; i<count; i++) {
render = (GPAC_MediaRendererItem *)gf_list_get(upnp->m_pAVCtrlPoint->m_MediaRenderers, i);
- if (render->m_UUID==uuid) return render;
+ if (render->m_UUID==(const char *)uuid) {
+ SMJS_FREE(c, uuid);
+ return render;
+ }
}
+ SMJS_FREE(c, uuid);
return NULL;
}
static GPAC_MediaServerItem *upnp_server_get_device(GF_UPnP *upnp , JSContext *c, JSObject *obj)
{
- const char *uuid;
+ char *uuid;
jsval val;
u32 i, count;
GPAC_MediaServerItem *server;
if (!JS_LookupProperty(c, obj, "UUID", &val) || JSVAL_IS_NULL(val) || JSVAL_IS_VOID(val) )
return NULL;
- uuid = JS_GetStringBytes(JSVAL_TO_STRING(val));
+ uuid = SMJS_CHARS(c, val);
if (!uuid) return NULL;
count = gf_list_count(upnp->m_pAVCtrlPoint->m_MediaServers);
for (i=0; i<count; i++) {
server = (GPAC_MediaServerItem *)gf_list_get(upnp->m_pAVCtrlPoint->m_MediaServers, i);
- if (server->m_UUID==uuid) return server;
+ if (server->m_UUID==(const char *)uuid) {
+ SMJS_FREE(c, uuid);
+ return server;
+ }
}
+ SMJS_FREE(c, uuid);
return NULL;
}
-static JSBool upnp_renderer_open(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_renderer_open)
{
JSObject *sobj, *fobj;
jsval val;
GPAC_MediaRendererItem *render;
GPAC_MediaServerItem *server;
- const char *item, *resource_url;
+ char *item, *resource_url;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc<1) ) return JS_FALSE;
if (JSVAL_IS_OBJECT(argv[0])) {
fobj = JSVAL_TO_OBJECT(argv[0]);
if (!JS_LookupProperty(c, fobj, "ObjectID", &val) || JSVAL_IS_NULL(val) || !JSVAL_IS_STRING(val)) return JS_TRUE;
- item = JS_GetStringBytes(JSVAL_TO_STRING(val));
+ item = SMJS_CHARS(c, val);
}
else if (JSVAL_IS_STRING(argv[0]))
- resource_url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ resource_url = SMJS_CHARS(c, argv[0]);
- if (!item && !resource_url) return JS_TRUE;
- if (item && !server) return JS_TRUE;
+ if (!item && !resource_url) {
+ SMJS_FREE(c, item);
+ SMJS_FREE(c, resource_url);
+ return JS_TRUE;
+ }
+ if (item && !server) {
+ SMJS_FREE(c, item);
+ SMJS_FREE(c, resource_url);
+ return JS_TRUE;
+ }
if (NPT_SUCCEEDED(render->m_device->FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service))) {
if (resource_url) {
}
}
}
+ SMJS_FREE(c, item);
+ SMJS_FREE(c, resource_url);
return JS_TRUE;
}
-static JSBool upnp_renderer_playback(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, u32 act_type)
+static JSBool SMJS_FUNCTION_EXT(upnp_renderer_playback, u32 act_type)
{
char szSpeed[20];
GPAC_MediaRendererItem *render;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp) return JS_FALSE;
}
return JS_TRUE;
}
-static JSBool upnp_renderer_play(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_renderer_play)
{
- return upnp_renderer_playback(c, obj, argc, argv, rval, 0);
+ return upnp_renderer_playback(SMJS_CALL_ARGS, 0);
}
-static JSBool upnp_renderer_pause(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_renderer_pause)
{
- return upnp_renderer_playback(c, obj, argc, argv, rval, 1);
+ return upnp_renderer_playback(SMJS_CALL_ARGS, 1);
}
-static JSBool upnp_renderer_stop(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_renderer_stop)
{
- return upnp_renderer_playback(c, obj, argc, argv, rval, 2);
+ return upnp_renderer_playback(SMJS_CALL_ARGS, 2);
}
-static JSBool upnp_renderer_seek(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_renderer_seek)
{
- return upnp_renderer_playback(c, obj, argc, argv, rval, 3);
+ return upnp_renderer_playback(SMJS_CALL_ARGS, 3);
}
-static JSBool upnp_get_renderer(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_get_renderer)
{
JSObject *s_obj;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || !upnp->m_pAVCtrlPoint || (argc!=1) ) return JS_FALSE;
}
else if (JSVAL_IS_STRING(argv[0])) {
u32 i=0;
- const char *uuid = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ char *uuid = SMJS_CHARS(c, argv[0]);
while ((mr = (GPAC_MediaRendererItem *) gf_list_enum(upnp->m_pAVCtrlPoint->m_MediaRenderers, &i))) {
- if (mr->m_UUID==uuid) break;
+ if (mr->m_UUID==(const char *)uuid) break;
}
+ SMJS_FREE(c, uuid);
}
if (!mr) return JS_FALSE;
JS_DefineFunction(c, s_obj, "Stop", upnp_renderer_stop, 0, 0);
JS_DefineFunction(c, s_obj, "Seek", upnp_renderer_seek, 0, 0);
- *rval = OBJECT_TO_JSVAL(s_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(s_obj) );
return JS_TRUE;
}
-static JSBool upnp_server_browse(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_server_browse)
{
NPT_String parent;
GPAC_MediaServerItem *server;
- const char *dir, *filter;
+ char *dir, *filter, *_dir, *_filter;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc!=2) ) return JS_FALSE;
server = upnp_server_get_device(upnp, c, obj);
if (!server) return JS_FALSE;
- dir = JSVAL_IS_NULL(argv[0]) ? NULL : JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ _dir = _filter = NULL;
+
+ dir = _dir = SMJS_CHARS(c, argv[0]);
if (!dir) dir = "0";
- filter = JSVAL_IS_NULL(argv[1]) ? NULL : JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ filter = _filter = SMJS_CHARS(c, argv[1]);
if (!filter) filter = "*";
PLT_Service* service;
server->m_ParentDirectories.Clear();
}
if (!strcmp(dir, "..")) {
- if (!server->m_ParentDirectories.GetItemCount()) return JS_FALSE;
+ if (!server->m_ParentDirectories.GetItemCount()) {
+ SMJS_FREE(c, _dir);
+ SMJS_FREE(c, _filter);
+ return JS_FALSE;
+ }
server->m_ParentDirectories.Pop(parent);
server->m_ParentDirectories.Peek(parent);
dir=parent;
upnp->m_pAVCtrlPoint->Browse(server, dir, filter);
- jsval rval = INT_TO_JSVAL(0);
+ jsval aval = INT_TO_JSVAL(0);
if (!server->m_BrowseResults.IsNull()) {
- rval = INT_TO_JSVAL(server->m_BrowseResults->GetItemCount());
+ aval = INT_TO_JSVAL(server->m_BrowseResults->GetItemCount());
}
- JS_SetProperty(c, obj, "FilesCount", &rval);
+ JS_SetProperty(c, obj, "FilesCount", &aval);
}
-
+ SMJS_FREE(c, _dir);
+ SMJS_FREE(c, _filter);
return JS_TRUE;
}
-static JSBool upnp_server_has_parent_dir(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_server_has_parent_dir)
{
GPAC_MediaServerItem *server;
+ SMJS_OBJ
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp) return JS_FALSE;
server = upnp_server_get_device(upnp, c, obj);
if (!server) return JS_TRUE;
- *rval = BOOLEAN_TO_JSVAL( server->m_ParentDirectories.GetItemCount() ? JS_TRUE : JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( server->m_ParentDirectories.GetItemCount() ? JS_TRUE : JS_FALSE));
return JS_TRUE;
}
-static JSBool upnp_server_get_resource_uri(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_server_get_resource_uri)
{
u32 idx;
+ SMJS_OBJ
+ SMJS_ARGS
PLT_MediaObject *mo = (PLT_MediaObject *)JS_GetPrivate(c, obj);
if (!mo || (argc!=1) || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE;
idx = JSVAL_TO_INT(argv[0]);
if (idx<mo->m_Resources.GetItemCount()) {
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, mo->m_Resources[idx].m_Uri));
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, mo->m_Resources[idx].m_Uri)));
} else {
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, ""));
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, "")));
}
return JS_TRUE;
}
-static JSBool upnp_server_get_file(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_server_get_file)
{
GPAC_MediaServerItem *server;
u32 id;
JSObject *f_obj;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc!=1) || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE;
JS_DefineProperty(c, f_obj, "ResourceCount", INT_TO_JSVAL(mo->m_Resources.GetItemCount()), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(c, f_obj, "GetResourceURI", upnp_server_get_resource_uri, 1, 0);
}
- *rval = OBJECT_TO_JSVAL(f_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(f_obj));
return JS_TRUE;
}
-static JSBool upnp_server_get_file_uri(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_server_get_file_uri)
{
GPAC_MediaServerItem *server;
u32 id;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc!=1) || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE;
if (!mo) return JS_TRUE;
if (mo->m_Resources.GetItemCount()) {
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, mo->m_Resources[0].m_Uri) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, mo->m_Resources[0].m_Uri) ) );
}
return JS_TRUE;
}
-static JSBool upnp_get_server(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_get_server)
{
JSObject *s_obj;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || !upnp->m_pAVCtrlPoint || (argc!=1)) return JS_FALSE;
}
else if (JSVAL_IS_STRING(argv[0])) {
u32 i=0;
- const char *uuid = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ char *uuid = SMJS_CHARS(c, argv[0]);
while ((ms = (GPAC_MediaServerItem *) gf_list_enum(upnp->m_pAVCtrlPoint->m_MediaServers, &i))) {
- if (ms->m_UUID==uuid) break;
+ if (ms->m_UUID==(const char *)uuid) break;
}
+ SMJS_FREE(c, uuid);
}
if (!ms) return JS_FALSE;
s_obj = JS_NewObject(c, &upnp->upnpDeviceClass, 0, 0);
JS_DefineFunction(c, s_obj, "HasParentDirectory", upnp_server_has_parent_dir, 0, 0);
- *rval = OBJECT_TO_JSVAL(s_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(s_obj) );
return JS_TRUE;
}
-static JSBool upnp_bind_renderer(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_bind_renderer)
{
+ SMJS_OBJ
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp) return JS_TRUE;
upnp->m_renderer_bound = 1;
/*remove ourselves from the event filters since we will only be called through JS*/
- gf_term_unregister_event_filter(upnp->m_pTerm, upnp->term_ext);
+ gf_term_remove_event_filter(upnp->m_pTerm, &upnp->evt_filter);
return JS_TRUE;
}
-static JSBool upnp_share_resource(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_share_resource)
{
- const char *url, *host;
+ char *url, *host;
NPT_String resourceURI;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || !upnp->m_pMediaServer || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_TRUE;
- url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ url = SMJS_CHARS(c, argv[0]);
if (!url) return JS_TRUE;
host = NULL;
if (argc && JSVAL_IS_STRING(argv[1]) ) {
- host = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ host = SMJS_CHARS(c, argv[1]);
}
resourceURI = upnp->m_pMediaServer->GetResourceURI(url, host);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(upnp->m_pJSCtx, resourceURI ) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(upnp->m_pJSCtx, resourceURI ) ));
+
+ SMJS_FREE(c, url);
+ SMJS_FREE(c, host);
return JS_TRUE;
}
-static JSBool upnp_share_virtual_resource(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_share_virtual_resource)
{
Bool temp = 0;
- const char *res_url, *res_val, *mime;
+ char *res_url, *res_val, *mime;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || !upnp->m_pMediaServer || (argc<2) || !JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_STRING(argv[1]) ) return JS_TRUE;
- res_url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ res_url = SMJS_CHARS(c, argv[0]);
if (!res_url) return JS_TRUE;
- res_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- if (!res_val) return JS_TRUE;
-
- mime = "application/octet-stream";
- if (argc==3) mime = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
+ res_val = SMJS_CHARS(c, argv[1]);
+ if (!res_val) {
+ SMJS_FREE(c, res_url);
+ return JS_TRUE;
+ }
+ mime = NULL;
+ if (argc==3) mime = SMJS_CHARS(c, argv[2]);
if ((argc==4) && JSVAL_IS_BOOLEAN(argv[3]) && (JSVAL_TO_BOOLEAN(argv[3])==JS_TRUE) ) temp = 1;;
- upnp->m_pMediaServer->ShareVirtualResource(res_url, res_val, mime, temp);
+ upnp->m_pMediaServer->ShareVirtualResource(res_url, res_val, mime ? mime : "application/octet-stream", temp);
+ SMJS_FREE(c, res_url);
+ SMJS_FREE(c, res_val);
+ SMJS_FREE(c, mime);
return JS_TRUE;
}
static NPT_UInt8 GENERIC_SCPDXML[] = "<scpd xmlns=\"urn:schemas-upnp-org:service-1-0\"><specVersion> <major>1</major> <minor>0</minor> </specVersion> <actionList> <action> <name>GetStatus</name> <argumentList> <argument> <name>ResultStatus</name> <direction>out</direction> <relatedStateVariable>Status</relatedStateVariable> </argument> </argumentList> </action> </actionList> <serviceStateTable> <stateVariable sendEvents=\"yes\"> <name>Status</name> <dataType>boolean</dataType> </stateVariable></serviceStateTable> </scpd>";
-static JSBool upnp_device_setup_service(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_device_setup_service)
{
char *name, *type, *id, *scpd_xml;
+ NPT_Result res;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj);
if (!device) return JS_FALSE;
if (argc<3) return JS_FALSE;
- name = NULL;
- if (JSVAL_IS_STRING(argv[0])) name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- if (!name) return JS_FALSE;
-
- type = NULL;
- if (JSVAL_IS_STRING(argv[1])) type = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- if (!type) return JS_FALSE;
+ name = SMJS_CHARS(c, argv[0]);
+ type = SMJS_CHARS(c, argv[1]);
+ id = SMJS_CHARS(c, argv[2]);
- id = NULL;
- if (JSVAL_IS_STRING(argv[2])) id = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
- if (!id) return JS_FALSE;
+ if (!name || !type || !id) {
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, type);
+ SMJS_FREE(c, id);
+ return JS_FALSE;
+ }
scpd_xml = NULL;
- if ((argc>3) && JSVAL_IS_STRING(argv[3])) scpd_xml = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
- if (!scpd_xml) scpd_xml = (char *)GENERIC_SCPDXML;
-
+ if ((argc>3) && JSVAL_IS_STRING(argv[3])) scpd_xml = SMJS_CHARS(c, argv[3]);
GPAC_Service* service = new GPAC_Service(device, type, id);
- if (service->SetSCPDXML((const char*)scpd_xml) != NPT_SUCCESS) {
- delete service;
- return JS_FALSE;
- }
- if (service->InitURLs(name, device->GetUUID() ) != NPT_SUCCESS) {
+ res = service->SetSCPDXML((const char*) scpd_xml ? scpd_xml : (char *)GENERIC_SCPDXML);
+ if (res == NPT_SUCCESS) res = service->InitURLs(name, device->GetUUID() );
+
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, type);
+ SMJS_FREE(c, id);
+
+ if (res != NPT_SUCCESS) {
delete service;
return JS_FALSE;
}
+
gf_list_add(device->m_pServices, service);
service->SetupJS(c, device->m_pUPnP, device->obj);
- *rval = OBJECT_TO_JSVAL(service->m_pObj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(service->m_pObj) );
return JS_TRUE;
}
-
-static JSBool upnp_device_start(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_device_start)
{
jsval sval;
char *str;
+ SMJS_OBJ
GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj);
if (!device) return JS_FALSE;
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "PresentationURL", &sval) && JSVAL_IS_STRING(sval)) {
- str = JS_GetStringBytes(JSVAL_TO_STRING(sval));
+ str = SMJS_CHARS(c, sval);
char *url = gf_url_concatenate(device->js_source, str);
+ SMJS_FREE(c, str);
/*we will use our media server to exchange the URL if file based
!!! THIS IS BROKEN IF MULTIPLE INTERFACES EXIST ON THE DEVICE !!!
str = NULL;
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "ModelDescription", &sval) && JSVAL_IS_STRING(sval))
- str = JS_GetStringBytes(JSVAL_TO_STRING(sval));
+ str = SMJS_CHARS(c, sval);
+
device->m_ModelDescription = str ? str : "GPAC Generic Device";
+ SMJS_FREE(c, str);
str = NULL;
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "ModelURL", &sval) && JSVAL_IS_STRING(sval))
- str = JS_GetStringBytes(JSVAL_TO_STRING(sval));
+ str = SMJS_CHARS(c, sval);
device->m_ModelURL = str ? str : "http://gpac.sourceforge.net";
+ SMJS_FREE(c, str);
str = NULL;
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "ModelNumber", &sval) && JSVAL_IS_STRING(sval))
- str = JS_GetStringBytes(JSVAL_TO_STRING(sval));
+ str = SMJS_CHARS(c, sval);
device->m_ModelNumber = str ? str : GPAC_FULL_VERSION;
+ SMJS_FREE(c, str);
str = NULL;
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "ModelName", &sval) && JSVAL_IS_STRING(sval))
- str = JS_GetStringBytes(JSVAL_TO_STRING(sval));
+ str = SMJS_CHARS(c, sval);
device->m_ModelName = str ? str : "GPAC Generic Device";
+ SMJS_FREE(c, str);
device->m_Manufacturer = "Telecom ParisTech";
device->m_ManufacturerURL = "http://www.telecom-paristech.fr/";
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "Run", &sval) && JSVAL_IS_OBJECT(sval)) {
device->obj = obj;
device->run_proc = sval;
- gf_js_add_root(device->m_pUPnP->m_pJSCtx, &device->run_proc);
+ gf_js_add_root(device->m_pUPnP->m_pJSCtx, &device->run_proc, GF_JSGC_VAL);
}
if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "OnAction", &sval) && JSVAL_IS_OBJECT(sval)) {
device->obj = obj;
device->act_proc = sval;
- gf_js_add_root(device->m_pUPnP->m_pJSCtx, &device->act_proc);
+ gf_js_add_root(device->m_pUPnP->m_pJSCtx, &device->act_proc, GF_JSGC_VAL);
}
PLT_DeviceHostReference devRef(device);
device->m_pUPnP->m_pPlatinum->AddDevice(devRef);
return JS_TRUE;
}
-static JSBool upnp_device_stop(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_device_stop)
{
+ SMJS_OBJ
GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj);
if (!device) return JS_FALSE;
device->js_source = "";
device->obj = JS_NewObject(upnp->m_pJSCtx, &upnp->upnpDeviceClass, 0, global);
- gf_js_add_root(upnp->m_pJSCtx, &device->obj);
+ gf_js_add_root(upnp->m_pJSCtx, &device->obj, GF_JSGC_OBJECT);
JS_DefineProperty(upnp->m_pJSCtx, device->obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(upnp->m_pJSCtx, name) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(upnp->m_pJSCtx, device->obj, "ID", STRING_TO_JSVAL( JS_NewStringCopyZ(upnp->m_pJSCtx, id) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
return device;
}
-static JSBool upnp_create_device(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_create_device)
{
GPAC_GenericDevice *device;
- const char *id, *name;
+ char *id, *name;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc != 2)) return JS_FALSE;
- id = NULL;
- if (JSVAL_IS_STRING(argv[0])) id = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- name = NULL;
- if (JSVAL_IS_STRING(argv[1])) name = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- if (!id || !name) return JS_FALSE;
+ id = SMJS_CHARS(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
+ if (!id || !name) {
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, id);
+ return JS_FALSE;
+ }
device = upnp_create_generic_device(upnp, NULL, id, name);
if (device)
- *rval = OBJECT_TO_JSVAL(device->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(device->obj) );
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, id);
return JS_TRUE;
}
-static JSBool upnp_delete_device(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_delete_device)
{
GPAC_GenericDevice *device;
+ SMJS_OBJ
+ SMJS_ARGS
GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj);
if (!upnp || (argc != 1)) return JS_FALSE;
{0, 0, 0, 0, 0}
};
JSFunctionSpec upnpClassFuncs[] = {
- {"BindRenderer", upnp_bind_renderer, 0, 0, 0},
- {"GetMediaServer", upnp_get_server, 1, 0, 0},
- {"GetMediaRenderer", upnp_get_renderer, 1, 0, 0},
- {"ShareResource", upnp_share_resource, 1, 0, 0},
- {"ShareVirtualResource", upnp_share_virtual_resource, 2, 0, 0},
- {"GetDevice", upnp_get_device, 1, 0, 0},
- {"FindService", upnp_find_service, 1, 0, 0},
- {"CreateDevice", upnp_create_device, 2, 0, 0},
- {"DeleteDevice", upnp_delete_device, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("BindRenderer", upnp_bind_renderer, 0),
+ SMJS_FUNCTION_SPEC("GetMediaServer", upnp_get_server, 1),
+ SMJS_FUNCTION_SPEC("GetMediaRenderer", upnp_get_renderer, 1),
+ SMJS_FUNCTION_SPEC("ShareResource", upnp_share_resource, 1),
+ SMJS_FUNCTION_SPEC("ShareVirtualResource", upnp_share_virtual_resource, 2),
+ SMJS_FUNCTION_SPEC("GetDevice", upnp_get_device, 1),
+ SMJS_FUNCTION_SPEC("FindService", upnp_find_service, 1),
+ SMJS_FUNCTION_SPEC("CreateDevice", upnp_create_device, 2),
+ SMJS_FUNCTION_SPEC("DeleteDevice", upnp_delete_device, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
if (param->unload) {
return 0;
}
if (m_nbJSInstances) {
+ /*FIXME - this was possible in previous version of SpiderMonkey, don't know how to fix that for new ones*/
+#if (JS_VERSION>=185)
m_nbJSInstances++;
+ return 0;
+#else
JS_DefineProperty((JSContext*)param->ctx, (JSObject*)param->global, "UPnP", OBJECT_TO_JSVAL(m_pObj), 0, 0, 0);
+ m_nbJSInstances++;
+#endif
return 0;
}
m_pJSCtx = (JSContext*)param->ctx;
/*setup JS bindings*/
- _SETUP_CLASS(upnpClass, "UPNPMANAGER", JSCLASS_HAS_PRIVATE, upnp_getProperty, upnp_setProperty, JS_FinalizeStub);
+ JS_SETUP_CLASS(upnpClass, "UPNPMANAGER", JSCLASS_HAS_PRIVATE, upnp_getProperty, upnp_setProperty, JS_FinalizeStub);
JS_InitClass(m_pJSCtx, (JSObject*)param->global, 0, &upnpClass, 0, 0, upnpClassProps, upnpClassFuncs, 0, 0);
m_pObj = JS_DefineObject(m_pJSCtx, (JSObject*)param->global, "UPnP", &upnpClass, 0, 0);
JS_SetPrivate(m_pJSCtx, m_pObj, this);
- _SETUP_CLASS(upnpDeviceClass, "UPNPAVDEVICE", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub, JS_FinalizeStub);
+ JS_SETUP_CLASS(upnpDeviceClass, "UPNPAVDEVICE", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
/*setup JS bindings*/
JSPropertySpec upnpDeviceClassProps[] = {
{0, 0, 0, 0, 0}
};
JSFunctionSpec upnpDeviceClassFuncs[] = {
- {"FindService", upnp_device_find_service, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("FindService", upnp_device_find_service, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
- _SETUP_CLASS(upnpGenericDeviceClass, "UPNPDEVICE", JSCLASS_HAS_PRIVATE, upnpdevice_getProperty, JS_PropertyStub, JS_FinalizeStub);
+ JS_SETUP_CLASS(upnpGenericDeviceClass, "UPNPDEVICE", JSCLASS_HAS_PRIVATE, upnpdevice_getProperty, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_InitClass(m_pJSCtx, (JSObject*)param->global, 0, &upnpGenericDeviceClass, 0, 0, upnpDeviceClassProps, upnpDeviceClassFuncs, 0, 0);
- _SETUP_CLASS(upnpServiceClass, "UPNPSERVICEDEVICE", JSCLASS_HAS_PRIVATE, upnpservice_getProperty, JS_PropertyStub, JS_FinalizeStub);
+ JS_SETUP_CLASS(upnpServiceClass, "UPNPSERVICEDEVICE", JSCLASS_HAS_PRIVATE, upnpservice_getProperty, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_InitClass(m_pJSCtx, (JSObject*)param->global, 0, &upnpServiceClass, 0, 0, 0, 0, 0, 0);
-
m_nbJSInstances=1;
upnp_init_time = gf_sys_clock();
device->js_source = szFile;
jsval aval;
- fseek(f, 0, SEEK_END);
- u32 size = ftell(f);
- fseek(f, 0, SEEK_SET);
+ gf_f64_seek(f, 0, SEEK_END);
+ u32 size = (u32) gf_f64_tell(f);
+ gf_f64_seek(f, 0, SEEK_SET);
char *buf = (char*)gf_malloc(sizeof(char)*(size+1));
size = fread(buf, 1, size, f);
buf[size]=0;
/*evaluate the script on the object only*/
if (JS_EvaluateScript(m_pJSCtx, device->obj, buf, size, 0, 0, &aval) != JS_TRUE) {
- gf_js_remove_root(m_pJSCtx, &device->obj);
+ gf_js_remove_root(m_pJSCtx, &device->obj, GF_JSGC_OBJECT);
GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[UPnP] Unable to load device %s: script error in %s\n", szFriendlyName, szFile));
gf_list_del_item(m_Devices, device);
delete device;
#endif
break;
- case GF_TERM_EXT_EVENT:
- return upnp->ProcessEvent((GF_Event*)param);
#ifdef GPAC_HAS_SPIDERMONKEY
case GF_TERM_EXT_JSBIND:
return upnp->LoadJS((GF_TermExtJS*)param);
ext = new GF_UPnP();
dr->udta = ext;
ext->term_ext = dr;
+ ext->evt_filter.on_event = upnp_on_term_event;
+ ext->evt_filter.udta = ext;
- dr->caps = GF_TERM_EXTENSION_FILTER_EVENT | GF_TERM_EXTENSION_NOT_THREADED;
+ dr->caps = GF_TERM_EXTENSION_NOT_THREADED;
#ifdef GPAC_HAS_SPIDERMONKEY
dr->caps |= GF_TERM_EXTENSION_JS;
#endif
#ifdef GPAC_HAS_SPIDERMONKEY
#include <gpac/internal/scenegraph_dev.h>
-#include <jsapi.h>
+#include <gpac/internal/smjs_api.h>
#endif
void OnStop(const char *src_url);
void OnSeek(Double time);
void OnSetPlayMode(const char *src_url);
+ void onDurationChanged(s32 renderer_idx, Double dur);
+ void onTimeChanged(s32 renderer_idx, Double time);
void ContainerChanged(PLT_DeviceDataReference& device, const char *item_id, const char *update_id);
NPT_String OnMigrate();
PLT_CtrlPoint *m_pCtrlPoint;
PLT_CtrlPointReference m_ctrlPtRef;
+ GF_TermEventFilter evt_filter;
/*JS bindings*/
#ifdef GPAC_HAS_SPIDERMONKEY
Bool LoadJS(GF_TermExtJS *param);
};
#ifdef GPAC_HAS_SPIDERMONKEY
-JSBool upnpservice_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp);
+JSBool upnpservice_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp);
#endif
void format_time_string(char *str, Double dur);
void GPAC_ServiceItem::DetachJS()
{
if (obj) {
- gf_js_remove_root(js_ctx, &obj);
+ gf_js_remove_root(js_ctx, &obj, GF_JSGC_OBJECT);
JS_SetPrivate(js_ctx, obj, NULL);
obj = NULL;
}
if (on_event) {
- gf_js_remove_root(js_ctx, &on_event);
+ gf_js_remove_root(js_ctx, &on_event, GF_JSGC_VAL);
on_event = NULL;
}
while (gf_list_count(m_StateListeners)) {
GPAC_StateVariableListener *svl = (GPAC_StateVariableListener *)gf_list_get(m_StateListeners, 0);
gf_list_rem(m_StateListeners, 0);
- gf_js_remove_root(js_ctx, &svl->on_event);
+ gf_js_remove_root(js_ctx, &svl->on_event, GF_JSGC_VAL);
delete svl;
}
while (gf_list_count(m_ArgListeners)) {
GPAC_ActionArgListener *argl = (GPAC_ActionArgListener *)gf_list_get(m_ArgListeners, 0);
gf_list_rem(m_ArgListeners, 0);
- gf_js_remove_root(js_ctx, &argl->on_event);
+ gf_js_remove_root(js_ctx, &argl->on_event, GF_JSGC_VAL);
delete argl;
}
}
#ifdef GPAC_HAS_SPIDERMONKEY
void GPAC_DeviceItem::DetachJS() {
if (obj) {
- gf_js_remove_root(js_ctx, &obj);
+ gf_js_remove_root(js_ctx, &obj, GF_JSGC_OBJECT);
JS_SetPrivate(js_ctx, obj, NULL);
obj = NULL;
}
#endif
#ifdef GPAC_HAS_SPIDERMONKEY
-static JSBool upnp_service_set_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_service_set_listener)
{
GPAC_StateVariableListener *svl = NULL;
- const char *name;
+ char *name=NULL;
u32 i;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj);
if (!service || !argc || !JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
if (argc<1) {
- if (service->on_event) gf_js_remove_root(c, &service->on_event);
+ if (service->on_event) gf_js_remove_root(c, &service->on_event, GF_JSGC_VAL);
service->on_event = NULL;
if (!JSVAL_IS_NULL(argv[0])) {
service->on_event = argv[0];
- gf_js_add_root(c, &service->on_event);
+ gf_js_add_root(c, &service->on_event, GF_JSGC_VAL);
if (!service->subscribed) {
service->m_device->m_pUPnP->m_pGenericController->m_CtrlPoint->Subscribe(service->m_service);
service->subscribed = 1;
return JS_TRUE;
}
if (!JSVAL_IS_STRING(argv[1])) return JS_FALSE;
- name = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ name = SMJS_CHARS(c, argv[1]);
if (!name) return JS_FALSE;
/*variable state listener*/
i=0;
while ((svl = (GPAC_StateVariableListener *)gf_list_enum(service->m_StateListeners, &i))) {
- if (svl->name == name) break;
+ if (svl->name == (const char *) name) break;
}
if (!svl) {
svl = new GPAC_StateVariableListener();
svl->var = service->m_service->FindStateVariable(name);
gf_list_add(service->m_StateListeners, svl);
}
- if (svl->on_event) gf_js_remove_root(c, &svl->on_event);
+ if (svl->on_event) gf_js_remove_root(c, &svl->on_event, GF_JSGC_VAL);
if (JSVAL_IS_NULL(argv[0])) {
gf_list_del_item(service->m_StateListeners, svl);
delete svl;
}
svl->on_event = argv[0];
- gf_js_add_root(c, &svl->on_event);
+ gf_js_add_root(c, &svl->on_event, GF_JSGC_VAL);
if (!service->subscribed) {
service->m_device->m_pUPnP->m_pGenericController->m_CtrlPoint->Subscribe(service->m_service);
service->subscribed = 1;
}
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool upnp_service_set_action_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_service_set_action_listener)
{
PLT_ActionDesc *action;
PLT_ArgumentDesc *desc;
GPAC_ActionArgListener *argl = NULL;
- const char *name;
+ char *name;
Bool script_callback = 0;
u32 i;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj);
if (!service || (argc<2) || !JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_OBJECT(argv[1])) return JS_FALSE;
- name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ name = SMJS_CHARS(c, argv[0]);
if (!name) return JS_FALSE;
action = service->m_service->FindActionDesc(name);
- if (!action) return JS_FALSE;
+ SMJS_FREE(c, name);
+ if (!action) return JS_FALSE;
desc = NULL;
if (argc==3) {
script_callback = 1;
} else {
if (!JSVAL_IS_STRING(argv[2]) ) return JS_FALSE;
- name = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
+ name = SMJS_CHARS(c, argv[2]);
if (!name) return JS_FALSE;
desc = action->GetArgumentDesc(name);
+ SMJS_FREE(c, name);
if (!desc) return JS_FALSE;
}
}
argl->action = action;
gf_list_add(service->m_ArgListeners, argl);
}
- if (argl->on_event) gf_js_remove_root(c, &argl->on_event);
+ if (argl->on_event) gf_js_remove_root(c, &argl->on_event, GF_JSGC_VAL);
if (JSVAL_IS_NULL(argv[1])) {
gf_list_del_item(service->m_ArgListeners, argl);
delete argl;
}
argl->on_event = argv[1];
argl->is_script = script_callback;
- gf_js_add_root(c, &argl->on_event);
+ gf_js_add_root(c, &argl->on_event, GF_JSGC_VAL);
return JS_TRUE;
}
-JSBool upnpservice_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+JSBool upnpservice_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
char *prop_name;
GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj);
if (!service) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (!strcmp(prop_name, "Device")) {
*vp = OBJECT_TO_JSVAL(service->m_device->obj);
- return JS_TRUE;
}
- if (!strcmp(prop_name, "ModifiedStateVariablesCount")) {
+ else if (!strcmp(prop_name, "ModifiedStateVariablesCount")) {
*vp = INT_TO_JSVAL(service->vars ? service->vars->GetItemCount() : 0);
- return JS_TRUE;
}
+
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool upnp_service_has_var(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_service_has_var)
{
char *name = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj);
if (!service || !argc || !JSVAL_IS_STRING(argv[0]) )
return JS_FALSE;
- name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- *rval = BOOLEAN_TO_JSVAL( (service->m_service->FindStateVariable(name)==NULL) ? JS_FALSE : JS_TRUE );
+ name = SMJS_CHARS(c, argv[0]);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( (service->m_service->FindStateVariable(name)==NULL) ? JS_FALSE : JS_TRUE ) );
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool upnp_service_has_action(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_service_has_action)
{
PLT_ActionDesc *action;
char *name = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj);
if (!service || !argc || !JSVAL_IS_STRING(argv[0]) )
return JS_FALSE;
- name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ name = SMJS_CHARS(c, argv[0]);
action = service->m_service->FindActionDesc(name);
+ SMJS_FREE(c, name);
- *rval = BOOLEAN_TO_JSVAL(action ? JS_TRUE : JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(action ? JS_TRUE : JS_FALSE) );
if (!action) return JS_TRUE;
if ((argc==2) && JSVAL_IS_STRING(argv[1])) {
- name = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- if (action->GetArgumentDesc(name) == NULL) *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+ name = SMJS_CHARS(c, argv[1]);
+ if (action->GetArgumentDesc(name) == NULL) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_FALSE) );
+ SMJS_FREE(c, name);
}
return JS_TRUE;
}
-static JSBool upnp_service_call_action(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_service_call_action)
{
u32 i=1;
GPAC_ActionUDTA *act_udta = NULL;
char *action_name = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj);
if (!service || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE;
- action_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
-
+ action_name = SMJS_CHARS(c, argv[0]);
PLT_ActionDesc* action_desc = service->m_service->FindActionDesc(action_name);
+ SMJS_FREE(c, action_name);
+
if (action_desc == NULL) return JS_FALSE;
PLT_ActionReference action;
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Calling %s(", action_name));
i=0;
while (i+2<=count) {
+ NPT_Result res;
jsval an_arg;
- char *param_val;
+ char *param_val, *_param_val = NULL;
char szParamVal[1024];
JS_GetElement(c, list, (jsint) i, &an_arg);
- char *param_name = JSVAL_IS_STRING(an_arg) ? JS_GetStringBytes(JSVAL_TO_STRING(an_arg)) : NULL;
+ char *param_name = SMJS_CHARS(c, an_arg);
JS_GetElement(c, list, (jsint) i+1, &an_arg);
param_val = "";
if (JSVAL_IS_STRING(an_arg)) {
- param_val = JS_GetStringBytes(JSVAL_TO_STRING(an_arg));
+ param_val = _param_val = SMJS_CHARS(c, an_arg);
} else if (JSVAL_IS_BOOLEAN(an_arg)) {
param_val = (char *) ((JSVAL_TO_BOOLEAN(an_arg) == JS_TRUE) ? "true" : "false");
}
param_val = szParamVal;
}
- if (!param_name || !param_val) return JS_FALSE;
-
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, (" %s(%s)", param_name, param_val));
+ if (!param_name || !param_val) res = NPT_FAILURE;
+ else {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, (" %s(%s)", param_name, param_val));
+ res = action->SetArgumentValue(param_name, param_val);
+ }
+ SMJS_FREE(c, param_name);
+ SMJS_FREE(c, _param_val);
- if (action->SetArgumentValue(param_name, param_val) != NPT_SUCCESS)
- return JS_FALSE;
+ if (res != NPT_SUCCESS) return JS_FALSE;
+
i+=2;
}
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, (" )\n"));
if ((argc==3) && JSVAL_IS_OBJECT(argv[2])) {
act_udta = new GPAC_ActionUDTA();
act_udta->udta = argv[2];
- gf_js_add_root(c, &act_udta->udta);
+ gf_js_add_root(c, &act_udta->udta, GF_JSGC_VAL);
}
service->m_device->m_pUPnP->m_pGenericController->m_CtrlPoint->InvokeAction(action, act_udta);
return JS_TRUE;
#ifdef GPAC_HAS_SPIDERMONKEY
serv->js_ctx = js_ctx;
serv->obj = JS_NewObject(serv->js_ctx, &m_pUPnP->upnpServiceClass, 0, obj);
- gf_js_add_root(serv->js_ctx, &serv->obj);
+ gf_js_add_root(serv->js_ctx, &serv->obj, GF_JSGC_OBJECT);
JS_SetPrivate(serv->js_ctx, serv->obj, serv);
JS_DefineProperty(serv->js_ctx, serv->obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, service->GetServiceID()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(serv->js_ctx, serv->obj, "Type", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, service->GetServiceType()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
#ifdef GPAC_HAS_SPIDERMONKEY
-static JSBool upnp_action_get_argument_value(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_action_get_argument_value)
{
NPT_String res;
char *arg_name = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
PLT_Action *action = (PLT_Action *) JS_GetPrivate(c, obj);
if (!action || !argc || !JSVAL_IS_STRING(argv[0])) return JS_FALSE;
- arg_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ arg_name = SMJS_CHARS(c, argv[0]);
if (!arg_name) return JS_FALSE;
action->GetArgumentValue(arg_name, res);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, res) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, res) ));
+ SMJS_FREE(c, arg_name);
return JS_TRUE;
}
-static JSBool upnp_action_get_error_code(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_action_get_error_code)
{
NPT_String res;
char *arg_name = NULL;
+ SMJS_OBJ
PLT_Action *action = (PLT_Action *) JS_GetPrivate(c, obj);
if (!action ) return JS_FALSE;
- *rval = INT_TO_JSVAL( action->GetErrorCode() );
+ SMJS_SET_RVAL( INT_TO_JSVAL( action->GetErrorCode() ));
return JS_TRUE;
}
-static JSBool upnp_action_get_error(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_action_get_error)
{
NPT_String res;
unsigned int code;
char *arg_name = NULL;
+ SMJS_OBJ
PLT_Action *action = (PLT_Action *) JS_GetPrivate(c, obj);
if (!action ) return JS_FALSE;
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, action->GetError( code ) ) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, action->GetError( code ) ) ) );
return JS_TRUE;
}
JS_DefineFunction(serv->js_ctx, act_obj, "GetErrorCode", upnp_action_get_error_code, 1, 0);
JS_DefineFunction(serv->js_ctx, act_obj, "GetError", upnp_action_get_error, 1, 0);
- gf_js_add_root(serv->js_ctx, &act_obj);
+ gf_js_add_root(serv->js_ctx, &act_obj, GF_JSGC_OBJECT);
argv[0] = OBJECT_TO_JSVAL(act_obj);
if (act_udta) {
argv[1] = act_udta->udta;
} else {
JS_CallFunctionValue(serv->js_ctx, serv->obj, act_l->on_event, 1, argv, &rval);
}
- gf_js_remove_root(serv->js_ctx, &act_obj);
+ gf_js_remove_root(serv->js_ctx, &act_obj, GF_JSGC_OBJECT);
}
/*if error don't trigger listeners*/
else if (res == NPT_SUCCESS) {
exit:
if (act_udta) {
- gf_js_remove_root(serv->js_ctx, &act_udta->udta);
+ gf_js_remove_root(serv->js_ctx, &act_udta->udta, GF_JSGC_VAL);
delete act_udta;
}
GPAC_Service::~GPAC_Service()
{
#ifdef GPAC_HAS_SPIDERMONKEY
- if (m_pObj) gf_js_remove_root(m_pCtx, &m_pObj);
+ if (m_pObj) gf_js_remove_root(m_pCtx, &m_pObj, GF_JSGC_OBJECT);
#endif
}
#ifdef GPAC_HAS_SPIDERMONKEY
-static JSBool upnp_service_set_state_variable(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_service_set_state_variable)
{
char *name, *val;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_Service* service = (GPAC_Service*) JS_GetPrivate(c, obj);
if (!service) return JS_FALSE;
- name = NULL;
- if (JSVAL_IS_STRING(argv[0])) name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ name = SMJS_CHARS(c, argv[0]);
if (!name) return JS_FALSE;
- val = NULL;
- if (JSVAL_IS_STRING(argv[1])) val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- if (!val) return JS_FALSE;
+ val = SMJS_CHARS(c, argv[1]);
+ if (!val) {
+ SMJS_FREE(c, name);
+ return JS_FALSE;
+ }
service->SetStateVariable(name, val);
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, val);
return JS_TRUE;
}
{
m_pCtx = c;
m_pObj = JS_NewObject(c, &upnp->upnpDeviceClass, 0, parent);
- gf_js_add_root(m_pCtx, &m_pObj);
+ gf_js_add_root(m_pCtx, &m_pObj, GF_JSGC_OBJECT);
JS_SetPrivate(c, m_pObj, this);
JS_DefineFunction(c, m_pObj, "SetStateVariable", upnp_service_set_state_variable, 2, 0);
void GPAC_GenericDevice::DetachJS(JSContext *c)
{
u32 i, count;
- if (obj) gf_js_remove_root(c, &obj);
+ if (obj) gf_js_remove_root(c, &obj, GF_JSGC_OBJECT);
obj = NULL;
- if (run_proc) gf_js_remove_root(c, &run_proc);
+ if (run_proc) gf_js_remove_root(c, &run_proc, GF_JSGC_VAL);
run_proc = NULL;
- if (act_proc) gf_js_remove_root(c, &act_proc);
+ if (act_proc) gf_js_remove_root(c, &act_proc, GF_JSGC_VAL);
act_proc = NULL;
count = gf_list_count(m_pServices);
for (i=0; i<count; i++) {
GPAC_Service *service = (GPAC_Service*)gf_list_get(m_pServices, i);
if (service->m_pObj) {
- gf_js_remove_root(c, &service->m_pObj);
+ gf_js_remove_root(c, &service->m_pObj, GF_JSGC_OBJECT);
service->m_pObj = NULL;
}
}
#ifdef GPAC_HAS_SPIDERMONKEY
-static JSBool upnp_action_get_argument(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_action_get_argument)
{
char *act_name;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj);
if (!device || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE;
- act_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ act_name = SMJS_CHARS(c, argv[0]);
NPT_String value;
if (device->act_ref->GetArgumentValue(act_name, value) != NPT_SUCCESS) return JS_FALSE;
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, value) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, value) ));
+ SMJS_FREE(c, act_name);
return JS_TRUE;
}
-#endif
-#ifdef GPAC_HAS_SPIDERMONKEY
-
-static JSBool upnp_action_send_reply(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(upnp_action_send_reply)
{
u32 i=1;
+ SMJS_OBJ
+ SMJS_ARGS
GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj);
if (!device) return JS_FALSE;
i=0;
while (i+2<=count) {
jsval an_arg;
- char *param_val;
+ NPT_Result res;
+ char *param_val, *_param_val = NULL;
char szParamVal[1024];
JS_GetElement(c, list, (jsint) i, &an_arg);
- char *param_name = JSVAL_IS_STRING(an_arg) ? JS_GetStringBytes(JSVAL_TO_STRING(an_arg)) : NULL;
+ char *param_name = SMJS_CHARS(c, an_arg);
JS_GetElement(c, list, (jsint) i+1, &an_arg);
param_val = "";
if (JSVAL_IS_STRING(an_arg)) {
- param_val = JS_GetStringBytes(JSVAL_TO_STRING(an_arg));
+ param_val = _param_val = SMJS_CHARS(c, an_arg);
} else if (JSVAL_IS_BOOLEAN(an_arg)) {
param_val = (char *) ((JSVAL_TO_BOOLEAN(an_arg) == JS_TRUE) ? "true" : "false");
}
param_val = szParamVal;
}
- if (!param_name || !param_val) return JS_FALSE;
+ if (!param_name || !param_val) res = NPT_FAILURE;
+ else {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, (" %s(%s)", param_name, param_val));
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, (" %s(%s)", param_name, param_val));
-
- if (device->act_ref->SetArgumentValue(param_name, param_val) != NPT_SUCCESS)
- return JS_FALSE;
+ res = device->act_ref->SetArgumentValue(param_name, param_val);
+ }
+ SMJS_FREE(c, param_name);
+ SMJS_FREE(c, _param_val);
+ if (res != NPT_SUCCESS) return JS_FALSE;
i+=2;
}
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, (" )\n"));
#ifdef GPAC_HAS_SPIDERMONKEY
#include <gpac/internal/scenegraph_dev.h>
-#include <jsapi.h>
+#include <gpac/internal/smjs_api.h>
#endif
class GF_UPnP;
vpath %.c $(SRC_PATH)/modules/platinum
-CFLAGS= $(CPPFLAGS) -I$(SRC_PATH)/include -ISDK/include
+CFLAGS= $(CPPFLAGS) -I"$(SRC_PATH)/include" -I$(SRC_PATH)/extra_lib/include/platinum/
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
endif
LINKLIBS= -lgpac -lPlatinum -lPltMediaServer -lPltMediaConnect -lPltMediaRenderer -lNeptune -lZlib
-LOCAL_LIB=../../bin/gcc -LSDK/lib_gcc_x86
+LOCAL_LIB=../../bin/gcc -L../../extra_lib/lib/gcc
#common objects
OBJS=GPACFileMediaServer.o GPACMediaController.o GPACMediaRenderer.o GenericDevice.o GPACPlatinum.o
+++ /dev/null
-This directory contains a basic SDK for Platinum and Neptune libraries, version 0.5.4.
-
-Platinum has been slightly modified for GPAC usage:
- support for PresentationURL in device description reading.
- few workarounds for windowsCE compilation
-
-For most (99%) cases and most platforms, using the original platinum will work.
-
-The patched platinum library sources and binaries can be found here:
- gpac.sourceforge.net/downloads/platinum_sdk_0.4.5.zip
-
-
-include/
- Neptune and Platinum header files
-
-lib_arm/
- Neptune and Platinum libraries compiled for Smartphone ARM (MSVC8)
-
-lib_vc8/
- Neptune and Platinum libraries compiled for MS Windows (MSVC8)
-
-lib_gcc_x86/
- Neptune and Platinum libraries compiled for x86 linux (gcc)
-
-
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Toplevel Include
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NEPTUNE_H_
-#define _NEPTUNE_H_
-
-/*----------------------------------------------------------------------
-| flags
-+---------------------------------------------------------------------*/
-#define NPT_EXTERNAL_USE /* do not expose internal definitions */
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#include "NptCommon.h"
-#include "NptResults.h"
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptReferences.h"
-#include "NptStreams.h"
-#include "NptBufferedStreams.h"
-#include "NptFile.h"
-#include "NptNetwork.h"
-#include "NptSockets.h"
-#include "NptTime.h"
-#include "NptThreads.h"
-#include "NptSystem.h"
-#include "NptMessaging.h"
-#include "NptQueue.h"
-#include "NptSimpleMessageQueue.h"
-#include "NptSelectableMessageQueue.h"
-#include "NptXml.h"
-#include "NptStrings.h"
-#include "NptArray.h"
-#include "NptList.h"
-#include "NptMap.h"
-#include "NptStack.h"
-#include "NptUri.h"
-#include "NptHttp.h"
-#include "NptDataBuffer.h"
-#include "NptUtils.h"
-#include "NptRingBuffer.h"
-#include "NptBase64.h"
-#include "NptConsole.h"
-#include "NptLogging.h"
-#include "NptSerialPort.h"
-#include "NptVersion.h"
-#include "NptDynamicLibraries.h"
-#include "NptDynamicCast.h"
-
-// optional modules
-#include "NptZip.h"
-#include "NptTls.h"
-
-#endif // _NEPTUNE_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Arrays
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-
-#ifndef _NPT_ARRAY_H_
-#define _NPT_ARRAY_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#if defined(NPT_CONFIG_HAVE_NEW_H)
-#include <new>
-#endif
-#include "NptTypes.h"
-#include "NptResults.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ARRAY_INITIAL_MAX_SIZE = 128; // bytes
-
-/*----------------------------------------------------------------------
-| NPT_Array
-+---------------------------------------------------------------------*/
-template <typename T>
-class NPT_Array
-{
-public:
- // types
- typedef T Element;
- typedef T* Iterator;
-
- // methods
- NPT_Array<T>(): m_Capacity(0), m_ItemCount(0), m_Items(0) {}
- explicit NPT_Array<T>(NPT_Cardinal count);
- NPT_Array<T>(NPT_Cardinal count, const T& item);
- NPT_Array<T>(const T* items, NPT_Cardinal item_count);
- ~NPT_Array<T>();
- NPT_Array<T>(const NPT_Array<T>& copy);
- NPT_Array<T>& operator=(const NPT_Array<T>& copy);
- bool operator==(const NPT_Array<T>& other) const;
- bool operator!=(const NPT_Array<T>& other) const;
- NPT_Cardinal GetItemCount() const { return m_ItemCount; }
- NPT_Result Add(const T& item);
- T& operator[](NPT_Ordinal pos) { return m_Items[pos]; }
- const T& operator[](NPT_Ordinal pos) const { return m_Items[pos]; }
- NPT_Result Erase(Iterator which);
- NPT_Result Erase(NPT_Ordinal which) { return Erase(&m_Items[which]); }
- NPT_Result Erase(Iterator first, Iterator last);
- NPT_Result Erase(NPT_Ordinal first, NPT_Ordinal last) { return Erase(&m_Items[first], &m_Items[last]); }
- NPT_Result Insert(Iterator where, const T& item, NPT_Cardinal count = 1);
- NPT_Result Reserve(NPT_Cardinal count);
- NPT_Cardinal GetCapacity() const { return m_Capacity; }
- NPT_Result Resize(NPT_Cardinal count);
- NPT_Result Resize(NPT_Cardinal count, const T& fill);
- NPT_Result Clear();
- bool Contains(const T& data) const;
- Iterator GetFirstItem() const { return m_ItemCount?&m_Items[0]:NULL; }
- Iterator GetLastItem() const { return m_ItemCount?&m_Items[m_ItemCount-1]:NULL; }
- Iterator GetItem(NPT_Ordinal n) { return n<m_ItemCount?&m_Items[n]:NULL; }
-
- // template list operations
- // keep these template members defined here because MSV6 does not let
- // us define them later
- template <typename X>
- NPT_Result Apply(const X& function) const
- {
- for (unsigned int i=0; i<m_ItemCount; i++) function(m_Items[i]);
- return NPT_SUCCESS;
- }
-
- template <typename X, typename P>
- NPT_Result ApplyUntil(const X& function, const P& predicate, bool* match = NULL) const
- {
- for (unsigned int i=0; i<m_ItemCount; i++) {
- NPT_Result return_value;
- if (predicate(function(m_Items[i]), return_value)) {
- if (match) *match = true;
- return return_value;
- }
- }
- if (match) *match = false;
- return NPT_SUCCESS;
- }
-
- template <typename X>
- T* Find(const X& predicate, NPT_Ordinal n=0, NPT_Ordinal* pos = NULL) const
- {
- if (pos) *pos = -1;
-
- for (unsigned int i=0; i<m_ItemCount; i++) {
- if (predicate(m_Items[i])) {
- if (pos) *pos = i;
- if (n == 0) return &m_Items[i];
- --n;
- }
- }
- return NULL;
- }
-
-protected:
- // methods
- T* Allocate(NPT_Cardinal count, NPT_Cardinal& allocated);
-
- // members
- NPT_Cardinal m_Capacity;
- NPT_Cardinal m_ItemCount;
- T* m_Items;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::NPT_Array<T>
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Array<T>::NPT_Array(NPT_Cardinal count) :
- m_Capacity(0),
- m_ItemCount(0),
- m_Items(0)
-{
- Reserve(count);
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::NPT_Array<T>
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Array<T>::NPT_Array(const NPT_Array<T>& copy) :
- m_Capacity(0),
- m_ItemCount(0),
- m_Items(0)
-{
- Reserve(copy.GetItemCount());
- for (NPT_Ordinal i=0; i<copy.m_ItemCount; i++) {
- new ((void*)&m_Items[i]) T(copy.m_Items[i]);
- }
- m_ItemCount = copy.m_ItemCount;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::NPT_Array<T>
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Array<T>::NPT_Array(NPT_Cardinal count, const T& item) :
- m_Capacity(0),
- m_ItemCount(count),
- m_Items(0)
-{
- Reserve(count);
- for (NPT_Ordinal i=0; i<count; i++) {
- new ((void*)&m_Items[i]) T(item);
- }
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::NPT_Array<T>
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Array<T>::NPT_Array(const T* items, NPT_Cardinal item_count) :
- m_Capacity(0),
- m_ItemCount(item_count),
- m_Items(0)
-{
- Reserve(item_count);
- for (NPT_Ordinal i=0; i<item_count; i++) {
- new ((void*)&m_Items[i]) T(items[i]);
- }
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::~NPT_Array<T>
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Array<T>::~NPT_Array()
-{
- // remove all items
- Clear();
-
- // free the memory
- ::operator delete((void*)m_Items);
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::operator=
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Array<T>&
-NPT_Array<T>::operator=(const NPT_Array<T>& copy)
-{
- // do nothing if we're assigning to ourselves
- if (this == ©) return *this;
-
- // destroy all elements
- Clear();
-
- // copy all elements from the other object
- Reserve(copy.GetItemCount());
- m_ItemCount = copy.m_ItemCount;
- for (NPT_Ordinal i=0; i<copy.m_ItemCount; i++) {
- new ((void*)&m_Items[i]) T(copy.m_Items[i]);
- }
-
- return *this;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Clear
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_Array<T>::Clear()
-{
- // destroy all items
- for (NPT_Ordinal i=0; i<m_ItemCount; i++) {
- m_Items[i].~T();
- }
-
- m_ItemCount = 0;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Allocate
-+---------------------------------------------------------------------*/
-template <typename T>
-T*
-NPT_Array<T>::Allocate(NPT_Cardinal count, NPT_Cardinal& allocated)
-{
- if (m_Capacity) {
- allocated = 2*m_Capacity;
- } else {
- // start with just enough elements to fill
- // NPT_ARRAY_INITIAL_MAX_SIZE worth of memory
- allocated = NPT_ARRAY_INITIAL_MAX_SIZE/sizeof(T);
- if (allocated == 0) allocated = 1;
- }
- if (allocated < count) allocated = count;
-
- // allocate the items
- return (T*)::operator new(allocated*sizeof(T));
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Reserve
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_Array<T>::Reserve(NPT_Cardinal count)
-{
- if (count <= m_Capacity) return NPT_SUCCESS;
-
- // (re)allocate the items
- NPT_Cardinal new_capacity;
- T* new_items = Allocate(count, new_capacity);
- if (new_items == NULL) {
- return NPT_ERROR_OUT_OF_MEMORY;
- }
- if (m_ItemCount && m_Items) {
- for (unsigned int i=0; i<m_ItemCount; i++) {
- // construct the copy
- new ((void*)&new_items[i])T(m_Items[i]);
-
- // destroy the item
- m_Items[i].~T();
- }
- }
- ::operator delete((void*)m_Items);
- m_Items = new_items;
- m_Capacity = new_capacity;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Add
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Result
-NPT_Array<T>::Add(const T& item)
-{
- // ensure capacity
- NPT_Result result = Reserve(m_ItemCount+1);
- if (result != NPT_SUCCESS) return result;
-
- // store the item
- new ((void*)&m_Items[m_ItemCount++]) T(item);
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Erase
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Result
-NPT_Array<T>::Erase(Iterator which)
-{
- return Erase(which, which);
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Erase
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_Array<T>::Erase(Iterator first, Iterator last)
-{
- // check parameters
- if (first == NULL || last == NULL) return NPT_ERROR_INVALID_PARAMETERS;
-
- // check the bounds
- NPT_Ordinal first_index = (NPT_Ordinal)(NPT_POINTER_TO_LONG(first-m_Items));
- NPT_Ordinal last_index = (NPT_Ordinal)(NPT_POINTER_TO_LONG(last-m_Items));
- if (first_index >= m_ItemCount ||
- last_index >= m_ItemCount ||
- first_index > last_index) {
- return NPT_ERROR_INVALID_PARAMETERS;
- }
-
- // shift items to the left
- NPT_Cardinal interval = last_index-first_index+1;
- NPT_Cardinal shifted = m_ItemCount-last_index-1;
- for (NPT_Ordinal i=first_index; i<first_index+shifted; i++) {
- m_Items[i] = m_Items[i+interval];
- }
-
- // destruct the remaining items
- for (NPT_Ordinal i=first_index+shifted; i<m_ItemCount; i++) {
- m_Items[i].~T();
- }
-
- // update the item count
- m_ItemCount -= interval;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Insert
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_Array<T>::Insert(Iterator where, const T& item, NPT_Cardinal repeat)
-{
- // check bounds
- NPT_Ordinal where_index = where?((NPT_Ordinal)NPT_POINTER_TO_LONG(where-m_Items)):m_ItemCount;
- if (where > &m_Items[m_ItemCount] || repeat == 0) return NPT_ERROR_INVALID_PARAMETERS;
-
- NPT_Cardinal needed = m_ItemCount+repeat;
- if (needed > m_Capacity) {
- // allocate more memory
- NPT_Cardinal new_capacity;
- T* new_items = Allocate(needed, new_capacity);
- if (new_items == NULL) return NPT_ERROR_OUT_OF_MEMORY;
- m_Capacity = new_capacity;
-
- // move the items before the insertion point
- for (NPT_Ordinal i=0; i<where_index; i++) {
- new((void*)&new_items[i])T(m_Items[i]);
- m_Items[i].~T();
- }
-
- // move the items after the insertion point
- for (NPT_Ordinal i=where_index; i<m_ItemCount; i++) {
- new((void*)&new_items[i+repeat])T(m_Items[i]);
- m_Items[i].~T();
- }
-
- // use the new items instead of the current ones
- ::operator delete((void*)m_Items);
- m_Items = new_items;
- } else {
- // shift items after the insertion point to the right
- for (NPT_Ordinal i=m_ItemCount; i>where_index; i--) {
- new((void*)&m_Items[i+repeat-1])T(m_Items[i-1]);
- m_Items[i-1].~T();
- }
- }
-
- // insert the new items
- for (NPT_Cardinal i=where_index; i<where_index+repeat; i++) {
- new((void*)&m_Items[i])T(item);
- }
-
- // update the item count
- m_ItemCount += repeat;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Resize
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_Array<T>::Resize(NPT_Cardinal size)
-{
- if (size < m_ItemCount) {
- // shrink
- for (NPT_Ordinal i=size; i<m_ItemCount; i++) {
- m_Items[i].~T();
- }
- m_ItemCount = size;
- } else if (size > m_ItemCount) {
- return Resize(size, T());
- }
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Resize
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_Array<T>::Resize(NPT_Cardinal size, const T& fill)
-{
- if (size < m_ItemCount) {
- return Resize(size);
- } else if (size > m_ItemCount) {
- Reserve(size);
- for (NPT_Ordinal i=m_ItemCount; i<size; i++) {
- new ((void*)&m_Items[i]) T(fill);
- }
- m_ItemCount = size;
- }
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::Contains
-+---------------------------------------------------------------------*/
-template <typename T>
-bool
-NPT_Array<T>::Contains(const T& data) const
-{
- for (NPT_Ordinal i=0; i<m_ItemCount; i++) {
- if (m_Items[i] == data) return true;
- }
-
- return false;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::operator==
-+---------------------------------------------------------------------*/
-template <typename T>
-bool
-NPT_Array<T>::operator==(const NPT_Array<T>& other) const
-{
- // we need the same number of items
- if (other.m_ItemCount != m_ItemCount) return false;
-
- // compare all items
- for (NPT_Ordinal i=0; i<m_ItemCount; i++) {
- if (!(m_Items[i] == other.m_Items[i])) return false;
- }
-
- return true;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Array<T>::operator!=
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-bool
-NPT_Array<T>::operator!=(const NPT_Array<T>& other) const
-{
- return !(*this == other);
-}
-
-#endif // _NPT_ARRAY_H_
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Base64
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-
-#ifndef _NPT_BASE64_H_
-#define _NPT_BASE64_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptDataBuffer.h"
-#include "NptStrings.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const NPT_Cardinal NPT_BASE64_MIME_BLOCKS_PER_LINE = 19;
-const NPT_Cardinal NPT_BASE64_PEM_BLOCKS_PER_LINE = 16;
-
-/*----------------------------------------------------------------------
-| NPT_Base64
-+---------------------------------------------------------------------*/
-class NPT_Base64 {
-public:
- // class methods
- static NPT_Result Decode(const char* base64,
- NPT_Size size,
- NPT_DataBuffer& data,
- bool url_safe = false);
- static NPT_Result Encode(const NPT_Byte* data,
- NPT_Size size,
- NPT_String& base64,
- NPT_Cardinal max_blocks_per_line = 0,
- bool url_safe = false);
-
-private:
- // this class is purely static
- NPT_Base64();
-};
-
-#endif // _NPT_BASE64_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Buffered Byte Stream
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_BUFFERED_STREAMS_H_
-#define _NPT_BUFFERED_STREAMS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptStreams.h"
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptStrings.h"
-#include "NptDebug.h"
-
-/*----------------------------------------------------------------------
-| NPT_BufferedStream
-+---------------------------------------------------------------------*/
-const NPT_Size NPT_BUFFERED_BYTE_STREAM_DEFAULT_SIZE = 4096;
-
-/*----------------------------------------------------------------------
-| NPT_BufferedInputStream
-+---------------------------------------------------------------------*/
-class NPT_BufferedInputStream : public NPT_InputStream
-{
-public:
- // constructors and destructor
- NPT_BufferedInputStream(NPT_InputStreamReference& stream,
- NPT_Size buffer_size = NPT_BUFFERED_BYTE_STREAM_DEFAULT_SIZE);
- virtual ~NPT_BufferedInputStream();
-
- // methods
- virtual NPT_Result ReadLine(NPT_String& line,
- NPT_Size max_chars = 4096,
- bool break_on_cr = false);
- virtual NPT_Result ReadLine(char* buffer,
- NPT_Size buffer_size,
- NPT_Size* chars_read = NULL,
- bool break_on_cr = false);
- virtual NPT_Result SetBufferSize(NPT_Size size, bool force = false);
- virtual NPT_Result Peek(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read);
-
- // NPT_InputStream methods
- NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL);
- NPT_Result Seek(NPT_Position offset);
- NPT_Result Tell(NPT_Position& offset);
- NPT_Result GetSize(NPT_LargeSize& size);
- NPT_Result GetAvailable(NPT_LargeSize& available);
-
-protected:
- // members
- NPT_InputStreamReference m_Source;
- bool m_SkipNewline;
- bool m_Eos;
- struct {
- NPT_Byte* data;
- NPT_Size offset;
- NPT_Size valid;
- NPT_Size size;
- } m_Buffer;
-
- // methods
- virtual NPT_Result FillBuffer();
- virtual NPT_Result ReleaseBuffer();
-};
-
-typedef NPT_Reference<NPT_BufferedInputStream> NPT_BufferedInputStreamReference;
-
-#endif // _NPT_BUFFERED_STREAMS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Common Definitions
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_COMMON_H_
-#define _NPT_COMMON_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptResults.h"
-
-/*----------------------------------------------------------------------
-| NPT_ObjectDeleter
-+---------------------------------------------------------------------*/
-template <class T>
-class NPT_ObjectDeleter {
-public:
- void operator()(T* object) const {
- delete object;
- }
-};
-
-/*----------------------------------------------------------------------
-| NPT_ObjectComparator
-+---------------------------------------------------------------------*/
-template <class T>
-class NPT_ObjectComparator {
-public:
- NPT_ObjectComparator(T& object) : m_Object(object) {}
- bool operator()(const T& object) const {
- return object == m_Object;
- }
-private:
- T& m_Object;
-};
-
-/*----------------------------------------------------------------------
-| NPT_ContainerFind
-+---------------------------------------------------------------------*/
-template <typename T, typename P>
-NPT_Result NPT_ContainerFind(T& container,
- const P& predicate,
- typename T::Element& item,
- NPT_Ordinal n=0)
-{
- typename T::Iterator found = container.Find(predicate, n);
- if (found) {
- item = *found;
- return NPT_SUCCESS;
- } else {
- return NPT_ERROR_NO_SUCH_ITEM;
- }
-}
-
-/*----------------------------------------------------------------------
-| NPT_ContainerFind
-+---------------------------------------------------------------------*/
-template <typename T, typename P>
-NPT_Result NPT_ContainerFind(T& container,
- const P& predicate,
- typename T::Iterator& iter,
- NPT_Ordinal n=0)
-{
- iter = container.Find(predicate, n);
- return iter?NPT_SUCCESS:NPT_ERROR_NO_SUCH_ITEM;
-}
-
-/*----------------------------------------------------------------------
-| NPT_UntilResultEquals
-+---------------------------------------------------------------------*/
-class NPT_UntilResultEquals
-{
-public:
- // methods
- NPT_UntilResultEquals(NPT_Result condition_result,
- NPT_Result return_value = NPT_SUCCESS) :
- m_ConditionResult(condition_result),
- m_ReturnValue(return_value) {}
- bool operator()(NPT_Result result, NPT_Result& return_value) const {
- if (result == m_ConditionResult) {
- return_value = m_ReturnValue;
- return true;
- } else {
- return false;
- }
- }
-
-private:
- // members
- NPT_Result m_ConditionResult;
- NPT_Result m_ReturnValue;
-};
-
-/*----------------------------------------------------------------------
-| NPT_UntilResultNotEquals
-+---------------------------------------------------------------------*/
-class NPT_UntilResultNotEquals
-{
-public:
- // methods
- NPT_UntilResultNotEquals(NPT_Result condition_result) :
- m_ConditionResult(condition_result) {}
- bool operator()(NPT_Result result, NPT_Result& return_value) const {
- if (result != m_ConditionResult) {
- return_value = result;
- return true;
- } else {
- return false;
- }
- }
-
-private:
- // members
- NPT_Result m_ConditionResult;
-};
-
-/*----------------------------------------------------------------------
-| NPT_PropertyValue
-+---------------------------------------------------------------------*/
-class NPT_PropertyValue
-{
- public:
- // typedefs
- typedef enum {UNKNOWN, INTEGER, STRING} Type;
-
- // methods
- NPT_PropertyValue() : m_Type(UNKNOWN), m_Integer(0) {}
- NPT_PropertyValue(int value) : m_Type(INTEGER), m_Integer(value) {}
- NPT_PropertyValue(const char* value) : m_Type(STRING), m_String(value) {}
-
- // members
- Type m_Type;
- union {
- int m_Integer;
- const char* m_String;
- };
-};
-
-#endif // _NPT_COMMON_H_
-
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Configuration
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_CONFIG_H_
-#define _NPT_CONFIG_H_
-
-/*----------------------------------------------------------------------
-| defaults
-+---------------------------------------------------------------------*/
-#define NPT_CONFIG_HAVE_ASSERT_H
-#define NPT_CONFIG_HAVE_STD_C
-#define NPT_CONFIG_HAVE_STDLIB_H
-#define NPT_CONFIG_HAVE_STDIO_H
-#define NPT_CONFIG_HAVE_STDARG_H
-#define NPT_CONFIG_HAVE_STRING_H
-#define NPT_CONFIG_HAVE_LIMITS_H
-
-/*----------------------------------------------------------------------
-| standard C runtime
-+---------------------------------------------------------------------*/
-#if defined(NPT_CONFIG_HAVE_STD_C)
-#define NPT_CONFIG_HAVE_MALLOC
-#define NPT_CONFIG_HAVE_CALLOC
-#define NPT_CONFIG_HAVE_REALLOC
-#define NPT_CONFIG_HAVE_FREE
-#define NPT_CONFIG_HAVE_MEMCPY
-#define NPT_CONFIG_HAVE_MEMSET
-#define NPT_CONFIG_HAVE_MEMCMP
-#define NPT_CONFIG_HAVE_GETENV
-#define NPT_CONFIG_HAVE_READDIR_R
-#endif /* NPT_CONFIG_HAS_STD_C */
-
-#if defined(NPT_CONFIG_HAVE_STRING_H)
-#define NPT_CONFIG_HAVE_STRCMP
-#define NPT_CONFIG_HAVE_STRNCMP
-#define NPT_CONFIG_HAVE_STRDUP
-#define NPT_CONFIG_HAVE_STRLEN
-#define NPT_CONFIG_HAVE_STRCPY
-#define NPT_CONFIG_HAVE_STRNCPY
-#endif /* NPT_CONFIG_HAVE_STRING_H */
-
-#if defined(NPT_CONFIG_HAVE_STDIO_H)
-#define NPT_CONFIG_HAVE_SPRINTF
-#define NPT_CONFIG_HAVE_SNPRINTF
-#define NPT_CONFIG_HAVE_VSPRINTF
-#define NPT_CONFIG_HAVE_VSNPRINTF
-#endif /* NPT_CONFIG_HAVE_STDIO_H */
-
-#if defined(NPT_CONFIG_HAVE_LIMITS_H)
-#define NPT_CONFIG_HAVE_INT_MIN
-#define NPT_CONFIG_HAVE_INT_MAX
-#define NPT_CONFIG_HAVE_UINT_MAX
-#define NPT_CONFIG_HAVE_LONG_MIN
-#define NPT_CONFIG_HAVE_LONG_MAX
-#define NPT_CONFIG_HAVE_ULONG_MAX
-#endif
-
-/*----------------------------------------------------------------------
-| standard C++ runtime
-+---------------------------------------------------------------------*/
-#define NPT_CONFIG_HAVE_NEW_H
-
-/*----------------------------------------------------------------------
-| sockets
-+---------------------------------------------------------------------*/
-#define NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
-
-/*----------------------------------------------------------------------
-| platform specifics
-+---------------------------------------------------------------------*/
-/* Windows 32 */
-#if defined(_WIN32) || defined(_XBOX)
-#if !defined(STRICT)
-#define STRICT
-#endif
-#endif
-
-/* XBox */
-#if defined(_XBOX)
-#define NPT_CONFIG_THREAD_STACK_SIZE 0x10000
-#endif
-
-/* QNX */
-#if defined(__QNX__)
-#endif
-
-/* cygwin */
-#if defined(__CYGWIN__)
-#undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
-#endif
-
-/* linux */
-#if defined(__linux__)
-#undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
-#endif
-
-/* symbian */
-#if defined(__SYMBIAN32__)
-/* If defined, specify the stack size of each NPT_Thread. */
-#define NPT_CONFIG_THREAD_STACK_SIZE 0x14000
-#endif
-
-/*----------------------------------------------------------------------
-| compiler specifics
-+---------------------------------------------------------------------*/
-/* GCC */
-#if defined(__GNUC__)
-#define NPT_LocalFunctionName __FUNCTION__
-#define NPT_COMPILER_UNUSED(p) (void)p
-#else
-#define NPT_COMPILER_UNUSED(p)
-#endif
-
-/* TriMedia C/C++ Compiler */
-#if defined(__TCS__)
-#undef NPT_CONFIG_HAVE_ASSERT_H
-#undef NPT_CONFIG_HAVE_SNPRINTF
-#undef NPT_CONFIG_HAVE_VSNPRINTF
-#endif
-
-/* palmos compiler */
-#if defined(__PALMOS__)
-#if __PALMOS__ <= 0x05000000
-#undef NPT_CONFIG_HAVE_ASSERT_H
-#undef NPT_CONFIG_HAVE_SNPRINTF
-#undef NPT_CONFIG_HAVE_VSNPRINTF
-#endif
-#endif
-
-/* Microsoft C/C++ Compiler */
-#if defined(_MSC_VER)
-#define NPT_FORMAT_64 "I64"
-#define NPT_CONFIG_INT64_TYPE __int64
-#define NPT_INT64_MIN _I64_MIN
-#define NPT_INT64_MAX _I64_MAX
-#define NPT_UINT64_MAX _UI64_MAX
-#define NPT_INT64_C(_x) _x##i64
-#define NPT_UINT64_C(_x) _x##ui64
-#define NPT_LocalFunctionName __FUNCTION__
-#if !defined(_WIN32_WCE)
-#define NPT_fseek _fseeki64
-#define NPT_ftell _ftelli64
-#else
-#define NPT_fseek(a,b,c) fseek((a),(long)(b), (c))
-#define NPT_ftell ftell
-#endif
-#define NPT_stat NPT_stat_utf8
-#define NPT_stat_struct struct __stat64
-#if defined(_WIN64)
-typedef __int64 NPT_PointerLong;
-#else
-#if _MSC_VER >= 1400
-typedef __w64 long NPT_PointerLong;
-#else
-typedef long NPT_PointerLong;
-#endif
-#endif
-#define NPT_POINTER_TO_LONG(_p) ((NPT_PointerLong) (_p) )
-#if _MSC_VER >= 1400 && !defined(_WIN32_WCE)
-#define NPT_CONFIG_HAVE_GMTIME_S
-#define NPT_CONFIG_HAVE_LOCALTIME_S
-#define NPT_CONFIG_HAVE_FOPEN_S
-#define NPT_CONFIG_HAVE_FSOPEN
-#define NPT_CONFIG_HAVE_SHARE_H
-#define NPT_vsnprintf(s,c,f,a) _vsnprintf_s(s,c,_TRUNCATE,f,a)
-#define NPT_snprintf(s,c,f,...) _snprintf_s(s,c,_TRUNCATE,f,__VA_ARGS__)
-#define NPT_strncpy(d,s,c) strncpy_s(d,c+1,s,c)
-#define NPT_strcpy(d,s) strcpy_s(d,strlen(s)+1,s)
-#undef NPT_CONFIG_HAVE_GETENV
-#define NPT_CONFIG_HAVE_DUPENV_S
-#define dupenv_s _dupenv_s
-#else
-#define NPT_vsnprintf _vsnprintf
-#define NPT_snprintf _snprintf
-#endif
-#if defined(_DEBUG)
-#define _CRTDBG_MAP_ALLOC
-#endif
-#endif
-
-/* Windows CE */
-#if defined(_WIN32_WCE)
-#if defined(NPT_CONFIG_HAVE_FOPEN_S)
-#undef NPT_CONFIG_HAVE_FOPEN_S
-#endif
-#if defined(NPT_CONFIG_HAVE_GMTIME_S)
-#undef NPT_CONFIG_HAVE_GMTIME_S
-#endif
-#if defined(NPT_CONFIG_HAVE_LOCALTIME_S)
-#undef NPT_CONFIG_HAVE_LOCALTIME_S
-#endif
-#endif
-
-/* Symbian */
-#if defined(__SYMBIAN32__)
-#undef NPT_CONFIG_HAVE_NEW_H
-#include "e32std.h"
-#define explicit
-#define NPT_fseek fseek // no fseeko ?
-#define NPT_ftell ftell // no ftello ?
-#endif
-
-/* Android */
-#if defined(ANDROID)
-#define NPT_CONFIG_NO_RTTI
-#endif
-
-/*----------------------------------------------------------------------
-| defaults
-+---------------------------------------------------------------------*/
-#if !defined(NPT_FORMAT_64)
-#define NPT_FORMAT_64 "ll"
-#endif
-
-#if !defined(NPT_POINTER_TO_LONG)
-#define NPT_POINTER_TO_LONG(_p) ((long)(_p))
-#endif
-
-#if !defined(NPT_CONFIG_INT64_TYPE)
-#define NPT_CONFIG_INT64_TYPE long long
-#endif
-
-#if !defined(NPT_INT64_C)
-#define NPT_INT64_C(_x) _x##LL
-#endif
-
-#if !defined(NPT_UINT64_C)
-#define NPT_UINT64_C(_x) _x##ULL
-#endif
-
-#if !defined(NPT_snprintf)
-#define NPT_snprintf snprintf
-#endif
-
-#if !defined(NPT_strcpy)
-#define NPT_strcpy strcpy
-#endif
-
-#if !defined(NPT_strncpy)
-#define NPT_strncpy strncpy
-#endif
-
-#if !defined(NPT_vsnprintf)
-#define NPT_vsnprintf vsnprintf
-#endif
-
-#if !defined(NPT_LocalFunctionName)
-#define NPT_LocalFunctionName (NULL)
-#endif
-
-#if !defined(NPT_CONFIG_THREAD_STACK_SIZE)
-#define NPT_CONFIG_THREAD_STACK_SIZE 0
-#endif
-
-#if !defined(NPT_fseek)
-#define NPT_fseek fseeko
-#endif
-
-#if !defined(NPT_ftell)
-#define NPT_ftell ftello
-#endif
-
-#if !defined(NPT_stat)
-#define NPT_stat stat
-#endif
-
-#if !defined(NPT_stat_struct)
-#define NPT_stat_struct struct stat
-#endif
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#if defined(DMALLOC)
-#include <dmalloc.h>
-#endif
-
-#endif // _NPT_CONFIG_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Console
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-/** @file
-* Header file for console support
-*/
-
-#ifndef _NPT_CONSOLE_H_
-#define _NPT_CONSOLE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptResults.h"
-
-/*----------------------------------------------------------------------
-| prototypes
-+---------------------------------------------------------------------*/
-class NPT_Console {
-public:
- // class methods
- static void Output(const char* message);
- static void OutputF(const char* format, ...);
-};
-
-
-#endif /* _NPT_CONSOLE_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Constants
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_CONSTANTS_H_
-#define _NPT_CONSTANTS_H_
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#ifndef NULL
-#define NULL 0
-#endif
-
-const int NPT_TIMEOUT_INFINITE = -1;
-
-#endif // _NPT_CONSTANTS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Datagram Packets
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_DATA_BUFFER_H_
-#define _NPT_DATA_BUFFER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptConstants.h"
-
-/*----------------------------------------------------------------------
-| NPT_DataBuffer
-+---------------------------------------------------------------------*/
-class NPT_DataBuffer
-{
- public:
- // constructors & destructor
- NPT_DataBuffer(); // size unknown until first set
- NPT_DataBuffer(NPT_Size size); // initial size specified
- NPT_DataBuffer(const void* data, NPT_Size size, bool copy = true); // initial data and size specified
- NPT_DataBuffer(const NPT_DataBuffer& other);
- virtual ~NPT_DataBuffer();
-
- // operators
- NPT_DataBuffer& operator=(const NPT_DataBuffer& copy);
- bool operator==(const NPT_DataBuffer& other) const;
-
- // data buffer handling methods
- virtual NPT_Result SetBuffer(NPT_Byte* buffer, NPT_Size bufferSize);
- virtual NPT_Result SetBufferSize(NPT_Size bufferSize);
- virtual NPT_Size GetBufferSize() const { return m_BufferSize; }
- virtual NPT_Result Reserve(NPT_Size size);
- virtual NPT_Result Clear();
-
- // data handling methods
- virtual const NPT_Byte* GetData() const { return m_Buffer; }
- virtual NPT_Byte* UseData() { return m_Buffer; };
- virtual NPT_Size GetDataSize() const { return m_DataSize; }
- virtual NPT_Result SetDataSize(NPT_Size size);
- virtual NPT_Result SetData(const NPT_Byte* data, NPT_Size dataSize);
-
- protected:
- // members
- bool m_BufferIsLocal;
- NPT_Byte* m_Buffer;
- NPT_Size m_BufferSize;
- NPT_Size m_DataSize;
-
- // methods
- NPT_Result ReallocateBuffer(NPT_Size size);
-};
-
-#endif // _NPT_DATA_BUFFER_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Debug Utilities
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_DEBUG_H_
-#define _NPT_DEBUG_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-
-/*----------------------------------------------------------------------
-| standard macros
-+---------------------------------------------------------------------*/
-#if defined(NPT_CONFIG_HAVE_ASSERT_H) && defined(NPT_DEBUG)
-#include <assert.h>
-#define NPT_ASSERT(x) assert(x)
-#else
-#define NPT_ASSERT(x) ((void)0)
-#endif
-
-/*----------------------------------------------------------------------
-| NPT_Debug
-+---------------------------------------------------------------------*/
-extern void NPT_Debug(const char* format, ...);
-extern void NPT_DebugOutput(const char* message);
-
-#endif // _NPT_DEBUG_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Dynamic Cast Support
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_DYNAMIC_CAST_H_
-#define _NPT_DYNAMIC_CAST_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptCommon.h"
-#include "NptResults.h"
-#include "NptConfig.h"
-
-/*----------------------------------------------------------------------
-| macros
-+---------------------------------------------------------------------*/
-#if defined(NPT_CONFIG_NO_RTTI)
-#define NPT_DYNAMIC_CAST(_class,_object) \
-( ((_object)==0) ? 0 : reinterpret_cast<_class*>((_object)->DynamicCast(&_class::_class_##_class)) )
-#define NPT_IMPLEMENT_DYNAMIC_CAST(_class) \
-static int _class_##_class; \
-virtual void* DynamicCast(const void* class_anchor) { \
- if (class_anchor == &_class::_class_##_class) { \
- return static_cast<_class*>(this); \
- } \
- return NULL; \
-}
-#define NPT_IMPLEMENT_DYNAMIC_CAST_D(_class,_superclass)\
-static int _class_##_class; \
-virtual void* DynamicCast(const void* class_anchor) { \
- if (class_anchor == &_class::_class_##_class) { \
- return static_cast<_class*>(this); \
- } else { \
- return _superclass::DynamicCast(class_anchor); \
- } \
-}
-#define NPT_IMPLEMENT_DYNAMIC_CAST_D2(_class,_superclass,_mixin)\
-static int _class_##_class; \
-virtual void* DynamicCast(const void* class_anchor) { \
- if (class_anchor == &_class::_class_##_class) { \
- return static_cast<_class*>(this); \
- } else { \
- void* sup = _superclass::DynamicCast(class_anchor); \
- if (sup) return sup; \
- return _mixin::DynamicCast(class_anchor); \
- } \
-}
-#define NPT_DEFINE_DYNAMIC_CAST_ANCHOR(_class) int _class::_class_##_class = 0;
-
-#else
-
-#define NPT_DYNAMIC_CAST(_class,_object) dynamic_cast<_class*>(_object)
-#define NPT_IMPLEMENT_DYNAMIC_CAST(_class)
-#define NPT_IMPLEMENT_DYNAMIC_CAST_D(_class,_superclass)
-#define NPT_IMPLEMENT_DYNAMIC_CAST_D2(_class,_superclass,_mixin)
-#define NPT_DEFINE_DYNAMIC_CAST_ANCHOR(_class)
-
-#endif
-
-#endif // _NPT_DYNAMIC_CAST_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Dynamic Libraries
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_DYNAMIC_LIBRARIES_H_
-#define _NPT_DYNAMIC_LIBRARIES_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define NPT_DYANMIC_LIBRARY_LOAD_FLAG_NOW 1
-
-/*----------------------------------------------------------------------
-| NPT_DynamicLibraryInterface
-+---------------------------------------------------------------------*/
-class NPT_DynamicLibraryInterface
-{
-public:
- virtual ~NPT_DynamicLibraryInterface() {}
- virtual NPT_Result FindSymbol(const char* name, void*& symbol) = 0;
- virtual NPT_Result Unload() = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_DynamicLibrary
-+---------------------------------------------------------------------*/
-class NPT_DynamicLibrary : public NPT_DynamicLibraryInterface
-{
-public:
- // class methods
- static NPT_Result Load(const char* name, NPT_Flags flags, NPT_DynamicLibrary*& library);
-
- // destructor
- ~NPT_DynamicLibrary() { delete m_Delegate; }
-
- // NPT_DynamicLibraryInterface methods
- virtual NPT_Result FindSymbol(const char* name, void*& symbol) {
- return m_Delegate->FindSymbol(name, symbol);
- }
- virtual NPT_Result Unload() {
- return m_Delegate->Unload();
- }
-
-private:
- // methods
- NPT_DynamicLibrary(NPT_DynamicLibraryInterface* delegate) : m_Delegate(delegate) {}
-
- // members
- NPT_DynamicLibraryInterface* m_Delegate;
-};
-
-#endif // _NPT_DYNAMIC_LIBRARIES_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Files
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_FILE_H_
-#define _NPT_FILE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptStreams.h"
-#include "NptTime.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_NO_SUCH_FILE = NPT_ERROR_BASE_FILE - 0;
-const int NPT_ERROR_FILE_NOT_OPEN = NPT_ERROR_BASE_FILE - 1;
-const int NPT_ERROR_FILE_BUSY = NPT_ERROR_BASE_FILE - 2;
-const int NPT_ERROR_FILE_ALREADY_OPEN = NPT_ERROR_BASE_FILE - 3;
-const int NPT_ERROR_FILE_NOT_READABLE = NPT_ERROR_BASE_FILE - 4;
-const int NPT_ERROR_FILE_NOT_WRITABLE = NPT_ERROR_BASE_FILE - 5;
-const int NPT_ERROR_FILE_NOT_DIRECTORY = NPT_ERROR_BASE_FILE - 6;
-const int NPT_ERROR_FILE_ALREADY_EXISTS = NPT_ERROR_BASE_FILE - 7;
-const int NPT_ERROR_FILE_NOT_ENOUGH_SPACE = NPT_ERROR_BASE_FILE - 8;
-const int NPT_ERROR_DIRECTORY_NOT_EMPTY = NPT_ERROR_BASE_FILE - 9;
-
-const unsigned int NPT_FILE_OPEN_MODE_READ = 0x01;
-const unsigned int NPT_FILE_OPEN_MODE_WRITE = 0x02;
-const unsigned int NPT_FILE_OPEN_MODE_CREATE = 0x04;
-const unsigned int NPT_FILE_OPEN_MODE_TRUNCATE = 0x08;
-const unsigned int NPT_FILE_OPEN_MODE_UNBUFFERED = 0x10;
-const unsigned int NPT_FILE_OPEN_MODE_APPEND = 0x20;
-
-const unsigned int NPT_FILE_ATTRIBUTE_READ_ONLY = 0x01;
-const unsigned int NPT_FILE_ATTRIBUTE_LINK = 0x02;
-
-#define NPT_FILE_STANDARD_INPUT "@STDIN"
-#define NPT_FILE_STANDARD_OUTPUT "@STDOUT"
-#define NPT_FILE_STANDARD_ERROR "@STDERR"
-
-/*----------------------------------------------------------------------
-| class references
-+---------------------------------------------------------------------*/
-class NPT_DataBuffer;
-
-/*----------------------------------------------------------------------
-| NPT_FileInfo
-+---------------------------------------------------------------------*/
-struct NPT_FileInfo
-{
- // types
- typedef enum {
- FILE_TYPE_NONE,
- FILE_TYPE_REGULAR,
- FILE_TYPE_DIRECTORY,
- FILE_TYPE_SPECIAL,
- FILE_TYPE_OTHER
- } FileType;
-
- // constructor
- NPT_FileInfo() : m_Type(FILE_TYPE_NONE), m_Size(0), m_AttributesMask(0), m_Attributes(0) {}
-
- // members
- FileType m_Type;
- NPT_UInt64 m_Size;
- NPT_Flags m_AttributesMask;
- NPT_Flags m_Attributes;
- NPT_TimeStamp m_Created;
- NPT_TimeStamp m_Modified;
-};
-
-/*----------------------------------------------------------------------
-| NPT_FilePath
-+---------------------------------------------------------------------*/
-class NPT_FilePath
-{
-public:
- // class members
- static const NPT_String Separator;
-
- // class methods
- static NPT_String BaseName(const char* path, bool with_extension = true);
- static NPT_String DirName(const char* path);
- static NPT_String FileExtension(const char* path);
- static NPT_String Create(const char* directory, const char* base);
-
-private:
- NPT_FilePath() {} // this class can't have instances
-};
-
-/*----------------------------------------------------------------------
-| NPT_FileInterface
-+---------------------------------------------------------------------*/
-class NPT_FileInterface
-{
-public:
- // types
- typedef unsigned int OpenMode;
-
- // constructors and destructor
- virtual ~NPT_FileInterface() {}
-
- // methods
- virtual NPT_Result Open(OpenMode mode) = 0;
- virtual NPT_Result Close() = 0;
- virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream) = 0;
- virtual NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_File
-+---------------------------------------------------------------------*/
-class NPT_File : public NPT_FileInterface
-{
-public:
- // class methods
- static NPT_Result GetRoots(NPT_List<NPT_String>& roots);
- static NPT_Result GetSize(const char* path, NPT_LargeSize &size);
- static NPT_Result GetInfo(const char* path, NPT_FileInfo* info = NULL);
- static NPT_Result GetCount(const char* path, NPT_Cardinal& count);
- static bool Exists(const char* path) { return NPT_SUCCEEDED(GetInfo(path)); }
- static NPT_Result Remove(const char* path, bool recursively = false);
- static NPT_Result RemoveFile(const char* path);
- static NPT_Result RemoveDir(const char* path);
- static NPT_Result RemoveDir(const char* path, bool recursively);
- static NPT_Result Rename(const char* from_path, const char* to_path);
- static NPT_Result ListDir(const char* path, NPT_List<NPT_String>& entries, NPT_Ordinal start = 0, NPT_Cardinal count = 0);
- static NPT_Result CreateDir(const char* path);
- static NPT_Result CreateDir(const char* path, bool recursively);
- static NPT_Result GetWorkingDir(NPT_String& path);
- static NPT_Result Load(const char* path, NPT_DataBuffer& buffer, NPT_FileInterface::OpenMode mode = NPT_FILE_OPEN_MODE_READ);
- static NPT_Result Load(const char* path, NPT_String& data, NPT_FileInterface::OpenMode mode = NPT_FILE_OPEN_MODE_READ);
- static NPT_Result Save(const char* path, NPT_String& data);
- static NPT_Result Save(const char* path, const NPT_DataBuffer& buffer);
-
- // constructors and destructor
- NPT_File(const char* path);
- ~NPT_File() { delete m_Delegate; }
-
- // methods
- NPT_Result Load(NPT_DataBuffer& buffer);
- NPT_Result Save(const NPT_DataBuffer& buffer);
- const NPT_String& GetPath() { return m_Path; }
- NPT_Result GetSize(NPT_LargeSize &size);
- NPT_Result GetInfo(NPT_FileInfo& info);
- NPT_Result ListDir(NPT_List<NPT_String>& entries);
- NPT_Result Rename(const char* path);
- NPT_Result GetCount(NPT_Cardinal& count);
-
- // NPT_FileInterface methods
- NPT_Result Open(OpenMode mode) {
- return m_Delegate->Open(mode);
- }
- NPT_Result Close() {
- return m_Delegate->Close();
- }
- NPT_Result GetInputStream(NPT_InputStreamReference& stream) {
- return m_Delegate->GetInputStream(stream);
- }
- NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) {
- return m_Delegate->GetOutputStream(stream);
- }
-
- // operators
- NPT_File& operator=(const NPT_File& file);
-
-protected:
- // members
- NPT_FileInterface* m_Delegate;
- NPT_String m_Path;
- bool m_IsSpecial;
-};
-
-#endif // _NPT_FILE_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - HTTP Protocol
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_HTTP_H_
-#define _NPT_HTTP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptUri.h"
-#include "NptTypes.h"
-#include "NptList.h"
-#include "NptBufferedStreams.h"
-#include "NptSockets.h"
-#include "NptMap.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const unsigned int NPT_HTTP_DEFAULT_PORT = 80;
-const unsigned int NPT_HTTP_INVALID_PORT = 0;
-
-const NPT_Timeout NPT_HTTP_CLIENT_DEFAULT_CONNECTION_TIMEOUT = 30000;
-const NPT_Timeout NPT_HTTP_CLIENT_DEFAULT_IO_TIMEOUT = 30000;
-const NPT_Timeout NPT_HTTP_CLIENT_DEFAULT_NAME_RESOLVER_TIMEOUT = 60000;
-
-const NPT_Timeout NPT_HTTP_SERVER_DEFAULT_CONNECTION_TIMEOUT = NPT_TIMEOUT_INFINITE;
-const NPT_Timeout NPT_HTTP_SERVER_DEFAULT_IO_TIMEOUT = 60000;
-
-const int NPT_HTTP_PROTOCOL_MAX_LINE_LENGTH = 8192;
-const int NPT_HTTP_PROTOCOL_MAX_HEADER_COUNT = 100;
-
-#define NPT_HTTP_PROTOCOL_1_0 "HTTP/1.0"
-#define NPT_HTTP_PROTOCOL_1_1 "HTTP/1.1"
-#define NPT_HTTP_METHOD_GET "GET"
-#define NPT_HTTP_METHOD_HEAD "HEAD"
-#define NPT_HTTP_METHOD_POST "POST"
-
-#define NPT_HTTP_HEADER_HOST "Host"
-#define NPT_HTTP_HEADER_CONNECTION "Connection"
-#define NPT_HTTP_HEADER_USER_AGENT "User-Agent"
-#define NPT_HTTP_HEADER_SERVER "Server"
-#define NPT_HTTP_HEADER_CONTENT_LENGTH "Content-Length"
-#define NPT_HTTP_HEADER_CONTENT_TYPE "Content-Type"
-#define NPT_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"
-#define NPT_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
-#define NPT_HTTP_HEADER_LOCATION "Location"
-#define NPT_HTTP_HEADER_RANGE "Range"
-#define NPT_HTTP_HEADER_CONTENT_RANGE "Content-Range"
-#define NPT_HTTP_HEADER_COOKIE "Cookie"
-#define NPT_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"
-#define NPT_HTTP_HEADER_CONTENT_RANGE "Content-Range"
-
-#define NPT_HTTP_TRANSFER_ENCODING_CHUNKED "chunked"
-
-#define NPT_HTTP_HEADER_AUTHORIZATION "Authorization"
-
-const int NPT_ERROR_HTTP_INVALID_RESPONSE_LINE = NPT_ERROR_BASE_HTTP - 0;
-const int NPT_ERROR_HTTP_INVALID_REQUEST_LINE = NPT_ERROR_BASE_HTTP - 1;
-const int NPT_ERROR_HTTP_NO_PROXY = NPT_ERROR_BASE_HTTP - 2;
-const int NPT_ERROR_HTTP_INVALID_REQUEST = NPT_ERROR_BASE_HTTP - 3;
-const int NPT_ERROR_HTTP_METHOD_NOT_SUPPORTED = NPT_ERROR_BASE_HTTP - 4;
-
-#define NPT_HTTP_LINE_TERMINATOR "\r\n"
-
-/*----------------------------------------------------------------------
-| types
-+---------------------------------------------------------------------*/
-typedef unsigned int NPT_HttpStatusCode;
-typedef NPT_UrlQuery NPT_HttpUrlQuery; // for backward compatibility
-
-/*----------------------------------------------------------------------
-| NPT_HttpUrl
-+---------------------------------------------------------------------*/
-class NPT_HttpUrl : public NPT_Url {
-public:
- // constructors
- NPT_HttpUrl() {}
- NPT_HttpUrl(const char* host,
- NPT_UInt16 port,
- const char* path,
- const char* query = NULL,
- const char* fragment = NULL);
- NPT_HttpUrl(const char* url, bool ignore_scheme = false);
-
- // methods
- virtual NPT_String ToString(bool with_fragment = true) const;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpProtocol
-+---------------------------------------------------------------------*/
-class NPT_HttpProtocol
-{
-public:
- // class methods
- const char* GetStatusCodeString(NPT_HttpStatusCode status_code);
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpHeader
-+---------------------------------------------------------------------*/
-class NPT_HttpHeader {
-public:
- // constructors and destructor
- NPT_HttpHeader(const char* name, const char* value);
- ~NPT_HttpHeader();
-
- // methods
- NPT_Result Emit(NPT_OutputStream& stream) const;
- const NPT_String& GetName() const { return m_Name; }
- const NPT_String& GetValue() const { return m_Value; }
- NPT_Result SetName(const char* name);
- NPT_Result SetValue(const char* value);
-
-private:
- // members
- NPT_String m_Name;
- NPT_String m_Value;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpHeaders
-+---------------------------------------------------------------------*/
-class NPT_HttpHeaders {
-public:
- // constructors and destructor
- NPT_HttpHeaders();
- ~NPT_HttpHeaders();
-
- // methods
- NPT_Result Parse(NPT_BufferedInputStream& stream);
- NPT_Result Emit(NPT_OutputStream& stream) const;
- NPT_List<NPT_HttpHeader*>& GetHeaders() { return m_Headers; }
- NPT_HttpHeader* GetHeader(const char* name) const;
- const NPT_String* GetHeaderValue(const char* name) const;
- NPT_Result SetHeader(const char* name, const char* value, bool replace=true);
- NPT_Result AddHeader(const char* name, const char* value);
-
-private:
- // members
- NPT_List<NPT_HttpHeader*> m_Headers;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpEntity
-+---------------------------------------------------------------------*/
-class NPT_HttpEntity {
-public:
- // constructors and destructor
- NPT_HttpEntity();
- NPT_HttpEntity(const NPT_HttpHeaders& headers);
- virtual ~NPT_HttpEntity();
-
- // methods
- NPT_Result SetInputStream(const NPT_InputStreamReference& stream,
- bool update_content_length = false);
- NPT_Result SetInputStream(const void* data, NPT_Size size);
- NPT_Result SetInputStream(const NPT_String& string);
- NPT_Result SetInputStream(const char* string);
- NPT_Result GetInputStream(NPT_InputStreamReference& stream);
- NPT_Result Load(NPT_DataBuffer& buffer);
- NPT_Result SetHeaders(const NPT_HttpHeaders& headers);
-
- // field access
- NPT_Result SetContentLength(NPT_LargeSize length);
- NPT_Result SetContentType(const char* type);
- NPT_Result SetContentEncoding(const char* encoding);
- NPT_Result SetTransferEncoding(const char* encoding);
- NPT_LargeSize GetContentLength() { return m_ContentLength; }
- const NPT_String& GetContentType() { return m_ContentType; }
- const NPT_String& GetContentEncoding() { return m_ContentEncoding; }
- const NPT_String& GetTransferEncoding(){ return m_TransferEncoding;}
- bool HasContentLength() { return m_HasContentLength;}
-
-private:
- // members
- NPT_InputStreamReference m_InputStream;
- NPT_LargeSize m_ContentLength;
- NPT_String m_ContentType;
- NPT_String m_ContentEncoding;
- NPT_String m_TransferEncoding;
- bool m_HasContentLength;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpMessage
-+---------------------------------------------------------------------*/
-class NPT_HttpMessage {
-public:
- // constructors and destructor
- virtual ~NPT_HttpMessage();
-
- // methods
- const NPT_String& GetProtocol() const {
- return m_Protocol;
- }
- NPT_Result SetProtocol(const char* protocol) {
- m_Protocol = protocol;
- return NPT_SUCCESS;
- }
- NPT_HttpHeaders& GetHeaders() {
- return m_Headers;
- }
- NPT_Result SetEntity(NPT_HttpEntity* entity);
- NPT_HttpEntity* GetEntity() {
- return m_Entity;
- }
- virtual NPT_Result ParseHeaders(NPT_BufferedInputStream& stream);
-
-protected:
- // constructors
- NPT_HttpMessage(const char* protocol);
-
- // members
- NPT_String m_Protocol;
- NPT_HttpHeaders m_Headers;
- NPT_HttpEntity* m_Entity;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpRequest
-+---------------------------------------------------------------------*/
-class NPT_HttpRequest : public NPT_HttpMessage {
-public:
- // class methods
- static NPT_Result Parse(NPT_BufferedInputStream& stream,
- const NPT_SocketAddress* endpoint,
- NPT_HttpRequest*& request);
-
- // constructors and destructor
- NPT_HttpRequest(const NPT_HttpUrl& url,
- const char* method,
- const char* protocol = NPT_HTTP_PROTOCOL_1_0);
- NPT_HttpRequest(const char* url,
- const char* method,
- const char* protocol = NPT_HTTP_PROTOCOL_1_0);
- virtual ~NPT_HttpRequest();
-
- // methods
- const NPT_HttpUrl& GetUrl() const { return m_Url; }
- NPT_HttpUrl& GetUrl() { return m_Url; }
- NPT_Result SetUrl(const char* url);
- NPT_Result SetUrl(const NPT_HttpUrl& url);
- const NPT_String& GetMethod() const { return m_Method; }
- virtual NPT_Result Emit(NPT_OutputStream& stream, bool use_proxy=false) const;
-
-protected:
- // members
- NPT_HttpUrl m_Url;
- NPT_String m_Method;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpResponse
-+---------------------------------------------------------------------*/
-class NPT_HttpResponse : public NPT_HttpMessage {
-public:
- // class methods
- static NPT_Result Parse(NPT_BufferedInputStream& stream,
- NPT_HttpResponse*& response,
- bool reuse_response = false);
-
- // constructors and destructor
- NPT_HttpResponse(NPT_HttpStatusCode status_code,
- const char* reason_phrase,
- const char* protocol = NPT_HTTP_PROTOCOL_1_0);
- virtual ~NPT_HttpResponse();
-
- // methods
- NPT_Result SetStatus(NPT_HttpStatusCode status_code,
- const char* reason_phrase,
- const char* protocol = NPT_HTTP_PROTOCOL_1_0);
- NPT_Result SetProtocol(const char* protocol);
- NPT_HttpStatusCode GetStatusCode() { return m_StatusCode; }
- NPT_String& GetReasonPhrase() { return m_ReasonPhrase; }
- virtual NPT_Result Emit(NPT_OutputStream& stream) const;
-
-protected:
- // members
- NPT_HttpStatusCode m_StatusCode;
- NPT_String m_ReasonPhrase;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpProxyAddress
-+---------------------------------------------------------------------*/
-class NPT_HttpProxyAddress
-{
-public:
- NPT_HttpProxyAddress() : m_Port(NPT_HTTP_INVALID_PORT) {}
- NPT_HttpProxyAddress(const char* hostname, NPT_UInt16 port) :
- m_HostName(hostname), m_Port(port) {}
-
- const NPT_String& GetHostName() const { return m_HostName; }
- void SetHostName(const char* hostname) { m_HostName = hostname; }
- NPT_UInt16 GetPort() const { return m_Port; }
- void SetPort(NPT_UInt16 port) { m_Port = port; }
-
-private:
- NPT_String m_HostName;
- NPT_UInt16 m_Port;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpProxySelector
-+---------------------------------------------------------------------*/
-class NPT_HttpProxySelector
-{
-public:
- // class methods
- static NPT_HttpProxySelector* GetSystemDefault();
-
- // methods
- virtual ~NPT_HttpProxySelector() {};
- virtual NPT_Result GetProxyForUrl(const NPT_HttpUrl& url, NPT_HttpProxyAddress& proxy) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpClient
-+---------------------------------------------------------------------*/
-class NPT_HttpClient {
-public:
- // types
- struct Config {
- NPT_Timeout m_ConnectionTimeout;
- NPT_Timeout m_IoTimeout;
- NPT_Timeout m_NameResolverTimeout;
- bool m_FollowRedirect;
- };
-
- class Connector {
- public:
- virtual ~Connector() {}
-
- virtual NPT_Result Connect(const char* hostname,
- NPT_UInt16 port,
- NPT_Timeout connection_timeout,
- NPT_Timeout io_timeout,
- NPT_Timeout name_resolver_timeout,
- NPT_InputStreamReference& input_stream,
- NPT_OutputStreamReference& output_stream) = 0;
-
- };
-
- // class methods
- static NPT_Result WriteRequest(NPT_OutputStream& output_stream,
- NPT_HttpRequest& request,
- bool use_proxy = false);
- static NPT_Result ReadResponse(NPT_InputStreamReference& input_stream,
- bool expect_entity,
- NPT_HttpResponse*& response);
-
- /**
- * @param connector Pointer to a Connector instance, or NULL to use
- * the default (TCP) connector.
- */
- NPT_HttpClient(Connector* connector = NULL);
-
- virtual ~NPT_HttpClient();
-
- // methods
- NPT_Result SendRequest(NPT_HttpRequest& request,
- NPT_HttpResponse*& response);
- NPT_Result SetConfig(const Config& config);
- NPT_Result SetProxy(const char* hostname, NPT_UInt16 port);
- NPT_Result SetProxySelector(NPT_HttpProxySelector* selector);
- NPT_Result SetConnector(Connector* connector);
- NPT_Result SetTimeouts(NPT_Timeout connection_timeout,
- NPT_Timeout io_timeout,
- NPT_Timeout name_resolver_timeout);
-
-protected:
- // methods
- NPT_Result SendRequestOnce(NPT_HttpRequest& request,
- NPT_HttpResponse*& response);
-
- // members
- Config m_Config;
- NPT_HttpProxySelector* m_ProxySelector;
- bool m_ProxySelectorIsOwned;
- Connector* m_Connector;
-
-public:
- static NPT_String m_UserAgentHeader;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpRequestContext
-+---------------------------------------------------------------------*/
-class NPT_HttpRequestContext
-{
-public:
- // constructor
- NPT_HttpRequestContext() {}
- NPT_HttpRequestContext(const NPT_SocketAddress* local_address,
- const NPT_SocketAddress* remote_address);
-
- // methods
- const NPT_SocketAddress& GetLocalAddress() const { return m_LocalAddress; }
- const NPT_SocketAddress& GetRemoteAddress() const { return m_RemoteAddress; }
- void SetLocalAddress(const NPT_SocketAddress& address) {
- m_LocalAddress = address;
- }
- void SetRemoteAddress(const NPT_SocketAddress& address) {
- m_RemoteAddress = address;
- }
-
-private:
- // members
- NPT_SocketAddress m_LocalAddress;
- NPT_SocketAddress m_RemoteAddress;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpRequestHandler
-+---------------------------------------------------------------------*/
-class NPT_HttpRequestHandler
-{
-public:
- // destructor
- virtual ~NPT_HttpRequestHandler() {}
-
- // methods
- virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response) = 0;
-
- /**
- * Override this method if you want to write the body yourself.
- * The default implementation will simply write out the entity's
- * input stream.
- */
- virtual NPT_Result SendResponseBody(const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response,
- NPT_OutputStream& output);
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpStaticRequestHandler
-+---------------------------------------------------------------------*/
-class NPT_HttpStaticRequestHandler : public NPT_HttpRequestHandler
-{
-public:
- // constructors
- NPT_HttpStaticRequestHandler(const char* document,
- const char* mime_type = "text/html",
- bool copy = true);
- NPT_HttpStaticRequestHandler(const void* data,
- NPT_Size size,
- const char* mime_type = "text/html",
- bool copy = true);
-
- // NPT_HttpRequestHandler methods
- virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
-protected:
- NPT_String m_MimeType;
- NPT_DataBuffer m_Buffer;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpFileRequestHandler_FileTypeMap
-+---------------------------------------------------------------------*/
-typedef struct NPT_HttpFileRequestHandler_FileTypeMapEntry {
- const char* extension;
- const char* mime_type;
-} NPT_HttpFileRequestHandler_FileTypeMapEntry;
-
-// specify size here so NPT_ARRAY_SIZE can work
-extern const NPT_HttpFileRequestHandler_FileTypeMapEntry NPT_HttpFileRequestHandler_DefaultFileTypeMap[43];
-
-/*----------------------------------------------------------------------
-| NPT_HttpFileRequestHandler
-+---------------------------------------------------------------------*/
-class NPT_HttpFileRequestHandler : public NPT_HttpRequestHandler
-{
-public:
- // constructors
- NPT_HttpFileRequestHandler(const char* url_root,
- const char* file_root,
- bool auto_dir = false);
-
- // NPT_HttpRequestHandler methods
- virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
- // accessors
- NPT_Map<NPT_String,NPT_String>& GetFileTypeMap() { return m_FileTypeMap; }
- void SetDefaultMimeType(const char* mime_type) {
- m_DefaultMimeType = mime_type;
- }
- void SetUseDefaultFileTypeMap(bool use_default) {
- m_UseDefaultFileTypeMap = use_default;
- }
-
-protected:
- // methods
- const char* GetContentType(const NPT_String& filename);
-
-private:
- NPT_String m_UrlRoot;
- NPT_String m_FileRoot;
- NPT_Map<NPT_String, NPT_String> m_FileTypeMap;
- NPT_String m_DefaultMimeType;
- bool m_UseDefaultFileTypeMap;
- bool m_AutoDir;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpServer
-+---------------------------------------------------------------------*/
-class NPT_HttpServer {
-public:
- // types
- struct Config {
- NPT_Timeout m_ConnectionTimeout;
- NPT_Timeout m_IoTimeout;
- NPT_IpAddress m_ListenAddress;
- NPT_UInt16 m_ListenPort;
- bool m_ReuseAddress;
- };
-
- // constructors and destructor
- NPT_HttpServer(NPT_UInt16 listen_port = NPT_HTTP_DEFAULT_PORT,
- bool reuse_address = true);
- NPT_HttpServer(NPT_IpAddress listen_address,
- NPT_UInt16 listen_port = NPT_HTTP_DEFAULT_PORT,
- bool reuse_address = true);
- virtual ~NPT_HttpServer();
-
- // methods
- NPT_Result SetConfig(const Config& config);
- const Config& GetConfig() const { return m_Config; }
- NPT_Result SetListenPort(NPT_UInt16 port, bool reuse_address = true);
- NPT_Result SetTimeouts(NPT_Timeout connection_timeout, NPT_Timeout io_timeout);
- NPT_Result Abort();
- NPT_Result WaitForNewClient(NPT_InputStreamReference& input,
- NPT_OutputStreamReference& output,
- NPT_HttpRequestContext* context);
- NPT_Result Loop();
- NPT_UInt16 GetPort() { return m_BoundPort; }
-
- /**
- * Add a request handler. The ownership of the handler is NOT transfered to this object,
- * so the caller is responsible for the lifetime management of the handler object.
- */
- NPT_Result AddRequestHandler(NPT_HttpRequestHandler* handler, const char* path, bool include_children = false);
- NPT_HttpRequestHandler* FindRequestHandler(NPT_HttpRequest& request);
-
- /**
- * Parse the request from a new client, form a response, and send it back.
- */
- NPT_Result RespondToClient(NPT_InputStreamReference& input,
- NPT_OutputStreamReference& output,
- const NPT_HttpRequestContext& context);
-
-protected:
- // types
- struct HandlerConfig {
- HandlerConfig(NPT_HttpRequestHandler* handler,
- const char* path,
- bool include_children);
- ~HandlerConfig();
-
- // methods
- bool WillHandle(NPT_HttpRequest& request);
-
- // members
- NPT_HttpRequestHandler* m_Handler;
- NPT_String m_Path;
- bool m_IncludeChildren;
- };
-
- // methods
- NPT_Result Bind();
-
- // members
- NPT_TcpServerSocket m_Socket;
- NPT_UInt16 m_BoundPort;
- Config m_Config;
- NPT_List<HandlerConfig*> m_RequestHandlers;
-
-public:
- static NPT_String m_ServerHeader;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpResponder
-+---------------------------------------------------------------------*/
-class NPT_HttpResponder {
-public:
- // types
- struct Config {
- NPT_Timeout m_IoTimeout;
- };
-
- // constructors and destructor
- NPT_HttpResponder(NPT_InputStreamReference& input,
- NPT_OutputStreamReference& output);
- virtual ~NPT_HttpResponder();
-
- // methods
- NPT_Result SetConfig(const Config& config);
- NPT_Result SetTimeout(NPT_Timeout io_timeout);
- NPT_Result ParseRequest(NPT_HttpRequest*& request,
- const NPT_SocketAddress* local_address = NULL);
- NPT_Result SendResponseHeaders(NPT_HttpResponse& response);
-
-protected:
- // members
- Config m_Config;
- NPT_BufferedInputStreamReference m_Input;
- NPT_OutputStreamReference m_Output;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpChunkedInputStream
-+---------------------------------------------------------------------*/
-class NPT_HttpChunkedInputStream : public NPT_InputStream
-{
-public:
- // constructors and destructor
- NPT_HttpChunkedInputStream(NPT_BufferedInputStreamReference& stream);
- virtual ~NPT_HttpChunkedInputStream();
-
- // NPT_InputStream methods
- NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL);
- NPT_Result Seek(NPT_Position offset);
- NPT_Result Tell(NPT_Position& offset);
- NPT_Result GetSize(NPT_LargeSize& size);
- NPT_Result GetAvailable(NPT_LargeSize& available);
-
-protected:
- // members
- NPT_BufferedInputStreamReference m_Source;
- NPT_UInt32 m_CurrentChunkSize;
- bool m_Eos;
-};
-
-/*----------------------------------------------------------------------
-| NPT_HttpChunkedOutputStream
-+---------------------------------------------------------------------*/
-class NPT_HttpChunkedOutputStream : public NPT_OutputStream
-{
-public:
- // constructors and destructor
- NPT_HttpChunkedOutputStream(NPT_OutputStream& stream);
- virtual ~NPT_HttpChunkedOutputStream();
-
- // NPT_OutputStream methods
- NPT_Result Write(const void* buffer,
- NPT_Size bytes_to_write,
- NPT_Size* bytes_written = NULL);
- NPT_Result Seek(NPT_Position /*offset*/) { return NPT_ERROR_NOT_SUPPORTED;}
- NPT_Result Tell(NPT_Position& offset) { return m_Stream.Tell(offset); }
- NPT_Result Flush() { return m_Stream.Flush(); }
-
-protected:
- // members
- NPT_OutputStream& m_Stream;
-};
-
-#endif // _NPT_HTTP_H_
-
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Interfaces
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_INTERFACES_H_
-#define _NPT_INTERFACES_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptCommon.h"
-#include "NptResults.h"
-#include "NptConfig.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_NO_SUCH_INTERFACE = NPT_ERROR_BASE_INTERFACES - 0;
-
-/*----------------------------------------------------------------------
-| NPT_InterfaceId
-+---------------------------------------------------------------------*/
-class NPT_InterfaceId
-{
- public:
- // methods
- bool operator==(const NPT_InterfaceId& id) const {
- return ((id.m_Id == m_Id) && (id.m_Version == m_Version));
- }
-
- // members
- unsigned long m_Id;
- unsigned long m_Version;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Polymorphic
-+---------------------------------------------------------------------*/
-class NPT_Polymorphic
-{
-public:
- // destructor
- virtual ~NPT_Polymorphic() {}
-
- // methods
- virtual NPT_Result GetInterface(const NPT_InterfaceId& id,
- NPT_Interface*& iface) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Interruptible
-+---------------------------------------------------------------------*/
-class NPT_Interruptible
-{
-public:
- // destructor
- virtual ~NPT_Interruptible() {}
-
- // methods
- virtual NPT_Result Interrupt() = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Configurable
-+---------------------------------------------------------------------*/
-class NPT_Configurable
-{
-public:
- // destructor
- virtual ~NPT_Configurable() {}
-
- // methods
- virtual NPT_Result SetProperty(const char* /*name*/,
- const char* /*value*/) {
- return NPT_ERROR_NO_SUCH_PROPERTY;
- }
- virtual NPT_Result SetProperty(const char* /*name*/,
- int /*value*/) {
- return NPT_ERROR_NO_SUCH_PROPERTY;
- }
- virtual NPT_Result GetProperty(const char* /*name*/,
- NPT_PropertyValue& /*value*/) {
- return NPT_ERROR_NO_SUCH_PROPERTY;
- }
-};
-
-#endif // _NPT_INTERFACES_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Lists
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_LIST_H_
-#define _NPT_LIST_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptResults.h"
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptCommon.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_LIST_EMPTY = NPT_ERROR_BASE_LIST - 0;
-const int NPT_ERROR_LIST_OPERATION_ABORTED = NPT_ERROR_BASE_LIST - 1;
-const int NPT_ERROR_LIST_OPERATION_CONTINUE = NPT_ERROR_BASE_LIST - 2;
-
-/*----------------------------------------------------------------------
-| NPT_List
-+---------------------------------------------------------------------*/
-template <typename T>
-class NPT_List
-{
-protected:
- class Item;
-
-public:
- // types
- typedef T Element;
-
- class Iterator {
- public:
- Iterator() : m_Item(NULL) {}
- explicit Iterator(Item* item) : m_Item(item) {}
- Iterator(const Iterator& copy) : m_Item(copy.m_Item) {}
- T& operator*() const { return m_Item->m_Data; }
- T* operator->() const { return &m_Item->m_Data;}
- Iterator& operator++() { // prefix
- m_Item = m_Item->m_Next;
- return (*this);
- }
- Iterator operator++(int) { // postfix
- Iterator saved_this = *this;
- m_Item = m_Item->m_Next;
- return saved_this;
- }
- Iterator& operator--() { // prefix
- m_Item = m_Item->m_Prev;
- return (*this);
- }
- Iterator operator--(int) { // postfix
- Iterator saved_this = *this;
- m_Item = m_Item->m_Prev;
- return saved_this;
- }
- operator bool() const {
- return m_Item != NULL;
- }
- bool operator==(const Iterator& other) const {
- return m_Item == other.m_Item;
- }
- bool operator!=(const Iterator& other) const {
- return m_Item != other.m_Item;
- }
- void operator=(const Iterator& other) {
- m_Item = other.m_Item;
- }
- void operator=(Item* item) {
- m_Item = item;
- }
-
- private:
- Item* m_Item;
-
- // friends
- friend class NPT_List<T>;
- };
-
- // methods
- NPT_List<T>();
- NPT_List<T>(const NPT_List<T>& list);
- ~NPT_List<T>();
- NPT_Result Add(const T& data);
- NPT_Result Insert(const Iterator where, const T& data);
- NPT_Result Remove(const T& data, bool all=false);
- NPT_Result Erase(const Iterator position);
- NPT_Result PopHead(T& data);
- bool Contains(const T& data) const;
- NPT_Result Clear();
- NPT_Result Get(NPT_Ordinal index, T& data) const;
- NPT_Result Get(NPT_Ordinal index, T*& data) const;
- NPT_Cardinal GetItemCount() const { return m_ItemCount; }
- Iterator GetFirstItem() const { return Iterator(m_Head); }
- Iterator GetLastItem() const { return Iterator(m_Tail); }
- Iterator GetItem(NPT_Ordinal index) const;
-
- // list manipulation
- NPT_Result Add(NPT_List<T>& list);
- NPT_Result Remove(const NPT_List<T>& list, bool all=false);
-
- // item manipulation
- NPT_Result Add(Item& item);
- NPT_Result Detach(Item& item);
- NPT_Result Insert(const Iterator where, Item& item);
-
- // list operations
- // keep these template members defined here because MSV6 does not let
- // us define them later
- template <typename X>
- NPT_Result Apply(const X& function) const
- {
- Item* item = m_Head;
- while (item) {
- function(item->m_Data);
- item = item->m_Next;
- }
-
- return NPT_SUCCESS;
- }
-
- template <typename X, typename P>
- NPT_Result ApplyUntil(const X& function, const P& predicate, bool* match = NULL) const
- {
- Item* item = m_Head;
- while (item) {
- NPT_Result return_value;
- if (predicate(function(item->m_Data), return_value)) {
- if (match) *match = true;
- return return_value;
- }
- item = item->m_Next;
- }
-
- if (match) *match = false;
- return NPT_SUCCESS;
- }
-
- template <typename P>
- Iterator Find(const P& predicate, NPT_Ordinal n=0) const
- {
- Item* item = m_Head;
- while (item) {
- if (predicate(item->m_Data)) {
- if (n == 0) {
- return Iterator(item);
- }
- --n;
- }
- item = item->m_Next;
- }
-
- return Iterator(NULL);
- }
-
- // operators
- void operator=(const NPT_List<T>& other);
- bool operator==(const NPT_List<T>& other) const;
- bool operator!=(const NPT_List<T>& other) const;
-
-protected:
- // types
- class Item
- {
- public:
- // methods
- Item(const T& data) : m_Next(0), m_Prev(0), m_Data(data) {}
-
- // members
- Item* m_Next;
- Item* m_Prev;
- T m_Data;
-
- // friends
- //friend class NPT_List<T>;
- //friend class NPT_List<T>::Iterator;
- };
-
- // members
- NPT_Cardinal m_ItemCount;
- Item* m_Head;
- Item* m_Tail;
-};
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::NPT_List
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_List<T>::NPT_List() : m_ItemCount(0), m_Head(0), m_Tail(0)
-{
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::NPT_List
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_List<T>::NPT_List(const NPT_List<T>& list) : m_ItemCount(0), m_Head(0), m_Tail(0)
-{
- *this = list;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::~NPT_List<T>
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_List<T>::~NPT_List()
-{
- Clear();
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::operator=
-+---------------------------------------------------------------------*/
-template <typename T>
-void
-NPT_List<T>::operator=(const NPT_List<T>& list)
-{
- // cleanup
- Clear();
-
- // copy the new list
- Item* item = list.m_Head;
- while (item) {
- Add(item->m_Data);
- item = item->m_Next;
- }
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::operator==
-+---------------------------------------------------------------------*/
-template <typename T>
-bool
-NPT_List<T>::operator==(const NPT_List<T>& other) const
-{
- // quick test
- if (m_ItemCount != other.m_ItemCount) return false;
-
- // compare all elements one by one
- Item* our_item = m_Head;
- Item* their_item = other.m_Head;
- while (our_item && their_item) {
- if (our_item->m_Data != their_item->m_Data) return false;
- our_item = our_item->m_Next;
- their_item = their_item->m_Next;
- }
-
- return our_item == NULL && their_item == NULL;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::operator!=
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-bool
-NPT_List<T>::operator!=(const NPT_List<T>& other) const
-{
- return !(*this == other);
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Clear
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Clear()
-{
- // delete all items
- Item* item = m_Head;
- while (item) {
- Item* next = item->m_Next;
- delete item;
- item = next;
- }
-
- m_ItemCount = 0;
- m_Head = NULL;
- m_Tail = NULL;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Add
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Add(Item& item)
-{
- // add element at the tail
- if (m_Tail) {
- item.m_Prev = m_Tail;
- item.m_Next = NULL;
- m_Tail->m_Next = &item;
- m_Tail = &item;
- } else {
- m_Head = &item;
- m_Tail = &item;
- item.m_Next = NULL;
- item.m_Prev = NULL;
- }
-
- // one more item in the list now
- ++m_ItemCount;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Add
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Add(NPT_List<T>& list)
-{
- // copy the new list
- Item* item = list.m_Head;
- while (item) {
- Add(item->m_Data);
- item = item->m_Next;
- }
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Add
-+---------------------------------------------------------------------*/
-template <typename T>
-inline
-NPT_Result
-NPT_List<T>::Add(const T& data)
-{
- return Add(*new Item(data));
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::GetItem
-+---------------------------------------------------------------------*/
-template <typename T>
-typename NPT_List<T>::Iterator
-NPT_List<T>::GetItem(NPT_Ordinal n) const
-{
- Iterator result;
- if (n >= m_ItemCount) return result;
-
- result = m_Head;
- for (unsigned int i=0; i<n; i++) {
- ++result;
- }
-
- return result;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Insert
-+---------------------------------------------------------------------*/
-template <typename T>
-inline NPT_Result
-NPT_List<T>::Insert(Iterator where, const T&data)
-{
- return Insert(where, *new Item(data));
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Insert
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Insert(Iterator where, Item& item)
-{
- // insert the item in the list
- Item* position = where.m_Item;
- if (position) {
- // insert at position
- item.m_Next = position;
- item.m_Prev = position->m_Prev;
- position->m_Prev = &item;
- if (item.m_Prev) {
- item.m_Prev->m_Next = &item;
- } else {
- // this is the new head
- m_Head = &item;
- }
-
- // one more item in the list now
- ++m_ItemCount;
- } else {
- // insert at tail
- return Add(item);
- }
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Erase
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Erase(Iterator position)
-{
- if (!position) return NPT_ERROR_NO_SUCH_ITEM;
- Detach(*position.m_Item);
- delete position.m_Item;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Remove
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Remove(const T& data, bool all)
-{
- Item* item = m_Head;
- NPT_Cardinal matches = 0;
-
- while (item) {
- Item* next = item->m_Next;
- if (item->m_Data == data) {
- // we found a match
- ++matches;
-
- // detach item
- Detach(*item);
-
- // destroy the item
- delete item;
-
- if (!all) return NPT_SUCCESS;
- }
- item = next;
- }
-
- return matches?NPT_SUCCESS:NPT_ERROR_NO_SUCH_ITEM;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Remove
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Remove(const NPT_List<T>& list, bool all)
-{
- Item* item = list.m_Head;
- while (item) {
- Remove(item->m_Data, all);
- item = item->m_Next;
- }
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Detach
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Detach(Item& item)
-{
- // remove item
- if (item.m_Prev) {
- // item is not the head
- if (item.m_Next) {
- // item is not the tail
- item.m_Next->m_Prev = item.m_Prev;
- item.m_Prev->m_Next = item.m_Next;
- } else {
- // item is the tail
- m_Tail = item.m_Prev;
- m_Tail->m_Next = NULL;
- }
- } else {
- // item is the head
- m_Head = item.m_Next;
- if (m_Head) {
- // item is not the tail
- m_Head->m_Prev = NULL;
- } else {
- // item is also the tail
- m_Tail = NULL;
- }
- }
-
- // one less item in the list now
- --m_ItemCount;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Get
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Get(NPT_Ordinal index, T& data) const
-{
- T* data_pointer;
- NPT_CHECK(Get(index, data_pointer));
- data = *data_pointer;
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Get
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::Get(NPT_Ordinal index, T*& data) const
-{
- Item* item = m_Head;
-
- if (index < m_ItemCount) {
- while (index--) item = item->m_Next;
- data = &item->m_Data;
- return NPT_SUCCESS;
- } else {
- data = NULL;
- return NPT_ERROR_NO_SUCH_ITEM;
- }
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::PopHead
-+---------------------------------------------------------------------*/
-template <typename T>
-NPT_Result
-NPT_List<T>::PopHead(T& data)
-{
- // check that we have an element
- if (m_Head == NULL) return NPT_ERROR_LIST_EMPTY;
-
- // copy the head item's data
- data = m_Head->m_Data;
-
- // discard the head item
- Item* head = m_Head;
- m_Head = m_Head->m_Next;
- if (m_Head) {
- m_Head->m_Prev = NULL;
- } else {
- m_Tail = NULL;
- }
- delete head;
-
- // update the count
- --m_ItemCount;
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_List<T>::Contains
-+---------------------------------------------------------------------*/
-template <typename T>
-bool
-NPT_List<T>::Contains(const T& data) const
-{
- Item* item = m_Head;
- while (item) {
- if (item->m_Data == data) return true;
- item = item->m_Next;
- }
-
- return false;
-}
-
-#endif // _NPT_LIST_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Logging Support
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-/** @file
-* Header file for logging
-*/
-
-#ifndef _NPT_LOGGING_H_
-#define _NPT_LOGGING_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#include "NptDebug.h"
-#include "NptTypes.h"
-#include "NptTime.h"
-#include "NptStrings.h"
-#include "NptList.h"
-#include "NptStreams.h"
-#include "NptThreads.h"
-#include "NptHttp.h"
-
-/*----------------------------------------------------------------------
-| class references
-+---------------------------------------------------------------------*/
-class NPT_LogManager;
-
-/*----------------------------------------------------------------------
-| types
-+---------------------------------------------------------------------*/
-class NPT_LogRecord {
-public:
- const char* m_LoggerName;
- int m_Level;
- const char* m_Message;
- NPT_TimeStamp m_TimeStamp;
- const char* m_SourceFile;
- unsigned int m_SourceLine;
- const char* m_SourceFunction;
-};
-
-class NPT_LogHandler {
-public:
- // class methods
- static NPT_Result Create(const char* logger_name,
- const char* handler_name,
- NPT_LogHandler*& handler);
-
- // methods
- virtual ~NPT_LogHandler() {}
- virtual void Log(const NPT_LogRecord& record) = 0;
- virtual NPT_String ToString() { return ""; }
-};
-
-class NPT_Logger {
-public:
- // methods
- NPT_Logger(const char* name, NPT_LogManager& manager);
- ~NPT_Logger();
- void Log(int level,
- const char* source_file,
- unsigned int source_line,
- const char* source_function,
- const char* msg,
- ...);
-
- NPT_Result AddHandler(NPT_LogHandler* handler);
- NPT_Result DeleteHandlers();
- NPT_Result SetParent(NPT_Logger* parent);
- const NPT_String& GetName() const { return m_Name; }
- int GetLevel() const { return m_Level; }
- bool GetForwardToParent() const { return m_ForwardToParent; }
- NPT_List<NPT_LogHandler*>& GetHandlers() { return m_Handlers; }
-
-private:
- // members
- NPT_LogManager& m_Manager;
- NPT_String m_Name;
- int m_Level;
- bool m_LevelIsInherited;
- bool m_ForwardToParent;
- NPT_Logger* m_Parent;
- NPT_List<NPT_LogHandler*> m_Handlers;
-
- // friends
- friend class NPT_LogManager;
-};
-
-typedef struct {
- NPT_Logger* logger;
- const char* name;
-} NPT_LoggerReference;
-
-class NPT_Log {
-public:
- // class methods
- static int GetLogLevel(const char* name);
- static const char* GetLogLevelName(int level);
- static const char* GetLogLevelAnsiColor(int level);
- static void FormatRecordToStream(const NPT_LogRecord& record,
- NPT_OutputStream& stream,
- bool use_colors,
- NPT_Flags format_filter);
-};
-
-class NPT_LogConfigEntry {
-public:
- NPT_LogConfigEntry(const char* key, const char* value) :
- m_Key(key), m_Value(value) {}
- NPT_String m_Key;
- NPT_String m_Value;
-};
-
-class NPT_LogManager {
-public:
- // class methods
- static NPT_LogManager& GetDefault();
- static bool ConfigValueIsBooleanTrue(NPT_String& value);
- static bool ConfigValueIsBooleanFalse(NPT_String& value);
- static NPT_Logger* GetLogger(const char* name);
-
- // methods
- NPT_LogManager();
- ~NPT_LogManager();
- NPT_Result Configure(const char* config_sources = NULL);
- NPT_String* GetConfigValue(const char* prefix, const char* suffix);
- NPT_List<NPT_Logger*>& GetLoggers() { return m_Loggers; }
- NPT_List<NPT_LogConfigEntry>& GetConfig() { return m_Config; }
- void Enable(bool value) { m_Enabled = value; }
- void Lock() { m_Lock.Lock(); }
- void Unlock() { m_Lock.Unlock(); }
-
-private:
- // methods
- NPT_Result SetConfigValue(const char* key, const char* value);
- NPT_Result ParseConfig(const char* config, NPT_Size config_size);
- NPT_Result ParseConfigSource(NPT_String& source);
- NPT_Result ParseConfigFile(const char* filename);
- bool HaveLoggerConfig(const char* name);
- NPT_Logger* FindLogger(const char* name);
- NPT_Result ConfigureLogger(NPT_Logger* logger);
-
- // members
- NPT_Mutex m_Lock;
- volatile bool m_Enabled;
- volatile bool m_Configured;
- volatile bool m_Configuring;
- NPT_List<NPT_LogConfigEntry> m_Config;
- NPT_List<NPT_Logger*> m_Loggers;
- NPT_Logger* m_Root;
-};
-
-const unsigned short NPT_HTTP_LOGGER_CONFIGURATOR_DEFAULT_PORT = 6378;
-class NPT_HttpLoggerConfigurator : NPT_HttpRequestHandler, public NPT_Thread {
-public:
- // constructor and destructor
- NPT_HttpLoggerConfigurator(NPT_UInt16 port = NPT_HTTP_LOGGER_CONFIGURATOR_DEFAULT_PORT,
- bool detached = true);
- virtual ~NPT_HttpLoggerConfigurator();
-
- // NPT_Runnable (NPT_Thread) methods
- virtual void Run();
-
-private:
- // NPT_HttpRequestHandler methods
- virtual NPT_Result SetupResponse(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
- // members
- NPT_HttpServer* m_Server;
-};
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define NPT_LOG_LEVEL_FATAL 700
-#define NPT_LOG_LEVEL_SEVERE 600
-#define NPT_LOG_LEVEL_WARNING 500
-#define NPT_LOG_LEVEL_INFO 400
-#define NPT_LOG_LEVEL_FINE 300
-#define NPT_LOG_LEVEL_FINER 200
-#define NPT_LOG_LEVEL_FINEST 100
-
-#define NPT_LOG_LEVEL_OFF 32767
-#define NPT_LOG_LEVEL_ALL 0
-
-/*----------------------------------------------------------------------
-| macros
-+---------------------------------------------------------------------*/
-#define NPT_LOG_GET_LOGGER(_logger) \
- if ((_logger).logger == NULL) { \
- (_logger).logger = NPT_LogManager::GetLogger((_logger).name); \
- }
-
-#if defined(NPT_CONFIG_ENABLE_LOGGING)
-
-#define NPT_DEFINE_LOGGER(_logger, _name) static NPT_LoggerReference _logger = { NULL, (_name) };
-
-#define NPT_LOG_X(_logger, _level, _argsx) \
-do { \
- NPT_LOG_GET_LOGGER((_logger)) \
- if ((_logger).logger && (_level) >= (_logger).logger->GetLevel()) { \
- (_logger).logger->Log _argsx; \
- } \
-} while(0)
-
-#define NPT_CHECK_LL(_logger, _level, _result) do { \
- NPT_Result _x = (_result); \
- if (_x != NPT_SUCCESS) { \
- NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"NPT_CHECK failed, result=%d (%s) [%s]", _x, NPT_ResultText(_x), #_result)); \
- return _x; \
- } \
-} while(0)
-
-#define NPT_CHECK_LABEL_LL(_logger, _level, _result, _label) do { \
- NPT_Result _x = (_result); \
- if (_x != NPT_SUCCESS) { \
- NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"NPT_CHECK failed, result=%d (%s) [%s]", _x, NPT_ResultText(_x), #_result)); \
- goto _label; \
- } \
-} while(0)
-#define NPT_CHECK_POINTER_LL(_logger, _level, _p) do { \
- if ((_p) == NULL) { \
- NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"@@@ NULL pointer parameter")); \
- return NPT_ERROR_INVALID_PARAMETERS; \
- } \
-} while(0)
-#define NPT_CHECK_POINTER_LABEL_LL(_logger, _level, _p, _label) do { \
- if ((_p) == NULL) { \
- NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),"@@@ NULL pointer parameter")); \
- goto _label; \
- } \
-} while(0)
-
-#else /* NPT_CONFIG_ENABLE_LOGGING */
-
-#define NPT_DEFINE_LOGGER(_logger, _name)
-#define NPT_LOG_X(_logger, _level, _argsx)
-#define NPT_CHECK_LL(_logger, _level, _result) NPT_CHECK(_result)
-#define NPT_CHECK_LABEL_LL(_logger, _level, _result, _label) NPT_CHECK_LABEL((_result), _label)
-#define NPT_CHECK_POINTER_LL(_logger, _level, _p) NPT_CHECK_POINTER((_p))
-#define NPT_CHECK_POINTER_LABEL_LL(_logger, _level, _p, _label) NPT_CHECK_POINTER_LABEL((_p), _label)
-
-#endif /* NPT_CONFIG_ENABLE_LOGGING */
-
-#define NPT_SET_LOCAL_LOGGER(_name) NPT_DEFINE_LOGGER(_NPT_LocalLogger, (_name))
-#define NPT_CHECK_L(_level, _result) NPT_CHECK_LL(_NPT_LocalLogger, (_level), (_result))
-#define NPT_CHECK_LABEL_L(_level, _result, _label) NPT_CHECK_LABEL_LL(_NPT_LocalLogger, (_level), NULL, (_result), _label)
-
-/* NOTE: the following are machine-generated, do not edit */
-#define NPT_LOG_LL(_logger,_level,_msg) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg)))
-#define NPT_LOG(_level,_msg) NPT_LOG_LL((_NPT_LocalLogger),(_level),(_msg))
-#define NPT_LOG_L(_logger,_level,_msg) NPT_LOG_LL((_logger),(_level),(_msg))
-#define NPT_LOG_LL1(_logger,_level,_msg,_arg1) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1)))
-#define NPT_LOG_1(_level,_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),(_level),(_msg),(_arg1))
-#define NPT_LOG_L1(_logger,_level,_msg,_arg1) NPT_LOG_LL1((_logger),(_level),(_msg),(_arg1))
-#define NPT_LOG_LL2(_logger,_level,_msg,_arg1,_arg2) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2)))
-#define NPT_LOG_2(_level,_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2))
-#define NPT_LOG_L2(_logger,_level,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),(_level),(_msg),(_arg1),(_arg2))
-#define NPT_LOG_LL3(_logger,_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3)))
-#define NPT_LOG_3(_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_L3(_logger,_level,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_LL4(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4)))
-#define NPT_LOG_4(_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_L4(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_LL5(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5)))
-#define NPT_LOG_5(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_L5(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_LL6(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6)))
-#define NPT_LOG_6(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_L6(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_LL7(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7)))
-#define NPT_LOG_7(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_L7(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_LL8(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8)))
-#define NPT_LOG_8(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_L8(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_LL9(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_X((_logger),(_level),((_level),__FILE__,__LINE__,(NPT_LocalFunctionName),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9)))
-#define NPT_LOG_9(_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_L9(_logger,_level,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),(_level),(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-
-#define NPT_LOG_FATAL(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg))
-#define NPT_LOG_FATAL_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FATAL,(_msg))
-#define NPT_LOG_FATAL_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1))
-#define NPT_LOG_FATAL_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1))
-#define NPT_LOG_FATAL_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FATAL_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FATAL_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FATAL_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FATAL_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FATAL_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FATAL_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FATAL_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FATAL_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FATAL_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FATAL_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FATAL_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FATAL_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FATAL_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FATAL_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FATAL_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FATAL,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_SEVERE(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg))
-#define NPT_LOG_SEVERE_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_msg))
-#define NPT_LOG_SEVERE_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1))
-#define NPT_LOG_SEVERE_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1))
-#define NPT_LOG_SEVERE_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_SEVERE_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_SEVERE_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_SEVERE_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_SEVERE_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_SEVERE_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_SEVERE_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_SEVERE_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_SEVERE_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_SEVERE_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_SEVERE_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_SEVERE_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_SEVERE_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_SEVERE_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_SEVERE_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_SEVERE_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_SEVERE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_WARNING(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg))
-#define NPT_LOG_WARNING_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_WARNING,(_msg))
-#define NPT_LOG_WARNING_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1))
-#define NPT_LOG_WARNING_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1))
-#define NPT_LOG_WARNING_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_WARNING_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_WARNING_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_WARNING_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_WARNING_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_WARNING_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_WARNING_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_WARNING_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_WARNING_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_WARNING_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_WARNING_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_WARNING_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_WARNING_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_WARNING_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_WARNING_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_WARNING_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_WARNING,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_INFO(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg))
-#define NPT_LOG_INFO_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_INFO,(_msg))
-#define NPT_LOG_INFO_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1))
-#define NPT_LOG_INFO_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1))
-#define NPT_LOG_INFO_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_INFO_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_INFO_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_INFO_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_INFO_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_INFO_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_INFO_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_INFO_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_INFO_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_INFO_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_INFO_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_INFO_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_INFO_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_INFO_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_INFO_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_INFO_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_INFO,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FINE(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg))
-#define NPT_LOG_FINE_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINE,(_msg))
-#define NPT_LOG_FINE_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1))
-#define NPT_LOG_FINE_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1))
-#define NPT_LOG_FINE_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FINE_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FINE_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FINE_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FINE_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FINE_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FINE_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FINE_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FINE_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FINE_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FINE_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FINE_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FINE_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FINE_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FINE_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FINE_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINE,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FINER(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg))
-#define NPT_LOG_FINER_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINER,(_msg))
-#define NPT_LOG_FINER_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1))
-#define NPT_LOG_FINER_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1))
-#define NPT_LOG_FINER_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FINER_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FINER_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FINER_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FINER_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FINER_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FINER_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FINER_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FINER_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FINER_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FINER_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FINER_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FINER_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FINER_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FINER_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FINER_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINER,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FINEST(_msg) NPT_LOG_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg))
-#define NPT_LOG_FINEST_L(_logger,_msg) NPT_LOG_LL((_logger),NPT_LOG_LEVEL_FINEST,(_msg))
-#define NPT_LOG_FINEST_1(_msg,_arg1) NPT_LOG_LL1((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1))
-#define NPT_LOG_FINEST_L1(_logger,_msg,_arg1) NPT_LOG_LL1((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1))
-#define NPT_LOG_FINEST_2(_msg,_arg1,_arg2) NPT_LOG_LL2((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FINEST_L2(_logger,_msg,_arg1,_arg2) NPT_LOG_LL2((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2))
-#define NPT_LOG_FINEST_3(_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FINEST_L3(_logger,_msg,_arg1,_arg2,_arg3) NPT_LOG_LL3((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3))
-#define NPT_LOG_FINEST_4(_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FINEST_L4(_logger,_msg,_arg1,_arg2,_arg3,_arg4) NPT_LOG_LL4((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4))
-#define NPT_LOG_FINEST_5(_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FINEST_L5(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5) NPT_LOG_LL5((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5))
-#define NPT_LOG_FINEST_6(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FINEST_L6(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6) NPT_LOG_LL6((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6))
-#define NPT_LOG_FINEST_7(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FINEST_L7(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7) NPT_LOG_LL7((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7))
-#define NPT_LOG_FINEST_8(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FINEST_L8(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8) NPT_LOG_LL8((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8))
-#define NPT_LOG_FINEST_9(_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-#define NPT_LOG_FINEST_L9(_logger,_msg,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9) NPT_LOG_LL9((_logger),NPT_LOG_LEVEL_FINEST,(_msg),(_arg1),(_arg2),(_arg3),(_arg4),(_arg5),(_arg6),(_arg7),(_arg8),(_arg9))
-
-#define NPT_CHECK_FATAL(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_result))
-#define NPT_CHECK_FATAL_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FATAL,(_result))
-#define NPT_CHECK_SEVERE(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_result))
-#define NPT_CHECK_SEVERE_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_result))
-#define NPT_CHECK_WARNING(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_result))
-#define NPT_CHECK_WARNING_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_WARNING,(_result))
-#define NPT_CHECK_INFO(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_result))
-#define NPT_CHECK_INFO_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_INFO,(_result))
-#define NPT_CHECK_FINE(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_result))
-#define NPT_CHECK_FINE_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINE,(_result))
-#define NPT_CHECK_FINER(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_result))
-#define NPT_CHECK_FINER_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINER,(_result))
-#define NPT_CHECK_FINEST(_result) NPT_CHECK_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_result))
-#define NPT_CHECK_FINEST_L(_logger,_result) NPT_CHECK_LL((_logger),NPT_LOG_LEVEL_FINEST,(_result))
-
-#define NPT_CHECK_LABEL_FATAL(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_result),_label)
-#define NPT_CHECK_LABEL_FATAL_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FATAL,(_result),_label)
-#define NPT_CHECK_LABEL_SEVERE(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_result),_label)
-#define NPT_CHECK_LABEL_SEVERE_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_SEVERE,(_result),_label)
-#define NPT_CHECK_LABEL_WARNING(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_result),_label)
-#define NPT_CHECK_LABEL_WARNING_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_WARNING,(_result),_label)
-#define NPT_CHECK_LABEL_INFO(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_result),_label)
-#define NPT_CHECK_LABEL_INFO_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_INFO,(_result),_label)
-#define NPT_CHECK_LABEL_FINE(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_result),_label)
-#define NPT_CHECK_LABEL_FINE_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINE,(_result),_label)
-#define NPT_CHECK_LABEL_FINER(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_result),_label)
-#define NPT_CHECK_LABEL_FINER_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINER,(_result),_label)
-#define NPT_CHECK_LABEL_FINEST(_result,_label) NPT_CHECK_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_result),_label)
-#define NPT_CHECK_LABEL_FINEST_L(_logger,_result,_label) NPT_CHECK_LABEL_LL((_logger),NPT_LOG_LEVEL_FINEST,(_result),_label)
-
-#define NPT_CHECK_POINTER_FATAL(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_p))
-#define NPT_CHECK_POINTER_FATAL_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FATAL,(_p))
-#define NPT_CHECK_POINTER_SEVERE(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_p))
-#define NPT_CHECK_POINTER_SEVERE_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_SEVERE,(_p))
-#define NPT_CHECK_POINTER_WARNING(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_p))
-#define NPT_CHECK_POINTER_WARNING_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_WARNING,(_p))
-#define NPT_CHECK_POINTER_INFO(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_p))
-#define NPT_CHECK_POINTER_INFO_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_INFO,(_p))
-#define NPT_CHECK_POINTER_FINE(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_p))
-#define NPT_CHECK_POINTER_FINE_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINE,(_p))
-#define NPT_CHECK_POINTER_FINER(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_p))
-#define NPT_CHECK_POINTER_FINER_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINER,(_p))
-#define NPT_CHECK_POINTER_FINEST(_p) NPT_CHECK_POINTER_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_p))
-#define NPT_CHECK_POINTER_FINEST_L(_logger,_p) NPT_CHECK_POINTER_LL(_logger,NPT_LOG_LEVEL_FINEST,(_p))
-
-#define NPT_CHECK_POINTER_LABEL_FATAL(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FATAL,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FATAL_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FATAL,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_SEVERE(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_SEVERE,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_SEVERE_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_SEVERE,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_WARNING(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_WARNING,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_WARNING_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_WARNING,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_INFO(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_INFO,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_INFO_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_INFO,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FINE(_p, _label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINE,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FINE_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINE,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FINER(_p,_label) NPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINER,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FINER_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINER,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FINEST(_p,_label) NNPT_CHECK_POINTER_LABEL_LL((_NPT_LocalLogger),NPT_LOG_LEVEL_FINEST,(_p),_label)
-#define NPT_CHECK_POINTER_LABEL_FINEST_L(_logger,_p,_label) NPT_CHECK_POINTER_LABEL_LL(_logger,NPT_LOG_LEVEL_FINEST,(_p),_label)
-
-#endif /* _NPT_LOGGING_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Maps
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-
-#ifndef _NPT_MAP_H_
-#define _NPT_MAP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptResults.h"
-#include "NptList.h"
-
-/*----------------------------------------------------------------------
-| NPT_Map
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-class NPT_Map
-{
-public:
- // types
- class Entry {
- public:
- // constructor
- Entry(const K& key, const V& value) : m_Key(key), m_Value(value) {}
- Entry(const K& key) : m_Key(key) {}
-
- // accessors
- const K& GetKey() const { return m_Key; }
- const V& GetValue() const { return m_Value; }
-
- // operators
- bool operator==(const Entry& other) const {
- return m_Key == other.m_Key && m_Value == other.m_Value;
- }
-
- protected:
- // methods
- void SetValue(const V& value) { m_Value = value; }
-
- // members
- K m_Key;
- V m_Value;
-
- // friends
- friend class NPT_Map<K,V>;
- };
-
- class EntryValueDeleter {
- public:
- void operator()(Entry* entry) const {
- delete entry->GetValue();
- }
- };
-
- // constructors
- NPT_Map<K,V>() {}
- NPT_Map<K,V>(const NPT_Map<K,V>& copy);
-
- // destructor
- ~NPT_Map<K,V>();
-
- // methods
- NPT_Result Put(const K& key, const V& value);
- NPT_Result Get(const K& key, V*& value) const;
- bool HasKey(const K& key) const { return GetEntry(key) != NULL; }
- bool HasValue(const V& value) const;
- NPT_Result Erase(const K& key);
- NPT_Cardinal GetEntryCount() const { return m_Entries.GetItemCount(); }
- const NPT_List<Entry*>& GetEntries() const { return m_Entries; }
- NPT_Result Clear();
-
- // operators
- V& operator[](const K& key);
- const NPT_Map<K,V>& operator=(const NPT_Map<K,V>& copy);
- bool operator==(const NPT_Map<K,V>& other) const;
- bool operator!=(const NPT_Map<K,V>& other) const;
-
-private:
- // types
- typedef typename NPT_List<Entry*>::Iterator ListIterator;
-
- // methods
- Entry* GetEntry(const K& key) const;
-
- // members
- NPT_List<Entry*> m_Entries;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::NPT_Map<K,V>
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-NPT_Map<K,V>::NPT_Map(const NPT_Map<K,V>& copy)
-{
- *this = copy;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::~NPT_Map<K,V>
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-NPT_Map<K,V>::~NPT_Map()
-{
- // call Clear to ensure we delete all entry objects
- Clear();
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::Clear
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-NPT_Result
-NPT_Map<K,V>::Clear()
-{
- m_Entries.Apply(NPT_ObjectDeleter<Entry>());
- m_Entries.Clear();
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::GetEntry
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-typename NPT_Map<K,V>::Entry*
-NPT_Map<K,V>::GetEntry(const K& key) const
-{
- typename NPT_List<Entry*>::Iterator entry = m_Entries.GetFirstItem();
- while (entry) {
- if ((*entry)->GetKey() == key) {
- return *entry;
- }
- ++entry;
- }
-
- return NULL;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::Put
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-NPT_Result
-NPT_Map<K,V>::Put(const K& key, const V& value)
-{
- Entry* entry = GetEntry(key);
- if (entry == NULL) {
- // no existing entry for that key, create one
- m_Entries.Add(new Entry(key, value));
- } else {
- // replace the existing entry for that key
- entry->SetValue(value);
- }
-
- return NPT_SUCCESS;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::Get
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-NPT_Result
-NPT_Map<K,V>::Get(const K& key, V*& value) const
-{
- Entry* entry = GetEntry(key);
- if (entry == NULL) {
- // no existing entry for that key
- value = NULL;
- return NPT_ERROR_NO_SUCH_ITEM;
- } else {
- // found an entry with that key
- value = &entry->m_Value;
- return NPT_SUCCESS;
- }
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::HasValue
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-bool
-NPT_Map<K,V>::HasValue(const V& value) const
-{
- ListIterator entry = m_Entries.GetFirstItem();
- while (entry) {
- if (value == (*entry)->m_Value) {
- return true;
- }
- ++entry;
- }
-
- return false;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::operator=
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-const NPT_Map<K,V>&
-NPT_Map<K,V>::operator=(const NPT_Map<K,V>& copy)
-{
- // do nothing if we're assigning to ourselves
- if (this == ©) return copy;
-
- // destroy all entries
- Clear();
-
- // copy all entries one by one
- ListIterator entry = copy.m_Entries.GetFirstItem();
- while (entry) {
- m_Entries.Add(new Entry((*entry)->GetKey(), (*entry)->GetValue()));
- ++entry;
- }
-
- return *this;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::Erase
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-NPT_Result
-NPT_Map<K,V>::Erase(const K& key)
-{
- ListIterator entry = m_Entries.GetFirstItem();
- while (entry) {
- if ((*entry)->GetKey() == key) {
- delete *entry; // do this before removing the entry from the
- // list, because Erase() will invalidate the
- // iterator item
- m_Entries.Erase(entry);
- return NPT_SUCCESS;
- }
- ++entry;
- }
-
- return NPT_ERROR_NO_SUCH_ITEM;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::operator==
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-bool
-NPT_Map<K,V>::operator==(const NPT_Map<K,V>& other) const
-{
- // quick test
- if (m_Entries.GetItemCount() != other.m_Entries.GetItemCount()) return false;
-
- // compare all entries to all other entries
- ListIterator entry = m_Entries.GetFirstItem();
- while (entry) {
- V* value;
- if (NPT_SUCCEEDED(other.Get((*entry)->m_Key, value))) {
- // the other map has an entry for this key, check the value
- if (!(*value == (*entry)->m_Value)) return false;
- } else {
- // the other map does not have an entry for this key
- return false;
- }
- ++entry;
- }
-
- return true;
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::operator!=
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-bool
-NPT_Map<K,V>::operator!=(const NPT_Map<K,V>& other) const
-{
- return !(*this == other);
-}
-
-/*----------------------------------------------------------------------
-| NPT_Map<K,V>::operator[]
-+---------------------------------------------------------------------*/
-template <typename K, typename V>
-inline
-V&
-NPT_Map<K,V>::operator[](const K& key)
-{
- Entry* entry = GetEntry(key);
- if (entry == NULL) {
- // create a new "default" entry for this key
- entry = new Entry(key);
- m_Entries.Add(entry);
- }
-
- return entry->m_Value;
-}
-
-#endif // _NPT_MAP_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Messaging System
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_MESSAGING_H_
-#define _NPT_MESSAGING_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConstants.h"
-#include "NptTypes.h"
-#include "NptResults.h"
-#include "NptList.h"
-#include "NptDynamicCast.h"
-
-/*----------------------------------------------------------------------
-| forward references
-+---------------------------------------------------------------------*/
-class NPT_Message;
-
-/*----------------------------------------------------------------------
-| NPT_MessageHandler
-+---------------------------------------------------------------------*/
-class NPT_MessageHandler
-{
-public:
- NPT_IMPLEMENT_DYNAMIC_CAST(NPT_MessageHandler)
-
- // methods
- virtual ~NPT_MessageHandler() {}
-
- // default message handler
- virtual void OnMessage(NPT_Message*) {}
-
- // this method is a central point of handling for received messages.
- // it can be overloaded by subclasses who wish to process all
- // incoming messages
- virtual NPT_Result HandleMessage(NPT_Message* message);
-};
-
-/*----------------------------------------------------------------------
-| NPT_Messsage
-+---------------------------------------------------------------------*/
-class NPT_Message
-{
-public:
- // types
- typedef const char* Type;
-
- // static members
- static Type MessageType;
-
- // methods
- virtual ~NPT_Message() {}
- virtual Type GetType() { return MessageType; }
- virtual NPT_Result Dispatch(NPT_MessageHandler* handler) {
- return DefaultDeliver(handler);
- }
- // this method should really be called 'Deliver', but this would
- // cause a problem when subclasses overload it
- virtual NPT_Result DefaultDeliver(NPT_MessageHandler* handler) {
- handler->OnMessage(this);
- return NPT_SUCCESS;
- }
-};
-
-/*----------------------------------------------------------------------
-| NPT_TerminateMesssage
-+---------------------------------------------------------------------*/
-class NPT_TerminateMessage : public NPT_Message
-{
- public:
- // methods
- NPT_Result Dispatch(NPT_MessageHandler* /*handler*/) {
- return NPT_ERROR_TERMINATED;
- }
-};
-
-/*----------------------------------------------------------------------
-| NPT_MessageQueue
-+---------------------------------------------------------------------*/
-class NPT_MessageQueue
-{
- public:
- // methods
- virtual ~NPT_MessageQueue() {}
- virtual NPT_Result PumpMessage(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
- virtual NPT_Result QueueMessage(NPT_Message* message,
- NPT_MessageHandler* handler) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_MessageReceiver
-+---------------------------------------------------------------------*/
-class NPT_MessageReceiver
-{
-public:
- // methods
- NPT_MessageReceiver() : m_Queue(NULL), m_Handler(NULL) {}
- NPT_MessageReceiver(NPT_MessageHandler* handler) :
- m_Queue(NULL), m_Handler(handler) {}
- NPT_MessageReceiver(NPT_MessageQueue* queue) :
- m_Queue(queue), m_Handler(NULL) {}
- NPT_MessageReceiver(NPT_MessageHandler* handler,
- NPT_MessageQueue* queue) :
- m_Queue(queue), m_Handler(handler) {}
- virtual ~NPT_MessageReceiver() {}
- NPT_Result SetQueue(NPT_MessageQueue* queue) {
- m_Queue = queue;
- return NPT_SUCCESS;
- }
- NPT_Result SetHandler(NPT_MessageHandler* handler) {
- m_Handler = handler;
- return NPT_SUCCESS;
- }
- virtual NPT_Result PostMessage(NPT_Message* message) {
- if (m_Queue) {
- return m_Queue->QueueMessage(message, m_Handler);
- } else {
- return NPT_FAILURE;
- }
- }
-
-protected:
- // members
- NPT_MessageQueue* m_Queue;
- NPT_MessageHandler* m_Handler;
-};
-
-/*----------------------------------------------------------------------
-| NPT_MessageBroadcaster
-+---------------------------------------------------------------------*/
-class NPT_MessageBroadcaster
-{
-public:
- // methods
- NPT_MessageBroadcaster(NPT_Message* message) : m_Message(message) {}
- NPT_Result operator()(NPT_MessageReceiver*& receiver) const {
- receiver->PostMessage(m_Message);
- return NPT_SUCCESS;
- }
-
-private:
- // members
- NPT_Message* m_Message;
-};
-
-#endif // _NPT_MESSAGING_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Network
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_NETWORK_H_
-#define _NPT_NETWORK_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptStrings.h"
-#include "NptList.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const unsigned int NPT_NETWORK_MAX_MAC_ADDRESS_LENGTH = 8;
-
-/*----------------------------------------------------------------------
-| flags
-+---------------------------------------------------------------------*/
-#define NPT_NETWORK_INTERFACE_FLAG_LOOPBACK 0x01
-#define NPT_NETWORK_INTERFACE_FLAG_PROMISCUOUS 0x02
-#define NPT_NETWORK_INTERFACE_FLAG_BROADCAST 0x04
-#define NPT_NETWORK_INTERFACE_FLAG_MULTICAST 0x08
-#define NPT_NETWORK_INTERFACE_FLAG_POINT_TO_POINT 0x10
-
-/*----------------------------------------------------------------------
-| workarounds
-+---------------------------------------------------------------------*/
-#if defined(_WIN32)
-#if defined(SetPort)
-#undef SetPort
-#endif
-#endif
-
-/*----------------------------------------------------------------------
-| types
-+---------------------------------------------------------------------*/
-typedef unsigned int NPT_IpPort;
-
-/*----------------------------------------------------------------------
-| NPT_IpAddress
-+---------------------------------------------------------------------*/
-class NPT_IpAddress
-{
-public:
- // class members
- static const NPT_IpAddress Any;
-
- // constructors and destructor
- NPT_IpAddress();
- NPT_IpAddress(unsigned long address);
-
- // methods
- NPT_Result ResolveName(const char* name,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
- NPT_Result Parse(const char* name);
- NPT_Result Set(unsigned long address);
- NPT_Result Set(const unsigned char bytes[4]);
- const unsigned char* AsBytes() const;
- unsigned long AsLong() const;
- NPT_String ToString() const;
-
- // operators
- bool operator==(const NPT_IpAddress& other) const;
-
-private:
- // members
- unsigned char m_Address[4];
-};
-
-/*----------------------------------------------------------------------
-| NPT_MacAddress
-+---------------------------------------------------------------------*/
-class NPT_MacAddress
-{
-public:
- // typedef enum
- typedef enum {
- TYPE_UNKNOWN,
- TYPE_LOOPBACK,
- TYPE_ETHERNET,
- TYPE_PPP,
- TYPE_IEEE_802_11
- } Type;
-
- // constructors and destructor
- NPT_MacAddress() : m_Type(TYPE_UNKNOWN), m_Length(0) {}
- NPT_MacAddress(Type type,
- const unsigned char* addr,
- unsigned int length);
-
- // methods
- void SetAddress(Type type, const unsigned char* addr,
- unsigned int length);
- Type GetType() const { return m_Type; }
- const unsigned char* GetAddress() const { return m_Address; }
- unsigned int GetLength() const { return m_Length; }
- NPT_String ToString() const;
-
-private:
- // members
- Type m_Type;
- unsigned char m_Address[NPT_NETWORK_MAX_MAC_ADDRESS_LENGTH];
- unsigned int m_Length;
-};
-
-/*----------------------------------------------------------------------
-| NPT_NetworkInterfaceAddress
-+---------------------------------------------------------------------*/
-class NPT_NetworkInterfaceAddress
-{
-public:
- // constructors and destructor
- NPT_NetworkInterfaceAddress(const NPT_IpAddress& primary,
- const NPT_IpAddress& broadcast,
- const NPT_IpAddress& destination,
- const NPT_IpAddress& netmask) :
- m_PrimaryAddress(primary),
- m_BroadcastAddress(broadcast),
- m_DestinationAddress(destination),
- m_NetMask(netmask) {}
-
- // methods
- const NPT_IpAddress& GetPrimaryAddress() const {
- return m_PrimaryAddress;
- }
- const NPT_IpAddress& GetBroadcastAddress() const {
- return m_BroadcastAddress;
- }
- const NPT_IpAddress& GetDestinationAddress() const {
- return m_DestinationAddress;
- }
- const NPT_IpAddress& GetNetMask() const {
- return m_NetMask;
- }
-
- bool IsAddressInNetwork(const NPT_IpAddress& adress) {
- if (m_PrimaryAddress.AsLong() == adress.AsLong()) return true;
- if (m_NetMask.AsLong() == 0) return false;
- return (m_PrimaryAddress.AsLong() & m_NetMask.AsLong()) == (adress.AsLong() & m_NetMask.AsLong());
- }
-
-private:
- // members
- NPT_IpAddress m_PrimaryAddress;
- NPT_IpAddress m_BroadcastAddress;
- NPT_IpAddress m_DestinationAddress;
- NPT_IpAddress m_NetMask;
-};
-
-/*----------------------------------------------------------------------
-| NPT_NetworkInterface
-+---------------------------------------------------------------------*/
-class NPT_NetworkInterface
-{
-public:
- // class methods
- static NPT_Result GetNetworkInterfaces(NPT_List<NPT_NetworkInterface*>& interfaces);
-
- // constructors and destructor
- NPT_NetworkInterface(const char* name,
- const NPT_MacAddress& mac,
- NPT_Flags flags);
- ~NPT_NetworkInterface() {}
-
- // methods
- NPT_Result AddAddress(const NPT_NetworkInterfaceAddress& address);
- const NPT_String& GetName() const {
- return m_Name;
- }
- const NPT_MacAddress& GetMacAddress() const {
- return m_MacAddress;
- }
- NPT_Flags GetFlags() const { return m_Flags; }
- const NPT_List<NPT_NetworkInterfaceAddress>& GetAddresses() const {
- return m_Addresses;
- }
-
- bool IsAddressInNetwork(const NPT_IpAddress& address) {
- NPT_List<NPT_NetworkInterfaceAddress>::Iterator iter = m_Addresses.GetFirstItem();
- while (iter) {
- if ((*iter).IsAddressInNetwork(address)) return true;
- ++iter;
- }
- return false;
- }
-
-private:
- // members
- NPT_String m_Name;
- NPT_MacAddress m_MacAddress;
- NPT_Flags m_Flags;
- NPT_List<NPT_NetworkInterfaceAddress> m_Addresses;
-};
-
-
-#endif // _NPT_NETWORK_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Queue
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_QUEUE_H_
-#define _NPT_QUEUE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptConstants.h"
-
-/*----------------------------------------------------------------------
-| NPT_QueueItem
-+---------------------------------------------------------------------*/
-class NPT_QueueItem;
-
-/*----------------------------------------------------------------------
-| NPT_GenericQueue
-+---------------------------------------------------------------------*/
-class NPT_GenericQueue
-{
- public:
- // class methods
- static NPT_GenericQueue* CreateInstance(NPT_Cardinal max_items = 0);
-
- // methods
- virtual ~NPT_GenericQueue() {}
- virtual NPT_Result Push(NPT_QueueItem* item,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
- virtual NPT_Result Pop(NPT_QueueItem*& item,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
- virtual NPT_Result Peek(NPT_QueueItem*& item,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
- protected:
- // methods
- NPT_GenericQueue() {}
-};
-
-/*----------------------------------------------------------------------
-| NPT_Queue
-+---------------------------------------------------------------------*/
-template <class T>
-class NPT_Queue
-{
- public:
- // methods
- NPT_Queue(NPT_Cardinal max_items = 0) :
- m_Delegate(NPT_GenericQueue::CreateInstance(max_items)) {}
- virtual ~NPT_Queue<T>() { delete m_Delegate; }
- virtual NPT_Result Push(T* item, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_Delegate->Push(reinterpret_cast<NPT_QueueItem*>(item), timeout);
- }
- virtual NPT_Result Pop(T*& item, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_Delegate->Pop(reinterpret_cast<NPT_QueueItem*&>(item),
- timeout);
- }
- virtual NPT_Result Peek(T*& item, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_Delegate->Peek(reinterpret_cast<NPT_QueueItem*&>(item),
- timeout);
- }
-
- protected:
- // members
- NPT_GenericQueue* m_Delegate;
-};
-
-#endif // _NPT_QUEUE_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - References
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-
-#ifndef _NPT_REFERENCES_H_
-#define _NPT_REFERENCES_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConstants.h"
-
-/*----------------------------------------------------------------------
-| NPT_Reference
-+---------------------------------------------------------------------*/
-template <typename T>
-class NPT_Reference
-{
-public:
- // constructors and destructor
- NPT_Reference() : m_Object(NULL), m_Counter(NULL) {}
- explicit NPT_Reference(T* object) :
- m_Object(object), m_Counter(object?new NPT_Cardinal(1):NULL) {}
-
- NPT_Reference(const NPT_Reference<T>& ref) :
- m_Object(ref.m_Object), m_Counter(ref.m_Counter) {
- if (m_Counter) ++(*m_Counter);
- }
-
- // this methods should be private, but this causes a problem on some
- // compilers, because we need this function in order to implement
- // the cast operator operator NPT_Reference<U>() below, which would
- // have to be marked as a friend, and friend declarations with the
- // same class name confuses some compilers
- NPT_Reference(T* object, NPT_Cardinal* counter) :
- m_Object(object), m_Counter(counter) {
- if (m_Counter) ++(*m_Counter);
- }
-
- ~NPT_Reference() {
- Release();
- }
-
- // overloaded operators
- NPT_Reference<T>& operator=(const NPT_Reference<T>& ref) {
- if (this != &ref) {
- Release();
- m_Object = ref.m_Object;
- m_Counter = ref.m_Counter;
- if (m_Counter) ++(*m_Counter);
- }
- return *this;
- }
- NPT_Reference<T>& operator=(T* object) {
- Release();
- m_Object = object;
- m_Counter = object?new NPT_Cardinal(1):NULL;
- return *this;
- }
- T& operator*() const { return *m_Object; }
- T* operator->() const { return m_Object; }
-
- bool operator==(const NPT_Reference<T>& ref) const {
- return m_Object == ref.m_Object;
- }
- bool operator!=(const NPT_Reference<T>& ref) const {
- return m_Object != ref.m_Object;
- }
-
- // overloaded cast operators
- template <typename U> operator NPT_Reference<U>() {
- return NPT_Reference<U>(m_Object, m_Counter);
- }
-
- // methods
- /**
- * Returns the naked pointer value.
- */
- T* AsPointer() const { return m_Object; }
-
- /**
- * Returns the reference counter value.
- */
- NPT_Cardinal GetCounter() const { return *m_Counter; }
-
- /**
- * Returns wether this references a NULL object.
- */
- bool IsNull() const { return m_Object == NULL; }
-
- /**
- * Detach the reference from the shared object.
- * The reference count is decremented, but the object is not deleted if the
- * reference count becomes 0.
- * After the method returns, this reference does not point to any shared object.
- */
- void Detach() {
- if (m_Counter && --(*m_Counter) == 0) {
- delete m_Counter;
- }
- m_Counter = NULL;
- m_Object = NULL;
- }
-
-private:
- // methods
- void Release() {
- if (m_Counter && --(*m_Counter) == 0) {
- delete m_Counter; m_Counter = NULL;
- delete m_Object; m_Object = NULL;
- }
- }
-
- // members
- T* m_Object;
- NPT_Cardinal* m_Counter;
-};
-
-#endif // _NPT_REFERENCES_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Result Codes
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_RESULTS_H_
-#define _NPT_RESULTS_H_
-
-/*----------------------------------------------------------------------
-| macros
-+---------------------------------------------------------------------*/
-#if defined(NPT_DEBUG)
-#include "NptDebug.h"
-#define NPT_CHECK(_x) \
-do { \
- NPT_Result _result = (_x); \
- if (_result != NPT_SUCCESS) { \
- NPT_Debug("%s(%d): @@@ NPT_CHECK failed, result=%d (%s)", __FILE__, __LINE__, _result, NPT_ResultText(_result)); \
- return _result; \
- } \
-} while(0)
-#define NPT_CHECK_POINTER(_p) \
-do { \
- if ((_p) == NULL) { \
- NPT_Debug("%s(%d): @@@ NULL pointer parameter", __FILE__, __LINE__); \
- return NPT_ERROR_INVALID_PARAMETERS; \
- } \
-} while(0)
-#define NPT_CHECK_LABEL(_x, label) \
-do { \
- NPT_Result _result = (_x); \
- if (_result != NPT_SUCCESS) { \
- NPT_Debug("%s(%d): @@@ NPT_CHECK failed, result=%d (%s)", __FILE__, __LINE__, _result, NPT_ResultText(_result)); \
- goto label; \
- } \
-} while(0)
-#define NPT_CHECK_POINTER_LABEL(_p, label) \
-do { \
- if (_p == NULL) { \
- NPT_Debug("%s(%d): @@@ NULL pointer parameter", __FILE__, __LINE__); \
- goto label; \
- } \
-} while(0)
-#else
-#define NPT_CHECK(_x) \
-do { \
- NPT_Result _result = (_x); \
- if (_result != NPT_SUCCESS) { \
- return _result; \
- } \
-} while(0)
-#define NPT_CHECK_POINTER(_p) \
-do { \
- if ((_p) == NULL) return NPT_ERROR_INVALID_PARAMETERS; \
-} while(0)
-#define NPT_CHECK_LABEL(_x, label) \
-do { \
- NPT_Result _result = (_x); \
- if (_result != NPT_SUCCESS) { \
- goto label; \
- } \
-} while(0)
-#define NPT_CHECK_POINTER_LABEL(_p, label) \
-do { \
- if ((_p) == NULL) { \
- goto label; \
- } \
-} while(0)
-#endif
-
-#define NPT_FAILED(result) ((result) != NPT_SUCCESS)
-#define NPT_SUCCEEDED(result) ((result) == NPT_SUCCESS)
-
-/*----------------------------------------------------------------------
-| result codes
-+---------------------------------------------------------------------*/
-/** Result indicating that the operation or call succeeded */
-#define NPT_SUCCESS 0
-
-/** Result indicating an unspecififed failure condition */
-#define NPT_FAILURE (-1)
-
-#if !defined(NPT_ERROR_BASE)
-#define NPT_ERROR_BASE -20000
-#endif
-
-// error bases
-const int NPT_ERROR_BASE_GENERAL = NPT_ERROR_BASE-0;
-const int NPT_ERROR_BASE_LIST = NPT_ERROR_BASE-100;
-const int NPT_ERROR_BASE_FILE = NPT_ERROR_BASE-200;
-const int NPT_ERROR_BASE_IO = NPT_ERROR_BASE-300;
-const int NPT_ERROR_BASE_SOCKET = NPT_ERROR_BASE-400;
-const int NPT_ERROR_BASE_INTERFACES = NPT_ERROR_BASE-500;
-const int NPT_ERROR_BASE_XML = NPT_ERROR_BASE-600;
-const int NPT_ERROR_BASE_UNIX = NPT_ERROR_BASE-700;
-const int NPT_ERROR_BASE_HTTP = NPT_ERROR_BASE-800;
-const int NPT_ERROR_BASE_THREADS = NPT_ERROR_BASE-900;
-const int NPT_ERROR_BASE_SERIAL_PORT = NPT_ERROR_BASE-1000;
-const int NPT_ERROR_BASE_TLS = NPT_ERROR_BASE-1100;
-
-// general errors
-const int NPT_ERROR_INVALID_PARAMETERS = NPT_ERROR_BASE_GENERAL - 0;
-const int NPT_ERROR_PERMISSION_DENIED = NPT_ERROR_BASE_GENERAL - 1;
-const int NPT_ERROR_OUT_OF_MEMORY = NPT_ERROR_BASE_GENERAL - 2;
-const int NPT_ERROR_NO_SUCH_NAME = NPT_ERROR_BASE_GENERAL - 3;
-const int NPT_ERROR_NO_SUCH_PROPERTY = NPT_ERROR_BASE_GENERAL - 4;
-const int NPT_ERROR_NO_SUCH_ITEM = NPT_ERROR_BASE_GENERAL - 5;
-const int NPT_ERROR_NO_SUCH_CLASS = NPT_ERROR_BASE_GENERAL - 6;
-const int NPT_ERROR_OVERFLOW = NPT_ERROR_BASE_GENERAL - 7;
-const int NPT_ERROR_INTERNAL = NPT_ERROR_BASE_GENERAL - 8;
-const int NPT_ERROR_INVALID_STATE = NPT_ERROR_BASE_GENERAL - 9;
-const int NPT_ERROR_INVALID_FORMAT = NPT_ERROR_BASE_GENERAL - 10;
-const int NPT_ERROR_INVALID_SYNTAX = NPT_ERROR_BASE_GENERAL - 11;
-const int NPT_ERROR_NOT_IMPLEMENTED = NPT_ERROR_BASE_GENERAL - 12;
-const int NPT_ERROR_NOT_SUPPORTED = NPT_ERROR_BASE_GENERAL - 13;
-const int NPT_ERROR_TIMEOUT = NPT_ERROR_BASE_GENERAL - 14;
-const int NPT_ERROR_WOULD_BLOCK = NPT_ERROR_BASE_GENERAL - 15;
-const int NPT_ERROR_TERMINATED = NPT_ERROR_BASE_GENERAL - 16;
-const int NPT_ERROR_OUT_OF_RANGE = NPT_ERROR_BASE_GENERAL - 17;
-const int NPT_ERROR_OUT_OF_RESOURCES = NPT_ERROR_BASE_GENERAL - 18;
-
-/* standard error codes */
-/* these are special codes to convey an errno */
-/* the error code is (SHI_ERROR_BASE_ERRNO - errno) */
-/* where errno is the positive integer from errno.h */
-const int NPT_ERROR_BASE_ERRNO = NPT_ERROR_BASE-2000;
-#define NPT_ERROR_ERRNO(e) (NPT_ERROR_BASE_ERRNO - (e))
-
-/*----------------------------------------------------------------------
-| functions
-+---------------------------------------------------------------------*/
-const char* NPT_ResultText(int result);
-
-#endif // _NPT_RESULTS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Ring Buffer
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_RING_BUFFER_H_
-#define _NPT_RING_BUFFER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptReferences.h"
-
-/*----------------------------------------------------------------------
-| NPT_RingBuffer
-+---------------------------------------------------------------------*/
-class NPT_RingBuffer
-{
- public:
- // methods
- NPT_RingBuffer(NPT_Size size);
- NPT_RingBuffer(void* buffer, NPT_Size size);
- virtual ~NPT_RingBuffer();
- NPT_Size GetSpace() const;
- NPT_Size GetContiguousSpace() const;
- NPT_Result Write(const void* buffer, NPT_Size byte_count);
- NPT_Size GetAvailable() const;
- NPT_Size GetContiguousAvailable() const;
- NPT_Result Read(void* buffer, NPT_Size byte_count);
- unsigned char ReadByte();
- unsigned char PeekByte(NPT_Position offset);
- NPT_Result MoveIn(NPT_Position offset);
- NPT_Result MoveOut(NPT_Position offset);
- NPT_Result Flush();
- NPT_Result Close();
- bool IsClosed() { return m_Closed; }
-
- // accessors
- unsigned char* GetWritePointer() { return m_In; }
- unsigned char* GetReadPointer() { return m_Out;}
-
- private:
- // members
- struct {
- unsigned char* start;
- unsigned char* end;
- } m_Data;
- unsigned char* m_In;
- unsigned char* m_Out;
- NPT_Size m_Size;
- bool m_BufferIsLocal;
- bool m_Closed;
-};
-
-typedef NPT_Reference<NPT_RingBuffer> NPT_RingBufferReference;
-
-#endif // _NPT_RING_BUFFER_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Selectable Message Queue
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_SELECTABLE_MESSAGE_QUEUE_H_
-#define _NPT_SELECTABLE_MESSAGE_QUEUE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptMessaging.h"
-#include "NptSimpleMessageQueue.h"
-
-/*----------------------------------------------------------------------
-| NPT_SelectableMessageQueue
-+---------------------------------------------------------------------*/
-class NPT_SelectableMessageQueue : public NPT_SimpleMessageQueue
-{
-public:
- // methods
- NPT_SelectableMessageQueue();
- virtual ~NPT_SelectableMessageQueue();
-
- // NPT_MessageQueue methods
- virtual NPT_Result PumpMessage(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
- virtual NPT_Result QueueMessage(NPT_Message* message,
- NPT_MessageHandler* handler);
-
- // methods
- int GetEventFd() { return m_Pipe[0]; }
-
-private:
- // methods
- NPT_Result FlushEvent();
-
- // members
- int m_Pipe[2];
-};
-
-
-#endif /* _NPT_SELECTABLE_MESSAGE_QUEUE_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Serial Ports
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_SERIAL_PORT_H_
-#define _NPT_SERIAL_PORT_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptStreams.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_NO_SUCH_SERIAL_PORT = NPT_ERROR_BASE_SERIAL_PORT - 0;
-const int NPT_ERROR_SERIAL_PORT_NOT_OPEN = NPT_ERROR_BASE_SERIAL_PORT - 1;
-const int NPT_ERROR_SERIAL_PORT_ALREADY_OPEN = NPT_ERROR_BASE_SERIAL_PORT - 2;
-const int NPT_ERROR_SERIAL_PORT_BUSY = NPT_ERROR_BASE_SERIAL_PORT - 3;
-
-typedef enum {
- NPT_SERIAL_PORT_PARITY_NONE,
- NPT_SERIAL_PORT_PARITY_EVEN,
- NPT_SERIAL_PORT_PARITY_ODD,
- NPT_SERIAL_PORT_PARITY_MARK
-} NPT_SerialPortParity;
-
-typedef enum {
- NPT_SERIAL_PORT_STOP_BITS_1,
- NPT_SERIAL_PORT_STOP_BITS_1_5,
- NPT_SERIAL_PORT_STOP_BITS_2
-} NPT_SerialPortStopBits;
-
-typedef enum {
- NPT_SERIAL_PORT_FLOW_CONTROL_NONE,
- NPT_SERIAL_PORT_FLOW_CONTROL_HARDWARE,
- NPT_SERIAL_PORT_FLOW_CONTROL_XON_XOFF
-} NPT_SerialPortFlowControl;
-
-/*----------------------------------------------------------------------
-| NPT_SerialPortInterface
-+---------------------------------------------------------------------*/
-class NPT_SerialPortInterface
-{
-public:
- // constructors and destructor
- virtual ~NPT_SerialPortInterface() {}
-
- // methods
- virtual NPT_Result Open(unsigned int speed,
- NPT_SerialPortStopBits stop_bits,
- NPT_SerialPortFlowControl flow_control,
- NPT_SerialPortParity parity) = 0;
- virtual NPT_Result Close() = 0;
- virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream) = 0;
- virtual NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_SerialPort
-+---------------------------------------------------------------------*/
-class NPT_SerialPort : public NPT_SerialPortInterface
-{
-public:
- // constructors and destructor
- NPT_SerialPort(const char* name);
- ~NPT_SerialPort() { delete m_Delegate; }
-
- // NPT_SerialPortInterface methods
- NPT_Result Open(unsigned int speed,
- NPT_SerialPortStopBits stop_bits = NPT_SERIAL_PORT_STOP_BITS_1,
- NPT_SerialPortFlowControl flow_control = NPT_SERIAL_PORT_FLOW_CONTROL_NONE,
- NPT_SerialPortParity parity = NPT_SERIAL_PORT_PARITY_NONE) {
- return m_Delegate->Open(speed, stop_bits, flow_control, parity);
- }
- NPT_Result Close() {
- return m_Delegate->Close();
- }
- NPT_Result GetInputStream(NPT_InputStreamReference& stream) {
- return m_Delegate->GetInputStream(stream);
- }
- NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) {
- return m_Delegate->GetOutputStream(stream);
- }
-
-protected:
- // members
- NPT_SerialPortInterface* m_Delegate;
-};
-
-#endif // _NPT_SERIAL_PORT_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Simple Message Queue
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_SIMPLE_MESSAGE_QUEUE_H_
-#define _NPT_SIMPLE_MESSAGE_QUEUE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptThreads.h"
-#include "NptMessaging.h"
-#include "NptQueue.h"
-
-/*----------------------------------------------------------------------
-| class references
-+---------------------------------------------------------------------*/
-struct NPT_SimpleMessageCapsule;
-
-/*----------------------------------------------------------------------
-| NPT_SimpleMessageQueue
-+---------------------------------------------------------------------*/
-class NPT_SimpleMessageQueue : public NPT_MessageQueue
-{
- public:
- // members
- NPT_SimpleMessageQueue();
- virtual ~NPT_SimpleMessageQueue();
-
- // NPT_MessageQueue methods
- virtual NPT_Result QueueMessage(NPT_Message* message,
- NPT_MessageHandler* handler);
- virtual NPT_Result PumpMessage(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
-
- private:
- // members
- NPT_Queue<NPT_SimpleMessageCapsule> m_Queue;
-};
-
-#endif // _NPT_SIMPLE_MESSAGE_QUEUE_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Network Sockets
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_SOCKETS_H_
-#define _NPT_SOCKETS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptStreams.h"
-#include "NptStrings.h"
-#include "NptDataBuffer.h"
-#include "NptNetwork.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_CONNECTION_RESET = NPT_ERROR_BASE_SOCKET - 0;
-const int NPT_ERROR_CONNECTION_ABORTED = NPT_ERROR_BASE_SOCKET - 1;
-const int NPT_ERROR_CONNECTION_REFUSED = NPT_ERROR_BASE_SOCKET - 2;
-const int NPT_ERROR_CONNECTION_FAILED = NPT_ERROR_BASE_SOCKET - 3;
-const int NPT_ERROR_HOST_UNKNOWN = NPT_ERROR_BASE_SOCKET - 4;
-const int NPT_ERROR_SOCKET_FAILED = NPT_ERROR_BASE_SOCKET - 5;
-const int NPT_ERROR_GETSOCKOPT_FAILED = NPT_ERROR_BASE_SOCKET - 6;
-const int NPT_ERROR_SETSOCKOPT_FAILED = NPT_ERROR_BASE_SOCKET - 7;
-const int NPT_ERROR_SOCKET_CONTROL_FAILED = NPT_ERROR_BASE_SOCKET - 8;
-const int NPT_ERROR_BIND_FAILED = NPT_ERROR_BASE_SOCKET - 9;
-const int NPT_ERROR_LISTEN_FAILED = NPT_ERROR_BASE_SOCKET - 10;
-const int NPT_ERROR_ACCEPT_FAILED = NPT_ERROR_BASE_SOCKET - 11;
-const int NPT_ERROR_ADDRESS_IN_USE = NPT_ERROR_BASE_SOCKET - 12;
-const int NPT_ERROR_NETWORK_DOWN = NPT_ERROR_BASE_SOCKET - 13;
-const int NPT_ERROR_NETWORK_UNREACHABLE = NPT_ERROR_BASE_SOCKET - 14;
-
-/*----------------------------------------------------------------------
-| forward references
-+---------------------------------------------------------------------*/
-class NPT_Socket;
-
-/*----------------------------------------------------------------------
-| NPT_SocketAddress
-+---------------------------------------------------------------------*/
-class NPT_SocketAddress
-{
-public:
- // constructors and destructor
- NPT_SocketAddress() : m_Port(0) {}
- NPT_SocketAddress(const NPT_IpAddress& address, NPT_IpPort port) :
- m_IpAddress(address),
- m_Port(port) {}
-
- // methods
- NPT_Result SetIpAddress(const NPT_IpAddress& address) {
- m_IpAddress = address;
- return NPT_SUCCESS;
- }
- const NPT_IpAddress& GetIpAddress() const {
- return m_IpAddress;
- }
- NPT_Result SetPort(NPT_IpPort port) {
- m_Port = port;
- return NPT_SUCCESS;
- }
- NPT_IpPort GetPort() const {
- return m_Port;
- }
- NPT_String ToString() const;
-
- // operators
- bool operator==(const NPT_SocketAddress& other) const;
-
-private:
- // members
- NPT_IpAddress m_IpAddress;
- NPT_IpPort m_Port;
-};
-
-/*----------------------------------------------------------------------
-| NPT_SocketInfo
-+---------------------------------------------------------------------*/
-typedef struct {
- NPT_SocketAddress local_address;
- NPT_SocketAddress remote_address;
-} NPT_SocketInfo;
-
-/*----------------------------------------------------------------------
-| NPT_SocketInterface
-+---------------------------------------------------------------------*/
-class NPT_SocketInterface
-{
- public:
- virtual ~NPT_SocketInterface() {}
-
- // interface methods
- virtual NPT_Result Bind(const NPT_SocketAddress& address, bool reuse_address = true) = 0;
- virtual NPT_Result Connect(const NPT_SocketAddress& address, NPT_Timeout timeout) = 0;
- virtual NPT_Result Disconnect() = 0;
- virtual NPT_Result WaitForConnection(NPT_Timeout timeout) = 0;
- virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream) = 0;
- virtual NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) = 0;
- virtual NPT_Result GetInfo(NPT_SocketInfo& info) = 0;
- virtual NPT_Result SetBlockingMode(bool blocking) = 0;
- virtual NPT_Result SetReadTimeout(NPT_Timeout timeout) = 0;
- virtual NPT_Result SetWriteTimeout(NPT_Timeout timeout) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_UdpSocketInterface
-+---------------------------------------------------------------------*/
-class NPT_UdpSocketInterface
-{
- public:
- virtual ~NPT_UdpSocketInterface() {}
-
- // methods
- virtual NPT_Result Send(const NPT_DataBuffer& packet,
- const NPT_SocketAddress* address = NULL) = 0;
- virtual NPT_Result Receive(NPT_DataBuffer& packet,
- NPT_SocketAddress* address = NULL) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_UdpMulticastSocketInterface
-+---------------------------------------------------------------------*/
-class NPT_UdpMulticastSocketInterface
-{
- public:
- virtual ~NPT_UdpMulticastSocketInterface() {}
-
- // methods
- virtual NPT_Result JoinGroup(const NPT_IpAddress& group,
- const NPT_IpAddress& iface) = 0;
- virtual NPT_Result LeaveGroup(const NPT_IpAddress& group,
- const NPT_IpAddress& iface) = 0;
- virtual NPT_Result SetTimeToLive(unsigned char ttl) = 0;
- virtual NPT_Result SetInterface(const NPT_IpAddress& iface) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_TcpServerSocketInterface
-+---------------------------------------------------------------------*/
-class NPT_TcpServerSocketInterface
-{
- public:
- virtual ~NPT_TcpServerSocketInterface() {}
-
- // interface methods
- virtual NPT_Result Listen(unsigned int max_clients) = 0;
- virtual NPT_Result WaitForNewClient(NPT_Socket*& client,
- NPT_Timeout timeout) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Socket
-+---------------------------------------------------------------------*/
-class NPT_Socket : public NPT_SocketInterface
-{
-public:
- // constructor and destructor
- NPT_Socket(NPT_SocketInterface* delegate) :
- m_SocketDelegate(delegate) {}
- virtual ~NPT_Socket();
-
- // delegate NPT_SocketInterface methods
- NPT_Result Bind(const NPT_SocketAddress& address, bool reuse_address = true) {
- return m_SocketDelegate->Bind(address, reuse_address);
- }
- NPT_Result Connect(const NPT_SocketAddress& address,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_SocketDelegate->Connect(address, timeout);
- }
- NPT_Result Disconnect() {
- return m_SocketDelegate->Disconnect();
- }
- NPT_Result WaitForConnection(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_SocketDelegate->WaitForConnection(timeout);
- }
- NPT_Result GetInputStream(NPT_InputStreamReference& stream) {
- return m_SocketDelegate->GetInputStream(stream);
- }
- NPT_Result GetOutputStream(NPT_OutputStreamReference& stream) {
- return m_SocketDelegate->GetOutputStream(stream);
- }
- NPT_Result GetInfo(NPT_SocketInfo& info) {
- return m_SocketDelegate->GetInfo(info);
- }
- NPT_Result SetBlockingMode(bool blocking) {
- return m_SocketDelegate->SetBlockingMode(blocking);
- }
- NPT_Result SetReadTimeout(NPT_Timeout timeout) {
- return m_SocketDelegate->SetReadTimeout(timeout);
- }
- NPT_Result SetWriteTimeout(NPT_Timeout timeout) {
- return m_SocketDelegate->SetWriteTimeout(timeout);
- }
-
-protected:
- // constructor
- NPT_Socket() {}
-
- // members
- NPT_SocketInterface* m_SocketDelegate;
-};
-
-typedef NPT_Reference<NPT_Socket> NPT_SocketReference;
-
-/*----------------------------------------------------------------------
-| NPT_UdpSocket
-+---------------------------------------------------------------------*/
-class NPT_UdpSocket : public NPT_Socket,
- public NPT_UdpSocketInterface
-{
- public:
- // constructor and destructor
- NPT_UdpSocket();
- virtual ~NPT_UdpSocket();
-
- // delegate NPT_UdpSocketInterface methods
- NPT_Result Send(const NPT_DataBuffer& packet,
- const NPT_SocketAddress* address = NULL) {
- return m_UdpSocketDelegate->Send(packet, address);
- }
- NPT_Result Receive(NPT_DataBuffer& packet,
- NPT_SocketAddress* address = NULL) {
- return m_UdpSocketDelegate->Receive(packet, address);
- }
-
-protected:
- // constructor
- NPT_UdpSocket(NPT_UdpSocketInterface* delegate);
-
- // members
- NPT_UdpSocketInterface* m_UdpSocketDelegate;
-};
-
-/*----------------------------------------------------------------------
-| NPT_UdpMulticastSocket
-+---------------------------------------------------------------------*/
-class NPT_UdpMulticastSocket : public NPT_UdpSocket,
- public NPT_UdpMulticastSocketInterface
-{
-public:
- // constructor and destructor
- NPT_UdpMulticastSocket();
- virtual ~NPT_UdpMulticastSocket();
-
- // delegate NPT_UdpMulticastSocketInterface methods
- NPT_Result JoinGroup(const NPT_IpAddress& group,
- const NPT_IpAddress& iface =
- NPT_IpAddress::Any) {
- return m_UdpMulticastSocketDelegate->JoinGroup(group, iface);
- }
- NPT_Result LeaveGroup(const NPT_IpAddress& group,
- const NPT_IpAddress& iface =
- NPT_IpAddress::Any) {
- return m_UdpMulticastSocketDelegate->LeaveGroup(group, iface);
- }
- NPT_Result SetTimeToLive(unsigned char ttl) {
- return m_UdpMulticastSocketDelegate->SetTimeToLive(ttl);
- }
- NPT_Result SetInterface(const NPT_IpAddress& iface) {
- return m_UdpMulticastSocketDelegate->SetInterface(iface);
- }
-
-protected:
- // members
- NPT_UdpMulticastSocketInterface* m_UdpMulticastSocketDelegate;
-};
-
-/*----------------------------------------------------------------------
-| NPT_TcpClientSocket
-+---------------------------------------------------------------------*/
-class NPT_TcpClientSocket : public NPT_Socket
-{
-public:
- // constructors and destructor
- NPT_TcpClientSocket();
- virtual ~NPT_TcpClientSocket();
-};
-
-/*----------------------------------------------------------------------
-| NPT_TcpServerSocket
-+---------------------------------------------------------------------*/
-class NPT_TcpServerSocket : public NPT_Socket,
- public NPT_TcpServerSocketInterface
-{
-public:
- // constructors and destructor
- NPT_TcpServerSocket();
- virtual ~NPT_TcpServerSocket();
-
- // delegate NPT_TcpServerSocketInterface methods
- NPT_Result Listen(unsigned int max_clients) {
- return m_TcpServerSocketDelegate->Listen(max_clients);
- }
- NPT_Result WaitForNewClient(NPT_Socket*& client,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_TcpServerSocketDelegate->WaitForNewClient(client, timeout);
- }
-
-protected:
- // members
- NPT_TcpServerSocketInterface* m_TcpServerSocketDelegate;
-};
-
-#endif // _NPT_SOCKETS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Stack
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
-****************************************************************/
-
-#ifndef _NPT_STACK_H_
-#define _NPT_STACK_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptResults.h"
-#include "NptTypes.h"
-#include "NptList.h"
-
-/*----------------------------------------------------------------------
-| NPT_Stack
-+---------------------------------------------------------------------*/
-template <typename T>
-class NPT_Stack : public NPT_List<T>
-{
-public:
- // methods
- NPT_Result Push(const T& value) {
- return Add(value);
- }
-
- NPT_Result Peek(T& value) {
- // NOTE: we must use the this-> accessor here because the standard
- // requires it when the member to look up is in a parent template
- if (this->m_ItemCount == 0) return NPT_ERROR_NO_SUCH_ITEM;
- value = this->m_Tail->m_Data;
- return NPT_SUCCESS;
- }
-
- NPT_Result Pop(T& value) {
- // NOTE: we must use the this-> accessor here because the standard
- // requires it when the member to look up is in a parent template
- if (this->m_ItemCount == 0) return NPT_ERROR_NO_SUCH_ITEM;
- typename NPT_List<T>::Iterator tail = this->GetLastItem();
- value = *tail;
- return this->Erase(tail);
- }
-};
-
-#endif // _NPT_STACK_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Byte Streams
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_STREAMS_H_
-#define _NPT_STREAMS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptReferences.h"
-#include "NptConstants.h"
-#include "NptResults.h"
-#include "NptDataBuffer.h"
-#include "NptStrings.h"
-
-/*----------------------------------------------------------------------
-| class references
-+---------------------------------------------------------------------*/
-class NPT_String;
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_READ_FAILED = NPT_ERROR_BASE_IO - 0;
-const int NPT_ERROR_WRITE_FAILED = NPT_ERROR_BASE_IO - 1;
-const int NPT_ERROR_EOS = NPT_ERROR_BASE_IO - 2;
-
-/*----------------------------------------------------------------------
-| NPT_InputStream
-+---------------------------------------------------------------------*/
-class NPT_InputStream
-{
- public:
- // constructor and destructor
- virtual ~NPT_InputStream() {};
-
- // methods
- virtual NPT_Result Load(NPT_DataBuffer& buffer, NPT_Size max_read = 0);
- virtual NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL) = 0;
- virtual NPT_Result ReadFully(void* buffer,
- NPT_Size bytes_to_read);
- virtual NPT_Result Seek(NPT_Position offset) = 0;
- virtual NPT_Result Skip(NPT_Size offset);
- virtual NPT_Result Tell(NPT_Position& offset) = 0;
- virtual NPT_Result GetSize(NPT_LargeSize& size) = 0;
- virtual NPT_Result GetAvailable(NPT_LargeSize& available) = 0;
- virtual NPT_Result Close() { return NPT_SUCCESS; }
-
- // data access methods
- NPT_Result ReadUI64(NPT_UInt64& value);
- NPT_Result ReadUI32(NPT_UInt32& value);
- NPT_Result ReadUI24(NPT_UInt32& value);
- NPT_Result ReadUI16(NPT_UInt16& value);
- NPT_Result ReadUI08(NPT_UInt8& value);
-};
-
-typedef NPT_Reference<NPT_InputStream> NPT_InputStreamReference;
-
-/*----------------------------------------------------------------------
-| NPT_OutputStream
-+---------------------------------------------------------------------*/
-class NPT_OutputStream
-{
-public:
- // constructor and destructor
- virtual ~NPT_OutputStream() {};
-
- // methods
- virtual NPT_Result Write(const void* buffer,
- NPT_Size bytes_to_write,
- NPT_Size* bytes_written = NULL) = 0;
- virtual NPT_Result WriteFully(const void* buffer,
- NPT_Size bytes_to_write);
- virtual NPT_Result WriteString(const char* string_buffer);
- virtual NPT_Result WriteLine(const char* line_buffer);
- virtual NPT_Result Seek(NPT_Position offset) = 0;
- virtual NPT_Result Tell(NPT_Position& offset) = 0;
- virtual NPT_Result Flush() { return NPT_SUCCESS; }
-
- // data access methods
- NPT_Result WriteUI64(NPT_UInt64 value);
- NPT_Result WriteUI32(NPT_UInt32 value);
- NPT_Result WriteUI24(NPT_UInt32 value);
- NPT_Result WriteUI16(NPT_UInt16 value);
- NPT_Result WriteUI08(NPT_UInt8 value);
-};
-
-typedef NPT_Reference<NPT_OutputStream> NPT_OutputStreamReference;
-
-/*----------------------------------------------------------------------
-| NPT_StreamToStreamCopy
-+---------------------------------------------------------------------*/
-NPT_Result NPT_StreamToStreamCopy(NPT_InputStream& from,
- NPT_OutputStream& to,
- NPT_Position offset = 0,
- NPT_LargeSize size = 0, /* 0 means the entire stream */
- NPT_LargeSize* bytes_written = NULL);
-
-/*----------------------------------------------------------------------
-| NPT_DelegatingInputStream
-|
-| Use this class as a base class if you need to inherit both from
-| NPT_InputStream and NPT_OutputStream which share the Seek and Tell
-| method. In this case, you override the base-specific version of
-| those methods, InputSeek, InputTell, instead of the Seek and Tell
-| methods.
-+---------------------------------------------------------------------*/
-class NPT_DelegatingInputStream : public NPT_InputStream
-{
-public:
- // NPT_InputStream methods
- NPT_Result Seek(NPT_Position offset) {
- return InputSeek(offset);
- }
- NPT_Result Tell(NPT_Position& offset) {
- return InputTell(offset);
- }
-
-private:
- // methods
- virtual NPT_Result InputSeek(NPT_Position offset) = 0;
- virtual NPT_Result InputTell(NPT_Position& offset) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_DelegatingOutputStream
-|
-| Use this class as a base class if you need to inherit both from
-| NPT_InputStream and NPT_OutputStream which share the Seek and Tell
-| method. In this case, you override the base-specific version of
-| those methods, OutputSeek and OutputTell, instead of the Seek and
-| Tell methods.
-+---------------------------------------------------------------------*/
-class NPT_DelegatingOutputStream : public NPT_OutputStream
-{
-public:
- // NPT_OutputStream methods
- NPT_Result Seek(NPT_Position offset) {
- return OutputSeek(offset);
- }
- NPT_Result Tell(NPT_Position& offset) {
- return OutputTell(offset);
- }
-
-private:
- // methods
- virtual NPT_Result OutputSeek(NPT_Position offset) = 0;
- virtual NPT_Result OutputTell(NPT_Position& offset) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_MemoryStream
-+---------------------------------------------------------------------*/
-class NPT_MemoryStream :
- public NPT_DelegatingInputStream,
- public NPT_DelegatingOutputStream
-{
-public:
- // constructor and destructor
- NPT_MemoryStream(NPT_Size initial_capacity = 0);
- NPT_MemoryStream(const void* data, NPT_Size size);
- virtual ~NPT_MemoryStream() {}
-
- // accessors
- const NPT_DataBuffer& GetBuffer() const { return m_Buffer; }
-
- // NPT_InputStream methods
- NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL);
- NPT_Result GetSize(NPT_LargeSize& size) {
- size = m_Buffer.GetDataSize();
- return NPT_SUCCESS;
- }
- NPT_Result GetAvailable(NPT_LargeSize& available) {
- available = (NPT_LargeSize)m_Buffer.GetDataSize()-m_ReadOffset;
- return NPT_SUCCESS;
- }
-
- // NPT_OutputStream methods
- NPT_Result Write(const void* buffer,
- NPT_Size bytes_to_write,
- NPT_Size* bytes_written = NULL);
-
- // methods delegated to m_Buffer
- const NPT_Byte* GetData() const { return m_Buffer.GetData(); }
- NPT_Byte* UseData() { return m_Buffer.UseData(); }
- NPT_Size GetDataSize() const { return m_Buffer.GetDataSize(); }
- NPT_Size GetBufferSize() const { return m_Buffer.GetBufferSize();}
-
- // methods
- NPT_Result SetDataSize(NPT_Size size);
-
-private:
- // NPT_DelegatingInputStream methods
- NPT_Result InputSeek(NPT_Position offset);
- NPT_Result InputTell(NPT_Position& offset) {
- offset = m_ReadOffset;
- return NPT_SUCCESS;
- }
-
- // NPT_DelegatingOutputStream methods
- NPT_Result OutputSeek(NPT_Position offset);
- NPT_Result OutputTell(NPT_Position& offset) {
- offset = m_WriteOffset;
- return NPT_SUCCESS;
- }
-
-protected:
- // members
- NPT_DataBuffer m_Buffer;
- NPT_Size m_ReadOffset;
- NPT_Size m_WriteOffset;
-};
-
-typedef NPT_Reference<NPT_MemoryStream> NPT_MemoryStreamReference;
-
-/*----------------------------------------------------------------------
-| NPT_StringOutputStream
-+---------------------------------------------------------------------*/
-class NPT_StringOutputStream : public NPT_OutputStream
-{
-public:
- // methods
- NPT_StringOutputStream(NPT_Size size = 4096);
- NPT_StringOutputStream(NPT_String* storage);
- virtual ~NPT_StringOutputStream() ;
-
- const NPT_String& GetString() const { return *m_String; }
- NPT_Result Reset() { if (m_String) m_String->SetLength(0); return NPT_SUCCESS; }
-
- // NPT_OutputStream methods
- NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL);
-
- NPT_Result Seek(NPT_Position /*offset*/) { return NPT_ERROR_NOT_SUPPORTED; }
- NPT_Result Tell(NPT_Position& offset) { offset = m_String->GetLength(); return NPT_SUCCESS; }
-
-protected:
- NPT_String* m_String;
- bool m_StringIsOwned;
-};
-
-typedef NPT_Reference<NPT_StringOutputStream> NPT_StringOutputStreamReference;
-
-/*----------------------------------------------------------------------
-| NPT_SubInputStream
-+---------------------------------------------------------------------*/
-class NPT_SubInputStream : public NPT_InputStream
-{
-public:
- // constructor and destructor
- NPT_SubInputStream(NPT_InputStreamReference& source,
- NPT_Position start,
- NPT_LargeSize size);
-
- // methods
- virtual NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL) = 0;
- virtual NPT_Result Seek(NPT_Position offset) = 0;
- virtual NPT_Result Tell(NPT_Position& offset) = 0;
- virtual NPT_Result GetSize(NPT_LargeSize& size) = 0;
- virtual NPT_Result GetAvailable(NPT_LargeSize& available) = 0;
-
-private:
- NPT_InputStreamReference m_Source;
- NPT_Position m_Position;
- NPT_Position m_Start;
- NPT_LargeSize m_Size;
-};
-
-/*----------------------------------------------------------------------
-| NPT_NullOutputStream
-+---------------------------------------------------------------------*/
-class NPT_NullOutputStream : public NPT_OutputStream
-{
-public:
- // methods
- NPT_NullOutputStream() {}
- virtual ~NPT_NullOutputStream() {}
-
- // NPT_OutputStream methods
- NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL);
-
- NPT_Result Seek(NPT_Position /*offset*/) { return NPT_ERROR_NOT_SUPPORTED; }
- NPT_Result Tell(NPT_Position& /*offset*/) { return NPT_ERROR_NOT_SUPPORTED; }
-};
-
-typedef NPT_Reference<NPT_NullOutputStream> NPT_NullOutputStreamReference;
-
-#endif // _NPT_STREAMS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - String Objects
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_STRINGS_H_
-#define _NPT_STRINGS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#if defined(NPT_CONFIG_HAVE_NEW_H)
-#include <new>
-#endif
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptList.h"
-#include "NptDebug.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_STRING_SEARCH_FAILED = -1;
-
-/*----------------------------------------------------------------------
-| NPT_String
-+---------------------------------------------------------------------*/
-class NPT_String
-{
-public:
- // factories
- static NPT_String FromInteger(NPT_Int64 value);
- static NPT_String FromIntegerU(NPT_UInt64 value);
- static NPT_String Format(const char* format, ...);
-
- // constructors
- NPT_String(const NPT_String& str);
- NPT_String(const char* str);
- NPT_String(const char* str, NPT_Size length);
- NPT_String(const char* str, NPT_Ordinal first, NPT_Size length);
- NPT_String(char c, NPT_Cardinal repeat = 1);
- NPT_String() : m_Chars(NULL) {}
- ~NPT_String() { if (m_Chars) delete GetBuffer(); }
-
- // string info and manipulations
- bool IsEmpty() const { return m_Chars == NULL || GetBuffer()->GetLength() == 0; }
- NPT_Size GetLength() const { return m_Chars ? GetBuffer()->GetLength() : 0; }
- NPT_Size GetCapacity() const { return m_Chars ? GetBuffer()->GetAllocated() : 0; }
- NPT_Result SetLength(NPT_Size length, bool pad = false);
- void Assign(const char* chars, NPT_Size size);
- void Append(const char* chars, NPT_Size size);
- void Append(const char* s) { Append(s, StringLength(s)); }
- int Compare(const char* s, bool ignore_case = false) const;
- static int Compare(const char* s1, const char* s2, bool ignore_case = false);
- int CompareN(const char* s, NPT_Size count, bool ignore_case = false) const;
- static int CompareN(const char* s1, const char* s2, NPT_Size count, bool ignore_case = false);
-
- // substrings
- NPT_String SubString(NPT_Ordinal first, NPT_Size length) const;
- NPT_String SubString(NPT_Ordinal first) const {
- return SubString(first, GetLength());
- }
- NPT_String Left(NPT_Size length) const {
- return SubString(0, length);
- }
- NPT_String Right(NPT_Size length) const {
- return length >= GetLength() ?
- *this :
- SubString(GetLength()-length, length);
- }
- NPT_List<NPT_String> Split(const char* separator) const;
- static NPT_String Join(NPT_List<NPT_String>& args, const char* separator);
-
- // buffer management
- void Reserve(NPT_Size length);
-
- // conversions
- NPT_String ToLowercase() const;
- NPT_String ToUppercase() const;
- NPT_Result ToInteger(int& value, bool relaxed = true) const;
- NPT_Result ToInteger(unsigned int& value, bool relaxed = true) const;
- NPT_Result ToInteger(long& value, bool relaxed = true) const;
- NPT_Result ToInteger(unsigned long& value, bool relaxed = true) const;
- NPT_Result ToInteger32(NPT_Int32& value, bool relaxed = true) const;
- NPT_Result ToInteger32(NPT_UInt32& value, bool relaxed = true) const;
- NPT_Result ToInteger64(NPT_Int64& value, bool relaxed = true) const;
- NPT_Result ToInteger64(NPT_UInt64& value, bool relaxed = true) const;
- NPT_Result ToFloat(float& value, bool relaxed = true) const;
-
- // processing
- void MakeLowercase();
- void MakeUppercase();
- void Replace(char a, char b);
- void Replace(char a, const char* b);
-
- // search
- int Find(char c, NPT_Ordinal start = 0, bool ignore_case = false) const;
- int Find(const char* s, NPT_Ordinal start = 0, bool ignore_case = false) const;
- int ReverseFind(char c, NPT_Ordinal start = 0, bool ignore_case = false) const;
- int ReverseFind(const char* s, NPT_Ordinal start = 0, bool ignore_case = false) const;
- bool StartsWith(const char* s, bool ignore_case = false) const;
- bool EndsWith(const char* s, bool ignore_case = false) const;
-
- // editing
- void Insert(const char* s, NPT_Ordinal where = 0);
- void Erase(NPT_Ordinal start, NPT_Cardinal count = 1);
- void Replace(NPT_Ordinal start, NPT_Cardinal count, const char* s);
- void TrimLeft();
- void TrimLeft(char c);
- void TrimLeft(const char* chars);
- void TrimRight();
- void TrimRight(char c);
- void TrimRight(const char* chars);
- void Trim();
- void Trim(char c);
- void Trim(const char* chars);
-
- // type casting
- operator char*() const { return m_Chars ? m_Chars: &EmptyString; }
- operator const char* () const { return m_Chars ? m_Chars: &EmptyString; }
- const char* GetChars() const { return m_Chars ? m_Chars: &EmptyString; }
- char* UseChars() { return m_Chars ? m_Chars: &EmptyString; }
-
- // operator overloading
- NPT_String& operator=(const char* str);
- NPT_String& operator=(const NPT_String& str);
- NPT_String& operator=(char c);
- const NPT_String& operator+=(const NPT_String& s) {
- Append(s.GetChars(), s.GetLength());
- return *this;
- }
- const NPT_String& operator+=(const char* s) {
- Append(s);
- return *this;
- }
- const NPT_String& operator+=(char c) {
- Append(&c, 1);
- return *this;
- }
- char operator[](int index) const {
- NPT_ASSERT((unsigned int)index < GetLength());
- return GetChars()[index];
- }
- char& operator[](int index) {
- NPT_ASSERT((unsigned int)index < GetLength());
- return UseChars()[index];
- }
-
- // friend operators
- friend NPT_String operator+(const NPT_String& s1, const NPT_String& s2) {
- return s1+s2.GetChars();
- }
- friend NPT_String operator+(const NPT_String& s1, const char* s2);
- friend NPT_String operator+(const char* s1, const NPT_String& s2);
- friend NPT_String operator+(const NPT_String& s, char c);
- friend NPT_String operator+(char c, const NPT_String& s);
-
-protected:
- // inner classes
- class Buffer {
- public:
- // class methods
- static Buffer* Allocate(NPT_Size allocated, NPT_Size length) {
- void* mem = ::operator new(sizeof(Buffer)+allocated+1);
- return new(mem) Buffer(allocated, length);
- }
- static char* Create(NPT_Size allocated, NPT_Size length=0) {
- Buffer* shared = Allocate(allocated, length);
- return shared->GetChars();
- }
- static char* Create(const char* copy) {
- NPT_Size length = StringLength(copy);
- Buffer* shared = Allocate(length, length);
- CopyString(shared->GetChars(), copy);
- return shared->GetChars();
- }
- static char* Create(const char* copy, NPT_Size length) {
- Buffer* shared = Allocate(length, length);
- CopyBuffer(shared->GetChars(), copy, length);
- shared->GetChars()[length] = '\0';
- return shared->GetChars();
- }
- static char* Create(char c, NPT_Cardinal repeat) {
- Buffer* shared = Allocate(repeat, repeat);
- char* s = shared->GetChars();
- while (repeat--) {
- *s++ = c;
- }
- *s = '\0';
- return shared->GetChars();
- }
-
- // methods
- char* GetChars() {
- // return a pointer to the first char
- return reinterpret_cast<char*>(this+1);
- }
- NPT_Size GetLength() const { return m_Length; }
- void SetLength(NPT_Size length) { m_Length = length; }
- NPT_Size GetAllocated() const { return m_Allocated; }
-
- private:
- // methods
- Buffer(NPT_Size allocated, NPT_Size length = 0) :
- m_Length(length),
- m_Allocated(allocated) {}
-
- // members
- NPT_Cardinal m_Length;
- NPT_Cardinal m_Allocated;
- // the actual string data follows
-
- };
-
- // members
- char* m_Chars;
-
-private:
- // friends
- friend class Buffer;
-
- // static members
- static char EmptyString;
-
- // methods
- Buffer* GetBuffer() const {
- return reinterpret_cast<Buffer*>(m_Chars)-1;
- }
- void Reset() {
- if (m_Chars != NULL) {
- delete GetBuffer();
- m_Chars = NULL;
- }
- }
- char* PrepareToWrite(NPT_Size length);
- void PrepareToAppend(NPT_Size length, NPT_Size allocate);
-
- // static methods
- static void CopyString(char* dst, const char* src) {
- while ((*dst++ = *src++)){}
- }
-
- static void CopyBuffer(char* dst, const char* src, NPT_Size size) {
- while (size--) *dst++ = *src++;
- }
-
- static NPT_Size StringLength(const char* str) {
- NPT_Size length = 0;
- while (*str++) length++;
- return length;
- }
-};
-
-/*----------------------------------------------------------------------
-| external operators
-+---------------------------------------------------------------------*/
-inline bool operator==(const NPT_String& s1, const NPT_String& s2) {
- return s1.Compare(s2) == 0;
-}
-inline bool operator==(const NPT_String& s1, const char* s2) {
- return s1.Compare(s2) == 0;
-}
-inline bool operator==(const char* s1, const NPT_String& s2) {
- return s2.Compare(s1) == 0;
-}
-inline bool operator!=(const NPT_String& s1, const NPT_String& s2) {
- return s1.Compare(s2) != 0;
-}
-inline bool operator!=(const NPT_String& s1, const char* s2) {
- return s1.Compare(s2) != 0;
-}
-inline bool operator!=(const char* s1, const NPT_String& s2) {
- return s2.Compare(s1) != 0;
-}
-inline bool operator<(const NPT_String& s1, const NPT_String& s2) {
- return s1.Compare(s2) < 0;
-}
-inline bool operator<(const NPT_String& s1, const char* s2) {
- return s1.Compare(s2) < 0;
-}
-inline bool operator<(const char* s1, const NPT_String& s2) {
- return s2.Compare(s1) > 0;
-}
-inline bool operator>(const NPT_String& s1, const NPT_String& s2) {
- return s1.Compare(s2) > 0;
-}
-inline bool operator>(const NPT_String& s1, const char* s2) {
- return s1.Compare(s2) > 0;
-}
-inline bool operator>(const char* s1, const NPT_String& s2) {
- return s2.Compare(s1) < 0;
-}
-inline bool operator<=(const NPT_String& s1, const NPT_String& s2) {
- return s1.Compare(s2) <= 0;
-}
-inline bool operator<=(const NPT_String& s1, const char* s2) {
- return s1.Compare(s2) <= 0;
-}
-inline bool operator<=(const char* s1, const NPT_String& s2) {
- return s2.Compare(s1) >= 0;
-}
-inline bool operator>=(const NPT_String& s1, const NPT_String& s2) {
- return s1.Compare(s2) >= 0;
-}
-inline bool operator>=(const NPT_String& s1, const char* s2) {
- return s1.Compare(s2) >= 0;
-}
-inline bool operator>=(const char* s1, const NPT_String& s2) {
- return s2.Compare(s1) <= 0;
-}
-
-#endif // _NPT_STRINGS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - System
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_SYSTEM_H_
-#define _NPT_SYSTEM_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptTime.h"
-
-/*----------------------------------------------------------------------
-| NPT_System
-+---------------------------------------------------------------------*/
-class NPT_System
-{
-public:
- // methods
- static NPT_Result GetProcessId(NPT_UInt32& id);
- static NPT_Result GetCurrentTimeStamp(NPT_TimeStamp& now);
- static NPT_Result Sleep(const NPT_TimeInterval& duration);
- static NPT_Result SleepUntil(const NPT_TimeStamp& when);
- static NPT_Result SetRandomSeed(unsigned int seed);
- static NPT_UInt32 GetRandomInteger();
-
-protected:
- // constructor
- NPT_System() {}
-};
-
-#endif // _NPT_SYSTEM_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Threads
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_THREADS_H_
-#define _NPT_THREADS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptConstants.h"
-#include "NptInterfaces.h"
-
-/*----------------------------------------------------------------------
-| error codes
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_CALLBACK_HANDLER_SHUTDOWN = NPT_ERROR_BASE_THREADS-0;
-const int NPT_ERROR_CALLBACK_NOTHING_PENDING = NPT_ERROR_BASE_THREADS-1;
-
-/*----------------------------------------------------------------------
-| NPT_MutexInterface
-+---------------------------------------------------------------------*/
-class NPT_MutexInterface
-{
- public:
- // methods
- virtual ~NPT_MutexInterface() {}
- virtual NPT_Result Lock() = 0;
- virtual NPT_Result Unlock() = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Mutex
-+---------------------------------------------------------------------*/
-class NPT_Mutex : public NPT_MutexInterface
-{
- public:
- // methods
- NPT_Mutex();
- ~NPT_Mutex() { delete m_Delegate; }
- NPT_Result Lock() { return m_Delegate->Lock(); }
- NPT_Result Unlock() { return m_Delegate->Unlock(); }
-
- private:
- // members
- NPT_MutexInterface* m_Delegate;
-};
-
-/*----------------------------------------------------------------------
-| NPT_AutoLock
-+---------------------------------------------------------------------*/
-class NPT_AutoLock
-{
- public:
- // methods
- NPT_AutoLock(NPT_Mutex &mutex) : m_Mutex(mutex) {
- m_Mutex.Lock();
- }
- ~NPT_AutoLock() {
- m_Mutex.Unlock();
- }
-
- private:
- // members
- NPT_Mutex& m_Mutex;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Lock
-+---------------------------------------------------------------------*/
-template <typename T>
-class NPT_Lock : public T,
- public NPT_Mutex
-{
-};
-
-/*----------------------------------------------------------------------
-| NPT_SharedVariableInterface
-+---------------------------------------------------------------------*/
-class NPT_SharedVariableInterface
-{
- public:
- // methods
- virtual ~NPT_SharedVariableInterface() {}
- virtual void SetValue(int value)= 0;
- virtual int GetValue() = 0;
- virtual NPT_Result WaitUntilEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
- virtual NPT_Result WaitWhileEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_SharedVariable
-+---------------------------------------------------------------------*/
-class NPT_SharedVariable : public NPT_SharedVariableInterface
-{
- public:
- // methods
- NPT_SharedVariable(int value = 0);
- ~NPT_SharedVariable() { delete m_Delegate; }
- void SetValue(int value) {
- m_Delegate->SetValue(value);
- }
- int GetValue() {
- return m_Delegate->GetValue();
- }
- NPT_Result WaitUntilEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_Delegate->WaitUntilEquals(value, timeout);
- }
- NPT_Result WaitWhileEquals(int value, NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_Delegate->WaitWhileEquals(value, timeout);
- }
-
- private:
- // members
- NPT_SharedVariableInterface* m_Delegate;
-};
-
-/*----------------------------------------------------------------------
-| NPT_AtomicVariableInterface
-+---------------------------------------------------------------------*/
-class NPT_AtomicVariableInterface
-{
- public:
- // methods
- virtual ~NPT_AtomicVariableInterface() {}
- virtual int Increment() = 0;
- virtual int Decrement() = 0;
- virtual int GetValue() = 0;
- virtual void SetValue(int value) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_AtomicVariable
-+---------------------------------------------------------------------*/
-class NPT_AtomicVariable : public NPT_AtomicVariableInterface
-{
- public:
- // methods
- NPT_AtomicVariable(int value = 0);
- ~NPT_AtomicVariable() { delete m_Delegate; }
- int Increment() { return m_Delegate->Increment();}
- int Decrement() { return m_Delegate->Decrement();}
- void SetValue(int value) { m_Delegate->SetValue(value); }
- int GetValue() { return m_Delegate->GetValue(); }
-
- private:
- // members
- NPT_AtomicVariableInterface* m_Delegate;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Runnable
-+---------------------------------------------------------------------*/
-class NPT_Runnable
-{
-public:
- virtual ~NPT_Runnable() {}
- virtual void Run() = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_ThreadInterface
-+---------------------------------------------------------------------*/
-class NPT_ThreadInterface: public NPT_Runnable, public NPT_Interruptible
-{
- public:
- // methods
- virtual ~NPT_ThreadInterface() {}
- virtual NPT_Result Start() = 0;
- virtual NPT_Result Wait(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Thread
-+---------------------------------------------------------------------*/
-class NPT_Thread : public NPT_ThreadInterface
-{
- public:
- // types
- typedef unsigned long ThreadId;
-
- // class methods
- static ThreadId GetCurrentThreadId();
-
- // methods
- explicit NPT_Thread(bool detached = false);
- explicit NPT_Thread(NPT_Runnable& target, bool detached = false);
- ~NPT_Thread() { delete m_Delegate; }
-
- // NPT_ThreadInterface methods
- NPT_Result Start() {
- return m_Delegate->Start();
- }
- NPT_Result Wait(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return m_Delegate->Wait(timeout);
- }
-
- // NPT_Runnable methods
- virtual void Run() {}
-
- // NPT_Interruptible methods
- virtual NPT_Result Interrupt() {
- return m_Delegate->Interrupt();
- }
-
- private:
- // members
- NPT_ThreadInterface* m_Delegate;
-};
-
-
-/*----------------------------------------------------------------------
-| NPT_ThreadCallbackReceiver
-+---------------------------------------------------------------------*/
-class NPT_ThreadCallbackReceiver
-{
-public:
- virtual ~NPT_ThreadCallbackReceiver() {}
- virtual void OnCallback(void* args) = 0;
-};
-
-/*----------------------------------------------------------------------
-| NPT_ThreadCallbackSlot
-+---------------------------------------------------------------------*/
-class NPT_ThreadCallbackSlot
-{
-public:
- // types
- class NotificationHelper {
- public:
- virtual ~NotificationHelper() {};
- virtual void Notify(void) = 0;
- };
-
- // constructor
- NPT_ThreadCallbackSlot();
-
- // methods
- NPT_Result ReceiveCallback(NPT_ThreadCallbackReceiver& receiver, NPT_Timeout timeout = 0);
- NPT_Result SendCallback(void* args);
- NPT_Result SetNotificationHelper(NotificationHelper* helper);
- NPT_Result Shutdown();
-
-protected:
- // members
- volatile void* m_CallbackArgs;
- volatile bool m_Shutdown;
- NPT_SharedVariable m_Pending;
- NPT_SharedVariable m_Ack;
- NPT_Mutex m_ReadLock;
- NPT_Mutex m_WriteLock;
- NotificationHelper* m_NotificationHelper;
-};
-
-#endif // _NPT_THREADS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Time
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_TIME_H_
-#define _NPT_TIME_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-
-/*----------------------------------------------------------------------
-| NPT_TimeStamp
-+---------------------------------------------------------------------*/
-class NPT_TimeStamp
-{
- public:
- // methods
- NPT_TimeStamp(unsigned long seconds = 0, unsigned long nano_seconds = 0) :
- m_Seconds(seconds), m_NanoSeconds(nano_seconds) {}
- NPT_TimeStamp(float seconds);
- operator float() const;
- NPT_TimeStamp& operator+=(const NPT_TimeStamp& time_stamp);
- NPT_TimeStamp& operator-=(const NPT_TimeStamp& time_stamp);
- bool operator==(const NPT_TimeStamp& time_stamp) const;
- bool operator!=(const NPT_TimeStamp& time_stamp) const;
- bool operator>(const NPT_TimeStamp& time_stamp) const;
- bool operator<(const NPT_TimeStamp& time_stamp) const;
- bool operator>=(const NPT_TimeStamp& time_stamp) const;
- bool operator<=(const NPT_TimeStamp& time_stamp) const;
-
- // friend operators
- friend NPT_TimeStamp operator+(const NPT_TimeStamp& timestamp, long seconds);
- friend NPT_TimeStamp operator-(const NPT_TimeStamp& timestamp, long seconds);
-
- // members
- long m_Seconds;
- long m_NanoSeconds;
-};
-
-/*----------------------------------------------------------------------
-| operator+
-+---------------------------------------------------------------------*/
-inline
-NPT_TimeStamp
-operator+(const NPT_TimeStamp& t1, const NPT_TimeStamp& t2)
-{
- NPT_TimeStamp t = t1;
- return t += t2;
-}
-
-/*----------------------------------------------------------------------
-| operator-
-+---------------------------------------------------------------------*/
-inline
-NPT_TimeStamp
-operator-(const NPT_TimeStamp& t1, const NPT_TimeStamp& t2)
-{
- NPT_TimeStamp t = t1;
- return t -= t2;
-}
-
-/*----------------------------------------------------------------------
-| NPT_TimeInterval
-+---------------------------------------------------------------------*/
-typedef NPT_TimeStamp NPT_TimeInterval;
-
-/*----------------------------------------------------------------------
-| NPT_DateTime
-+---------------------------------------------------------------------*/
-typedef struct {
- NPT_Int32 year;
- NPT_Int32 month;
- NPT_Int32 day;
- NPT_Int32 hours;
- NPT_Int32 minutes;
- NPT_Int32 seconds;
- NPT_Int32 milliseconds;
-} NPT_DateTime;
-
-typedef NPT_Int32 NPT_TimeZone; /* minutes westward of GMT */
-typedef NPT_DateTime NPT_LocalDate;
-
-/*----------------------------------------------------------------------
-| NPT_Date
-+---------------------------------------------------------------------*/
-typedef struct {
- NPT_LocalDate local;
- NPT_TimeZone timezone;
-} NPT_Date;
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define NPT_TIME_MIN_YEAR 1970
-#define NPT_TIME_MAX_YEAR 2106
-
-/*----------------------------------------------------------------------
-| NPT_Time
-+---------------------------------------------------------------------*/
-class NPT_Time
-{
-public:
- // methods
- static NPT_Result GetGMTDateFromTimeStamp(const NPT_TimeStamp& timestamp,
- NPT_Date& date);
- static NPT_Result GetLocalDate(NPT_LocalDate& today, NPT_TimeStamp& now);
-
- // helper functions
- static NPT_Result FormatDate(const NPT_Date& date,
- char* output,
- NPT_Size size);
- static NPT_Result GetDateFromString(const char* input,
- NPT_Date& date);
- static NPT_Result ParseANSIDate(const char* ansi_date,
- NPT_Date& date,
- bool relaxed = true);
- static NPT_Result ParseRFC850Date(const char* rfc850_date,
- NPT_Date& date);
-};
-
-#endif // _NPT_TIME_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - TLS/SSL Support
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_TLS_H_
-#define _NPT_TLS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#include "NptStreams.h"
-
-/*----------------------------------------------------------------------
-| error codes
-+---------------------------------------------------------------------*/
-const NPT_Result NPT_ERROR_INVALID_PASSWORD = (NPT_ERROR_BASE_TLS-1);
-const NPT_Result NPT_ERROR_TLS_INVALID_HANDSHAKE = (NPT_ERROR_BASE_TLS-2);
-const NPT_Result NPT_ERROR_TLS_INVALID_PROTOCOL_MESSAGE = (NPT_ERROR_BASE_TLS-3);
-const NPT_Result NPT_ERROR_TLS_INVALID_HMAC = (NPT_ERROR_BASE_TLS-4);
-const NPT_Result NPT_ERROR_TLS_INVALID_VERSION = (NPT_ERROR_BASE_TLS-5);
-const NPT_Result NPT_ERROR_TLS_INVALID_SESSION = (NPT_ERROR_BASE_TLS-6);
-const NPT_Result NPT_ERROR_TLS_NO_CIPHER = (NPT_ERROR_BASE_TLS-7);
-const NPT_Result NPT_ERROR_TLS_BAD_CERTIFICATE = (NPT_ERROR_BASE_TLS-8);
-const NPT_Result NPT_ERROR_INVALID_KEY = (NPT_ERROR_BASE_TLS-9);
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const unsigned int NPT_TLS_NULL_WITH_NULL_NULL = 0x00;
-const unsigned int NPT_TLS_RSA_WITH_RC4_128_MD5 = 0x04;
-const unsigned int NPT_TLS_RSA_WITH_RC4_128_SHA = 0x05;
-const unsigned int NPT_TLS_RSA_WITH_AES_128_CBC_SHA = 0x2F;
-const unsigned int NPT_TLS_RSA_WITH_AES_256_CBC_SHA = 0x35;
-
-/*----------------------------------------------------------------------
-| class references
-+---------------------------------------------------------------------*/
-class NPT_TlsContextImpl;
-class NPT_TlsSessionImpl;
-
-/*----------------------------------------------------------------------
-| types
-+---------------------------------------------------------------------*/
-typedef enum {
- NPT_TLS_KEY_FORMAT_RSA_PRIVATE,
- NPT_TLS_KEY_FORMAT_PKCS8,
- NPT_TLS_KEY_FORMAT_PKCS12
-} NPT_TlsKeyFormat;
-
-/*----------------------------------------------------------------------
-| NPT_TlsContext
-+---------------------------------------------------------------------*/
-class NPT_TlsContext
-{
-public:
- NPT_TlsContext();
- ~NPT_TlsContext();
-
- // methods
- NPT_Result LoadKey(NPT_TlsKeyFormat key_format,
- const unsigned char* key_data,
- NPT_Size key_data_size,
- const char* password);
-
-
-protected:
- NPT_TlsContextImpl* m_Impl;
-
- // friends
- friend class NPT_TlsClientSession;
- friend class NPT_TlsServerSession;
-};
-
-typedef NPT_Reference<NPT_TlsContext> NPT_TlsContextReference;
-
-/*----------------------------------------------------------------------
-| NPT_TlsCertificateInfo
-+---------------------------------------------------------------------*/
-struct NPT_TlsCertificateInfo
-{
- struct {
- NPT_String common_name;
- NPT_String organization;
- NPT_String organizational_name;
- } subject;
- struct {
- NPT_String common_name;
- NPT_String organization;
- NPT_String organizational_name;
- } issuer;
- struct {
- unsigned char sha1[20];
- unsigned char md5[16];
- } fingerprint;
-};
-
-/*----------------------------------------------------------------------
-| NPT_TlsClientSession
-+---------------------------------------------------------------------*/
-class NPT_TlsClientSession
-{
-public:
- NPT_TlsClientSession(NPT_TlsContextReference& context,
- NPT_InputStreamReference& input,
- NPT_OutputStreamReference& output);
- ~NPT_TlsClientSession();
- NPT_Result Handshake();
- NPT_Result GetSessionId(NPT_DataBuffer& session_id);
- NPT_UInt32 GetCipherSuiteId();
- NPT_Result GetPeerCertificateInfo(NPT_TlsCertificateInfo& info);
- NPT_Result GetInputStream(NPT_InputStreamReference& stream);
- NPT_Result GetOutputStream(NPT_OutputStreamReference& stream);
-
-protected:
- NPT_TlsContextReference m_Context;
- NPT_Reference<NPT_TlsSessionImpl> m_Impl;
-};
-
-/*----------------------------------------------------------------------
-| NPT_TlsServerSession
-+---------------------------------------------------------------------*/
-class NPT_TlsServerSession
-{
-public:
- NPT_TlsServerSession(NPT_TlsContext& context,
- NPT_InputStreamReference input,
- NPT_OutputStreamReference output);
-
-protected:
- NPT_TlsSessionImpl* m_Impl;
-};
-
-#endif // _NPT_TLS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Types
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_TYPES_H_
-#define _NPT_TYPES_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-
-/*----------------------------------------------------------------------
-| sized types (this assumes that ints are 32 bits)
-+---------------------------------------------------------------------*/
-typedef NPT_CONFIG_INT64_TYPE NPT_Int64;
-typedef unsigned NPT_CONFIG_INT64_TYPE NPT_UInt64;
-typedef unsigned int NPT_UInt32;
-typedef int NPT_Int32;
-typedef unsigned short NPT_UInt16;
-typedef short NPT_Int16;
-typedef unsigned char NPT_UInt8;
-typedef char NPT_Int8;
-typedef float NPT_Float;
-
-/*----------------------------------------------------------------------
-| named types
-+---------------------------------------------------------------------*/
-typedef int NPT_Result;
-typedef unsigned int NPT_Cardinal;
-typedef unsigned int NPT_Ordinal;
-typedef unsigned long NPT_Size;
-typedef NPT_UInt64 NPT_LargeSize;
-typedef signed long NPT_Offset;
-typedef NPT_UInt64 NPT_Position;
-typedef long NPT_Timeout;
-typedef void NPT_Interface;
-typedef unsigned char NPT_Byte;
-typedef unsigned int NPT_Flags;
-typedef void* NPT_Any;
-typedef const void* NPT_AnyConst;
-
-/*----------------------------------------------------------------------
-| limits
-+---------------------------------------------------------------------*/
-#if defined(NPT_CONFIG_HAVE_LIMITS_H)
-#include <limits.h>
-#endif
-
-#if !defined(NPT_INT_MIN)
-#if defined(NPT_CONFIG_HAVE_INT_MIN)
-#define NPT_INT_MIN INT_MIN
-#endif
-#endif
-
-#if !defined(NPT_INT_MAX)
-#if defined(NPT_CONFIG_HAVE_INT_MAX)
-#define NPT_INT_MAX INT_MAX
-#endif
-#endif
-
-#if !defined(NPT_UINT_MAX)
-#if defined(NPT_CONFIG_HAVE_UINT_MAX)
-#define NPT_UINT_MAX UINT_MAX
-#endif
-#endif
-
-#if !defined(NPT_LONG_MIN)
-#if defined(NPT_CONFIG_HAVE_LONG_MIN)
-#define NPT_LONG_MIN LONG_MIN
-#endif
-#endif
-
-#if !defined(NPT_LONG_MAX)
-#if defined(NPT_CONFIG_HAVE_LONG_MAX)
-#define NPT_LONG_MAX LONG_MAX
-#endif
-#endif
-
-#if !defined(NPT_ULONG_MAX)
-#if defined(NPT_CONFIG_HAVE_ULONG_MAX)
-#define NPT_ULONG_MAX ULONG_MAX
-#endif
-#endif
-
-#if !defined(NPT_INT32_MAX)
-#define NPT_INT32_MAX 0x7FFFFFFF
-#endif
-
-#if !defined(NPT_INT32_MIN)
-#define NPT_INT32_MIN (-NPT_INT32_MAX - 1)
-#endif
-
-#if !defined(NPT_UINT32_MAX)
-#define NPT_UINT32_MAX 0xFFFFFFFF
-#endif
-
-#if !defined(NPT_INT64_MAX)
-#if defined(NPT_CONFIG_HAVE_LLONG_MAX)
-#define NPT_INT64_MAX LLONG_MAX
-#else
-#define NPT_INT64_MAX 0x7FFFFFFFFFFFFFFFLL
-#endif
-#endif
-
-#if !defined(NPT_INT64_MIN)
-#if defined(NPT_CONFIG_HAVE_LLONG_MIN)
-#define NPT_INT64_MIN LLONG_MIN
-#else
-#define NPT_INT64_MIN (-NPT_INT64_MAX - 1LL)
-#endif
-#endif
-
-#if !defined(NPT_UINT64_MAX)
-#if defined(NPT_CONFIG_HAVE_ULLONG_MAX)
-#define NPT_UINT64_MAX ULLONG_MAX
-#else
-#define NPT_UINT64_MAX 0xFFFFFFFFFFFFFFFFULL
-#endif
-#endif
-
-#endif // _NPT_TYPES_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - URI
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_URI_H_
-#define _NPT_URI_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptStrings.h"
-#include "NptList.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const NPT_UInt16 NPT_URL_INVALID_PORT = 0;
-
-/*----------------------------------------------------------------------
-| NPT_Uri
-+---------------------------------------------------------------------*/
-class NPT_Uri {
-public:
- // types
- typedef enum {
- SCHEME_ID_UNKNOWN,
- SCHEME_ID_HTTP
- } SchemeId;
-
- // constants. use as a parameter to Encode()
- static const char* const PathCharsToEncode;
- static const char* const QueryCharsToEncode;
- static const char* const FragmentCharsToEncode;
- static const char* const UnsafeCharsToEncode;
-
- // class methods
- static NPT_String PercentEncode(const char* str, const char* chars, bool encode_percents=true);
- static NPT_String PercentDecode(const char* str);
- static SchemeId ParseScheme(const NPT_String& scheme);
-
- // methods
- NPT_Uri() : m_SchemeId(SCHEME_ID_UNKNOWN) {}
- virtual ~NPT_Uri() {}
- const NPT_String& GetScheme() const {
- return m_Scheme;
- }
- void SetScheme(const char* scheme);
- NPT_Result SetSchemeFromUri(const char* uri);
- SchemeId GetSchemeId() const {
- return m_SchemeId;
- }
-
-protected:
- // members
- NPT_String m_Scheme;
- SchemeId m_SchemeId;
-};
-
-/*----------------------------------------------------------------------
-| NPT_UrlQuery
-+---------------------------------------------------------------------*/
-class NPT_UrlQuery
-{
-public:
- // class methods
- static NPT_String UrlEncode(const char* str, bool encode_percents=true);
- static NPT_String UrlDecode(const char* str);
-
- // types
- struct Field {
- Field(const char* name, const char* value) :
- m_Name(name), m_Value(value) {}
- NPT_String m_Name;
- NPT_String m_Value;
- };
-
- // constructor
- NPT_UrlQuery() {}
- NPT_UrlQuery(const char* query);
-
- // accessors
- NPT_List<Field>& GetFields() { return m_Fields; }
-
- // methods
- NPT_Result Parse(const char* query);
- NPT_Result SetField(const char* name, const char* value);
- NPT_Result AddField(const char* name, const char* value);
- const char* GetField(const char* name);
- NPT_String ToString();
-
-private:
- // members
- NPT_List<Field> m_Fields;
-};
-
-/*----------------------------------------------------------------------
-| NPT_Url
-+---------------------------------------------------------------------*/
-class NPT_Url : public NPT_Uri {
-public:
- // constructors and destructor
- NPT_Url();
- NPT_Url(const char* url,
- SchemeId expected_scheme = SCHEME_ID_UNKNOWN,
- NPT_UInt16 default_port = NPT_URL_INVALID_PORT);
- NPT_Url(const char* scheme,
- const char* host,
- NPT_UInt16 port,
- const char* path,
- const char* query = NULL,
- const char* fragment = NULL);
-
- // methods
- const NPT_String& GetHost() const { return m_Host; }
- NPT_UInt16 GetPort() const { return m_Port; }
- const NPT_String& GetPath() const { return m_Path; }
- const NPT_String& GetQuery() const { return m_Query; }
- const NPT_String& GetFragment() const { return m_Fragment; }
- virtual bool IsValid() const;
- bool HasQuery() const { return m_HasQuery; }
- bool HasFragment() const { return m_HasFragment; }
- NPT_Result SetHost(const char* host);
- NPT_Result SetPort(NPT_UInt16 port);
- NPT_Result SetPath(const char* path);
- NPT_Result SetPathPlus(const char* path_plus);
- NPT_Result SetQuery(const char* query);
- NPT_Result SetFragment(const char* fragment);
- virtual NPT_String ToRequestString(bool with_fragment = false) const;
- virtual NPT_String ToStringWithDefaultPort(NPT_UInt16 default_port, bool with_fragment = true) const;
- virtual NPT_String ToString(bool with_fragment = true) const;
-
-protected:
- // members
- NPT_String m_Host;
- NPT_UInt16 m_Port;
- NPT_String m_Path;
- bool m_HasQuery;
- NPT_String m_Query;
- bool m_HasFragment;
- NPT_String m_Fragment;
-};
-
-#endif // _NPT_URI_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune Utils
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_UTILS_H_
-#define _NPT_UTILS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#include "NptTypes.h"
-#include "NptStrings.h"
-#include "NptMap.h"
-
-#if defined (NPT_CONFIG_HAVE_STDIO_H)
-#include <stdio.h>
-#endif
-
-#if defined (NPT_CONFIG_HAVE_STRING_H)
-#include <string.h>
-#endif
-
-#if defined(NPT_CONFIG_HAVE_STDARG_H)
-#include <stdarg.h>
-#endif
-
-/*----------------------------------------------------------------------
-| macros
-+---------------------------------------------------------------------*/
-#define NPT_ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0]))
-
-/*----------------------------------------------------------------------
-| byte I/O
-+---------------------------------------------------------------------*/
-extern void NPT_BytesFromInt64Be(unsigned char* buffer, NPT_UInt64 value);
-extern void NPT_BytesFromInt32Be(unsigned char* buffer, NPT_UInt32 value);
-extern void NPT_BytesFromInt24Be(unsigned char* buffer, NPT_UInt32 value);
-extern void NPT_BytesFromInt16Be(unsigned char* buffer, NPT_UInt16 value);
-extern NPT_UInt64 NPT_BytesToInt64Be(const unsigned char* buffer);
-extern NPT_UInt32 NPT_BytesToInt32Be(const unsigned char* buffer);
-extern NPT_UInt32 NPT_BytesToInt24Be(const unsigned char* buffer);
-extern NPT_UInt16 NPT_BytesToInt16Be(const unsigned char* buffer);
-
-extern void NPT_BytesFromInt64Le(unsigned char* buffer, NPT_UInt64 value);
-extern void NPT_BytesFromInt32Le(unsigned char* buffer, NPT_UInt32 value);
-extern void NPT_BytesFromInt24Le(unsigned char* buffer, NPT_UInt32 value);
-extern void NPT_BytesFromInt16Le(unsigned char* buffer, NPT_UInt16 value);
-extern NPT_UInt64 NPT_BytesToInt64Le(const unsigned char* buffer);
-extern NPT_UInt32 NPT_BytesToInt32Le(const unsigned char* buffer);
-extern NPT_UInt32 NPT_BytesToInt24Le(const unsigned char* buffer);
-extern NPT_UInt16 NPT_BytesToInt16Le(const unsigned char* buffer);
-
-/*----------------------------------------------------------------------
-| conversion utilities
-+---------------------------------------------------------------------*/
-extern NPT_Result
-NPT_ParseFloat(const char* str, float& result, bool relaxed = true);
-
-extern NPT_Result
-NPT_ParseInteger(const char* str, long& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger(const char* str, unsigned long& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger(const char* str, int& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger(const char* str, unsigned int& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger32(const char* str, NPT_Int32& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger32(const char* str, NPT_UInt32& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger64(const char* str, NPT_Int64& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-extern NPT_Result
-NPT_ParseInteger64(const char* str, NPT_UInt64& result, bool relaxed = true, NPT_Cardinal* chars_used = 0);
-
-/*----------------------------------------------------------------------
-| formatting
-+---------------------------------------------------------------------*/
-void
-NPT_FormatOutput(void (*function)(void* parameter, const char* message),
- void* function_parameter,
- const char* format,
- va_list args);
-
-void NPT_ByteToHex(NPT_Byte b, char* buffer, bool uppercase=false);
-NPT_Result NPT_HexToByte(const char* buffer, NPT_Byte& b);
-NPT_String NPT_HexString(const unsigned char* data,
- NPT_Size data_size,
- const char* separator = NULL,
- bool uppercase=false);
-char NPT_NibbleToHex(unsigned int nibble, bool uppercase = true);
-int NPT_HexToNibble(char hex);
-
-/*----------------------------------------------------------------------
-| parsing
-+---------------------------------------------------------------------*/
-NPT_Result
-NPT_ParseMimeParameters(const char* encoded,
- NPT_Map<NPT_String, NPT_String>& parameters);
-
-/*----------------------------------------------------------------------
-| environment variables
-+---------------------------------------------------------------------*/
-NPT_Result NPT_GetEnvironment(const char* name, NPT_String& value);
-
-/*----------------------------------------------------------------------
-| string utils
-+---------------------------------------------------------------------*/
-#if defined (NPT_CONFIG_HAVE_STDIO_H)
-#include <stdio.h>
-#endif
-
-#if defined (NPT_CONFIG_HAVE_STRING_H)
-#include <string.h>
-#endif
-
-#if defined (NPT_CONFIG_HAVE_SNPRINTF)
-#define NPT_FormatString NPT_snprintf
-#else
-int NPT_FormatString(char* str, NPT_Size size, const char* format, ...);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_VSNPRINTF)
-#define NPT_FormatStringVN(s,c,f,a) NPT_vsnprintf(s,c,f,a)
-#else
-extern int NPT_FormatStringVN(char *buffer, size_t count, const char *format, va_list argptr);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_MEMCPY)
-#define NPT_CopyMemory memcpy
-#else
-extern void NPT_CopyMemory(void* dest, void* src, NPT_Size size);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_STRCMP)
-#define NPT_StringsEqual(s1, s2) (strcmp((s1), (s2)) == 0)
-#else
-extern int NPT_StringsEqual(const char* s1, const char* s2);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_STRNCMP)
-#define NPT_StringsEqualN(s1, s2, n) (strncmp((s1), (s2), (n)) == 0)
-#else
-extern int NPT_StringsEqualN(const char* s1, const char* s2, unsigned long size);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_STRLEN)
-#define NPT_StringLength(s) (NPT_Size)(strlen(s))
-#else
-extern unsigned long NPT_StringLength(const char* s);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_STRCPY)
-#define NPT_CopyString(dst, src) ((void)NPT_strcpy((dst), (src)))
-#else
-extern void NPT_CopyString(char* dst, const char* src);
-#endif
-
-/**
- * Copy up to n characters from src to dst.
- * The destination buffer will be null-terminated, so it must
- * have enough space for n+1 characters (n from the source plus
- * the null terminator).
- */
-#if defined(NPT_CONFIG_HAVE_STRNCPY)
-#define NPT_CopyStringN(dst, src, n) \
-do { ((void)NPT_strncpy((dst), (src), n)); (dst)[(n)] = '\0'; } while(0)
-#else
-extern int NPT_CopyStringN(char* dst, const char* src, unsigned long n);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_MEMSET)
-#define NPT_SetMemory memset
-#else
-extern void NPT_SetMemory(void* dest, int c, NPT_Size size);
-#endif
-
-#if defined(NPT_CONFIG_HAVE_MEMCMP)
-#define NPT_MemoryEqual(s1, s2, n) (memcmp((s1), (s2), (n)) == 0)
-#else
-extern int NPT_MemoryEqual(const void* s1, const void* s2, unsigned long n);
-#endif
-
-#endif // _NPT_UTILS_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Version Info
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_VERSION_H_
-#define _NPT_VERSION_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#define NPT_NEPTUNE_VERSION 0x01000200
-#define NPT_NEPTUNE_VERSION_STRING "1.0.2"
-
-#endif // _NPT_VERSION_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Xml Support
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_XML_H_
-#define _NPT_XML_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptList.h"
-#include "NptStrings.h"
-#include "NptStreams.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-const int NPT_ERROR_XML_INVALID_NESTING = NPT_ERROR_BASE_XML - 0;
-const int NPT_ERROR_XML_TAG_MISMATCH = NPT_ERROR_BASE_XML - 1;
-
-#define NPT_XML_ANY_NAMESPACE "*"
-#define NPT_XML_NO_NAMESPACE NULL
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class NPT_XmlProcessor;
-
-/*----------------------------------------------------------------------
-| NPT_XmlAttribute
-+---------------------------------------------------------------------*/
-class NPT_XmlAttribute
-{
- public:
- // methods
- NPT_XmlAttribute(const char* name, const char* value);
- NPT_XmlAttribute(const char* prefix, const char* name, const char* value) :
- m_Prefix(prefix), m_Name(name), m_Value(value) {}
- const NPT_String& GetPrefix() const { return m_Prefix; }
- const NPT_String& GetName() const { return m_Name; }
- const NPT_String& GetValue() const { return m_Value; }
- void SetValue(const char* value) { m_Value = value; }
-
- private:
- // members
- NPT_String m_Prefix;
- NPT_String m_Name;
- NPT_String m_Value;
-
- NPT_XmlAttribute(const NPT_XmlAttribute& attribute) :
- m_Prefix(attribute.m_Prefix),
- m_Name(attribute.m_Name),
- m_Value(attribute.m_Value) {}
- NPT_XmlAttribute& operator=(const NPT_XmlAttribute& a);
-
- // friends
- friend class NPT_XmlAttributeFinder;
- friend class NPT_XmlAttributeFinderWithPrefix;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlNamespaceMap
-+---------------------------------------------------------------------*/
-class NPT_XmlNamespaceMap
-{
-public:
- // destructor
- ~NPT_XmlNamespaceMap();
-
- // methods
- NPT_Result SetNamespaceUri(const char* prefix, const char* uri);
- const NPT_String* GetNamespaceUri(const char* prefix);
- const NPT_String* GetNamespacePrefix(const char* uri);
-
-private:
- // types
- class Entry {
- public:
- // constructor
- Entry(const char* prefix, const char* uri) :
- m_Prefix(prefix), m_Uri(uri) {}
-
- // members
- NPT_String m_Prefix;
- NPT_String m_Uri;
- };
-
- // members
- NPT_List<Entry*> m_Entries;
-
- // friends
- friend class NPT_XmlWriter;
- friend class NPT_XmlNodeWriter;
- friend class NPT_XmlNodeCanonicalWriter;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlNode
-+---------------------------------------------------------------------*/
-class NPT_XmlElementNode;
-class NPT_XmlTextNode;
-class NPT_XmlNode
-{
- public:
- // types
- typedef enum {
- DOCUMENT,
- ELEMENT,
- TEXT
- } Type;
-
- // methods
- NPT_XmlNode(Type type) : m_Type(type), m_Parent(NULL) {}
- virtual ~NPT_XmlNode() {}
- Type GetType() const { return m_Type; }
- NPT_XmlNode* GetParent() const { return m_Parent; }
-
- // type casting
- virtual NPT_XmlElementNode* AsElementNode() { return NULL; }
- virtual const NPT_XmlElementNode* AsElementNode() const { return NULL; }
- virtual NPT_XmlTextNode* AsTextNode() { return NULL; }
- virtual const NPT_XmlTextNode* AsTextNode() const { return NULL; }
-
- protected:
- // methods
- virtual void SetParent(NPT_XmlNode* parent) { m_Parent = parent; }
-
- // members
- Type m_Type;
- NPT_XmlNode* m_Parent;
-
- // friends
- friend class NPT_XmlNodeFinder;
- friend class NPT_XmlSerializer;
- friend class NPT_XmlWriter;
- friend class NPT_XmlElementNode; // to allow access to SetParent()
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlElementNode
-+---------------------------------------------------------------------*/
-class NPT_XmlElementNode : public NPT_XmlNode
-{
- public:
- // methods
- NPT_XmlElementNode(const char* tag);
- NPT_XmlElementNode(const char* prefix, const char* tag);
- virtual ~NPT_XmlElementNode();
- NPT_List<NPT_XmlNode*>& GetChildren() { return m_Children; }
- const NPT_List<NPT_XmlNode*>&
- GetChildren() const { return m_Children; }
- NPT_XmlElementNode* GetChild(const char* tag,
- const char* namespc = NPT_XML_NO_NAMESPACE,
- NPT_Ordinal n=0) const;
- NPT_Result AddChild(NPT_XmlNode* child);
- NPT_Result SetAttribute(const char* prefix,
- const char* name,
- const char* value);
- NPT_Result SetAttribute(const char* name,
- const char* value);
- NPT_Result AddText(const char* text);
- NPT_List<NPT_XmlAttribute*>&
- GetAttributes() { return m_Attributes; }
- const NPT_List<NPT_XmlAttribute*>&
- GetAttributes() const { return m_Attributes; }
- const NPT_String* GetAttribute(const char* name,
- const char* namespc = NPT_XML_NO_NAMESPACE) const;
- const NPT_String& GetPrefix() const { return m_Prefix; }
- const NPT_String& GetTag() const { return m_Tag; }
- const NPT_String* GetText(NPT_Ordinal n=0) const;
-
- // bring all the namespace definitions used in this element of one of its descendants
- // into the namespace map of this element so that it may be serialized as a
- // standalone element without any prefixes with undefined namespace uris
- NPT_Result MakeStandalone();
-
- // namespace methods
- const NPT_String* GetNamespace() const;
- NPT_Result SetNamespaceUri(const char* prefix, const char* uri);
- const NPT_String* GetNamespaceUri(const char* prefix) const;
- const NPT_String* GetNamespacePrefix(const char* uri) const;
-
- // type casting
- NPT_XmlElementNode* AsElementNode() { return this; }
- const NPT_XmlElementNode* AsElementNode() const { return this; }
-
-protected:
- // methods
- void SetParent(NPT_XmlNode* parent);
- void SetNamespaceParent(NPT_XmlElementNode* parent);
- void RelinkNamespaceMaps();
-
- NPT_Result AddAttribute(const char* name, const char* value);
-
- // members
- NPT_String m_Prefix;
- NPT_String m_Tag;
- NPT_List<NPT_XmlNode*> m_Children;
- NPT_List<NPT_XmlAttribute*> m_Attributes;
- NPT_XmlNamespaceMap* m_NamespaceMap;
- NPT_XmlElementNode* m_NamespaceParent;
-
- // friends
- friend class NPT_XmlTagFinder;
- friend class NPT_XmlSerializer;
- friend class NPT_XmlWriter;
- friend class NPT_XmlNodeWriter;
- friend class NPT_XmlNodeCanonicalWriter;
- friend class NPT_XmlParser;
- friend class NPT_XmlProcessor;
- friend class NPT_XmlNamespaceCollapser;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlTextNode
-+---------------------------------------------------------------------*/
-class NPT_XmlTextNode : public NPT_XmlNode
-{
- public:
- // types
- typedef enum {
- CHARACTER_DATA,
- IGNORABLE_WHITESPACE,
- CDATA_SECTION,
- ENTITY_REFERENCE,
- COMMENT
- } TokenType;
-
- // constructor
- NPT_XmlTextNode(TokenType token_type, const char* text);
-
- // methods
- const NPT_String& GetString() const { return m_Text; }
-
- // type casting
- NPT_XmlTextNode* AsTextNode() { return this; }
- const NPT_XmlTextNode* AsTextNode() const { return this; }
-
- private:
- // members
- TokenType m_TokenType;
- NPT_String m_Text;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlParser
-+---------------------------------------------------------------------*/
-class NPT_XmlParser
-{
- public:
- // methods
- NPT_XmlParser(bool keep_whitespace = true);
- virtual ~NPT_XmlParser();
- virtual NPT_Result Parse(const char* xml,
- NPT_XmlNode*& tree,
- bool incremental=false);
- virtual NPT_Result Parse(const char* xml,
- NPT_Size size,
- NPT_XmlNode*& tree,
- bool incremental=false);
- virtual NPT_Result Parse(NPT_InputStream& stream,
- NPT_XmlNode*& tree,
- bool incremental=false);
- virtual NPT_Result Parse(NPT_InputStream& stream,
- NPT_Size& size,
- NPT_XmlNode*& tree,
- bool incremental=false);
-
- protected:
- // NPT_XmlHandler methods
- NPT_Result OnStartElement(const char* name);
- NPT_Result OnElementAttribute(const char* name, const char* value);
- NPT_Result OnEndElement(const char* name);
- NPT_Result OnCharacterData(const char* data, unsigned long size);
- void RemoveIgnorableWhitespace();
-
- // members
- NPT_XmlProcessor* m_Processor;
- NPT_XmlElementNode* m_Tree;
- NPT_XmlElementNode* m_CurrentElement;
- bool m_KeepWhitespace;
-
- // friends
- friend class NPT_XmlProcessor;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlSerializer
-+---------------------------------------------------------------------*/
-class NPT_XmlSerializer
-{
-public:
- // methods
- NPT_XmlSerializer(NPT_OutputStream* output,
- NPT_Cardinal indentation = 0,
- bool shrink_empty_elements = true,
- bool add_header = true);
- virtual ~NPT_XmlSerializer();
- virtual NPT_Result StartDocument();
- virtual NPT_Result EndDocument();
- virtual NPT_Result StartElement(const char* prefix, const char* name);
- virtual NPT_Result EndElement(const char* prefix, const char* name);
- virtual NPT_Result Attribute(const char* prefix, const char* name, const char* value);
- virtual NPT_Result Text(const char* text);
- virtual NPT_Result CdataSection(const char* data);
- virtual NPT_Result Comment(const char* comment);
-
-protected:
- // methods
- void EscapeChar(unsigned char c, char* text);
- NPT_Result ProcessPending();
- NPT_Result OutputEscapedString(const char* text, bool attribute);
- void OutputIndentation(bool start);
-
- // members
- NPT_OutputStream* m_Output;
- bool m_ElementPending;
- NPT_Cardinal m_Depth;
- NPT_Cardinal m_Indentation;
- NPT_String m_IndentationPrefix;
- bool m_ElementHasText;
- bool m_ShrinkEmptyElements;
- bool m_AddHeader;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlWriter
-+---------------------------------------------------------------------*/
-class NPT_XmlWriter
-{
-public:
- // constructor
- explicit NPT_XmlWriter(NPT_Cardinal indentation = 0) : m_Indentation(indentation) {}
-
- // methods
- NPT_Result Serialize(NPT_XmlNode& node,
- NPT_OutputStream& stream,
- bool add_header = true);
-
-private:
- // members
- NPT_Cardinal m_Indentation;
-};
-
-/*----------------------------------------------------------------------
-| NPT_XmlCanonicalizer
-+---------------------------------------------------------------------*/
-class NPT_XmlCanonicalizer
-{
-public:
- // methods
- NPT_Result Serialize(NPT_XmlNode& node,
- NPT_OutputStream& stream,
- bool add_header = true);
-};
-
-#endif // _NPT_XML_H_
+++ /dev/null
-/*****************************************************************
-|
-| Neptune - Zip Support
-|
-| Copyright (c) 2002-2008, Axiomatic Systems, LLC.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions are met:
-| * Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| * Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| * Neither the name of Axiomatic Systems nor the
-| names of its contributors may be used to endorse or promote products
-| derived from this software without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
-| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-| DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-|
- ****************************************************************/
-
-#ifndef _NPT_ZIP_H_
-#define _NPT_ZIP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptConfig.h"
-#include "NptStreams.h"
-
-/*----------------------------------------------------------------------
-| class references
-+---------------------------------------------------------------------*/
-class NPT_ZipInflateState;
-class NPT_ZipDeflateState;
-
-/*----------------------------------------------------------------------
-| NPT_Zip
-+---------------------------------------------------------------------*/
-const int NPT_ZIP_COMPRESSION_LEVEL_DEFAULT = -1;
-const int NPT_ZIP_COMPRESSION_LEVEL_MIN = 0;
-const int NPT_ZIP_COMPRESSION_LEVEL_MAX = 9;
-const int NPT_ZIP_COMPRESSION_LEVEL_NONE = 0;
-class NPT_Zip
-{
-public:
- // class methods
- static NPT_Result MapError(int err);
-
- /**
- * Compressed data format
- */
- typedef enum {
- ZLIB,
- GZIP
- } Format;
-
- /**
- * Deflate (i.e compress) a buffer
- */
- static NPT_Result Deflate(const NPT_DataBuffer& in,
- NPT_DataBuffer& out,
- int compression_level = NPT_ZIP_COMPRESSION_LEVEL_DEFAULT,
- Format format = ZLIB);
-
- /**
- * Inflate (i.e decompress) a buffer
- */
- static NPT_Result Inflate(const NPT_DataBuffer& in,
- NPT_DataBuffer& out);
-};
-
-/*----------------------------------------------------------------------
-| NPT_ZipInflatingInputStream
-+---------------------------------------------------------------------*/
-class NPT_ZipInflatingInputStream : public NPT_InputStream
-{
-public:
- NPT_ZipInflatingInputStream(NPT_InputStreamReference& source);
- ~NPT_ZipInflatingInputStream();
-
- // NPT_InputStream methods
- virtual NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL);
- virtual NPT_Result Seek(NPT_Position offset);
- virtual NPT_Result Tell(NPT_Position& offset);
- virtual NPT_Result GetSize(NPT_LargeSize& size);
- virtual NPT_Result GetAvailable(NPT_LargeSize& available);
-
-private:
- NPT_InputStreamReference m_Source;
- NPT_Position m_Position;
- NPT_ZipInflateState* m_State;
- NPT_DataBuffer m_Buffer;
-};
-
-/*----------------------------------------------------------------------
-| NPT_ZipInflatingOutputStream
-+---------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------
-| NPT_ZipDeflatingInputStream
-+---------------------------------------------------------------------*/
-class NPT_ZipDeflatingInputStream : public NPT_InputStream
-{
-public:
- NPT_ZipDeflatingInputStream(NPT_InputStreamReference& source,
- int compression_level = NPT_ZIP_COMPRESSION_LEVEL_DEFAULT,
- NPT_Zip::Format format = NPT_Zip::ZLIB);
- ~NPT_ZipDeflatingInputStream();
-
- // NPT_InputStream methods
- virtual NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL);
- virtual NPT_Result Seek(NPT_Position offset);
- virtual NPT_Result Tell(NPT_Position& offset);
- virtual NPT_Result GetSize(NPT_LargeSize& size);
- virtual NPT_Result GetAvailable(NPT_LargeSize& available);
-
-private:
- NPT_InputStreamReference m_Source;
- NPT_Position m_Position;
- bool m_Eos;
- NPT_ZipDeflateState* m_State;
- NPT_DataBuffer m_Buffer;
-};
-
-/*----------------------------------------------------------------------
-| NPT_ZipDeflatingInputStream
-+---------------------------------------------------------------------*/
-
-#endif // _NPT_ZIP_H_
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Top Level Include
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
- ****************************************************************/
-
-#ifndef _PLATINUM_H_
-#define _PLATINUM_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltUPnP.h"
-#include "PltCtrlPoint.h"
-#include "PltDeviceData.h"
-#include "PltHttpServer.h"
-#include "PltVersion.h"
-#include "PltSvnVersion.h"
-#include "PltTime.h"
-
-#ifdef PLT_DEVICE_HEADERS_INCLUDE
-#include "PltMediaServer.h"
-#include "PltMediaBrowser.h"
-#include "PltMediaRenderer.h"
-#include "PltMediaController.h"
-#endif
-
-#endif /* _PLATINUM_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Service Action
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_ACTION_H_
-#define _PLT_ACTION_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltArgument.h"
-#include "PltDeviceData.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_Service;
-
-/*----------------------------------------------------------------------
-| PLT_ActionDesc
-+---------------------------------------------------------------------*/
-class PLT_ActionDesc
-{
-public:
- PLT_ActionDesc(const char* name, PLT_Service* service);
- ~PLT_ActionDesc();
-
- NPT_Array<PLT_ArgumentDesc*>& GetArgumentDescs() {
- return m_ArgumentDescs;
- }
-
- const NPT_String& GetName() const { return m_Name;}
- PLT_ArgumentDesc* GetArgumentDesc(const char* name);
- NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
- PLT_Service* GetService();
-
-protected:
- //members
- NPT_String m_Name;
- PLT_Service* m_Service;
- NPT_Array<PLT_ArgumentDesc*> m_ArgumentDescs;
-};
-
-/*----------------------------------------------------------------------
-| PLT_Action
-+---------------------------------------------------------------------*/
-class PLT_Action
-{
-public:
- ~PLT_Action();
-
- PLT_ActionDesc& GetActionDesc() { return m_ActionDesc; }
-
- NPT_Result GetArgumentValue(const char* name, NPT_String& value);
- NPT_Result GetArgumentValue(const char* name, NPT_UInt32& value);
- NPT_Result GetArgumentValue(const char* name, NPT_Int32& value);
- NPT_Result GetArgumentValue(const char* name, bool& value);
- NPT_Result VerifyArgumentValue(const char* name, const char* value);
- NPT_Result VerifyArguments(bool input);
- NPT_Result SetArgumentOutFromStateVariable(const char* name);
- NPT_Result SetArgumentsOutFromStateVariable();
- NPT_Result SetArgumentValue(const char* name, const char* value);
-
- NPT_Result SetError(unsigned int code, const char* description);
- const char* GetError(unsigned int& code);
- unsigned int GetErrorCode();
-
- NPT_Result FormatSoapRequest(NPT_OutputStream& stream);
- NPT_Result FormatSoapResponse(NPT_OutputStream& stream);
-
- static NPT_Result FormatSoapError(unsigned int code,
- NPT_String desc,
- NPT_OutputStream& stream);
-
-private:
- // only PLT_DeviceHost and PLT_CtrlPoint can instantiate those directly
- friend class PLT_DeviceHost;
- friend class PLT_CtrlPoint;
- PLT_Action(PLT_ActionDesc& action_desc);
- PLT_Action(PLT_ActionDesc& action_desc, PLT_DeviceDataReference& root_device);
-
-private:
- NPT_Result SetArgumentOutFromStateVariable(PLT_ArgumentDesc* arg_desc);
- PLT_Argument* GetArgument(const char* name);
-
-protected:
- // members
- PLT_ActionDesc& m_ActionDesc;
- PLT_Arguments m_Arguments;
- unsigned int m_ErrorCode;
- NPT_String m_ErrorDescription;
- // keep reference to device to prevent it
- // from being released during action lifetime
- PLT_DeviceDataReference m_RootDevice;
-};
-
-typedef NPT_Reference<PLT_Action> PLT_ActionReference;
-
-/*----------------------------------------------------------------------
-| PLT_GetSCPDXMLIterator
-+---------------------------------------------------------------------*/
-template <class T>
-class PLT_GetSCPDXMLIterator
-{
-public:
- PLT_GetSCPDXMLIterator<T>(NPT_XmlElementNode* node) :
- m_Node(node) {}
-
- NPT_Result operator()(T* const & data) const {
- return data->GetSCPDXML(m_Node);
- }
-
-private:
- NPT_XmlElementNode* m_Node;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ActionDescNameFinder
-+---------------------------------------------------------------------*/
-class PLT_ActionDescNameFinder
-{
-public:
- // methods
- PLT_ActionDescNameFinder(PLT_Service* service, const char* name) :
- m_Service(service), m_Name(name) {}
- virtual ~PLT_ActionDescNameFinder() {}
-
- bool operator()(const PLT_ActionDesc* const & action_desc) const {
- return action_desc->GetName().Compare(m_Name, true) ? false : true;
- }
-
-private:
- // members
- PLT_Service* m_Service;
- NPT_String m_Name;
-};
-
-#endif /* _PLT_ACTION_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Action Argument
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_ARGUMENT_H_
-#define _PLT_ARGUMENT_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_StateVariable;
-class PLT_Argument;
-class PLT_ActionDesc;
-typedef NPT_Array<PLT_Argument*> PLT_Arguments;
-
-/*----------------------------------------------------------------------
-| PLT_ArgumentDesc
-+---------------------------------------------------------------------*/
-class PLT_ArgumentDesc
-{
-public:
- PLT_ArgumentDesc(const char* name,
- NPT_Ordinal position,
- const char* direction = "in",
- PLT_StateVariable* variable = NULL,
- bool has_ret = false);
-
- // accessor methods
- NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
- const NPT_String& GetName() const { return m_Name; }
- const NPT_String& GetDirection() const { return m_Direction; }
- NPT_Ordinal GetPosition() { return m_Position; }
- PLT_StateVariable* GetRelatedStateVariable() { return m_RelatedStateVariable; }
- bool HasRetValue() { return m_HasReturnValue; }
-
-protected:
- NPT_String m_Name;
- NPT_Ordinal m_Position;
- NPT_String m_Direction;
- PLT_StateVariable* m_RelatedStateVariable;
- bool m_HasReturnValue;
-};
-
-/*----------------------------------------------------------------------
-| PLT_Argument
-+---------------------------------------------------------------------*/
-class PLT_Argument
-{
-public:
- PLT_Argument(PLT_ArgumentDesc& arg_desc);
-
- // class methods
- static NPT_Result CreateArgument(PLT_ActionDesc& action_desc,
- const char* arg_name,
- const char* arg_value,
- PLT_Argument*& arg);
-
- // accessor methods
- PLT_ArgumentDesc& GetDesc() { return m_ArgDesc; }
- NPT_Ordinal GetPosition() { return m_ArgDesc.GetPosition(); }
- NPT_Result SetValue(const char* value);
- const NPT_String& GetValue();
-
-private:
- NPT_Result ValidateValue(const char* value);
-
-protected:
- PLT_ArgumentDesc& m_ArgDesc;
- NPT_String m_Value;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ArgumentNameFinder
-+---------------------------------------------------------------------*/
-class PLT_ArgumentNameFinder
-{
-public:
- // methods
- PLT_ArgumentNameFinder(const char* name) : m_Name(name) {}
-
- bool operator()(PLT_Argument* const & argument) const {
- return argument->GetDesc().GetName().Compare(m_Name, true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_Name;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ArgumentDescNameFinder
-+---------------------------------------------------------------------*/
-class PLT_ArgumentDescNameFinder
-{
-public:
- // methods
- PLT_ArgumentDescNameFinder(const char* name) : m_Name(name) {}
-
- bool operator()(PLT_ArgumentDesc* const & arg_desc) const {
- return arg_desc->GetName().Compare(m_Name, true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_Name;
-};
-
-#endif /* _PLT_ARGUMENT_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - UPnP Constants
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_UPNP_CONSTANTS_H_
-#define _PLT_UPNP_CONSTANTS_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| PLT_Constants
-+---------------------------------------------------------------------*/
-class PLT_Constants
-{
-public:
- // class methods
- static PLT_Constants& GetInstance();
-
- PLT_Constants();
- ~PLT_Constants() {};
-
- // members
- NPT_TimeInterval m_DefaultDeviceLease;
- NPT_TimeInterval m_DefaultSubscribeLease;
-};
-
-#endif /* _PLT_UPNP_CONSTANTS_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Control Point
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_CONTROL_POINT_H_
-#define _PLT_CONTROL_POINT_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltService.h"
-#include "PltHttpServerListener.h"
-#include "PltSsdpListener.h"
-#include "PltDeviceData.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_HttpServer;
-class PLT_CtrlPointHouseKeepingTask;
-class PLT_SsdpSearchTask;
-class PLT_SsdpListenTask;
-class PLT_CtrlPointGetSCPDRequest;
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointListener class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointListener
-{
-public:
- virtual ~PLT_CtrlPointListener() {}
-
- virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device) = 0;
- virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device) = 0;
- virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata) = 0;
- virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars) = 0;
-};
-
-typedef NPT_List<PLT_CtrlPointListener*> PLT_CtrlPointListenerList;
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPoint class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPoint : public PLT_SsdpPacketListener,
- public PLT_SsdpSearchResponseListener
-{
-public:
- PLT_CtrlPoint(const char* search_criteria = "upnp:rootdevice"); // pass NULL to prevent repeated automatic search
-
- // delegation
- NPT_Result AddListener(PLT_CtrlPointListener* listener);
- NPT_Result RemoveListener(PLT_CtrlPointListener* listener);
-
- // discovery
- void IgnoreUUID(const char* uuid);
- NPT_Result InspectDevice(const char* location,
- const char* uuid,
- NPT_Timeout leasetime = PLT_Constants::GetInstance().m_DefaultDeviceLease);
- NPT_Result Search(const NPT_HttpUrl& url = NPT_HttpUrl("239.255.255.250", 1900, "*"),
- const char* target = "upnp:rootdevice",
- NPT_Cardinal mx = 5,
- NPT_Timeout frequency = 50000); // pass 0 for one time only
- NPT_Result Discover(const NPT_HttpUrl& url = NPT_HttpUrl("239.255.255.250", 1900, "*"),
- const char* target = "ssdp:all",
- NPT_Cardinal mx = 5,
- NPT_Timeout frequency = 50000); // pass 0 for one time only
-
- // actions
- NPT_Result FindActionDesc(PLT_DeviceDataReference& device,
- const char* service_type,
- const char* action_name,
- PLT_ActionDesc*& action_desc);
- NPT_Result CreateAction(PLT_DeviceDataReference& device,
- const char* service_type,
- const char* action_name,
- PLT_ActionReference& action);
- NPT_Result InvokeAction(PLT_ActionReference& action, void* userdata = NULL);
-
- // events
- NPT_Result Subscribe(PLT_Service* service,
- bool cancel = false,
- void* userdata = NULL);
-
- // NPT_HttpRequestHandler methods
- virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
- // PLT_SsdpSearchResponseListener methods
- virtual NPT_Result ProcessSsdpSearchResponse(NPT_Result res,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
- // PLT_SsdpPacketListener method
- virtual NPT_Result OnSsdpPacket(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context);
-
-protected:
- virtual ~PLT_CtrlPoint();
-
- NPT_Result Start(PLT_SsdpListenTask* task);
- NPT_Result Stop(PLT_SsdpListenTask* task);
-
- NPT_Result ProcessSsdpNotify(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context);
- NPT_Result ProcessSsdpMessage(NPT_HttpMessage* message,
- const NPT_HttpRequestContext& context,
- NPT_String& uuid);
- NPT_Result ProcessGetDescriptionResponse(NPT_Result res,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response,
- PLT_DeviceDataReference& root_device);
- NPT_Result ProcessGetSCPDResponse(NPT_Result res,
- PLT_CtrlPointGetSCPDRequest* request,
- NPT_HttpResponse* response,
- PLT_DeviceDataReference& root_device);
- NPT_Result ProcessActionResponse(NPT_Result res,
- NPT_HttpResponse* response,
- PLT_ActionReference& action,
- void* userdata);
- NPT_Result ProcessSubscribeResponse(NPT_Result res,
- NPT_HttpResponse* response,
- PLT_Service* service,
- void* userdata);
- NPT_Result ProcessHttpNotify(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-private:
- // methods
- NPT_Result RenewSubscribers();
- NPT_Result RenewSubscriber(PLT_EventSubscriber& subscriber);
- NPT_Result DoHouseKeeping();
- NPT_Result FetchDeviceSCPDs(PLT_HttpClientSocketTask& task,
- PLT_DeviceDataReference& device,
- NPT_Cardinal level);
- NPT_Result FindDevice(const char* uuid, PLT_DeviceDataReference& device, bool return_root = false);
- NPT_Result AddDevice(PLT_DeviceDataReference& data);
- NPT_Result NotifyDeviceReady(PLT_DeviceDataReference& data);
- NPT_Result RemoveDevice(PLT_DeviceDataReference& data);
- NPT_Result NotifyDeviceRemoved(PLT_DeviceDataReference& data);
- NPT_Result CleanupDevice(PLT_DeviceDataReference& data);
-
- NPT_Result ParseFault(PLT_ActionReference& action, NPT_XmlElementNode* fault);
- PLT_SsdpSearchTask* CreateSearchTask(const NPT_HttpUrl& url,
- const char* target,
- NPT_Cardinal mx,
- NPT_Timeout frequency,
- const NPT_IpAddress& address);
-
-private:
- friend class NPT_Reference<PLT_CtrlPoint>;
- friend class PLT_UPnP;
- friend class PLT_UPnP_CtrlPointStartIterator;
- friend class PLT_UPnP_CtrlPointStopIterator;
- friend class PLT_EventSubscriberRemoverIterator;
- friend class PLT_CtrlPointGetDescriptionTask;
- friend class PLT_CtrlPointGetSCPDTask;
- friend class PLT_CtrlPointInvokeActionTask;
- friend class PLT_CtrlPointHouseKeepingTask;
- friend class PLT_CtrlPointSubscribeEventTask;
-
- NPT_List<NPT_String> m_UUIDsToIgnore;
- NPT_Lock<PLT_CtrlPointListenerList> m_ListenerList;
- PLT_HttpServer* m_EventHttpServer;
- NPT_HttpRequestHandler* m_EventHttpServerHandler;
- PLT_TaskManager m_TaskManager;
- NPT_Lock<NPT_List<PLT_DeviceDataReference> > m_Devices;
- NPT_Lock<NPT_List<PLT_EventSubscriber*> > m_Subscribers;
- NPT_String m_SearchCriteria;
-};
-
-typedef NPT_Reference<PLT_CtrlPoint> PLT_CtrlPointReference;
-
-#endif /* _PLT_CONTROL_POINT_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Control Point Tasks
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_CONTROL_POINT_TASK_H_
-#define _PLT_CONTROL_POINT_TASK_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttpClientTask.h"
-#include "PltDatagramStream.h"
-#include "PltDeviceData.h"
-#include "PltCtrlPoint.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_Action;
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointGetDescriptionTask class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointGetDescriptionTask : public PLT_HttpClientSocketTask
-{
-public:
- PLT_CtrlPointGetDescriptionTask(const NPT_HttpUrl& url,
- PLT_CtrlPoint* ctrl_point,
- PLT_DeviceDataReference& root_device);
- virtual ~PLT_CtrlPointGetDescriptionTask();
-
-protected:
- // PLT_HttpClientSocketTask methods
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-protected:
- PLT_CtrlPoint* m_CtrlPoint;
- PLT_DeviceDataReference m_RootDevice;
-};
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointGetSCPDRequest class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointGetSCPDRequest : public NPT_HttpRequest
-{
-public:
- PLT_CtrlPointGetSCPDRequest(const char* url,
- const char* method,
- const char* protocol) :
- NPT_HttpRequest(url, method, protocol) {}
- ~PLT_CtrlPointGetSCPDRequest() {}
-
- // members
- PLT_Service* m_Service;
-};
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointGetSCPDTask class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointGetSCPDTask : public PLT_HttpClientSocketTask
-{
-public:
- PLT_CtrlPointGetSCPDTask(PLT_CtrlPoint* ctrl_point,
- PLT_DeviceDataReference& root_device);
- virtual ~PLT_CtrlPointGetSCPDTask();
-
-protected:
- // PLT_HttpClientSocketTask methods
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-protected:
- PLT_CtrlPoint* m_CtrlPoint;
- PLT_DeviceDataReference m_RootDevice;
-};
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointInvokeActionTask class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointInvokeActionTask : public PLT_HttpClientSocketTask
-{
-public:
- PLT_CtrlPointInvokeActionTask(NPT_HttpRequest* request,
- PLT_CtrlPoint* ctrl_point,
- PLT_ActionReference& action,
- void* userdata);
- virtual ~PLT_CtrlPointInvokeActionTask();
-
-protected:
- // PLT_HttpClientSocketTask methods
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-protected:
- PLT_CtrlPoint* m_CtrlPoint;
- PLT_ActionReference m_Action;
- void* m_Userdata;
-};
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointHouseKeepingTask class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointHouseKeepingTask : public PLT_ThreadTask
-{
-public:
- PLT_CtrlPointHouseKeepingTask(PLT_CtrlPoint* ctrl_point,
- NPT_TimeInterval timer = NPT_TimeInterval(5, 0));
-
-protected:
- ~PLT_CtrlPointHouseKeepingTask() {}
-
- // PLT_ThreadTask methods
- virtual void DoRun();
-
-protected:
- PLT_CtrlPoint* m_CtrlPoint;
- NPT_TimeInterval m_Timer;
-};
-
-/*----------------------------------------------------------------------
-| PLT_CtrlPointSubscribeEventTask class
-+---------------------------------------------------------------------*/
-class PLT_CtrlPointSubscribeEventTask : public PLT_HttpClientSocketTask
-{
-public:
- PLT_CtrlPointSubscribeEventTask(NPT_HttpRequest* request,
- PLT_CtrlPoint* ctrl_point,
- PLT_DeviceDataReference &device,
- PLT_Service* service,
- void* userdata = NULL);
- virtual ~PLT_CtrlPointSubscribeEventTask();
-
-protected:
- // PLT_HttpClientSocketTask methods
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-protected:
- PLT_CtrlPoint* m_CtrlPoint;
- PLT_Service* m_Service;
- PLT_DeviceDataReference m_Device; // force to keep a reference to device owning m_Service
- void* m_Userdata;
-};
-
-#endif /* _PLT_CONTROL_POINT_TASK_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Datagram Stream
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_DATAGRAM_H_
-#define _PLT_DATAGRAM_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| PLT_InputDatagramStream
-+---------------------------------------------------------------------*/
-class PLT_InputDatagramStream : public NPT_InputStream
-{
-public:
- // methods
- PLT_InputDatagramStream(NPT_UdpSocket* socket);
- virtual ~PLT_InputDatagramStream();
-
- NPT_Result GetInfo(NPT_SocketInfo& info);
-
- // NPT_InputStream methods
- NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = 0);
-
- NPT_Result Seek(NPT_Position offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
- NPT_Result Skip(NPT_Size offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
- NPT_Result Tell(NPT_Position& offset){ NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
- NPT_Result GetSize(NPT_LargeSize& size) { NPT_COMPILER_UNUSED(size); return NPT_FAILURE; }
- NPT_Result GetAvailable(NPT_LargeSize& available) { NPT_COMPILER_UNUSED(available); return NPT_FAILURE; }
-
-protected:
- NPT_UdpSocket* m_Socket;
- NPT_SocketInfo m_Info;
-};
-
-typedef NPT_Reference<PLT_InputDatagramStream> PLT_InputDatagramStreamReference;
-
-/*----------------------------------------------------------------------
-| PLT_OutputDatagramStream
-+---------------------------------------------------------------------*/
-class PLT_OutputDatagramStream : public NPT_OutputStream
-{
-public:
- // methods
- PLT_OutputDatagramStream(NPT_UdpSocket* socket,
- NPT_Size size = 4096,
- const NPT_SocketAddress* address = NULL);
- virtual ~PLT_OutputDatagramStream();
-
- // NPT_OutputStream methods
- NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL);
- NPT_Result Flush();
-
- NPT_Result Seek(NPT_Position offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
- NPT_Result Tell(NPT_Position& offset) { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
-
-protected:
- NPT_UdpSocket* m_Socket;
- NPT_DataBuffer m_Buffer;
- NPT_SocketAddress* m_Address;
-};
-
-typedef NPT_Reference<PLT_OutputDatagramStream> PLT_OutputDatagramStreamReference;
-
-#endif /* _PLT_DATAGRAM_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Device Data
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_DEVICE_DATA_H_
-#define _PLT_DEVICE_DATA_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltConstants.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_Service;
-class PLT_DeviceData;
-
-typedef NPT_Reference<PLT_DeviceData> PLT_DeviceDataReference;
-typedef NPT_List<PLT_DeviceDataReference> PLT_DeviceDataReferenceList;
-
-/*----------------------------------------------------------------------
-| PLT_DeviceIcon class
-+---------------------------------------------------------------------*/
-class PLT_DeviceIcon
-{
-public:
- PLT_DeviceIcon(const char* mimetype = "",
- NPT_Int32 width = 0,
- NPT_Int32 height = 0,
- NPT_Int32 depth = 0,
- const char* urlpath = "") :
- m_MimeType(mimetype),
- m_Width(width),
- m_Height(height),
- m_Depth(depth),
- m_UrlPath(urlpath) {}
- virtual ~PLT_DeviceIcon() {}
-
- NPT_String m_MimeType;
- NPT_Int32 m_Width;
- NPT_Int32 m_Height;
- NPT_Int32 m_Depth;
- NPT_String m_UrlPath;
-};
-
-/*----------------------------------------------------------------------
-| PLT_DeviceData class
-+---------------------------------------------------------------------*/
-class PLT_DeviceData
-{
-public:
- PLT_DeviceData(
- NPT_HttpUrl description_url = NPT_HttpUrl(NULL, 0, "/"),
- const char* uuid = "",
- NPT_TimeInterval lease_time = PLT_Constants::GetInstance().m_DefaultDeviceLease,
- const char* device_type = "",
- const char* friendly_name = "");
-
- /* Getters */
- virtual NPT_Result GetDescription(NPT_String& desc);
- virtual NPT_String GetDescriptionUrl(const char* bind_addr = NULL);
- virtual NPT_HttpUrl GetURLBase();
- virtual NPT_HttpUrl NormalizeURL(const NPT_String& url);
- virtual NPT_Result GetDescription(NPT_XmlElementNode* parent, NPT_XmlElementNode** device = NULL);
- virtual NPT_String GetIconUrl(const char* mimetype = NULL, NPT_Int32 maxsize = 0, NPT_Int32 maxdepth = 0);
-
- const NPT_TimeInterval& GetLeaseTime() const { return m_LeaseTime; }
- const NPT_String& GetUUID() const { return m_UUID; }
- const NPT_String& GetFriendlyName() const { return m_FriendlyName; }
- const NPT_String& GetType() const { return m_DeviceType; }
- const NPT_String& GetModelDescription() const { return m_ModelDescription; }
- const NPT_String& GetParentUUID() const { return m_ParentUUID; }
- bool IsRoot() { return m_ParentUUID.IsEmpty(); }
-
- const NPT_Array<PLT_Service*>& GetServices() const { return m_Services; }
- const NPT_Array<PLT_DeviceDataReference>& GetEmbeddedDevices() const { return m_EmbeddedDevices; }
-
- NPT_Result FindEmbeddedDevice(const char* uuid, PLT_DeviceDataReference& device);
- NPT_Result FindEmbeddedDeviceByType(const char* type, PLT_DeviceDataReference& device);
- NPT_Result FindServiceById(const char* id, PLT_Service*& service);
- NPT_Result FindServiceByType(const char* type, PLT_Service*& service);
- NPT_Result FindServiceBySCPDURL(const char* url, PLT_Service*& service);
- NPT_Result FindServiceByControlURL(const char* url, PLT_Service*& service, bool recursive = false);
- NPT_Result FindServiceByEventSubURL(const char* url, PLT_Service*& service, bool recursive = false);
-
- /* called by PLT_Device subclasses */
- NPT_Result AddEmbeddedDevice(PLT_DeviceDataReference& device);
- NPT_Result RemoveEmbeddedDevice(PLT_DeviceDataReference& device);
- NPT_Result AddService(PLT_Service* service);
-
- operator const char* ();
-
-protected:
- virtual ~PLT_DeviceData();
- virtual void Cleanup();
- virtual NPT_Result OnAddExtraInfo(NPT_XmlElementNode* /*device_node*/) { return NPT_SUCCESS; }
-
-private:
- /* called by PLT_CtrlPoint when new device is discovered */
- NPT_Result SetURLBase(NPT_HttpUrl& url_base);
- NPT_TimeStamp GetLeaseTimeLastUpdate();
- NPT_Result SetLeaseTime(NPT_TimeInterval lease_time);
- NPT_Result SetDescription(const char* szDescription,
- const NPT_IpAddress& local_iface_ip);
- NPT_Result SetDescriptionDevice(NPT_XmlElementNode* device_node);
-
-public:
- NPT_String m_Manufacturer;
- NPT_String m_ManufacturerURL;
- NPT_String m_ModelDescription;
- NPT_String m_ModelName;
- NPT_String m_ModelNumber;
- NPT_String m_ModelURL;
- NPT_String m_SerialNumber;
- NPT_String m_UPC;
- NPT_String m_PresentationURL;
- NPT_String m_DlnaDoc;
- NPT_String m_DlnaCap;
- NPT_String m_AggregationFlags;
-
-protected:
- friend class NPT_Reference<PLT_DeviceData>;
- friend class PLT_CtrlPoint;
- friend class PLT_DeviceReadyIterator;
- friend class PLT_DeviceHost;
-
- //members
- NPT_String m_ParentUUID;
- NPT_String m_UUID;
- NPT_HttpUrl m_URLDescription;
- NPT_HttpUrl m_URLBase;
- NPT_String m_DeviceType;
- NPT_String m_FriendlyName;
- NPT_TimeInterval m_LeaseTime;
- NPT_TimeStamp m_LeaseTimeLastUpdate;
- NPT_Array<PLT_Service*> m_Services;
- NPT_Array<PLT_DeviceDataReference> m_EmbeddedDevices;
- NPT_Array<PLT_DeviceIcon> m_Icons;
-
- /* IP address of interface used when retrieving device description.
- We need the info for the control point subscription callback */
- NPT_IpAddress m_LocalIfaceIp;
- NPT_String m_Representation;
-};
-
-/*----------------------------------------------------------------------
-| PLT_DeviceDataFinder
-+---------------------------------------------------------------------*/
-class PLT_DeviceDataFinder
-{
-public:
- // methods
- PLT_DeviceDataFinder(const char* uuid) : m_UUID(uuid) {}
- virtual ~PLT_DeviceDataFinder() {}
-
- bool operator()(const PLT_DeviceDataReference& data) const {
- return data->GetUUID().Compare(m_UUID, true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_UUID;
-};
-
-/*----------------------------------------------------------------------
-| PLT_DeviceDataFinderByType
-+---------------------------------------------------------------------*/
-class PLT_DeviceDataFinderByType
-{
-public:
- // methods
- PLT_DeviceDataFinderByType(const char* type) : m_Type(type) {}
- virtual ~PLT_DeviceDataFinderByType() {}
-
- bool operator()(const PLT_DeviceDataReference& data) const {
- return data->GetType().Compare(m_Type, true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_Type;
-};
-
-#endif /* _PLT_DEVICE_DATA_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Device Host
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_DEVICE_HOST_H_
-#define _PLT_DEVICE_HOST_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltDeviceData.h"
-#include "PltHttpServerListener.h"
-#include "PltSsdpListener.h"
-#include "PltTaskManager.h"
-#include "PltAction.h"
-#include "PltHttp.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_HttpServer;
-class PLT_HttpServerHandler;
-class PLT_SsdpDeviceAnnounceTask;
-class PLT_SsdpListenTask;
-
-/*----------------------------------------------------------------------
-| PLT_DeviceHost class
-+---------------------------------------------------------------------*/
-class PLT_DeviceHost : public PLT_DeviceData,
- public PLT_SsdpPacketListener
-{
-public:
- PLT_DeviceHost(const char* description_path = "/",
- const char* uuid = "",
- const char* device_type = "",
- const char* friendly_name = "",
- bool show_ip = false,
- NPT_UInt16 port = 0,
- bool port_rebind = false);
-
- // public methods
- virtual void SetBroadcast(bool broadcast) { m_Broadcast = broadcast; }
- virtual NPT_UInt16 GetPort() { return m_Port; };
-
- // NPT_HttpRequestHandler forward for control/event requests
- virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
- // PLT_SsdpDeviceAnnounceTask & PLT_SsdpDeviceAnnounceUnicastTask
- virtual NPT_Result Announce(PLT_DeviceData* device,
- NPT_HttpRequest& request,
- NPT_UdpSocket& socket,
- bool byebye);
-
- virtual NPT_Result Announce(NPT_HttpRequest& request,
- NPT_UdpSocket& socket,
- bool byebye) {
- return Announce(this, request, socket, byebye);
- }
-
- // PLT_SsdpPacketListener method
- virtual NPT_Result OnSsdpPacket(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context);
-
- // PLT_SsdpDeviceSearchListenTask
- virtual NPT_Result ProcessSsdpSearchRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context);
-
- // PLT_SsdpDeviceSearchResponseTask
- virtual NPT_Result SendSsdpSearchResponse(PLT_DeviceData* device,
- NPT_HttpResponse& response,
- NPT_UdpSocket& socket,
- const char* st,
- const NPT_SocketAddress* addr = NULL);
- virtual NPT_Result SendSsdpSearchResponse(NPT_HttpResponse& response,
- NPT_UdpSocket& socket,
- const char* ST,
- const NPT_SocketAddress* addr = NULL) {
- return SendSsdpSearchResponse(this, response, socket, ST, addr);
- }
-
-protected:
- virtual ~PLT_DeviceHost();
-
- // pure methods
- virtual NPT_Result SetupServices(PLT_DeviceData& data) = 0;
-
- // setup methods
- virtual NPT_Result SetupIcons();
- virtual NPT_Result SetupDevice();
-
- // overridable methods
- virtual NPT_Result AddIcon(const PLT_DeviceIcon& icon,
- const char* filepath);
- virtual NPT_Result AddIcon(const PLT_DeviceIcon& icon,
- const void* data,
- NPT_Size size,
- bool copy = true);
- virtual NPT_Result Start(PLT_SsdpListenTask* task);
- virtual NPT_Result Stop(PLT_SsdpListenTask* task);
- virtual NPT_Result SetupServiceSCPDHandler(PLT_Service* service);
- virtual NPT_Result OnAction(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
- virtual NPT_Result ProcessHttpGetRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
- virtual NPT_Result ProcessHttpPostRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
- virtual NPT_Result ProcessHttpSubscriberRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
-protected:
- friend class PLT_UPnP;
- friend class PLT_UPnP_DeviceStartIterator;
- friend class PLT_UPnP_DeviceStopIterator;
- friend class PLT_Service;
- friend class NPT_Reference<PLT_DeviceHost>;
-
-private:
- PLT_TaskManager m_TaskManager;
- PLT_HttpServer* m_HttpServer;
- bool m_Broadcast;
- NPT_UInt16 m_Port;
- bool m_PortRebind;
- NPT_List<NPT_HttpRequestHandler*> m_RequestHandlers;
-};
-
-typedef NPT_Reference<PLT_DeviceHost> PLT_DeviceHostReference;
-
-#endif /* _PLT_DEVICE_HOST_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - DIDL handling
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_DIDL_H_
-#define _PLT_DIDL_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltMediaItem.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define PLT_FILTER_MASK_ALL 0xFFFFFFFF
-
-#define PLT_FILTER_MASK_CREATOR 0x00000001
-#define PLT_FILTER_MASK_ARTIST 0x00000002
-#define PLT_FILTER_MASK_ALBUM 0x00000004
-#define PLT_FILTER_MASK_GENRE 0x00000008
-#define PLT_FILTER_MASK_ALBUMARTURI 0x00000010
-#define PLT_FILTER_MASK_DESCRIPTION 0x00000020
-#define PLT_FILTER_MASK_SEARCHABLE 0x00000040
-#define PLT_FILTER_MASK_CHILDCOUNT 0x00000080
-#define PLT_FILTER_MASK_ORIGINALTRACK 0x00000100
-#define PLT_FILTER_MASK_ACTOR 0x00000200
-#define PLT_FILTER_MASK_AUTHOR 0x00000400
-#define PLT_FILTER_MASK_DATE 0x00000800
-
-#define PLT_FILTER_MASK_RES 0x00010000
-#define PLT_FILTER_MASK_RES_DURATION 0x00020000
-#define PLT_FILTER_MASK_RES_SIZE 0x00040000
-#define PLT_FILTER_MASK_RES_PROTECTION 0x00080000
-#define PLT_FILTER_MASK_RES_RESOLUTION 0x00100000
-#define PLT_FILTER_MASK_RES_BITRATE 0x00200000
-#define PLT_FILTER_MASK_RES_BITSPERSAMPLE 0x00400000
-#define PLT_FILTER_MASK_RES_NRAUDIOCHANNELS 0x00800000
-#define PLT_FILTER_MASK_RES_SAMPLEFREQUENCY 0x01000000
-
-#define PLT_FILTER_MASK_TOC 0x02000000
-
-#define PLT_FILTER_FIELD_CREATOR "dc:creator"
-#define PLT_FILTER_FIELD_DATE "dc:date"
-#define PLT_FILTER_FIELD_ARTIST "upnp:artist"
-#define PLT_FILTER_FIELD_ACTOR "upnp:actor"
-#define PLT_FILTER_FIELD_AUTHOR "upnp:author"
-#define PLT_FILTER_FIELD_ALBUM "upnp:album"
-#define PLT_FILTER_FIELD_GENRE "upnp:genre"
-#define PLT_FILTER_FIELD_ALBUMARTURI "upnp:albumArtURI"
-#define PLT_FILTER_FIELD_DESCRIPTION "upnp:longDescription"
-#define PLT_FILTER_FIELD_ORIGINALTRACK "upnp:originalTrackNumber"
-#define PLT_FILTER_FIELD_SEARCHABLE "@searchable"
-#define PLT_FILTER_FIELD_CHILDCOUNT "@childcount"
-#define PLT_FILTER_FIELD_CONTAINER_CHILDCOUNT "container@childCount"
-#define PLT_FILTER_FIELD_CONTAINER_SEARCHABLE "container@searchable"
-
-#define PLT_FILTER_FIELD_RES "res"
-#define PLT_FILTER_FIELD_RES_DURATION "res@duration"
-#define PLT_FILTER_FIELD_RES_SIZE "res@size"
-#define PLT_FILTER_FIELD_RES_PROTECTION "res@protection"
-#define PLT_FILTER_FIELD_RES_RESOLUTION "res@resolution"
-#define PLT_FILTER_FIELD_RES_BITRATE "res@bitrate"
-#define PLT_FILTER_FIELD_RES_BITSPERSAMPLE "res@bitsPerSample"
-#define PLT_FILTER_FIELD_RES_NRAUDIOCHANNELS "res@nrAudioChannels"
-#define PLT_FILTER_FIELD_RES_SAMPLEFREQUENCY "res@sampleFrequency"
-
-extern const char* didl_header;
-extern const char* didl_footer;
-extern const char* didl_namespace_dc;
-extern const char* didl_namespace_upnp;
-
-/*----------------------------------------------------------------------
-| PLT_Didl class
-+---------------------------------------------------------------------*/
-class PLT_Didl
-{
-public:
- static NPT_Result ToDidl(PLT_MediaObject& object,
- NPT_String filter,
- NPT_String& didl);
- static NPT_Result FromDidl(const char* didl,
- PLT_MediaObjectListReference& objects);
-
- static void AppendXmlEscape(NPT_String& out, const char* in);
- static void AppendXmlUnEscape(NPT_String& out, const char* in);
- static NPT_Result ParseTimeStamp(NPT_String timestamp, NPT_UInt32& seconds);
- static void FormatTimeStamp(NPT_String& out, NPT_UInt32 seconds);
-
- static NPT_Result ParseTimeStamp(NPT_String in, NPT_TimeStamp& timestamp) {
- NPT_UInt32 seconds;
- NPT_Result res = ParseTimeStamp(in, seconds);
- timestamp = NPT_TimeStamp(seconds, 0);
- return res;
- }
-
- static NPT_UInt32 ConvertFilterToMask(NPT_String filter);
-};
-
-#endif /* _PLT_DIDL_H_ */
+++ /dev/null
-/*****************************************************************
-|
-||
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_DOWNLOADER_H_
-#define _PLT_DOWNLOADER_H_
-
-/*----------------------------------------------------------------------
-| Includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttpClientTask.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_Downloader;
-
-/*----------------------------------------------------------------------
-| types
-+---------------------------------------------------------------------*/
-typedef PLT_HttpClientTask<PLT_Downloader> PLT_HttpDownloadTask;
-
-typedef enum {
- PLT_DOWNLOADER_IDLE,
- PLT_DOWNLOADER_STARTED,
- PLT_DOWNLOADER_DOWNLOADING,
- PLT_DOWNLOADER_ERROR,
- PLT_DOWNLOADER_SUCCESS
-} Plt_DowloaderState;
-
-/*----------------------------------------------------------------------
-| PLT_Downloader class
-+---------------------------------------------------------------------*/
-class PLT_Downloader
-{
-public:
- PLT_Downloader(PLT_TaskManager* task_manager,
- const char* url,
- NPT_OutputStreamReference& output);
- virtual ~PLT_Downloader();
-
- NPT_Result Start();
- NPT_Result Stop();
- Plt_DowloaderState GetState() { return m_State; }
-
- // PLT_HttpClientTask method
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-
-private:
- // members
- NPT_String m_URL;
- NPT_OutputStreamReference m_Output;
- PLT_TaskManager* m_TaskManager;
- PLT_HttpDownloadTask* m_Task;
- Plt_DowloaderState m_State;
-};
-
-#endif /* _PLT_DOWNLOADER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Event
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_EVENT_H_
-#define _PLT_EVENT_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttpClientTask.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_StateVariable;
-class PLT_DeviceData;
-class PLT_Service;
-class PLT_TaskManager;
-class PLT_CtrlPoint;
-
-/*----------------------------------------------------------------------
-| PLT_EventSubscriber class
-+---------------------------------------------------------------------*/
-class PLT_EventSubscriber
-{
-public:
- PLT_EventSubscriber(PLT_TaskManager* task_manager,
- PLT_Service* service,
- const char* sid,
- int timeout = -1);
- ~PLT_EventSubscriber();
-
- PLT_Service* GetService();
- NPT_Ordinal GetEventKey();
- NPT_Result SetEventKey(NPT_Ordinal value);
- NPT_SocketAddress GetLocalIf();
- NPT_Result SetLocalIf(NPT_SocketAddress value);
- NPT_TimeStamp GetExpirationTime();
- NPT_Result SetTimeout(NPT_Cardinal timeout);
- const NPT_String& GetSID() const { return m_SID; }
- NPT_Result FindCallbackURL(const char* callback_url);
- NPT_Result AddCallbackURL(const char* callback_url);
- NPT_Result Notify(NPT_List<PLT_StateVariable*>& vars);
-
-protected:
- //members
- PLT_TaskManager* m_TaskManager;
- PLT_Service* m_Service;
- NPT_Ordinal m_EventKey;
- PLT_HttpClientSocketTask* m_SubscriberTask;
- NPT_String m_SID;
- NPT_SocketAddress m_LocalIf;
- NPT_Array<NPT_String> m_CallbackURLs;
- NPT_TimeStamp m_ExpirationTime;
-};
-
-/*----------------------------------------------------------------------
-| PLT_EventSubscriberFinderBySID
-+---------------------------------------------------------------------*/
-class PLT_EventSubscriberFinderBySID
-{
-public:
- // methods
- PLT_EventSubscriberFinderBySID(const char* sid) : m_SID(sid) {}
-
- bool operator()(PLT_EventSubscriber* const & sub) const {
- return m_SID.Compare(sub->GetSID(), true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_SID;
-};
-
-/*----------------------------------------------------------------------
-| PLT_EventSubscriberFinderByCallbackURL
-+---------------------------------------------------------------------*/
-class PLT_EventSubscriberFinderByCallbackURL
-{
-public:
- // methods
- PLT_EventSubscriberFinderByCallbackURL(const char* callback_url) :
- m_CallbackURL(callback_url) {}
-
- bool operator()(PLT_EventSubscriber* const & sub) const {
- return NPT_SUCCEEDED(sub->FindCallbackURL(m_CallbackURL));
- }
-
-private:
- // members
- NPT_String m_CallbackURL;
-};
-
-/*----------------------------------------------------------------------
-| PLT_EventSubscriberFinderByService
-+---------------------------------------------------------------------*/
-class PLT_EventSubscriberFinderByService
-{
-public:
- // methods
- PLT_EventSubscriberFinderByService(PLT_Service* service) : m_Service(service) {}
- virtual ~PLT_EventSubscriberFinderByService() {}
- bool operator()(PLT_EventSubscriber* const & eventSub) const;
-
-private:
- // members
- PLT_Service* m_Service;
-};
-
-#endif /* _PLT_EVENT_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - File Media Server
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_FILE_MEDIA_SERVER_H_
-#define _PLT_FILE_MEDIA_SERVER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltMediaServer.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define MAX_PATH_LENGTH 1024
-#define ALBUMART_QUERY "aa"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_MetadataHandler;
-
-/*----------------------------------------------------------------------
-| PLT_FileMediaServer class
-+---------------------------------------------------------------------*/
-class PLT_FileMediaServer : public PLT_MediaServer
-{
-public:
- // class methods
- static NPT_String BuildSafeResourceUri(const NPT_HttpUrl& base_uri,
- const char* host,
- const char* file_path);
-
- // constructor
- PLT_FileMediaServer(const char* path,
- const char* friendly_name,
- bool show_ip = false,
- const char* uuid = NULL,
- NPT_UInt16 port = 0,
- bool port_rebind = false);
-
- // overridable
- virtual NPT_Result AddMetadataHandler(PLT_MetadataHandler* handler);
- virtual NPT_Result ExtractResourcePath(const NPT_HttpUrl& url, NPT_String& file_path);
- virtual NPT_String BuildResourceUri(const NPT_HttpUrl& base_uri, const char* host, const char* file_path);
-
-protected:
- virtual ~PLT_FileMediaServer();
-
- // overridable
- virtual NPT_Result ProcessFileRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
- // PLT_DeviceHost methods
- virtual NPT_Result SetupDevice();
- virtual NPT_Result ProcessHttpGetRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
- virtual NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
- // PLT_MediaServer methods
- virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action,
- const char* object_id,
- const char* filter,
- NPT_UInt32 starting_index,
- NPT_UInt32 requested_count,
- const NPT_List<NPT_String>& sort_criteria,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action,
- const char* object_id,
- const char* filter,
- NPT_UInt32 starting_index,
- NPT_UInt32 requested_count,
- const NPT_List<NPT_String>& sort_criteria,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnSearchContainer(PLT_ActionReference& action,
- const char* object_id,
- const char* search_criteria,
- const char* filter,
- NPT_UInt32 starting_index,
- NPT_UInt32 requested_count,
- const NPT_List<NPT_String>& sort_criteria,
- const PLT_HttpRequestContext& context);
-
- virtual NPT_Result ServeFile(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response,
- const NPT_String& file_path);
- virtual NPT_Result OnAlbumArtRequest(NPT_HttpResponse& response,
- NPT_String file_path);
- virtual NPT_Result GetFilePath(const char* object_id, NPT_String& filepath);
- virtual bool ProcessFile(const NPT_String&) { return true;}
- virtual PLT_MediaObject* BuildFromFilePath(const NPT_String& filepath,
- const PLT_HttpRequestContext& context,
- bool with_count = true,
- bool keep_extension_in_title = false);
-
-public:
- NPT_UInt16 m_FileServerPort;
-
-protected:
- friend class PLT_MediaItem;
-
- NPT_String m_Path;
- NPT_HttpUrl m_FileBaseUri;
- NPT_HttpUrl m_AlbumArtBaseUri;
- NPT_List<PLT_MetadataHandler*> m_MetadataHandlers;
- bool m_FilterUnknownOut;
-};
-
-#endif /* _PLT_FILE_MEDIA_SERVER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - HTTP Helper
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_HTTP_H_
-#define _PLT_HTTP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| PLT_HttpHelper
-+---------------------------------------------------------------------*/
-class PLT_HttpHelper {
- public:
- static bool IsConnectionKeepAlive(NPT_HttpMessage& message);
- static bool IsBodyStreamSeekable(NPT_HttpMessage& message);
-
- static NPT_Result ToLog(NPT_LoggerReference logger, int level, NPT_HttpRequest* request);
- static NPT_Result ToLog(NPT_LoggerReference logger, int level, NPT_HttpResponse* response);
-
- static NPT_Result GetContentType(NPT_HttpMessage& message, NPT_String& type);
- static void SetContentType(NPT_HttpMessage& message, const char* type);
- static NPT_Result GetContentLength(NPT_HttpMessage& message, NPT_LargeSize& len);
- static void SetContentLength(NPT_HttpMessage& message, NPT_LargeSize len);
-
- static NPT_Result GetHost(NPT_HttpRequest& request, NPT_String& value);
- static void SetHost(NPT_HttpRequest& request, const char* host);
- static NPT_Result GetRange(NPT_HttpRequest& request, NPT_Position& start, NPT_Position& end);
- static void SetRange(NPT_HttpRequest& request, NPT_Position start, NPT_Position end = (NPT_Position)-1);
-
- static NPT_Result GetContentRange(NPT_HttpResponse& response, NPT_Position& start, NPT_Position& end, NPT_LargeSize& length);
- static NPT_Result SetContentRange(NPT_HttpResponse& response, NPT_Position start, NPT_Position end, NPT_LargeSize length);
-
- static NPT_Result SetBody(NPT_HttpMessage& message, NPT_String& body);
- static NPT_Result SetBody(NPT_HttpMessage& message, const char* body, NPT_Size len);
- static NPT_Result SetBody(NPT_HttpMessage& message, NPT_InputStreamReference& stream, NPT_LargeSize len = 0);
-
-
- static NPT_Result GetBody(NPT_HttpMessage& message, NPT_String& body);
- static NPT_Result ParseBody(NPT_HttpMessage& message, NPT_XmlElementNode*& xml);
-
- static NPT_Result Connect(NPT_Socket& connection,
- NPT_HttpRequest& request,
- NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
- static void SetBasicAuthorization(NPT_HttpRequest& request, const char* login, const char* password);
-};
-
-/*----------------------------------------------------------------------
-| PLT_HttpRequestContext
-+---------------------------------------------------------------------*/
-class PLT_HttpRequestContext : public NPT_HttpRequestContext {
-public:
- // constructors and destructor
- PLT_HttpRequestContext(NPT_HttpRequest& request) :
- m_Request(request) {}
- PLT_HttpRequestContext(NPT_HttpRequest& request, const NPT_HttpRequestContext& context) :
- NPT_HttpRequestContext(&context.GetLocalAddress(), &context.GetRemoteAddress()),
- m_Request(request) {}
- virtual ~PLT_HttpRequestContext() {}
-
- NPT_HttpRequest& GetRequest() const { return m_Request; }
-
-private:
- NPT_HttpRequest& m_Request;
-};
-
-/*----------------------------------------------------------------------
-| macros
-+---------------------------------------------------------------------*/
-#if defined(NPT_CONFIG_ENABLE_LOGGING)
-#define PLT_LOG_HTTP_MESSAGE_L(_logger, _level, _msg) \
- PLT_HttpHelper::ToLog((_logger), (_level), (_msg))
-#define PLT_LOG_HTTP_MESSAGE(_level, _msg) \
- PLT_HttpHelper::ToLog((_NPT_LocalLogger), (_level), (_msg))
-
-#else /* NPT_CONFIG_ENABLE_LOGGING */
-#define PLT_LOG_HTTP_MESSAGE_L(_logger, _level, _msg)
-#define PLT_LOG_HTTP_MESSAGE(_level, _msg)
-#endif /* NPT_CONFIG_ENABLE_LOGGING */
-
-/*----------------------------------------------------------------------
-| PLT_HttpRequestHandler
-+---------------------------------------------------------------------*/
-template <class T>
-class PLT_HttpRequestHandler : public NPT_HttpRequestHandler
-{
-public:
- PLT_HttpRequestHandler<T>(T* data) : m_Data(data) {}
- virtual ~PLT_HttpRequestHandler<T>() {}
-
- // NPT_HttpRequestHandler methods
- NPT_Result SetupResponse(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response) {
- return m_Data->ProcessHttpRequest(request, context, response);
- }
-
-private:
- T* m_Data;
-};
-
-
-#endif /* _PLT_HTTP_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - HTTP Client Tasks
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_HTTP_CLIENT_TASK_H_
-#define _PLT_HTTP_CLIENT_TASK_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttp.h"
-#include "PltThreadTask.h"
-
-/*----------------------------------------------------------------------
-| PLT_HttpTcpConnector
-+---------------------------------------------------------------------*/
-class PLT_HttpTcpConnector : public NPT_HttpClient::Connector
-{
-public:
- PLT_HttpTcpConnector();
- virtual ~PLT_HttpTcpConnector();
- virtual NPT_Result Connect(const char* hostname,
- NPT_UInt16 port,
- NPT_Timeout connection_timeout,
- NPT_Timeout io_timeout,
- NPT_Timeout name_resolver_timeout,
- NPT_InputStreamReference& input_stream,
- NPT_OutputStreamReference& output_stream);
-
-public:
- void GetInfo(NPT_SocketInfo& info) { info = m_SocketInfo;}
- void Abort() { if (!m_Socket.IsNull()) m_Socket->Disconnect(); }
-
-private:
- NPT_String m_HostName;
- NPT_UInt16 m_Port;
- NPT_InputStreamReference m_InputStream;
- NPT_OutputStreamReference m_OutputStream;
- NPT_SocketInfo m_SocketInfo;
- NPT_Reference<NPT_Socket> m_Socket;
-};
-
-/*----------------------------------------------------------------------
-| PLT_HttpClientSocketTask class
-+---------------------------------------------------------------------*/
-class PLT_HttpClientSocketTask : public PLT_ThreadTask
-{
-friend class PLT_ThreadTask;
-
-public:
- PLT_HttpClientSocketTask(NPT_HttpRequest* request = NULL,
- bool wait_forever = false);
-
- virtual NPT_Result AddRequest(NPT_HttpRequest* request);
-
-protected:
- virtual ~PLT_HttpClientSocketTask();
-
-protected:
- virtual NPT_Result SetConnector(PLT_HttpTcpConnector* connector);
-
- // PLT_ThreadTask methods
- virtual void DoAbort();
- virtual void DoRun();
-
- virtual NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-private:
- NPT_Result GetNextRequest(NPT_HttpRequest*& request, NPT_Timeout timeout);
-
-protected:
- NPT_HttpClient m_Client;
- bool m_WaitForever;
- NPT_Queue<NPT_HttpRequest> m_Requests;
- NPT_Mutex m_ConnectorLock;
- PLT_HttpTcpConnector* m_Connector;
-};
-
-/*----------------------------------------------------------------------
-| PLT_HttpClientTask class
-+---------------------------------------------------------------------*/
-template <class T>
-class PLT_HttpClientTask : public PLT_HttpClientSocketTask
-{
-public:
- PLT_HttpClientTask<T>(const NPT_HttpUrl& url, T* data) :
- PLT_HttpClientSocketTask(new NPT_HttpRequest(url, "GET", NPT_HTTP_PROTOCOL_1_1)),
- m_Data(data) {}
- protected:
- virtual ~PLT_HttpClientTask<T>() {}
-
-protected:
- // PLT_HttpClientSocketTask method
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response) {
- return m_Data->ProcessResponse(res, request, context, response);
- }
-
-protected:
- T* m_Data;
-};
-
-/*----------------------------------------------------------------------
-| PLT_FileHttpClientTask class
-+---------------------------------------------------------------------*/
-class PLT_FileHttpClientTask : public PLT_HttpClientSocketTask
-{
-public:
- PLT_FileHttpClientTask(const NPT_HttpUrl& url) :
- PLT_HttpClientSocketTask(new NPT_HttpRequest(url, "GET", NPT_HTTP_PROTOCOL_1_1)) {}
-
-protected:
- virtual ~PLT_FileHttpClientTask() {}
-
-protected:
- // PLT_HttpClientSocketTask method
- NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-};
-
-#endif /* _PLT_HTTP_CLIENT_TASK_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - HTTP Server
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_HTTP_SERVER_H_
-#define _PLT_HTTP_SERVER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttpServerListener.h"
-#include "PltHttpServerTask.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_HttpServerStartIterator;
-
-/*----------------------------------------------------------------------
-| PLT_HttpServer class
-+---------------------------------------------------------------------*/
-class PLT_HttpServer : public PLT_HttpServerListener,
- public NPT_HttpServer
-{
- friend class PLT_HttpServerTask<class PLT_HttpServer>;
- friend class PLT_HttpServerStartIterator;
-
-public:
- PLT_HttpServer(unsigned int port = 0,
- bool port_rebind = false,
- NPT_Cardinal max_clients = 0,
- bool reuse_address = false);
- virtual ~PLT_HttpServer();
-
- // PLT_HttpServerListener method
- virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse*& response,
- bool& headers_only);
-
- virtual NPT_Result Start();
- virtual NPT_Result Stop();
- virtual unsigned int GetPort() { return m_Port; }
-
-private:
- PLT_TaskManager* m_TaskManager;
- unsigned int m_Port;
- bool m_PortRebind;
- bool m_ReuseAddress;
- PLT_HttpServerListenTask* m_HttpListenTask;
-};
-
-/*----------------------------------------------------------------------
-| PLT_FileServer class
-+---------------------------------------------------------------------*/
-class PLT_FileServer
-{
-public:
- // class methods
- static NPT_Result ServeFile(NPT_HttpResponse& response,
- NPT_String file_path,
- NPT_Position start = (NPT_Position)-1,
- NPT_Position end = (NPT_Position)-1,
- bool request_is_head = false);
- static const char* GetMimeType(const NPT_String& filename);
-};
-
-#endif /* _PLT_HTTP_SERVER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - HTTP Server Listener
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-#ifndef _PLT_HTTP_SERVER_LISTENER_H_
-#define _PLT_HTTP_SERVER_LISTENER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| PLT_HttpServerListener Interface
-+---------------------------------------------------------------------*/
-class PLT_HttpServerListener
-{
- public:
- virtual ~PLT_HttpServerListener() {}
-
- virtual NPT_Result ProcessHttpRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse*& response,
- bool& headers_only) = 0;
-};
-
-#endif /* _PLT_HTTP_SERVER_LISTENER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - HTTP Server Tasks
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_HTTP_SERVER_TASK_H_
-#define _PLT_HTTP_SERVER_TASK_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttp.h"
-#include "PltDatagramStream.h"
-#include "PltThreadTask.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-template <class T> class PLT_HttpListenTask;
-class PLT_HttpServerListener;
-typedef PLT_HttpListenTask<PLT_HttpServerListener> PLT_HttpServerListenTask;
-
-/*----------------------------------------------------------------------
-| PLT_HttpServerSocketTask class
-+---------------------------------------------------------------------*/
-class PLT_HttpServerSocketTask : public PLT_ThreadTask
-{
- friend class PLT_ThreadTask;
-
-public:
- PLT_HttpServerSocketTask(NPT_Socket* socket, bool stay_alive_forever = false);
-
-protected:
- virtual ~PLT_HttpServerSocketTask();
-
-protected:
- // Request callback handler
- virtual NPT_Result ProcessRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse*& response,
- bool& headers_only) = 0;
-
- // overridables
- virtual NPT_Result GetInputStream(NPT_InputStreamReference& stream);
- virtual NPT_Result GetInfo(NPT_SocketInfo& info);
-
- // PLT_ThreadTask methods
- virtual void DoAbort() { m_Socket->Disconnect(); }
- virtual void DoRun();
-
-private:
- virtual NPT_Result Read(NPT_BufferedInputStreamReference& buffered_input_stream,
- NPT_HttpRequest*& request,
- NPT_HttpRequestContext* context = NULL);
- virtual NPT_Result Write(NPT_HttpResponse* response,
- bool& keep_alive,
- bool headers_only = false);
-
-protected:
- NPT_Socket* m_Socket;
- bool m_StayAliveForever;
-};
-
-/*----------------------------------------------------------------------
-| PLT_HttpServerTask class
-+---------------------------------------------------------------------*/
-template <class T>
-class PLT_HttpServerTask : public PLT_HttpServerSocketTask
-{
-public:
- PLT_HttpServerTask<T>(T* data,
- NPT_Socket* socket,
- bool keep_alive = false) :
- PLT_HttpServerSocketTask(socket, keep_alive), m_Data(data) {}
-
-protected:
- virtual ~PLT_HttpServerTask<T>() {}
-
-protected:
- NPT_Result ProcessRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse*& response,
- bool& headers_only) {
- return m_Data->ProcessHttpRequest(request, context, response, headers_only);
- }
-
-protected:
- T* m_Data;
-};
-
-/*----------------------------------------------------------------------
-| PLT_HttpListenTask class
-+---------------------------------------------------------------------*/
-template <class T>
-class PLT_HttpListenTask : public PLT_ThreadTask
-{
-public:
- PLT_HttpListenTask<T>(T* data, NPT_TcpServerSocket* socket, bool cleanup_socket = true) :
- m_Data(data), m_Socket(socket), m_CleanupSocket(cleanup_socket) {}
-
-protected:
- virtual ~PLT_HttpListenTask<T>() {
- if (m_CleanupSocket) delete m_Socket;
- }
-
-protected:
- // PLT_ThreadTask methods
- virtual void DoAbort() { m_Socket->Disconnect(); }
- virtual void DoRun() {
- while (!IsAborting(0)) {
- NPT_Socket* client = NULL;
- NPT_Result result = m_Socket->WaitForNewClient(client, 5000);
- if (NPT_FAILED(result) && result != NPT_ERROR_TIMEOUT) {
- if (client) delete client;
- //NPT_LOG_WARNING_2("PLT_HttpListenTask exiting with %d (%s)", result, NPT_ResultText(result));
- break;
- }
-
- if (NPT_SUCCEEDED(result)) {
- PLT_ThreadTask* task = new PLT_HttpServerTask<T>(m_Data, client);
- if (NPT_FAILED(m_TaskManager->StartTask(task))) {
- task->Kill();
- }
- }
- }
- }
-
-protected:
- T* m_Data;
- NPT_TcpServerSocket* m_Socket;
- bool m_CleanupSocket;
-};
-
-#endif /* _PLT_HTTP_SERVER_TASK_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Leaks
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_LEAKS_H_
-#define _PLT_LEAKS_H_
-
-/*----------------------------------------------------------------------
-| functions
-+---------------------------------------------------------------------*/
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-void PLT_Leak_Enable(void);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* _PLT_LEAKS_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Browser (Media Server Control Point)
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_BROWSER_H_
-#define _PLT_MEDIA_BROWSER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltCtrlPoint.h"
-#include "PltMediaItem.h"
-
-/*----------------------------------------------------------------------
-| PLT_BrowseInfo
-+---------------------------------------------------------------------*/
-struct PLT_BrowseInfo {
- NPT_String object_id;
- PLT_MediaObjectListReference items;
- NPT_UInt32 nr;
- NPT_UInt32 tm;
- NPT_UInt32 uid;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaBrowserDelegate class
-+---------------------------------------------------------------------*/
-class PLT_MediaBrowserDelegate
-{
-public:
- virtual ~PLT_MediaBrowserDelegate() {}
-
- virtual bool OnMSAdded(PLT_DeviceDataReference& /* device */) { return true; }
- virtual void OnMSRemoved(PLT_DeviceDataReference& /* device */) {}
- virtual void OnMSStateVariablesChanged(
- PLT_Service* /*service*/,
- NPT_List<PLT_StateVariable*>* /*vars*/) {}
-
- // ContentDirectory
- virtual void OnBrowseResult(
- NPT_Result /*res*/,
- PLT_DeviceDataReference& /*device*/,
- PLT_BrowseInfo* /*info*/,
- void* /*userdata*/) {}
-
- virtual void OnSearchResult(
- NPT_Result /*res*/,
- PLT_DeviceDataReference& /*device*/,
- PLT_BrowseInfo* /*info*/,
- void* /*userdata*/) {}
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaBrowser class
-+---------------------------------------------------------------------*/
-class PLT_MediaBrowser : public PLT_CtrlPointListener
-{
-public:
- PLT_MediaBrowser(PLT_CtrlPointReference& ctrl_point,
- PLT_MediaBrowserDelegate* delegate = NULL);
- virtual ~PLT_MediaBrowser();
-
- // ContentDirectory service
- virtual NPT_Result Browse(PLT_DeviceDataReference& device,
- const char* object_id,
- NPT_UInt32 start_index,
- NPT_UInt32 count = 30, // DLNA recommendations
- bool browse_metadata = false,
- const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
- const char* sort_criteria = "",
- void* userdata = NULL);
-
- virtual NPT_Result Search(PLT_DeviceDataReference& device,
- const char* container_id,
- const char* search_criteria,
- NPT_UInt32 start_index,
- NPT_UInt32 count = 30, // DLNA recommendations
- const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
- void* userdata = NULL);
- //BBMOD END
-
- // methods
- virtual const NPT_Lock<PLT_DeviceDataReferenceList>& GetMediaServers() { return m_MediaServers; }
- virtual NPT_Result FindServer(const char* uuid, PLT_DeviceDataReference& device);
- virtual void SetDelegate(PLT_MediaBrowserDelegate* delegate) { m_Delegate = delegate; }
-
-protected:
- // PLT_CtrlPointListener methods
- virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
- virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
- virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata);
- virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars);
-
- // ContentDirectory service responses
- virtual NPT_Result OnBrowseResponse(NPT_Result res,
- PLT_DeviceDataReference& device,
- PLT_ActionReference& action,
- void* userdata);
-
- virtual NPT_Result OnSearchResponse(NPT_Result res,
- PLT_DeviceDataReference& device,
- PLT_ActionReference& action,
- void* userdata);
-
-protected:
- PLT_CtrlPointReference m_CtrlPoint;
- PLT_MediaBrowserDelegate* m_Delegate;
- NPT_Lock<PLT_DeviceDataReferenceList> m_MediaServers;
-};
-
-#endif /* _PLT_MEDIA_BROWSER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Browser Listener
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_BROWSER_LISTENER_H_
-#define _PLT_MEDIA_BROWSER_LISTENER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltMediaItem.h"
-#include "PltDeviceData.h"
-
-/*----------------------------------------------------------------------
-| PLT_BrowseInfo
-+---------------------------------------------------------------------*/
-class PLT_BrowseInfo {
-public:
- PLT_BrowseInfo() : nr(0), tm(0), uid(0) {}
-
- NPT_String object_id;
- PLT_MediaObjectListReference items;
- NPT_UInt32 nr;
- NPT_UInt32 tm;
- NPT_UInt32 uid;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaBrowserListener class
-+---------------------------------------------------------------------*/
-class PLT_MediaBrowserListener
-{
-public:
- virtual ~PLT_MediaBrowserListener() {}
-
- virtual void OnMSAddedRemoved(
- PLT_DeviceDataReference& /*device*/,
- int /*added*/) {}
-
- virtual void OnMSStateVariablesChanged(
- PLT_Service* /*service*/,
- NPT_List<PLT_StateVariable*>* /*vars*/) {}
-
- virtual void OnMSBrowseResult(
- NPT_Result /*res*/,
- PLT_DeviceDataReference& /*device*/,
- PLT_BrowseInfo* /*info*/,
- void* /*userdata*/) {}
-};
-
-#endif /* _PLT_MEDIA_BROWSER_LISTENER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Cache
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_CACHE_H_
-#define _PLT_MEDIA_CACHE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltMediaItem.h"
-#include "PltDeviceData.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------
-| typedefs
-+---------------------------------------------------------------------*/
-typedef NPT_Map<NPT_String, PLT_MediaObjectListReference>::Entry PLT_MediaCacheEntry;
-
-/*----------------------------------------------------------------------
-| PLT_MediaCache class
-+---------------------------------------------------------------------*/
-class PLT_MediaCache
-{
-public:
- PLT_MediaCache();
- virtual ~PLT_MediaCache();
-
- NPT_Result Put(const char* device_uuid, const char* item_id, PLT_MediaObjectListReference& list);
- NPT_Result Get(const char* device_uuid, const char* item_id, PLT_MediaObjectListReference& list);
- NPT_Result Clear(const char* device_uuid, const char* item_id);
- NPT_Result Clear(const char* device_uuid = NULL);
-
-private:
- NPT_String GenerateKey(const char* device_uuid, const char* item_id);
-
-private:
- NPT_Mutex m_Mutex;
- NPT_Map<NPT_String, PLT_MediaObjectListReference> m_Items;
-};
-
-#endif /* _PLT_MEDIA_CACHE_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Connect Device
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_CONNECT_H_
-#define _PLT_MEDIA_CONNECT_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltFileMediaServer.h"
-
-/*----------------------------------------------------------------------
-| PLT_MediaConnectInfo
-+---------------------------------------------------------------------*/
-class PLT_MediaConnectInfo
-{
-public:
- PLT_MediaConnectInfo(bool authorized = false) :
- m_Authorized(authorized), m_Validated(false) {}
-
- bool m_Authorized;
- bool m_Validated;
- NPT_String m_UDN;
-};
-
-/*----------------------------------------------------------------------
-| defines
-+---------------------------------------------------------------------*/
-typedef NPT_Map<NPT_String, PLT_MediaConnectInfo> PLT_MediaConnectDeviceInfoMap;
-typedef NPT_Map<NPT_String, PLT_MediaConnectInfo>::Entry PLT_MediaConnectDeviceInfoMapEntry;
-typedef NPT_Map<NPT_String, NPT_String> PLT_UDNtoMACMap;
-typedef NPT_Map<NPT_String, NPT_String>::Entry PLT_UDNtoMACMapEntry;
-
-/*----------------------------------------------------------------------
-| PLT_MediaConnect
-+---------------------------------------------------------------------*/
-class PLT_MediaConnect : public PLT_FileMediaServer
-{
-public:
- PLT_MediaConnect(const char* path,
- const char* friendly_name,
- bool show_ip = false,
- const char* udn = NULL,
- NPT_UInt16 port = 0,
- bool port_rebind = false);
-
- NPT_Result Authorize(PLT_MediaConnectInfo* info, bool state);
- NPT_Result Validate(PLT_MediaConnectInfo* info, bool state);
-
-protected:
- virtual ~PLT_MediaConnect();
-
-
- // PLT_DeviceHost methods
- virtual NPT_Result SetupServices(PLT_DeviceData& data);
- virtual NPT_Result OnAction(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result ProcessGetDescription(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse& response);
-
- // PLT_FileMediaServer methods
- virtual NPT_Result GetFilePath(const char* object_id, NPT_String& filepath);
-
- // X_MS_MediaReceiverRegistrar
- virtual NPT_Result OnIsAuthorized(PLT_ActionReference& action,
- PLT_MediaConnectInfo* mediaConnectInfo);
- virtual NPT_Result OnRegisterDevice(PLT_ActionReference& action,
- PLT_MediaConnectInfo* mediaConnectInfo);
- virtual NPT_Result OnIsValidated(PLT_ActionReference& action,
- PLT_MediaConnectInfo* mediaConnectInfo);
-
-private:
- NPT_Result LookUpMediaConnectInfo(NPT_String deviceID,
- PLT_MediaConnectInfo*& mediaConnectInfo);
-
-protected:
- PLT_MediaConnectDeviceInfoMap m_MediaConnectDeviceInfoMap;
- PLT_UDNtoMACMap m_MediaConnectUDNMap;
-
-private:
- PLT_Service* m_RegistrarService;
-};
-
-#endif /* _PLT_MEDIA_CONNECT_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Controller (Media Renderer Control Point)
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_CONTROLLER_H_
-#define _PLT_MEDIA_CONTROLLER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltCtrlPoint.h"
-#include "PltMediaItem.h"
-
-/*----------------------------------------------------------------------
-| Defines
-+---------------------------------------------------------------------*/
-typedef NPT_List<NPT_String> PLT_StringList;
-
-struct PLT_DeviceCapabilities {
- PLT_StringList play_media;
- PLT_StringList rec_media;
- PLT_StringList rec_quality_modes;
-};
-
-struct PLT_MediaInfo {
- NPT_UInt32 num_tracks;
- NPT_TimeStamp media_duration;
- NPT_String cur_uri;
- NPT_String cur_metadata;
- NPT_String next_uri;
- NPT_String next_metadata;
- NPT_String play_medium;
- NPT_String rec_medium;
- NPT_String write_status;
-};
-
-struct PLT_PositionInfo {
- NPT_UInt32 track;
- NPT_TimeStamp track_duration;
- NPT_String track_metadata;
- NPT_String track_uri;
- NPT_TimeStamp rel_time;
- NPT_TimeStamp abs_time;
- NPT_Int32 rel_count;
- NPT_Int32 abs_count;
-};
-
-struct PLT_TransportInfo {
- NPT_String cur_transport_state;
- NPT_String cur_transport_status;
- NPT_String cur_speed;
-};
-
-struct PLT_TransportSettings {
- NPT_String play_mode;
- NPT_String rec_quality_mode;
-};
-
-struct PLT_ConnectionInfo {
- NPT_UInt32 rcs_id;
- NPT_UInt32 avtransport_id;
- NPT_String protocol_info;
- NPT_String peer_connection_mgr;
- NPT_UInt32 peer_connection_id;
- NPT_String direction;
- NPT_String status;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaControllerDelegate class
-+---------------------------------------------------------------------*/
-class PLT_MediaControllerDelegate
-{
-public:
- virtual ~PLT_MediaControllerDelegate() {}
-
- virtual bool OnMRAdded(PLT_DeviceDataReference& /* device */) { return true; }
- virtual void OnMRRemoved(PLT_DeviceDataReference& /* device */) {}
- virtual void OnMRStateVariablesChanged(PLT_Service* /* service */,
- NPT_List<PLT_StateVariable*>* /* vars */) {}
-
- // AVTransport
- virtual void OnGetCurrentTransportActionsResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_StringList* /* actions */,
- void* /* userdata */) {}
-
- virtual void OnGetDeviceCapabilitiesResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_DeviceCapabilities* /* capabilities */,
- void* /* userdata */) {}
-
- virtual void OnGetMediaInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_MediaInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetPositionInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_PositionInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetTransportInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_TransportInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetTransportSettingsResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_TransportSettings* /* settings */,
- void* /* userdata */) {}
-
- virtual void OnNextResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnPauseResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnPlayResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnPreviousResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnSeekResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnSetAVTransportURIResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnSetPlayModeResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnStopResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- // ConnectionManager
- virtual void OnGetCurrentConnectionIDsResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_StringList* /* ids */,
- void* /* userdata */) {}
-
- virtual void OnGetCurrentConnectionInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_ConnectionInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetProtocolInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_StringList* /* sources */,
- PLT_StringList* /* sinks */,
- void* /* userdata */) {}
-
- // RenderingControl
- virtual void OnSetMuteResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnGetMuteResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- const char* /* channel */,
- bool /* mute */,
- void* /* userdata */) {}
-
- virtual void OnSetVolumeResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnGetVolumeResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- const char* /* channel */,
- NPT_UInt32 /* volume */,
- void* /* userdata */) {}
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaController class
-+---------------------------------------------------------------------*/
-class PLT_MediaController : public PLT_CtrlPointListener
-{
-public:
- PLT_MediaController(PLT_CtrlPointReference& ctrl_point,
- PLT_MediaControllerDelegate* delegate = NULL);
- virtual ~PLT_MediaController();
-
- // public methods
- virtual void SetDelegate(PLT_MediaControllerDelegate* delegate) {
- m_Delegate = delegate;
- }
-
- // PLT_CtrlPointListener methods
- virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
- virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
- virtual NPT_Result OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata);
- virtual NPT_Result OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars);
-
- // AVTransport
- NPT_Result GetCurrentTransportActions(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result GetDeviceCapabilities(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result GetMediaInfo(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result GetPositionInfo(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result GetTransportInfo(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result GetTransportSettings(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result Next(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result Pause(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result Play(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, NPT_String speed, void* userdata);
- NPT_Result Previous(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
- NPT_Result Seek(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, NPT_String unit, NPT_String target, void* userdata);
- NPT_Result SetAVTransportURI(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* uri, const char* metadata, void* userdata);
- NPT_Result SetPlayMode(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, NPT_String new_play_mode, void* userdata);
- NPT_Result Stop(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, void* userdata);
-
- // ConnectionManager
- NPT_Result GetCurrentConnectionIDs(PLT_DeviceDataReference& device, void* userdata);
- NPT_Result GetCurrentConnectionInfo(PLT_DeviceDataReference& device, NPT_UInt32 connection_id, void* userdata);
- NPT_Result GetProtocolInfo(PLT_DeviceDataReference& device, void* userdata);
-
- // RenderingControl
- NPT_Result SetMute(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, bool mute, void* userdata);
- NPT_Result GetMute(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, void* userdata);
- NPT_Result SetVolume(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, int volume, void* userdata);
- NPT_Result GetVolume(PLT_DeviceDataReference& device, NPT_UInt32 instance_id, const char* channel, void* userdata);
-
- // methods
- virtual NPT_Result FindRenderer(const char* uuid, PLT_DeviceDataReference& device);
- virtual NPT_Result GetProtocolInfoSink(PLT_DeviceDataReference& device, NPT_List<NPT_String>& sinks);
- virtual NPT_Result FindMatchingProtocolInfo(NPT_List<NPT_String>& sinks,
- const char* protocol_info);
- virtual NPT_Result FindBestResource(PLT_DeviceDataReference& device, PLT_MediaObject& item, NPT_Cardinal& resource_index);
-
-private:
- NPT_Result InvokeActionWithInstance(PLT_ActionReference& action,
- NPT_UInt32 instance_id,
- void* userdata = NULL);
-
- NPT_Result OnGetCurrentTransportActionsResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetDeviceCapabilitiesResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetMediaInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetPositionInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetTransportInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetTransportSettingsResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
-
- NPT_Result OnGetCurrentConnectionIDsResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetCurrentConnectionInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetProtocolInfoResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
-
- NPT_Result OnGetMuteResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
- NPT_Result OnGetVolumeResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata);
-
-public:
- static void ParseCSV(const char* csv, PLT_StringList& values) {
- const char* start = csv;
- const char* p = start;
-
- // look for the , character
- while (*p) {
- if (*p == ',') {
- NPT_String val(start, (int)(p-start));
- val.Trim(' ');
- values.Add(val);
- start = p + 1;
- }
- p++;
- }
-
- // last one
- NPT_String last(start, (int)(p-start));
- last.Trim(' ');
- if (last.GetLength()) {
- values.Add(last);
- }
- }
-
-private:
- PLT_CtrlPointReference m_CtrlPoint;
- PLT_MediaControllerDelegate* m_Delegate;
- NPT_Lock<PLT_DeviceDataReferenceList> m_MediaRenderers;
-};
-
-#endif /* _PLT_MEDIA_CONTROLLER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Controller Listener
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_CONTROLLER_LISTENER_H_
-#define _PLT_MEDIA_CONTROLLER_LISTENER_H_
-
-/*----------------------------------------------------------------------
-| Defines
-+---------------------------------------------------------------------*/
-typedef NPT_List<NPT_String> PLT_StringList;
-
-struct PLT_DeviceCapabilities {
- PLT_StringList play_media;
- PLT_StringList rec_media;
- PLT_StringList rec_quality_modes;
-};
-
-struct PLT_MediaInfo {
- NPT_UInt32 num_tracks;
- NPT_TimeStamp media_duration;
- NPT_String cur_uri;
- NPT_String cur_metadata;
- NPT_String next_uri;
- NPT_String next_metadata;
- NPT_String play_medium;
- NPT_String rec_medium;
- NPT_String write_status;
-};
-
-struct PLT_PositionInfo {
- NPT_UInt32 track;
- NPT_TimeStamp track_duration;
- NPT_String track_metadata;
- NPT_String track_uri;
- NPT_TimeStamp rel_time;
- NPT_TimeStamp abs_time;
- NPT_Int32 rel_count;
- NPT_Int32 abs_count;
-};
-
-struct PLT_TransportInfo {
- NPT_String cur_transport_state;
- NPT_String cur_transport_status;
- NPT_String cur_speed;
-};
-
-struct PLT_TransportSettings {
- NPT_String play_mode;
- NPT_String rec_quality_mode;
-};
-
-struct PLT_ConnectionInfo {
- NPT_UInt32 rcs_id;
- NPT_UInt32 avtransport_id;
- NPT_String protocol_info;
- NPT_String peer_connection_mgr;
- NPT_UInt32 peer_connection_id;
- NPT_String direction;
- NPT_String status;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaControllerListener class
-+---------------------------------------------------------------------*/
-class PLT_MediaControllerListener
-{
-public:
- virtual ~PLT_MediaControllerListener() {}
-
- virtual void OnMRAddedRemoved(PLT_DeviceDataReference& /* device */,
- int /* added */) {}
- virtual void OnMRStateVariablesChanged(PLT_Service* /* service */,
- NPT_List<PLT_StateVariable*>* /* vars */) {}
-
- // AVTransport
- virtual void OnGetCurrentTransportActionsResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_StringList* /* actions */,
- void* /* userdata */) {}
-
- virtual void OnGetDeviceCapabilitiesResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_DeviceCapabilities* /* capabilities */,
- void* /* userdata */) {}
-
- virtual void OnGetMediaInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_MediaInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetPositionInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_PositionInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetTransportInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_TransportInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetTransportSettingsResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_TransportSettings* /* settings */,
- void* /* userdata */) {}
-
- virtual void OnNextResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnPauseResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnPlayResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnPreviousResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnSeekResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnSetAVTransportURIResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnSetPlayModeResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- virtual void OnStopResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- void* /* userdata */) {}
-
- // ConnectionManager
- virtual void OnGetCurrentConnectionIDsResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_StringList* /* ids */,
- void* /* userdata */) {}
-
- virtual void OnGetCurrentConnectionInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_ConnectionInfo* /* info */,
- void* /* userdata */) {}
-
- virtual void OnGetProtocolInfoResult(
- NPT_Result /* res */,
- PLT_DeviceDataReference& /* device */,
- PLT_StringList* /* sources */,
- PLT_StringList* /* sinks */,
- void* /* userdata */) {}
-};
-
-#endif /* _PLT_MEDIA_CONTROLLER_LISTENER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Item
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_ITEM_H_
-#define _PLT_MEDIA_ITEM_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltHttp.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_MediaServer;
-
-/*----------------------------------------------------------------------
-| typedefs
-+---------------------------------------------------------------------*/
-typedef struct {
- NPT_String type;
- NPT_String friendly_name;
-} PLT_ObjectClass;
-
-typedef struct {
- NPT_String type;
- NPT_String friendly_name;
- bool include_derived;
-} PLT_SearchClass;
-
-typedef struct {
- NPT_String name;
- NPT_String role;
-} PLT_PersonRole;
-
-class PLT_PersonRoles : public NPT_List<PLT_PersonRole>
-{
-public:
- NPT_Result Add(const NPT_String& name, const NPT_String& role = "");
- NPT_Result ToDidl(NPT_String& didl, const NPT_String& tag);
- NPT_Result FromDidl(const NPT_Array<NPT_XmlElementNode*>& nodes);
-};
-
-typedef struct {
- NPT_String allowed_use; // (CSV)
- NPT_String validity_start;
- NPT_String validity_end;
- NPT_String remaining_time;
- NPT_String usage_info;
- NPT_String rights_info_uri;
- NPT_String content_info_uri;
-} PLT_Constraint;
-
-typedef struct {
- PLT_PersonRoles artists;
- PLT_PersonRoles actors;
- PLT_PersonRoles authors;
- NPT_String producer;
- NPT_String director;
- NPT_String publisher;
- NPT_String contributor; // should match m_Creator (dc:creator)
-} PLT_PeopleInfo;
-
-typedef struct {
- NPT_List<NPT_String> genre;
- NPT_String album;
- NPT_String playlist; // dc:title of the playlist item the content belongs too
-} PLT_AffiliationInfo;
-
-typedef struct {
- NPT_String description;
- NPT_String long_description;
- NPT_String icon_uri;
- NPT_String region;
- NPT_String rating;
- NPT_String rights;
- NPT_String date;
- NPT_String language;
-} PLT_Description;
-
-typedef struct {
- NPT_String album_art_uri;
- NPT_String album_art_uri_dlna_profile;
- NPT_String artist_discography_uri;
- NPT_String lyrics_uri;
- NPT_List<NPT_String> relation; // dc:relation
-} PLT_ExtraInfo;
-
-typedef struct {
- NPT_UInt32 dvdregioncode;
- NPT_UInt32 original_track_number;
- NPT_String toc;
- NPT_String user_annotation;
-} PLT_MiscInfo;
-
-typedef struct {
- int total;
- int used;
- int free;
- int max_partition;
- NPT_String medium;
-} PLT_StorageInfo;
-
-/*----------------------------------------------------------------------
-| PLT_ProtocolInfo class
-+---------------------------------------------------------------------*/
-class PLT_ProtocolInfo
-{
-public:
- class FieldEntry {
- public:
- FieldEntry(const char* key, const char* value) :
- m_Key(key), m_Value(value) {}
- NPT_String m_Key;
- NPT_String m_Value;
- };
-
- PLT_ProtocolInfo();
- PLT_ProtocolInfo(const char* protocol_info);
- PLT_ProtocolInfo(const char* protocol,
- const char* mask,
- const char* content_type,
- const char* extra);
- const NPT_String& GetProtocol() const { return m_Protocol; }
- const NPT_String& GetMask() const { return m_Mask; }
- const NPT_String& GetContentType() const { return m_ContentType; }
- const NPT_String& GetExtra() const { return m_Extra; }
-
- const NPT_String& GetDLNA_PN() const { return m_DLNA_PN; }
-
- bool IsValid() { return m_Valid; }
- NPT_String ToString() const;
-
- bool Match(const PLT_ProtocolInfo& other) const;
-
-private:
- NPT_Result ValidateField(const char* val,
- const char* valid_chars,
- NPT_Cardinal num_chars = 0); // 0 means variable number of chars
- NPT_Result ParseExtra(NPT_List<FieldEntry>& entries);
- NPT_Result ValidateExtra();
-
-private:
- NPT_String m_Protocol;
- NPT_String m_Mask;
- NPT_String m_ContentType;
- NPT_String m_Extra;
-
- NPT_String m_DLNA_PN;
- NPT_String m_DLNA_OP;
- NPT_String m_DLNA_PS;
- NPT_String m_DLNA_CI;
- NPT_String m_DLNA_FLAGS;
- NPT_String m_DLNA_MAXSP;
-
- NPT_List<FieldEntry> m_DLNA_OTHER;
- bool m_Valid;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaItemResource class
-+---------------------------------------------------------------------*/
-class PLT_MediaItemResource
-{
-public:
- PLT_MediaItemResource();
- ~PLT_MediaItemResource() {}
-
- NPT_String m_Uri;
- PLT_ProtocolInfo m_ProtocolInfo;
- NPT_UInt32 m_Duration; /* seconds */
- NPT_LargeSize m_Size;
- NPT_String m_Protection;
- NPT_UInt32 m_Bitrate; /* bytes/seconds */
- NPT_UInt32 m_BitsPerSample;
- NPT_UInt32 m_SampleFrequency;
- NPT_UInt32 m_NbAudioChannels;
- NPT_String m_Resolution;
- NPT_UInt32 m_ColorDepth;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaObject class
-+---------------------------------------------------------------------*/
-class PLT_MediaObject
-{
-public:
- PLT_MediaObject() {}
- virtual ~PLT_MediaObject() {}
-
- bool IsContainer() { return m_ObjectClass.type.StartsWith("object.container"); }
-
- static const char* GetMimeType(const NPT_String& filename,
- const PLT_HttpRequestContext* context = NULL);
- static const char* GetMimeTypeFromExtension(const NPT_String& extension,
- const PLT_HttpRequestContext* context = NULL);
- static NPT_String GetProtocolInfo(const char* filename,
- bool with_dlna_extension = true,
- const PLT_HttpRequestContext* context = NULL);
- static NPT_String GetMimeTypeFromProtocolInfo(const char* protocol_info);
- static const char* GetUPnPClass(const char* filename,
- const PLT_HttpRequestContext* context = NULL);
- static const char* GetDlnaExtension(const char* mime_type,
- const PLT_HttpRequestContext* context = NULL);
-
- virtual NPT_Result Reset();
- virtual NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
- virtual NPT_Result FromDidl(NPT_XmlElementNode* entry);
-
-public:
- /* common properties */
- PLT_ObjectClass m_ObjectClass;
- NPT_String m_ObjectID;
- NPT_String m_ParentID;
-
- /* metadata */
- NPT_String m_Title;
- NPT_String m_Creator;
- NPT_String m_Date;
- PLT_PeopleInfo m_People;
- PLT_AffiliationInfo m_Affiliation;
- PLT_Description m_Description;
-
- /* properties */
- bool m_Restricted;
-
- /* extras */
- PLT_ExtraInfo m_ExtraInfo;
-
- /* miscellaneous info */
- PLT_MiscInfo m_MiscInfo;
-
- /* resources related */
- NPT_Array<PLT_MediaItemResource> m_Resources;
-
- /* original DIDL for Control Points to pass to a renderer when invoking SetAVTransportURI */
- NPT_String m_Didl;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaItem class
-+---------------------------------------------------------------------*/
-class PLT_MediaItem : public PLT_MediaObject
-{
-public:
- PLT_MediaItem();
- virtual ~PLT_MediaItem();
-
- // PLT_MediaObject methods
- NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
- NPT_Result FromDidl(NPT_XmlElementNode* entry);
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaContainer class
-+---------------------------------------------------------------------*/
-class PLT_MediaContainer : public PLT_MediaObject
-{
-public:
- PLT_MediaContainer();
- virtual ~PLT_MediaContainer();
-
- // PLT_MediaObject methods
- NPT_Result Reset();
- NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
- NPT_Result FromDidl(NPT_XmlElementNode* entry);
-
-public:
- NPT_List<PLT_SearchClass> m_SearchClasses;
-
- /* properties */
- bool m_Searchable;
-
- /* container info related */
- NPT_Int32 m_ChildrenCount;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaObjectList class
-+---------------------------------------------------------------------*/
-class PLT_MediaObjectList : public NPT_List<PLT_MediaObject*>
-{
-public:
- PLT_MediaObjectList();
-
-protected:
- virtual ~PLT_MediaObjectList(void);
- friend class NPT_Reference<PLT_MediaObjectList>;
-};
-
-typedef NPT_Reference<PLT_MediaObjectList> PLT_MediaObjectListReference;
-typedef NPT_Reference<PLT_MediaObject> PLT_MediaObjectReference;
-
-
-#endif /* _PLT_MEDIA_ITEM_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Playlist
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_PLAYLIST_H_
-#define _PLT_MEDIA_PLAYLIST_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltMediaItem.h"
-
-/*----------------------------------------------------------------------
-| typedefs
-+---------------------------------------------------------------------*/
-typedef NPT_List<PLT_MediaItem*> PLT_MediaItemList;
-typedef NPT_Reference<PLT_MediaItemList> PLT_MediaItemListReference;
-
-/*----------------------------------------------------------------------
-| PLT_MediaPlaylist class
-+---------------------------------------------------------------------*/
-class PLT_MediaPlaylist
-{
-public:
- PLT_MediaPlaylist();
- ~PLT_MediaPlaylist(void);
-
- NPT_Result Clear();
- NPT_Result Queue(PLT_MediaItem* item);
- NPT_Result Queue(PLT_MediaItemList* list);
- template <typename X>
- NPT_Result Apply(const X& function) {
- return m_List->Apply(function);
- }
-
-private:
- PLT_MediaItemListReference m_List;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaItemQueueIterator class
-+---------------------------------------------------------------------*/
-class PLT_MediaItemQueueIterator
-{
-public:
- PLT_MediaItemQueueIterator(PLT_MediaPlaylist* playlist) : m_Playlist(playlist) {}
- NPT_Result operator()(PLT_MediaItem*& item) const {
- return m_Playlist->Queue(item);
- }
-
-private:
- PLT_MediaPlaylist* m_Playlist;
-};
-
-#endif /* _PLT_MEDIA_PLAYLIST_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Renderer Device
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_RENDERER_H_
-#define _PLT_MEDIA_RENDERER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltDeviceHost.h"
-
-/*----------------------------------------------------------------------
-| PLT_MediaRenderer class
-+---------------------------------------------------------------------*/
-class PLT_MediaRendererInterface
-{
-public:
- virtual ~PLT_MediaRendererInterface() {}
-
- // ConnectionManager
- virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action) = 0;
-
- // AVTransport
- virtual NPT_Result OnNext(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnPause(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnPlay(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnPrevious(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnSeek(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnStop(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnSetAVTransportURI(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnSetPlayMode(PLT_ActionReference& action) = 0;
-
- // RenderingControl
- virtual NPT_Result OnSetVolume(PLT_ActionReference& action) = 0;
- virtual NPT_Result OnSetMute(PLT_ActionReference& action) = 0;
-};
-
-/*----------------------------------------------------------------------
-| PLT_MediaRenderer class
-+---------------------------------------------------------------------*/
-class PLT_MediaRenderer : public PLT_DeviceHost,
- public PLT_MediaRendererInterface
-{
-public:
- PLT_MediaRenderer(const char* friendly_name,
- bool show_ip = false,
- const char* uuid = NULL,
- unsigned int port = 0,
- bool port_rebind = false);
-
- // PLT_DeviceHost methods
- virtual NPT_Result SetupServices(PLT_DeviceData& data);
- virtual NPT_Result OnAction(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
-
-protected:
- virtual ~PLT_MediaRenderer();
-
- // PLT_MediaRendererInterface methods
- // ConnectionManager
- virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action);
-
- // AVTransport
- virtual NPT_Result OnNext(PLT_ActionReference& action);
- virtual NPT_Result OnPause(PLT_ActionReference& action);
- virtual NPT_Result OnPlay(PLT_ActionReference& action);
- virtual NPT_Result OnPrevious(PLT_ActionReference& action);
- virtual NPT_Result OnSeek(PLT_ActionReference& action);
- virtual NPT_Result OnStop(PLT_ActionReference& action);
- virtual NPT_Result OnSetAVTransportURI(PLT_ActionReference& action);
- virtual NPT_Result OnSetPlayMode(PLT_ActionReference& action);
-
- // RenderingControl
- virtual NPT_Result OnSetVolume(PLT_ActionReference& action);
- virtual NPT_Result OnSetVolumeDB(PLT_ActionReference &action);
- virtual NPT_Result OnGetVolumeDBRange(PLT_ActionReference &action);
- virtual NPT_Result OnSetMute(PLT_ActionReference& action);
-};
-
-#endif /* _PLT_MEDIA_RENDERER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - AV Media Server Device
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_MEDIA_SERVER_H_
-#define _PLT_MEDIA_SERVER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltDeviceHost.h"
-#include "PltMediaItem.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define MAX_PATH_LENGTH 1024
-
-/* BrowseFlags */
-enum BrowseFlags {
- BROWSEMETADATA,
- BROWSEDIRECTCHILDREN
-};
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-extern const char* BrowseFlagsStr[];
-class PLT_HttpFileServerHandler;
-
-/*----------------------------------------------------------------------
-| PLT_MediaServer class
-+---------------------------------------------------------------------*/
-class PLT_MediaServer : public PLT_DeviceHost
-{
-public:
- PLT_MediaServer(const char* friendly_name,
- bool show_ip = false,
- const char* uuid = NULL,
- NPT_UInt16 port = 0,
- bool port_rebind = false);
- virtual ~PLT_MediaServer();
-
- // PLT_DeviceHost methods
- virtual NPT_Result SetupServices(PLT_DeviceData& data);
- virtual NPT_Result OnAction(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
-
- // class methods
- static NPT_Result GetBrowseFlag(const char* str, BrowseFlags& flag);
-
-protected:
- // ConnectionManager
- virtual NPT_Result OnGetCurrentConnectionIDs(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnGetProtocolInfo(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnGetCurrentConnectionInfo(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
-
- // ContentDirectory
- virtual NPT_Result OnGetSortCapabilities(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnGetSearchCapabilities(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnGetSystemUpdateID(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnBrowse(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnSearch(PLT_ActionReference& action,
- const PLT_HttpRequestContext& context);
-
- // overridable methods
- virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action,
- const char* object_id,
- const char* filter,
- NPT_UInt32 starting_index,
- NPT_UInt32 requested_count,
- const NPT_List<NPT_String>& sort_criteria,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action,
- const char* object_id,
- const char* filter,
- NPT_UInt32 starting_index,
- NPT_UInt32 requested_count,
- const NPT_List<NPT_String>& sort_criteria,
- const PLT_HttpRequestContext& context);
- virtual NPT_Result OnSearchContainer(PLT_ActionReference& action,
- const char* container_id,
- const char* search_criteria,
- const char* filter,
- NPT_UInt32 starting_index,
- NPT_UInt32 requested_count,
- const NPT_List<NPT_String>& sort_criteria,
- const PLT_HttpRequestContext& context);
-
- // methods
- virtual NPT_Result ParseSort(const NPT_String& sort, NPT_List<NPT_String>& list);
-};
-
-#endif /* _PLT_MEDIA_SERVER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Metadata Handler
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_METADATA_HANDLER_H_
-#define _PLT_METADATA_HANDLER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| PLT_MetadataHandler class
-+---------------------------------------------------------------------*/
-class PLT_MetadataHandler
-{
-public:
- virtual ~PLT_MetadataHandler() {}
-
- // metadata overridables
- virtual bool HandleExtension(const char* extension) = 0;
- virtual NPT_Result Load(NPT_InputStream& stream,
- NPT_TimeInterval sleeptime = NPT_TimeInterval(0, 10000),
- NPT_TimeInterval timeout = NPT_TimeInterval(30, 0)) = 0;
- virtual NPT_Result Save(NPT_OutputStream& stream,
- NPT_TimeInterval sleeptime = NPT_TimeInterval(0, 10000),
- NPT_TimeInterval timeout = NPT_TimeInterval(30, 0)) = 0;
-
- virtual const char* GetLicenseData(NPT_String& licenseData) = 0;
- virtual NPT_Result GetCoverArtData(char*& caData, int& len) = 0;
- virtual const char* GetContentID(NPT_String& value) = 0;
- virtual const char* GetTitle(NPT_String& value) = 0;
- virtual const char* GetDescription(NPT_String& value) = 0;
- virtual NPT_Result GetDuration(NPT_UInt32& seconds) = 0;
- virtual const char* GetProtection(NPT_String& protection) = 0;
- virtual NPT_Result GetYear(NPT_Size& year) = 0;
-
- // helper functions
- virtual NPT_Result Load(const char* filename);
- virtual NPT_Result Save(const char* filename);
-};
-
-/*----------------------------------------------------------------------
-| PLT_MetadataHandlerFinder
-+---------------------------------------------------------------------*/
-class PLT_MetadataHandlerFinder
-{
-public:
- // methods
- PLT_MetadataHandlerFinder(const char* extension) : m_Extension(extension) {}
- bool operator()(PLT_MetadataHandler* const & handler) const {
- return handler->HandleExtension(m_Extension) ? true : false;
- }
-
-private:
- // members
- NPT_String m_Extension;
-};
-
-#endif /* _PLT_METADATA_HANDLER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Ring buffer stream
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_RING_BUFFER_STREAM_H_
-#define _PLT_RING_BUFFER_STREAM_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptStreams.h"
-#include "NptRingBuffer.h"
-#include "NptThreads.h"
-
-/*----------------------------------------------------------------------
-| PLT_RingBufferStream class
-+---------------------------------------------------------------------*/
-class PLT_RingBufferStream : public NPT_DelegatingInputStream,
- public NPT_DelegatingOutputStream
-{
-public:
- PLT_RingBufferStream(NPT_Size buffer_size = 4096, bool blocking = true);
- PLT_RingBufferStream(NPT_RingBufferReference& buffer, bool blocking = true);
- virtual ~PLT_RingBufferStream();
-
- void SetEos() {m_Eos = true;}
-
- // NPT_InputStream methods
- NPT_Result Read(void* buffer,
- NPT_Size bytes_to_read,
- NPT_Size* bytes_read = NULL);
- NPT_Result GetSize(NPT_LargeSize& size) {
- NPT_AutoLock autoLock(m_Lock);
- size = m_TotalBytesWritten;
- return NPT_SUCCESS;
- }
- NPT_Result GetAvailable(NPT_LargeSize& available) {
- NPT_AutoLock autoLock(m_Lock);
- available = m_RingBuffer->GetAvailable();
- return NPT_SUCCESS;
- }
-
- // NPT_OutputStream methods
- NPT_Result Write(const void* buffer,
- NPT_Size bytes_to_write,
- NPT_Size* bytes_written = NULL);
- NPT_Result Flush();
- NPT_Result Close() { m_RingBuffer->Close(); return NPT_SUCCESS; }
-
-protected:
- // NPT_DelegatingInputStream methods
- NPT_Result InputSeek(NPT_Position offset) {
- NPT_COMPILER_UNUSED(offset);
- return NPT_FAILURE;
- }
- NPT_Result InputTell(NPT_Position& offset) {
- NPT_AutoLock autoLock(m_Lock);
- offset = m_TotalBytesRead;
- return NPT_SUCCESS;
- }
-
- // NPT_DelegatingOutputStream methods
- NPT_Result OutputSeek(NPT_Position offset) {
- NPT_COMPILER_UNUSED(offset);
- return NPT_FAILURE;
- }
- NPT_Result OutputTell(NPT_Position& offset) {
- NPT_AutoLock autoLock(m_Lock);
- offset = m_TotalBytesWritten;
- return NPT_SUCCESS;
- }
-
-private:
- NPT_RingBufferReference m_RingBuffer;
- NPT_Offset m_TotalBytesRead;
- NPT_Offset m_TotalBytesWritten;
- NPT_Mutex m_Lock;
- bool m_Eos;
- bool m_Blocking;
-};
-
-typedef NPT_Reference<PLT_RingBufferStream> PLT_RingBufferStreamReference;
-
-#endif // _PLT_RING_BUFFER_STREAM_H_
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Service
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_SERVICE_H_
-#define _PLT_SERVICE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltEvent.h"
-#include "PltArgument.h"
-#include "PltStateVariable.h"
-#include "PltAction.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_DeviceData;
-
-/*----------------------------------------------------------------------
-| PLT_Service class
-+---------------------------------------------------------------------*/
-class PLT_Service
-{
-public:
- // methods
- PLT_Service(PLT_DeviceData* device,
- const char* type = NULL,
- const char* id = NULL,
- const char* last_change_namespace = NULL);
- ~PLT_Service();
-
- // class methods
- NPT_Result InitURLs(const char* service_name, const char* device_uuid);
- bool IsInitted() {
- return (m_ActionDescs.GetItemCount() > 0);
- }
- NPT_Result PauseEventing(bool paused = true);
-
- // static methods
- static bool IsTrue(const NPT_String& value) {
- if (value.Compare("1", true) &&
- value.Compare("true", true) &&
- value.Compare("yes", true)) {
- return false;
- }
- return true;
- }
-
- // accessor methods
- NPT_String GetSCPDURL(bool absolute = false);
- NPT_String GetControlURL(bool absolute = false);
- NPT_String GetEventSubURL(bool absolute = false);
- const NPT_String& GetServiceID() const { return m_ServiceID; }
- const NPT_String& GetServiceType() const { return m_ServiceType; }
- PLT_DeviceData* GetDevice() { return m_Device; }
- NPT_Result ForceVersion(NPT_Cardinal version);
-
- // XML
- NPT_Result GetSCPDXML(NPT_String& xml);
- NPT_Result SetSCPDXML(const char* xml);
- NPT_Result GetDescription(NPT_XmlElementNode* parent, NPT_XmlElementNode** service = NULL);
-
- // State Variables
- NPT_Result SetStateVariable(const char* name, const char* value);
- NPT_Result SetStateVariableRate(const char* name, NPT_TimeInterval rate);
- NPT_Result SetStateVariableExtraAttribute(const char* name,
- const char* key,
- const char* value);
- NPT_Result IncStateVariable(const char* name);
- PLT_StateVariable* FindStateVariable(const char* name);
- NPT_Result GetStateVariableValue(const char* name, NPT_String& value);
- bool IsSubscribable();
-
- // Actions
- PLT_ActionDesc* FindActionDesc(const char* name);
-
-private:
- void Cleanup();
- NPT_Result AddChanged(PLT_StateVariable* var);
- NPT_Result UpdateLastChange(NPT_List<PLT_StateVariable*>& vars);
- NPT_Result NotifyChanged();
-
-
- /*----------------------------------------------------------------------
- | PLT_ServiceEventTask
- +---------------------------------------------------------------------*/
- class PLT_ServiceEventTask : public PLT_ThreadTask
- {
- public:
- PLT_ServiceEventTask(PLT_Service* service) : m_Service(service) {}
-
- void DoRun() {
- while (!IsAborting(100)) m_Service->NotifyChanged();
- }
-
- private:
- PLT_Service* m_Service;
- };
-
- // Events
- NPT_Result ProcessNewSubscription(
- PLT_TaskManager* task_manager,
- const NPT_SocketAddress& addr,
- const NPT_String& callback_urls,
- int timeout,
- NPT_HttpResponse& response);
-
- NPT_Result ProcessRenewSubscription(
- const NPT_SocketAddress& addr,
- const NPT_String& sid,
- int timeout,
- NPT_HttpResponse& response);
-
- NPT_Result ProcessCancelSubscription(
- const NPT_SocketAddress& addr,
- const NPT_String& sid,
- NPT_HttpResponse& response);
-
-
-protected:
- friend class PLT_StateVariable; // so that we can call AddChanged from StateVariable
- friend class PLT_DeviceHost;
- friend class PLT_DeviceData;
-
- //members
- PLT_DeviceData* m_Device;
- NPT_String m_ServiceType;
- NPT_String m_ServiceID;
- NPT_String m_SCPDURL;
- NPT_String m_ControlURL;
- NPT_String m_EventSubURL;
-
- PLT_ServiceEventTask* m_EventTask;
- NPT_Array<PLT_ActionDesc*> m_ActionDescs;
- NPT_List<PLT_StateVariable*> m_StateVars;
- NPT_Mutex m_Lock;
- NPT_List<PLT_StateVariable*> m_StateVarsChanged;
- NPT_List<PLT_StateVariable*> m_StateVarsToPublish;
- NPT_List<PLT_EventSubscriber*> m_Subscribers;
- bool m_EventingPaused;
- NPT_String m_LastChangeNamespace;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ServiceSCPDURLFinder
-+---------------------------------------------------------------------*/
-class PLT_ServiceSCPDURLFinder
-{
-public:
- // methods
- PLT_ServiceSCPDURLFinder(const char* url) : m_URL(url) {}
- virtual ~PLT_ServiceSCPDURLFinder() {}
- bool operator()(PLT_Service* const & service) const;
-
-private:
- // members
- NPT_String m_URL;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ServiceControlURLFinder
-+---------------------------------------------------------------------*/
-class PLT_ServiceControlURLFinder
-{
-public:
- // methods
- PLT_ServiceControlURLFinder(const char* url) : m_URL(url) {}
- virtual ~PLT_ServiceControlURLFinder() {}
- bool operator()(PLT_Service* const & service) const;
-
-private:
- // members
- NPT_String m_URL;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ServiceEventSubURLFinder
-+---------------------------------------------------------------------*/
-class PLT_ServiceEventSubURLFinder
-{
-public:
- // methods
- PLT_ServiceEventSubURLFinder(const char* url) : m_URL(url) {}
- virtual ~PLT_ServiceEventSubURLFinder() {}
- bool operator()(PLT_Service* const & service) const;
-
-private:
- // members
- NPT_String m_URL;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ServiceIDFinder
-+---------------------------------------------------------------------*/
-class PLT_ServiceIDFinder
-{
-public:
- // methods
- PLT_ServiceIDFinder(const char* id) : m_Id(id) {}
- virtual ~PLT_ServiceIDFinder() {}
- bool operator()(PLT_Service* const & service) const;
-
-private:
- // members
- NPT_String m_Id;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ServiceTypeFinder
-+---------------------------------------------------------------------*/
-class PLT_ServiceTypeFinder
-{
-public:
- // methods
- PLT_ServiceTypeFinder(const char* type) : m_Type(type) {}
- virtual ~PLT_ServiceTypeFinder() {}
- bool operator()(PLT_Service* const & service) const;
-
-private:
- // members
- NPT_String m_Type;
-};
-
-/*----------------------------------------------------------------------
-| PLT_LastChangeXMLIterator
-+---------------------------------------------------------------------*/
-class PLT_LastChangeXMLIterator
-{
-public:
- // methods
- PLT_LastChangeXMLIterator(NPT_XmlElementNode* node) : m_Node(node) {}
- virtual ~PLT_LastChangeXMLIterator() {}
-
- NPT_Result operator()(PLT_StateVariable* const & var) const;
-
-private:
- NPT_XmlElementNode* m_Node;
-};
-
-#endif /* _PLT_SERVICE_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - SSDP
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_SSDP_H_
-#define _PLT_SSDP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltSsdpListener.h"
-#include "PltThreadTask.h"
-#include "PltHttpServerTask.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_DeviceHost;
-
-/*----------------------------------------------------------------------
-| PLT_SsdpSender class
-+---------------------------------------------------------------------*/
-class PLT_SsdpSender
-{
-public:
- static NPT_Result SendSsdp(NPT_HttpRequest& request,
- const char* usn,
- const char* nt,
- NPT_UdpSocket& socket,
- bool notify,
- const NPT_SocketAddress* addr = NULL);
-
- static NPT_Result SendSsdp(NPT_HttpResponse& response,
- const char* usn,
- const char* nt,
- NPT_UdpSocket& socket,
- bool notify,
- const NPT_SocketAddress* addr = NULL);
-
-private:
- static NPT_Result FormatPacket(NPT_HttpMessage& message,
- const char* usn,
- const char* nt,
- NPT_UdpSocket& socket,
- bool notify);
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpDeviceSearchResponseInterfaceIterator class
-+---------------------------------------------------------------------*/
-class PLT_SsdpDeviceSearchResponseInterfaceIterator
-{
-public:
- PLT_SsdpDeviceSearchResponseInterfaceIterator(PLT_DeviceHost* device,
- NPT_SocketAddress remote_addr,
- const char* st) :
- m_Device(device), m_RemoteAddr(remote_addr), m_ST(st) {}
- virtual ~PLT_SsdpDeviceSearchResponseInterfaceIterator() {}
-
- NPT_Result operator()(NPT_NetworkInterface*& if_addr) const;
-
-private:
- PLT_DeviceHost* m_Device;
- NPT_SocketAddress m_RemoteAddr;
- NPT_String m_ST;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpDeviceSearchResponseTask class
-+---------------------------------------------------------------------*/
-class PLT_SsdpDeviceSearchResponseTask : public PLT_ThreadTask
-{
-public:
- PLT_SsdpDeviceSearchResponseTask(PLT_DeviceHost* device,
- NPT_SocketAddress remote_addr,
- const char* st) :
- m_Device(device), m_RemoteAddr(remote_addr), m_ST(st) {}
-
-protected:
- virtual ~PLT_SsdpDeviceSearchResponseTask() {}
-
- // PLT_ThreadTask methods
- virtual void DoRun();
-
-protected:
- PLT_DeviceHost* m_Device;
- NPT_SocketAddress m_RemoteAddr;
- NPT_String m_ST;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpAnnounceInterfaceIterator class
-+---------------------------------------------------------------------*/
-class PLT_SsdpAnnounceInterfaceIterator
-{
-public:
- PLT_SsdpAnnounceInterfaceIterator(PLT_DeviceHost* device, bool is_byebye = false, bool broadcast = false) :
- m_Device(device), m_IsByeBye(is_byebye), m_Broadcast(broadcast) {}
-
- NPT_Result operator()(NPT_NetworkInterface*& if_addr) const;
-
-private:
- PLT_DeviceHost* m_Device;
- bool m_IsByeBye;
- bool m_Broadcast;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpInitMulticastIterator class
-+---------------------------------------------------------------------*/
-class PLT_SsdpInitMulticastIterator
-{
-public:
- PLT_SsdpInitMulticastIterator(NPT_UdpMulticastSocket* socket) :
- m_Socket(socket) {}
-
- NPT_Result operator()(NPT_IpAddress& if_addr) const {
- NPT_IpAddress addr;
- addr.ResolveName("239.255.255.250");
- return m_Socket->JoinGroup(addr, if_addr);
- }
-
-private:
- NPT_UdpMulticastSocket* m_Socket;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpDeviceAnnounceTask class
-+---------------------------------------------------------------------*/
-class PLT_SsdpDeviceAnnounceTask : public PLT_ThreadTask
-{
-public:
- PLT_SsdpDeviceAnnounceTask(PLT_DeviceHost* device,
- NPT_TimeInterval repeat,
- bool is_byebye_first = false,
- bool broadcast = false) :
- m_Device(device),
- m_Repeat(repeat), m_IsByeByeFirst(is_byebye_first),
- m_IsBroadcast(broadcast) {}
-
-protected:
- virtual ~PLT_SsdpDeviceAnnounceTask() {}
-
- // PLT_ThreadTask methods
- virtual void DoRun();
-
-protected:
- PLT_DeviceHost* m_Device;
- NPT_TimeInterval m_Repeat;
- bool m_IsByeByeFirst;
- bool m_IsBroadcast;
-};
-
-/*----------------------------------------------------------------------
-| PLT_NetworkInterfaceAddressSearchIterator class
-+---------------------------------------------------------------------*/
-class PLT_NetworkInterfaceAddressSearchIterator
-{
-public:
- PLT_NetworkInterfaceAddressSearchIterator(NPT_String ip) : m_Ip(ip) {}
- virtual ~PLT_NetworkInterfaceAddressSearchIterator() {}
-
- NPT_Result operator()(NPT_NetworkInterface*& addr) const {
- NPT_List<NPT_NetworkInterfaceAddress>::Iterator niaddr = addr->GetAddresses().GetFirstItem();
- if (!niaddr) return NPT_FAILURE;
-
- return (m_Ip.Compare((*niaddr).GetPrimaryAddress().ToString(), true) == 0) ? NPT_SUCCESS : NPT_FAILURE;
- }
-
-private:
- NPT_String m_Ip;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpPacketListenerIterator class
-+---------------------------------------------------------------------*/
-class PLT_SsdpPacketListenerIterator
-{
-public:
- PLT_SsdpPacketListenerIterator(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context) :
- m_Request(request), m_Context(context) {}
-
- NPT_Result operator()(PLT_SsdpPacketListener*& listener) const {
- return listener->OnSsdpPacket(m_Request, m_Context);
- }
-
-private:
- NPT_HttpRequest& m_Request;
- const NPT_HttpRequestContext& m_Context;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpListenTask class
-+---------------------------------------------------------------------*/
-class PLT_SsdpListenTask : public PLT_HttpServerSocketTask
-{
-public:
- PLT_SsdpListenTask(NPT_Socket* socket,
- bool multicast = true,
- bool join_hard = false) :
- PLT_HttpServerSocketTask(socket, true),
- m_Multicast(multicast), m_JoinHard(join_hard) {}
-
- NPT_Result AddListener(PLT_SsdpPacketListener* listener) {
- NPT_AutoLock lock(m_Mutex);
- m_Listeners.Add(listener);
- return NPT_SUCCESS;
- }
-
- NPT_Result RemoveListener(PLT_SsdpPacketListener* listener) {
- NPT_AutoLock lock(m_Mutex);
- m_Listeners.Remove(listener);
- return NPT_SUCCESS;
- }
-
-protected:
- virtual ~PLT_SsdpListenTask() {}
-
- // PLT_ThreadTask methods
- virtual void DoInit();
-
- // PLT_HttpServerSocketTask methods
- NPT_Result GetInputStream(NPT_InputStreamReference& stream);
- NPT_Result GetInfo(NPT_SocketInfo& info);
- NPT_Result ProcessRequest(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse*& response,
- bool& headers_only);
-
-protected:
- PLT_InputDatagramStreamReference m_Datagram;
- bool m_Multicast;
- bool m_JoinHard;
- NPT_List<PLT_SsdpPacketListener*> m_Listeners;
- NPT_Mutex m_Mutex;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpSearchTask class
-+---------------------------------------------------------------------*/
-class PLT_SsdpSearchTask : public PLT_ThreadTask
-{
-public:
- PLT_SsdpSearchTask(NPT_UdpSocket* socket,
- PLT_SsdpSearchResponseListener* listener,
- NPT_HttpRequest* request,
- NPT_Timeout frequency); // pass 0 for one time
-
-protected:
- virtual ~PLT_SsdpSearchTask();
-
- // PLT_ThreadTask methods
- virtual void DoAbort();
- virtual void DoRun();
-
- virtual NPT_Result ProcessResponse(NPT_Result res,
- NPT_HttpRequest* request,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response);
-
-private:
- PLT_SsdpSearchResponseListener* m_Listener;
- NPT_HttpRequest* m_Request;
- NPT_Timeout m_Timeout;
- bool m_Repeat;
- NPT_UdpSocket* m_Socket;
-};
-
-#endif /* _PLT_SSDP_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - SSDP Listener
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_SSDP_LISTENER_H_
-#define _PLT_SSDP_LISTENER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| PLT_SsdpPacketListener class
-+---------------------------------------------------------------------*/
-class PLT_SsdpPacketListener
-{
-public:
- virtual ~PLT_SsdpPacketListener() {}
- virtual NPT_Result OnSsdpPacket(NPT_HttpRequest& request,
- const NPT_HttpRequestContext& context) = 0;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SsdpSearchResponseListener class
-+---------------------------------------------------------------------*/
-class PLT_SsdpSearchResponseListener
-{
-public:
- virtual ~PLT_SsdpSearchResponseListener() {}
- virtual NPT_Result ProcessSsdpSearchResponse(NPT_Result res,
- const NPT_HttpRequestContext& context,
- NPT_HttpResponse* response) = 0;
-};
-
-#endif /* _PLT_SSDP_LISTENER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Service State Variable
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_STATE_VARIABLE_H_
-#define _PLT_STATE_VARIABLE_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_Argument;
-class PLT_Service;
-
-/*----------------------------------------------------------------------
-| NPT_AllowedValueRange class
-+---------------------------------------------------------------------*/
-typedef struct {
- NPT_Int32 min_value;
- NPT_Int32 max_value;
- NPT_Int32 step;
-} NPT_AllowedValueRange;
-
-/*----------------------------------------------------------------------
-| PLT_StateVariable class
-+---------------------------------------------------------------------*/
-class PLT_StateVariable
-{
-public:
- PLT_StateVariable(PLT_Service* service);
- ~PLT_StateVariable();
-
- NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
- PLT_Service* GetService();
- bool IsSendingEvents(bool indirectly = false);
- void DisableIndirectEventing();
- NPT_Result SetRate(NPT_TimeInterval rate);
- NPT_Result SetValue(const char* value);
- NPT_Result ValidateValue(const char* value);
- NPT_Result Serialize(NPT_XmlElementNode& node);
- NPT_Result SetExtraAttribute(const char* name, const char* value);
-
- const NPT_String& GetName() const { return m_Name; }
- const NPT_String& GetValue() const { return m_Value; }
- const NPT_String& GetDataType() const { return m_DataType; }
- const NPT_AllowedValueRange* GetAllowedValueRange() const { return m_AllowedValueRange; }
-
- static PLT_StateVariable* Find(NPT_List<PLT_StateVariable*>& vars,
- const char* name);
-
-protected:
- bool IsReadyToPublish();
-
-protected:
- friend class PLT_Service;
-
- //members
- PLT_Service* m_Service;
- NPT_AllowedValueRange* m_AllowedValueRange;
- NPT_String m_Name;
- NPT_String m_DataType;
- NPT_String m_DefaultValue;
- bool m_IsSendingEvents;
- bool m_IsSendingEventsIndirectly;
- NPT_TimeInterval m_Rate;
- NPT_TimeStamp m_LastEvent;
- NPT_Array<NPT_String*> m_AllowedValues;
- NPT_String m_Value;
-
- NPT_Map<NPT_String,NPT_String> m_ExtraAttributes;
-};
-
-/*----------------------------------------------------------------------
-| PLT_StateVariableNameFinder
-+---------------------------------------------------------------------*/
-class PLT_StateVariableNameFinder
-{
-public:
- // methods
- PLT_StateVariableNameFinder(const char* name) : m_Name(name) {}
- virtual ~PLT_StateVariableNameFinder() {}
-
- bool operator()(const PLT_StateVariable* const & state_variable) const {
- return state_variable->GetName().Compare(m_Name, true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_Name;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ListStateVariableNameFinder
-+---------------------------------------------------------------------*/
-class PLT_ListStateVariableNameFinder
-{
-public:
- // methods
- PLT_ListStateVariableNameFinder(const char* name) : m_Name(name) {}
- virtual ~PLT_ListStateVariableNameFinder() {}
-
- bool operator()(const PLT_StateVariable* const & state_variable) const {
- return state_variable->GetName().Compare(m_Name, true) ? false : true;
- }
-
-private:
- // members
- NPT_String m_Name;
-};
-
-#endif /* _PLT_STATE_VARIABLE_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Stream Pump
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_STREAM_PUMP_H_
-#define _PLT_STREAM_PUMP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptStreams.h"
-#include "NptRingBuffer.h"
-
-/*----------------------------------------------------------------------
-| PLT_PipeInputStream
-+---------------------------------------------------------------------*/
-class PLT_PipeInputStream
-{
-public:
- // constructor and destructor
- virtual ~PLT_PipeInputStream() {};
-
- // methods
- virtual NPT_Result Receive(NPT_InputStream& stream, NPT_Size max_bytes_to_read, NPT_Size* bytes_read = 0) = 0;
-};
-
-typedef NPT_Reference<PLT_PipeInputStream> PLT_PipeInputStreamReference;
-
-/*----------------------------------------------------------------------
-| PLT_PipeOutputStream
-+---------------------------------------------------------------------*/
-class PLT_PipeOutputStream
-{
-public:
- // constructor and destructor
- virtual ~PLT_PipeOutputStream() {};
-
- // methods
- virtual NPT_Result Transmit(NPT_OutputStream& stream) = 0;
-};
-
-typedef NPT_Reference<PLT_PipeOutputStream> PLT_PipeOutputStreamReference;
-
-/*----------------------------------------------------------------------
-| PLT_StreamPump class
-+---------------------------------------------------------------------*/
-class PLT_StreamPump
-{
-public:
- virtual ~PLT_StreamPump();
-
-protected:
- // methods
- PLT_StreamPump(NPT_Size size = 65535);
- NPT_Result PullData(NPT_InputStream& input, NPT_Size max_bytes_to_read);
- NPT_Result PushData(NPT_OutputStream& output, NPT_Size& bytes_written);
-
- // members
- NPT_RingBuffer* m_RingBuffer;
- NPT_Offset m_TotalBytesRead;
- NPT_Offset m_TotalBytesWritten;
-};
-
-/*----------------------------------------------------------------------
-| PLT_PipeInputStreamPump class
-+---------------------------------------------------------------------*/
-class PLT_PipeInputStreamPump : public PLT_StreamPump,
- public PLT_PipeInputStream
-{
-public:
- PLT_PipeInputStreamPump(NPT_OutputStreamReference& output, NPT_Size size = 65535);
- virtual ~PLT_PipeInputStreamPump();
-
- NPT_Result Receive(NPT_InputStream& input, NPT_Size max_bytes_to_read, NPT_Size* bytes_read);
-
-protected:
- NPT_OutputStreamReference m_Output;
- NPT_Result m_LastRes;
-};
-
-/*----------------------------------------------------------------------
-| PLT_PipeInputStreamPump class
-+---------------------------------------------------------------------*/
-class PLT_PipeOutputStreamPump : public PLT_StreamPump,
- public PLT_PipeOutputStream
-{
-public:
- PLT_PipeOutputStreamPump(NPT_InputStreamReference& input,
- NPT_Size size = 65535,
- NPT_Size max_bytes_to_read = 0);
- virtual ~PLT_PipeOutputStreamPump();
-
- NPT_Result Transmit(NPT_OutputStream& output);
-
-protected:
- NPT_InputStreamReference m_Input;
- NPT_Size m_MaxBytesToRead;
- NPT_Result m_LastRes;
-};
-
-
-#endif // _PLT_STREAM_PUMP_H_
+++ /dev/null
-/* DO NOT EDIT. This file was automatically generated by GenSvnVersionHeader.py */
-#define PLT_SVN_VERSION 498
-#define PLT_SVN_VERSION_STRING "498"
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Synchronous Media Browser
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_SYNC_MEDIA_BROWSER_
-#define _PLT_SYNC_MEDIA_BROWSER_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltCtrlPoint.h"
-#include "PltMediaBrowser.h"
-#include "PltMediaCache.h"
-
-/*----------------------------------------------------------------------
-| types
-+---------------------------------------------------------------------*/
-typedef NPT_Map<NPT_String, PLT_DeviceDataReference> PLT_DeviceMap;
-typedef NPT_Map<NPT_String, PLT_DeviceDataReference>::Entry PLT_DeviceMapEntry;
-
-typedef struct PLT_BrowseData {
- NPT_SharedVariable shared_var;
- NPT_Result res;
- PLT_BrowseInfo info;
-} PLT_BrowseData;
-
-typedef NPT_Reference<PLT_BrowseData> PLT_BrowseDataReference;
-
-/*----------------------------------------------------------------------
-| PLT_MediaContainerListener
-+---------------------------------------------------------------------*/
-class PLT_MediaContainerChangesListener
-{
-public:
- virtual ~PLT_MediaContainerChangesListener() {}
- virtual void OnContainerChanged(PLT_DeviceDataReference& device,
- const char* item_id,
- const char* update_id) = 0;
-};
-
-/*----------------------------------------------------------------------
-| PLT_SyncMediaBrowser
-+---------------------------------------------------------------------*/
-class PLT_SyncMediaBrowser : public PLT_MediaBrowser,
- public PLT_MediaBrowserDelegate
-{
-public:
- PLT_SyncMediaBrowser(PLT_CtrlPointReference& ctrlPoint,
- bool use_cache = false,
- PLT_MediaContainerChangesListener* listener = NULL);
- virtual ~PLT_SyncMediaBrowser();
-
- // PLT_MediaBrowser methods
- virtual NPT_Result OnDeviceAdded(PLT_DeviceDataReference& device);
- virtual NPT_Result OnDeviceRemoved(PLT_DeviceDataReference& device);
-
- // PLT_MediaBrowserDelegate methods
- virtual void OnMSStateVariablesChanged(PLT_Service* service,
- NPT_List<PLT_StateVariable*>* vars);
- virtual void OnBrowseResult(NPT_Result res,
- PLT_DeviceDataReference& device,
- PLT_BrowseInfo* info,
- void* userdata);
-
- // methods
- void SetContainerListener(PLT_MediaContainerChangesListener* listener) {
- m_ContainerListener = listener;
- }
- NPT_Result BrowseSync(PLT_DeviceDataReference& device,
- const char* id,
- PLT_MediaObjectListReference& list,
- bool metadata = false,
- NPT_Int32 start = 0,
- NPT_Cardinal max_results = 0); // 0 means all
-
- const NPT_Lock<PLT_DeviceMap>& GetMediaServersMap() const { return m_MediaServers; }
- bool IsCached(const char* uuid, const char* object_id);
-
-protected:
- NPT_Result BrowseSync(PLT_BrowseDataReference& browse_data,
- PLT_DeviceDataReference& device,
- const char* object_id,
- NPT_Int32 index,
- NPT_Int32 count,
- bool browse_metadata = false,
- const char* filter = "dc:date,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:album,upnp:artist,upnp:author", // explicitely specify res otherwise WMP won't return a URL!
- const char* sort = "");
-private:
- NPT_Result Find(const char* ip, PLT_DeviceDataReference& device);
- NPT_Result WaitForResponse(NPT_SharedVariable& shared_var);
-
-private:
- NPT_Lock<PLT_DeviceMap> m_MediaServers;
- PLT_MediaContainerChangesListener* m_ContainerListener;
- bool m_UseCache;
- PLT_MediaCache m_Cache;
-};
-
-/*----------------------------------------------------------------------
-| PLT_DeviceMapFinderByIp
-+---------------------------------------------------------------------*/
-class PLT_DeviceMapFinderByIp
-{
-public:
- // methods
- PLT_DeviceMapFinderByIp(const char* ip) : m_IP(ip) {}
-
- bool operator()(const PLT_DeviceMapEntry* const& entry) const {
- PLT_DeviceDataReference device = entry->GetValue();
- return (device->GetURLBase().GetHost() == m_IP);
- }
-
-private:
- // members
- NPT_String m_IP;
-};
-
-/*----------------------------------------------------------------------
-| PLT_DeviceFinderByUUID
-+---------------------------------------------------------------------*/
-class PLT_DeviceMapFinderByUUID
-{
-public:
- // methods
- PLT_DeviceMapFinderByUUID(const char* uuid) : m_UUID(uuid) {}
-
- bool operator()(const PLT_DeviceMapEntry* const& entry) const {
- PLT_DeviceDataReference device = entry->GetValue();
- return device->GetUUID() == m_UUID;
- }
-
-private:
- // members
- NPT_String m_UUID;
-};
-
-#endif /* _PLT_SYNC_MEDIA_BROWSER_ */
-
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Task Manager
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_TASKMANAGER_H_
-#define _PLT_TASKMANAGER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| forward declarations
-+---------------------------------------------------------------------*/
-class PLT_ThreadTask;
-
-/*----------------------------------------------------------------------
-| PLT_TaskManager class
-+---------------------------------------------------------------------*/
-class PLT_TaskManager
-{
- friend class PLT_ThreadTask;
- friend class PLT_ThreadTaskCallback;
-
-public:
- PLT_TaskManager(NPT_Cardinal max_items = 0);
- virtual ~PLT_TaskManager();
-
- // tasks related methods
- virtual NPT_Result StartTask(PLT_ThreadTask* task,
- NPT_TimeInterval* delay = NULL,
- bool auto_destroy = true);
-
- // methods
- NPT_Result StopAllTasks();
-
-private:
- // called by PLT_ThreadTaskCallback
- NPT_Mutex& GetCallbackLock() { return m_CallbackLock; }
-
- // called by PLT_ThreadTask
- NPT_Result AddTask(PLT_ThreadTask* task);
- NPT_Result RemoveTask(PLT_ThreadTask* task);
-
-private:
- NPT_List<PLT_ThreadTask*> m_Tasks;
- NPT_Mutex m_TasksLock;
- NPT_Mutex m_CallbackLock;
- NPT_Queue<int>* m_Queue;
-};
-
-#endif /* _PLT_TASKMANAGER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Thread Tasks
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_THREADTASK_H_
-#define _PLT_THREADTASK_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-#include "PltTaskManager.h"
-
-/*----------------------------------------------------------------------
-| PLT_ThreadTask class
-+---------------------------------------------------------------------*/
-class PLT_ThreadTask : public NPT_Runnable
-{
-public:
- friend class PLT_TaskManager;
-
- PLT_ThreadTask();
-
- NPT_Result Kill();
-
- virtual bool IsAborting(NPT_Timeout timeout = NPT_TIMEOUT_INFINITE) {
- return NPT_SUCCEEDED(m_Abort.WaitUntilEquals(1, timeout));
- }
-
-protected:
- NPT_Result Start(PLT_TaskManager* task_manager = NULL,
- NPT_TimeInterval* delay = NULL,
- bool auto_destroy = true);
- NPT_Result Stop(bool blocking = true);
-
- // overridable
- virtual void DoAbort() {}
- virtual void DoRun() {}
- virtual void DoInit() {}
-
- // the task manager will destroy the task when finished
- // if m_AutoDestroy is set otherwise use Kill
- virtual ~PLT_ThreadTask();
-
-private:
- // NPT_Thread methods
- void Run();
-
-protected:
- // members
- PLT_TaskManager* m_TaskManager;
-
-private:
- // members
- NPT_SharedVariable m_Abort;
- NPT_Thread* m_Thread;
- bool m_AutoDestroy;
- NPT_TimeInterval m_Delay;
-};
-
-/*----------------------------------------------------------------------
-| PLT_ThreadTaskCallback class
-+---------------------------------------------------------------------*/
-class PLT_ThreadTaskCallback
-{
-public:
- PLT_ThreadTaskCallback(NPT_Mutex& lock) : m_Lock(lock) {}
- virtual ~PLT_ThreadTaskCallback() {};
-
- NPT_Result Callback();
-
-protected:
- virtual NPT_Result DoCallback() = 0;
-
-protected:
- NPT_Mutex& m_Lock;
-};
-
-#endif /* _PLT_THREADTASK_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Time
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_TIME_H_
-#define _PLT_TIME_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "NptTypes.h"
-#include "NptTime.h"
-
-/*----------------------------------------------------------------------
-| PLT_Time
-+---------------------------------------------------------------------*/
-class PLT_Time
-{
-public:
- // methods
- static NPT_Result GetTimeStampFromDate(const NPT_Date& date,
- NPT_TimeStamp& timestamp);
-
- /* helper functions */
- static NPT_Result SetDateTimeZone(NPT_Date& date, NPT_TimeZone tz);
-};
-
-#endif // _NPT_TIME_H_
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - UPnP Engine
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_UPNP_H_
-#define _PLT_UPNP_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltTaskManager.h"
-#include "PltCtrlPoint.h"
-#include "PltDeviceHost.h"
-#include "PltUPnPHelper.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define PLT_DLNA_SSDP_DELAY 0.02f
-
-/*----------------------------------------------------------------------
-| forward definitions
-+---------------------------------------------------------------------*/
-class PLT_SsdpListenTask;
-
-/*----------------------------------------------------------------------
-| PLT_UPnP class
-+---------------------------------------------------------------------*/
-class PLT_UPnP
-{
-public:
- PLT_UPnP(NPT_UInt32 ssdp_port = 1900, bool multicast = true);
- ~PLT_UPnP();
-
- NPT_Result AddDevice(PLT_DeviceHostReference& device);
- NPT_Result AddCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
-
- NPT_Result RemoveDevice(PLT_DeviceHostReference& device);
- NPT_Result RemoveCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
-
- NPT_Result Start();
- NPT_Result Stop();
-
- void SetIgnoreLocalUUIDs(bool ignore) { m_IgnoreLocalUUIDs = ignore; }
-
-private:
- // members
- NPT_Mutex m_Lock;
- NPT_List<PLT_DeviceHostReference> m_Devices;
- NPT_List<PLT_CtrlPointReference> m_CtrlPoints;
- PLT_TaskManager m_TaskManager;
-
- // since we can only have one socket listening on port 1900,
- // we create it in here and we will attach every control points
- // and devices to it when they're added
- bool m_Started;
- NPT_UInt32 m_Port;
- bool m_Multicast;
- PLT_SsdpListenTask* m_SsdpListenTask;
- bool m_IgnoreLocalUUIDs;
-};
-
-#endif /* _PLT_UPNP_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - UPnP Helper
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_UPNP_HELPER_H_
-#define _PLT_UPNP_HELPER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-
-/*----------------------------------------------------------------------
-| NPT_StringFinder
-+---------------------------------------------------------------------*/
-class NPT_StringFinder
-{
-public:
- // methods
- NPT_StringFinder(const char* value) : m_Value(value) {}
- virtual ~NPT_StringFinder() {}
- bool operator()(const NPT_String* const & value) const {
- return value->Compare(m_Value) ? false : true;
- }
- bool operator()(const NPT_String& value) const {
- return value.Compare(m_Value) ? false : true;
- }
-
-private:
- // members
- NPT_String m_Value;
-};
-
-/*----------------------------------------------------------------------
-| PLT_UPnPMessageHelper class
-+---------------------------------------------------------------------*/
-class PLT_UPnPMessageHelper
-{
-public:
- // methods
- static const NPT_String* GetST(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("ST");
- }
- static NPT_Result SetST(NPT_HttpMessage& message,
- const char* st) {
- return message.GetHeaders().SetHeader("ST", st);
- }
- static const NPT_String* GetNT(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("NT");
- }
- static NPT_Result SetNT(NPT_HttpMessage& message,
- const char* nt) {
- return message.GetHeaders().SetHeader("NT", nt);
- }
- static const NPT_String* GetNTS(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("NTS");
- }
- static NPT_Result SetNTS(NPT_HttpMessage& message,
- const char* nts) {
- return message.GetHeaders().SetHeader("NTS", nts);
- }
- static const NPT_String* GetMAN(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("MAN");
- }
- static NPT_Result SetMAN(NPT_HttpMessage& message,
- const char* man) {
- return message.GetHeaders().SetHeader("MAN", man);
- }
- static const NPT_String* GetLocation(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("LOCATION");
- }
- static NPT_Result SetLocation(NPT_HttpMessage& message,
- const char* location) {
- return message.GetHeaders().SetHeader("LOCATION", location);
- }
- static const NPT_String* GetServer(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_SERVER);
- }
- static NPT_Result SetServer(NPT_HttpMessage& message,
- const char* server,
- bool replace = true) {
- return message.GetHeaders().SetHeader(
- NPT_HTTP_HEADER_SERVER,
- server,
- replace);
- }
- static const NPT_String* GetUSN(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("USN");
- }
- static NPT_Result SetUSN(NPT_HttpMessage& message,
- const char* usn) {
- return message.GetHeaders().SetHeader("USN", usn);
- }
- static const NPT_String* GetCallbacks(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("CALLBACK");
- }
- static NPT_Result SetCallbacks(NPT_HttpMessage& message,
- const char* callbacks) {
- return message.GetHeaders().SetHeader("CALLBACK", callbacks);
- }
- static const NPT_String* GetSID(NPT_HttpMessage& message) {
- return message.GetHeaders().GetHeaderValue("SID");
- }
- static NPT_Result SetSID(NPT_HttpMessage& message,
- const char* sid) {
- return message.GetHeaders().SetHeader("SID", sid);
- }
- static NPT_Result GetLeaseTime(NPT_HttpMessage& message,
- NPT_Timeout& value) {
- value = 0;
- const NPT_String* cc =
- message.GetHeaders().GetHeaderValue("CACHE-CONTROL");
- NPT_CHECK_POINTER(cc);
- return ExtractLeaseTime(*cc, value);
- }
- static NPT_Result SetLeaseTime(NPT_HttpMessage& message,
- const NPT_Timeout lease) {
- return message.GetHeaders().SetHeader(
- "CACHE-CONTROL",
- "max-age="+NPT_String::FromInteger(lease));
- }
- static NPT_Result GetTimeOut(NPT_HttpMessage& message,
- NPT_Int32& value) {
- value = 0;
- const NPT_String* timeout =
- message.GetHeaders().GetHeaderValue("TIMEOUT");
- NPT_CHECK_POINTER(timeout);
- return ExtractTimeOut(*timeout, value);
- }
- static NPT_Result SetTimeOut(NPT_HttpMessage& message,
- const NPT_Int32 timeout) {
- if (timeout >= 0) {
- return message.GetHeaders().SetHeader(
- "TIMEOUT",
- "Second-"+NPT_String::FromInteger(timeout));
- } else {
- return message.GetHeaders().SetHeader(
- "TIMEOUT", "Second-infinite");
- }
- }
- static NPT_Result GetMX(NPT_HttpMessage& message,
- NPT_UInt32& value) {
- value = 0;
- const NPT_String* mx =
- message.GetHeaders().GetHeaderValue("MX");
- NPT_CHECK_POINTER(mx);
- return NPT_ParseInteger32(*mx, value);
- }
- static NPT_Result SetMX(NPT_HttpMessage& message,
- const NPT_UInt32 mx) {
- return message.GetHeaders().SetHeader(
- "MX",
- NPT_String::FromInteger(mx));
- }
- static NPT_Result GetSeq(NPT_HttpMessage& message,
- NPT_UInt32& value) {
- value = 0;
- const NPT_String* seq =
- message.GetHeaders().GetHeaderValue("SEQ");
- NPT_CHECK_POINTER(seq);
- return NPT_ParseInteger32(*seq, value);
- }
- static NPT_Result SetSeq(NPT_HttpMessage& message,
- const NPT_UInt32 seq) {
- return message.GetHeaders().SetHeader(
- "SEQ",
- NPT_String::FromInteger(seq));
- }
- static const char* GenerateUUID(int count,
- NPT_String& uuid) {
- uuid = "";
- for (int i=0;i<(count<100?count:100);i++) {
- int random = NPT_System::GetRandomInteger();
- uuid += (char)((random % 25) + 66);
- }
- return uuid;
- }
- static const char* GenerateGUID(NPT_String& guid) {
- guid = "";
- for (int i=0;i<32;i++) {
- char nibble = (char)(NPT_System::GetRandomInteger() % 16);
- guid += (nibble < 10) ? ('0' + nibble) : ('a' + (nibble-10));
- if (i == 7 || i == 11 || i == 15 || i == 19) {
- guid += '-';
- }
- }
- return guid;
- }
- static NPT_Result ExtractLeaseTime(const char* cache_control,
- NPT_Timeout& lease) {
- int value;
- if (cache_control &&
- sscanf(cache_control, "max-age=%d", &value) == 1) {
- lease = value;
- return NPT_SUCCESS;
- }
- return NPT_FAILURE;
- }
- static NPT_Result ExtractTimeOut(const char* timeout,
- NPT_Int32& len) {
- NPT_String temp = timeout;
- if (temp.CompareN("Second-", 7, true)) {
- return NPT_ERROR_INVALID_FORMAT;
- }
-
- if (temp.Compare("Second-infinite", true) == 0) {
- len = NPT_TIMEOUT_INFINITE;
- return NPT_SUCCESS;
- }
- return temp.SubString(7).ToInteger(len);
- }
- static NPT_Result GetIPAddresses(NPT_List<NPT_IpAddress>& ips,
- bool with_localhost = false) {
- NPT_List<NPT_NetworkInterface*> if_list;
- NPT_CHECK(NPT_NetworkInterface::GetNetworkInterfaces(if_list));
-
- NPT_List<NPT_NetworkInterface*>::Iterator iface =
- if_list.GetFirstItem();
- while (iface) {
- NPT_IpAddress ip =
- (*(*iface)->GetAddresses().GetFirstItem()).GetPrimaryAddress();
- if (ip.ToString().Compare("0.0.0.0") && ip.ToString().Compare("127.0.0.1")) {
- ips.Add(ip);
- }
- ++iface;
- }
-
- if (ips.GetItemCount() == 0 || with_localhost) {
- NPT_IpAddress localhost;
- localhost.Parse("127.0.0.1");
- ips.Add(localhost);
- }
-
- if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
- return NPT_SUCCESS;
- }
-
- static NPT_Result GetNetworkInterfaces(NPT_List<NPT_NetworkInterface*>& if_list,
- bool with_localhost = false) {
- NPT_CHECK(_GetNetworkInterfaces(if_list, false));
-
- // if no valid interfaces or if requested, add localhost capable interface
- if (if_list.GetItemCount() == 0 || with_localhost) {
- NPT_CHECK(_GetNetworkInterfaces(if_list, true));
- }
- return NPT_SUCCESS;
- }
-
- static NPT_Result GetMACAddresses(NPT_List<NPT_String>& addresses) {
- NPT_List<NPT_NetworkInterface*> if_list;
- NPT_CHECK(NPT_NetworkInterface::GetNetworkInterfaces(if_list));
-
- NPT_List<NPT_NetworkInterface*>::Iterator iface = if_list.GetFirstItem();
- while (iface) {
- NPT_String ip = (*(*iface)->GetAddresses().GetFirstItem()).GetPrimaryAddress().ToString();
- if (ip.Compare("0.0.0.0") && ip.Compare("127.0.0.1")) {
- addresses.Add((*iface)->GetMacAddress().ToString());
- }
- ++iface;
- }
-
- if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
- return NPT_SUCCESS;
- }
-
-
- static bool IsLocalNetworkAddress(const NPT_IpAddress& address) {
- if(address.ToString() == "127.0.0.1") return true;
-
- NPT_List<NPT_NetworkInterface*> if_list;
- NPT_NetworkInterface::GetNetworkInterfaces(if_list);
-
- NPT_List<NPT_NetworkInterface*>::Iterator iface = if_list.GetFirstItem();
- while (iface) {
- if((*iface)->IsAddressInNetwork(address)) return true;
- ++iface;
- }
-
- if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
- return false;
- }
-
-private:
-
- static NPT_Result _GetNetworkInterfaces(NPT_List<NPT_NetworkInterface*>& if_list,
- bool only_localhost = false) {
- NPT_List<NPT_NetworkInterface*> _if_list;
- NPT_CHECK(NPT_NetworkInterface::GetNetworkInterfaces(_if_list));
-
- NPT_NetworkInterface* iface;
- while (NPT_SUCCEEDED(_if_list.PopHead(iface))) {
- NPT_String ip =
- iface->GetAddresses().GetFirstItem()->GetPrimaryAddress().ToString();
- if (ip.Compare("0.0.0.0") &&
- ((!only_localhost && ip.Compare("127.0.0.1")) ||
- (only_localhost && !ip.Compare("127.0.0.1")))) {
- if_list.Add(iface);
-
- // add localhost only once
- if (only_localhost) break;
- } else {
- delete iface;
- }
- }
-
- // cleanup any remaining items in list if we breaked early
- _if_list.Apply(NPT_ObjectDeleter<NPT_NetworkInterface>());
- return NPT_SUCCESS;
- }
-};
-
-#endif /* _PLT_UPNP_HELPER_H_ */
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Version Info
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_VERSION_H_
-#define _PLT_VERSION_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "PltSvnVersion.h"
-
-/*----------------------------------------------------------------------
-| constants
-+---------------------------------------------------------------------*/
-#define PLT_PLATINUM_SDK_VERSION 0x00050400
-#define PLT_PLATINUM_SDK_VERSION_STRING "0.5.4.0"
-
-#endif // _PLT_VERSION_H_
+++ /dev/null
-/*****************************************************************
-|
-| Platinum - Xml Helper
-|
-| Copyright (c) 2004-2008, Plutinosoft, LLC.
-| All rights reserved.
-| http://www.plutinosoft.com
-|
-| This program is free software; you can redistribute it and/or
-| modify it under the terms of the GNU General Public License
-| as published by the Free Software Foundation; either version 2
-| of the License, or (at your option) any later version.
-|
-| OEMs, ISVs, VARs and other distributors that combine and
-| distribute commercially licensed software with Platinum software
-| and do not wish to distribute the source code for the commercially
-| licensed software under version 2, or (at your option) any later
-| version, of the GNU General Public License (the "GPL") must enter
-| into a commercial license agreement with Plutinosoft, LLC.
-|
-| This program is distributed in the hope that it will be useful,
-| but WITHOUT ANY WARRANTY; without even the implied warranty of
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-| GNU General Public License for more details.
-|
-| You should have received a copy of the GNU General Public License
-| along with this program; see the file LICENSE.txt. If not, write to
-| the Free Software Foundation, Inc.,
-| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-| http://www.gnu.org/licenses/gpl-2.0.html
-|
-****************************************************************/
-
-#ifndef _PLT_XML_HELPER_H_
-#define _PLT_XML_HELPER_H_
-
-/*----------------------------------------------------------------------
-| includes
-+---------------------------------------------------------------------*/
-#include "Neptune.h"
-/*----------------------------------------------------------------------
-| PLT_XmlAttributeFinder
-+---------------------------------------------------------------------*/
-class PLT_XmlAttributeFinder
-{
-public:
- // if 'namespc' is NULL, we're looking for ANY namespace
- // if 'namespc' is '\0', we're looking for NO namespace
- // if 'namespc' is non-empty, look for that SPECIFIC namespace
- PLT_XmlAttributeFinder(const NPT_XmlElementNode& element,
- const char* name,
- const char* namespc) :
- m_Element(element), m_Name(name), m_Namespace(namespc) {}
-
- bool operator()(const NPT_XmlAttribute* const & attribute) const {
- if (attribute->GetName() == m_Name) {
- if (m_Namespace) {
- const NPT_String& prefix = attribute->GetPrefix();
- if (m_Namespace[0] == '\0') {
- // match if the attribute has NO namespace
- return prefix.IsEmpty();
- } else {
- // match if the attribute has the SPECIFIC namespace
- // we're looking for
- const NPT_String* namespc = m_Element.GetNamespaceUri(prefix);
- return namespc && *namespc == m_Namespace;
- }
- } else {
- // ANY namespace will match
- return true;
- }
- } else {
- return false;
- }
- }
-
-private:
- const NPT_XmlElementNode& m_Element;
- const char* m_Name;
- const char* m_Namespace;
-};
-
-/*----------------------------------------------------------------------
-| PLT_XmlHelper
-+---------------------------------------------------------------------*/
-class PLT_XmlHelper
-{
-public:
-
- // static methods
- static NPT_Result GetChildText(NPT_XmlElementNode* node,
- const char* tag,
- NPT_String& value,
- const char* namespc = "") {
- value = "";
-
- if (!node) return NPT_FAILURE;
-
- // special case "" means we look for the same namespace as the parent
- if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
-
- NPT_XmlElementNode* child = node->GetChild(tag, namespc);
- if (!child) return NPT_FAILURE;
-
- const NPT_String* text = child->GetText();
- value = text?*text:"";
- return NPT_SUCCESS;
- }
-
- static NPT_Result RemoveAttribute(NPT_XmlElementNode* node,
- const char* name,
- const char* namespc = "") {
- if (!node) return NPT_FAILURE;
-
- // special case "" means we look for the same namespace as the parent
- if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
-
- NPT_List<NPT_XmlAttribute*>::Iterator attribute;
- attribute = node->GetAttributes().Find(PLT_XmlAttributeFinder(*node, name, namespc));
- if (!attribute) return NPT_FAILURE;
-
- delete *attribute;
- NPT_CHECK(node->GetAttributes().Erase(attribute));
-
- return NPT_SUCCESS;
- }
-
- static NPT_Result GetAttribute(NPT_XmlElementNode* node,
- const char* name,
- NPT_XmlAttribute*& attr,
- const char* namespc = "") {
- attr = NULL;
-
- if (!node) return NPT_FAILURE;
-
- // special case "" means we look for the same namespace as the parent
- if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
-
- NPT_List<NPT_XmlAttribute*>::Iterator attribute;
- attribute = node->GetAttributes().Find(PLT_XmlAttributeFinder(*node, name, namespc));
- if (!attribute) return NPT_FAILURE;
-
- attr = (*attribute);
- return NPT_SUCCESS;
- }
-
- static NPT_Result GetAttribute(NPT_XmlElementNode* node,
- const char* name,
- NPT_String& value,
- const char* namespc = "") {
- value = "";
-
- NPT_XmlAttribute* attribute = NULL;
- NPT_CHECK(GetAttribute(node, name, attribute, namespc));
- if (!attribute) return NPT_FAILURE;
-
- value = attribute->GetValue();
- return NPT_SUCCESS;
- }
-
- static NPT_Result SetAttribute(NPT_XmlElementNode* node,
- const char* name,
- NPT_String& value,
- const char* namespc = "") {
- NPT_XmlAttribute* attribute = NULL;
- NPT_CHECK(GetAttribute(node, name, attribute, namespc));
- if (!attribute) return NPT_FAILURE;
-
- attribute->SetValue(value);
- return NPT_SUCCESS;
- }
-
- static NPT_Result AddChildText(NPT_XmlElementNode* node,
- const char* tag,
- const char* text,
- const char* prefix = NULL) {
- if (!node) return NPT_FAILURE;
- NPT_XmlElementNode* child = new NPT_XmlElementNode(prefix, tag);
- child->AddText(text);
- return node->AddChild(child);
- }
-
- static bool IsMatch(const NPT_XmlNode* const & node, const char* tag, const char* namespc_mapped) {
- // if m_Namespace is NULL, we're looking for ANY namespace
- // if m_Namespace is '\0', we're looking for NO namespace
- // if m_Namespace is non-empty, look for that SPECIFIC namespace
-
- const NPT_XmlElementNode* element = node->AsElementNode();
- // is tag the same (case sensitive)?
- if (element && element->GetTag() == tag) {
- if (namespc_mapped) {
- // look for a SPECIFIC namespace or NO namespace
- const NPT_String* namespc = element->GetNamespace();
- if (namespc) {
- // the element has a namespace, match if it is equal to
- // what we're looking for
- return *namespc == namespc_mapped;
- } else {
- // the element does not have a namespace, match if we're
- // looking for NO namespace
- return namespc_mapped[0] == '\0';
- }
- } else {
- // ANY namespace will match
- return true;
- }
- }
- return false;
- }
-
- static NPT_Result GetChildren(NPT_XmlElementNode* node,
- NPT_Array<NPT_XmlElementNode*>& children,
- const char* tag,
- const char* namespc = "") {
- if (!node) return NPT_FAILURE;
-
- // special case "" means we look for the same namespace as the parent
- if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
-
- const char* namespc_mapped = (namespc==NULL)?"":(namespc[0]=='*' && namespc[1]=='\0')?NULL:namespc;
-
- // get all children first
- NPT_List<NPT_XmlNode*>& allchildren = node->GetChildren();
-
- // iterate through children and add only elements with matching tag
- NPT_List<NPT_XmlNode*>::Iterator child = allchildren.GetFirstItem();
- while (child) {
- if (IsMatch(*child, tag, namespc_mapped)) {
- children.Add((*child)->AsElementNode());
- }
- ++child;
- }
- return NPT_SUCCESS;
- }
-
- static NPT_XmlElementNode* GetChild(NPT_XmlElementNode* node,
- const char* tag,
- const char* namespc = "") {
- if (!node) return NULL;
-
- // special case "" means we look for the same namespace as the parent
- if (namespc && namespc[0] == '\0') namespc = node->GetNamespace()?node->GetNamespace()->GetChars():NPT_XML_NO_NAMESPACE;
-
- return node->GetChild(tag, namespc);
- }
-
- static NPT_Result GetChild(NPT_XmlElementNode* parent,
- NPT_XmlElementNode*& child,
- NPT_Ordinal n = 0) {
- if (!parent) return NPT_FAILURE;
-
- // reset child
- child = NULL;
-
- // get all children first
- NPT_List<NPT_XmlNode*>::Iterator children = parent->GetChildren().GetFirstItem();
- while (children) {
- if ((*children)->AsElementNode() && n-- == 0) {
- child = (*children)->AsElementNode();
- return NPT_SUCCESS;
- }
- children++;
- }
-
- return NPT_FAILURE;
- }
-
- static NPT_Result Serialize(NPT_XmlNode& node, NPT_String& xml, bool add_header = true) {
- NPT_XmlWriter writer(0);
- NPT_StringOutputStreamReference stream(new NPT_StringOutputStream(&xml));
- NPT_CHECK(writer.Serialize(node, *stream, add_header));
- return NPT_SUCCESS;
- }
-
- static NPT_String Serialize(NPT_XmlNode& node, bool add_header = true) {
- NPT_XmlWriter writer(0);
- NPT_String xml;
- NPT_StringOutputStreamReference stream(new NPT_StringOutputStream(&xml));
- if (NPT_FAILED(writer.Serialize(node, *stream, add_header))) {
- NPT_Debug("Failed to serialize xml node");
- return "";
- }
-
- return xml;
- }
-private:
- // members
-};
-
-#endif // _PLT_XML_HELPER_H_
-
-
-
-
-
-
-
-
-
vpath %.c $(SRC_PATH)/modules/pulseaudio
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
typedef struct
{
- pa_simple *playback_handle;
- pa_sample_spec sample_spec;
- const char *output_name;
- const char *output_description;
- int errors;
+ pa_simple *playback_handle;
+ pa_sample_spec sample_spec;
+ const char *output_name;
+ const char *output_description;
+ u32 errors;
+ u32 consecutive_zero_reads;
} PulseAudioContext;
static void
free_pulseaudio_resources (GF_AudioOutput * dr)
{
- if (dr == NULL)
- return;
- PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
- if (ctx == NULL)
- return;
- if (ctx->playback_handle != NULL)
+ PulseAudioContext *ctx;
+ if (dr == NULL)
+ return;
+ ctx = (PulseAudioContext *) dr->opaque;
+ if (ctx == NULL)
+ return;
+ if (ctx->playback_handle != NULL)
{
- pa_simple_free (ctx->playback_handle);
+ pa_simple_free (ctx->playback_handle);
}
- ctx->playback_handle = NULL;
+ ctx->playback_handle = NULL;
}
static const char *MODULE_NAME = "PulseAudio";
static GF_Err
PulseAudio_Setup (GF_AudioOutput * dr, void *os_handle,
- u32 num_buffers, u32 total_duration)
+ u32 num_buffers, u32 total_duration)
{
- const char *opt;
- PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
- if (ctx == NULL)
- return GF_BAD_PARAM;
- opt = gf_modules_get_option ((GF_BaseInterface *) dr, MODULE_NAME,
- OUTPUT_NAME);
- ctx->output_name = DEFAULT_OUTPUT_NAME;
- if (opt != NULL)
+ const char *opt;
+ PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
+ if (ctx == NULL)
+ return GF_BAD_PARAM;
+ opt = gf_modules_get_option ((GF_BaseInterface *) dr, MODULE_NAME,
+ OUTPUT_NAME);
+ ctx->output_name = DEFAULT_OUTPUT_NAME;
+ if (opt != NULL)
{
- ctx->output_name = opt;
+ ctx->output_name = opt;
}
- else
+ else
{
- gf_modules_set_option ((GF_BaseInterface *) dr, MODULE_NAME,
- OUTPUT_NAME, DEFAULT_OUTPUT_NAME);
+ gf_modules_set_option ((GF_BaseInterface *) dr, MODULE_NAME,
+ OUTPUT_NAME, DEFAULT_OUTPUT_NAME);
}
- opt = gf_modules_get_option ((GF_BaseInterface *) dr, MODULE_NAME,
- OUTPUT_DESCRIPTION);
- ctx->output_description = DEFAULT_OUTPUT_DESCRIPTION;
- if (opt != NULL)
+ opt = gf_modules_get_option ((GF_BaseInterface *) dr, MODULE_NAME,
+ OUTPUT_DESCRIPTION);
+ ctx->output_description = DEFAULT_OUTPUT_DESCRIPTION;
+ if (opt != NULL)
{
- ctx->output_description = opt;
+ ctx->output_description = opt;
}
- else
+ else
{
- gf_modules_set_option ((GF_BaseInterface *) dr, MODULE_NAME,
- OUTPUT_DESCRIPTION, DEFAULT_OUTPUT_DESCRIPTION);
+ gf_modules_set_option ((GF_BaseInterface *) dr, MODULE_NAME,
+ OUTPUT_DESCRIPTION, DEFAULT_OUTPUT_DESCRIPTION);
}
- return GF_OK;
+ return GF_OK;
}
static void
PulseAudio_Shutdown (GF_AudioOutput * dr)
{
- int pa_error = 0;
- PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
- if (ctx == NULL)
- return;
- if (ctx->playback_handle)
+ int pa_error = 0;
+ PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
+ if (ctx == NULL)
+ return;
+ if (ctx->playback_handle)
{
- GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO,
- ("[PulseAudio] Closing PulseAudio output\n"));
- pa_simple_drain (ctx->playback_handle, &pa_error);
- if (pa_error)
- {
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] Error while closing PulseAudio output: %s\n",
- pa_strerror (pa_error)));
+ GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO,
+ ("[PulseAudio] Closing PulseAudio output\n"));
+ pa_simple_drain (ctx->playback_handle, &pa_error);
+ if (pa_error)
+ {
+ GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
+ ("[PulseAudio] Error while closing PulseAudio output: %s\n",
+ pa_strerror (pa_error)));
- }
+ }
}
}
static GF_Err
PulseAudio_ConfigureOutput (GF_AudioOutput * dr, u32 * SampleRate,
- u32 * NbChannels, u32 * nbBitsPerSample,
- u32 channel_cfg)
+ u32 * NbChannels, u32 * nbBitsPerSample,
+ u32 channel_cfg)
{
- int pa_error = 0;
- PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
- if (ctx->playback_handle != NULL)
+ int pa_error = 0;
+ PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
+ if (ctx->playback_handle != NULL)
{
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] PulseAudio output already configured !\n"));
- /* Should not happen */
- pa_simple_flush (ctx->playback_handle, &pa_error);
- pa_simple_free (ctx->playback_handle);
- ctx->playback_handle = NULL;
+ GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO,
+ ("[PulseAudio] PulseAudio output already configured !\n"));
+ /* Should not happen */
+ pa_simple_flush (ctx->playback_handle, &pa_error);
+ pa_simple_free (ctx->playback_handle);
+ ctx->playback_handle = NULL;
}
- ctx->sample_spec.format = PA_SAMPLE_S16NE;
- ctx->sample_spec.channels = *NbChannels;
- ctx->sample_spec.rate = *SampleRate;
- ctx->playback_handle = pa_simple_new (NULL,
- ctx->output_name,
- PA_STREAM_PLAYBACK,
- NULL,
- ctx->output_description,
- &(ctx->sample_spec),
- NULL, NULL, &pa_error);
- if (ctx->playback_handle == NULL || pa_error != 0)
+ ctx->consecutive_zero_reads = 0;
+ ctx->sample_spec.format = PA_SAMPLE_S16NE;
+ ctx->sample_spec.channels = *NbChannels;
+ ctx->sample_spec.rate = *SampleRate;
+ ctx->playback_handle = pa_simple_new (NULL,
+ ctx->output_name,
+ PA_STREAM_PLAYBACK,
+ NULL,
+ ctx->output_description,
+ &(ctx->sample_spec),
+ NULL, NULL, &pa_error);
+ if (ctx->playback_handle == NULL || pa_error != 0)
{
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] Error while allocating PulseAudio output: %s.\n",
- pa_strerror (pa_error)));
- return GF_IO_ERR;
+ GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
+ ("[PulseAudio] Error while allocating PulseAudio output: %s.\n",
+ pa_strerror (pa_error)));
+ return GF_IO_ERR;
}
- GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO, ("[PulseAudio] Initialized - sampling rate %d - %d channels\n", ctx->sample_spec.rate, ctx->sample_spec.channels));
- return GF_OK;
+ GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO, ("[PulseAudio] Initialized - sampling rate %d - %d channels\n", ctx->sample_spec.rate, ctx->sample_spec.channels));
+ return GF_OK;
}
#define BUFF_SIZE 8192
static void
PulseAudio_WriteAudio (GF_AudioOutput * dr)
{
- char data[BUFF_SIZE];
- int written = 0;
- int pa_error = 0;
- PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
- if (ctx == NULL || ctx->playback_handle == NULL)
+ char data[BUFF_SIZE];
+ int written = 0;
+ int pa_error = 0;
+ PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
+ if (ctx == NULL || ctx->playback_handle == NULL)
{
- if (ctx == NULL || ctx->errors == 0)
- {
- if (ctx != NULL)
- ctx->errors++;
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] unable to connect to a PulseAudio daemon!\n"))}
- return;
+ if (ctx == NULL || ctx->errors == 0)
+ {
+ if (ctx != NULL)
+ ctx->errors++;
+ GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
+ ("[PulseAudio] unable to connect to a PulseAudio daemon!\n"))
+ }
+ return;
}
- written = dr->FillBuffer (dr->audio_renderer, data, BUFF_SIZE / 4);
- if (written <= 0)
+ written = dr->FillBuffer (dr->audio_renderer, data, BUFF_SIZE / 4);
+ if (written <= 0)
{
- return;
+ ctx->consecutive_zero_reads++;
+ if (ctx->consecutive_zero_reads > 5){
+ gf_sleep(5);
+ } else if (ctx->consecutive_zero_reads < 25) {
+ gf_sleep(10);
+ } else {
+ gf_sleep(33);
+ }
+ return;
}
- written = pa_simple_write (ctx->playback_handle, data, written, &pa_error);
- if (pa_error != 0)
+ ctx->consecutive_zero_reads = 0;
+ written = pa_simple_write (ctx->playback_handle, data, written, &pa_error);
+ if (pa_error != 0)
{
- if (ctx->errors < 1)
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] Write failure: %s\n", pa_strerror (pa_error)));
- ctx->errors++;
+ if (ctx->errors < 1)
+ GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
+ ("[PulseAudio] Write failure: %s\n", pa_strerror (pa_error)));
+ ctx->errors++;
}
- else
+ else
{
- ctx->errors = 0;
+ ctx->errors = 0;
}
}
static void
PulseAudio_SetVolume (GF_AudioOutput * dr, u32 Volume)
{
- GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO,
- ("[PulseAudio] Set volume to %lu: not yet implemented.\n", Volume));
+ GF_LOG (GF_LOG_WARNING, GF_LOG_MMIO,
+ ("[PulseAudio] Set volume to %lu: not yet implemented.\n", Volume));
}
static void
static u32
PulseAudio_GetAudioDelay (GF_AudioOutput * dr)
{
- pa_usec_t delay = 0;
- int pa_error = 0;
- u32 ms_delay = 0;
- PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
- if (ctx == NULL || ctx->playback_handle == NULL)
+ pa_usec_t delay = 0;
+ int pa_error = 0;
+ u32 ms_delay = 0;
+ PulseAudioContext *ctx = (PulseAudioContext *) dr->opaque;
+ if (ctx == NULL || ctx->playback_handle == NULL)
{
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] missing connection to pulseaudio daemon!\n"))
- return 0;
+ GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
+ ("[PulseAudio] missing connection to pulseaudio daemon!\n"))
+ return 0;
}
- delay = pa_simple_get_latency (ctx->playback_handle, &pa_error);
- if (pa_error)
+ delay = pa_simple_get_latency (ctx->playback_handle, &pa_error);
+ if (pa_error)
{
- GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
- ("[PulseAudio] Error while retrieving pulseaudio delay: %s.\n",
- pa_strerror (pa_error)));
- return 0;
+ GF_LOG (GF_LOG_ERROR, GF_LOG_MMIO,
+ ("[PulseAudio] Error while retrieving pulseaudio delay: %s.\n",
+ pa_strerror (pa_error)));
+ return 0;
}
- ms_delay = (u32) (delay / 1000);
- GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO, ("[PulseAudio] Audio delay: %llu us.\n",
- delay));
- return ms_delay;
+ ms_delay = (u32) (delay / 1000);
+ GF_LOG (GF_LOG_DEBUG, GF_LOG_MMIO, ("[PulseAudio] Audio delay: %llu us.\n",
+ delay));
+ return ms_delay;
}
static GF_Err
PulseAudio_QueryOutputSampleRate (GF_AudioOutput * dr, u32 * desired_sr,
- u32 * NbChannels, u32 * nbBitsPerSample)
+ u32 * NbChannels, u32 * nbBitsPerSample)
{
- /**
- * PulseAudio can do the resampling by itself and play any number of channels
- */
- return GF_OK;
+ /**
+ * PulseAudio can do the resampling by itself and play any number of channels
+ */
+ return GF_OK;
}
void *
NewPulseAudioOutput ()
{
- PulseAudioContext *ctx;
- GF_AudioOutput *driv;
- GF_SAFEALLOC (ctx, PulseAudioContext);
- if (!ctx)
- return NULL;
+ PulseAudioContext *ctx;
+ GF_AudioOutput *driv;
+ GF_SAFEALLOC (ctx, PulseAudioContext);
+ if (!ctx)
+ return NULL;
- GF_SAFEALLOC (driv, GF_AudioOutput);
- if (!driv)
+ GF_SAFEALLOC (driv, GF_AudioOutput);
+ if (!driv)
{
- gf_free(ctx);
- return NULL;
+ gf_free(ctx);
+ return NULL;
}
- driv->opaque = ctx;
- ctx->playback_handle = NULL;
- ctx->errors = 0;
- driv->SelfThreaded = 0;
- driv->Setup = PulseAudio_Setup;
- driv->Shutdown = PulseAudio_Shutdown;
- driv->ConfigureOutput = PulseAudio_ConfigureOutput;
- driv->GetAudioDelay = PulseAudio_GetAudioDelay;
- driv->SetVolume = PulseAudio_SetVolume;
- driv->SetPan = PulseAudio_SetPan;
- driv->SetPriority = PulseAudio_SetPriority;
- driv->QueryOutputSampleRate = PulseAudio_QueryOutputSampleRate;
- driv->WriteAudio = PulseAudio_WriteAudio;
- GF_REGISTER_MODULE_INTERFACE (driv, GF_AUDIO_OUTPUT_INTERFACE, "PulseAudio Audio Output", "gpac distribution");
- return driv;
+ driv->opaque = ctx;
+ ctx->playback_handle = NULL;
+ ctx->errors = 0;
+ driv->SelfThreaded = 0;
+ driv->Setup = PulseAudio_Setup;
+ driv->Shutdown = PulseAudio_Shutdown;
+ driv->ConfigureOutput = PulseAudio_ConfigureOutput;
+ driv->GetAudioDelay = PulseAudio_GetAudioDelay;
+ driv->SetVolume = PulseAudio_SetVolume;
+ driv->SetPan = PulseAudio_SetPan;
+ driv->SetPriority = PulseAudio_SetPriority;
+ driv->QueryOutputSampleRate = PulseAudio_QueryOutputSampleRate;
+ driv->WriteAudio = PulseAudio_WriteAudio;
+ GF_REGISTER_MODULE_INTERFACE (driv, GF_AUDIO_OUTPUT_INTERFACE, MODULE_NAME, "gpac distribution");
+ return driv;
}
void
DeletePulseAudioOutput (void *ifce)
{
- GF_AudioOutput *dr = (GF_AudioOutput *) ifce;
- free_pulseaudio_resources (dr);
- if (dr != NULL)
- gf_free(dr);
+ GF_AudioOutput *dr = (GF_AudioOutput *) ifce;
+ free_pulseaudio_resources (dr);
+ if (dr != NULL) {
+ if (dr->opaque)
+ gf_free(dr->opaque);
+ dr->opaque = NULL;
+ gf_free(dr);
+ }
}
* ********************************************************************
* interface
*/
-const u32 *QueryInterface (u32 InterfaceType)
+const u32 *QueryInterfaces(u32 InterfaceType)
{
- static u32 si [] = {
- GF_VIDEO_OUTPUT_INTERFACE,
- 0
- };
- return si;
+ static u32 si [] = {
+ GF_AUDIO_OUTPUT_INTERFACE,
+ 0
+ };
+ return si;
}
GF_BaseInterface *
LoadInterface (u32 InterfaceType)
{
- if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
- return NewPulseAudioOutput ();
- return NULL;
+ if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
+ return NewPulseAudioOutput ();
+ return NULL;
}
void
ShutdownInterface (GF_BaseInterface * ifce)
{
- if (ifce->InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
- DeletePulseAudioOutput ((GF_AudioOutput *) ifce);
+ if (ifce->InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
+ DeletePulseAudioOutput ((GF_AudioOutput *) ifce);
}
vpath %.c $(SRC_PATH)/modules/raw_out
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include -DGPAC_HAVE_CONFIG_H -I../../
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" -DGPAC_HAVE_CONFIG_H -I../../
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
/*driver interfaces*/
#include <gpac/modules/video_out.h>
+#include <gpac/user.h>
#include <gpac/list.h>
#include <gpac/constants.h>
{
char *pixels;
u32 width, height;
+ u32 pixel_format, bpp;
} RawContext;
-
-#define RAW_OUT_PIXEL_FORMAT GF_PIXEL_RGB_24
-#define NBPP 3
-
#define RAWCTX RawContext *rc = (RawContext *)dr->opaque
static GF_Err raw_resize(GF_VideoOutput *dr, u32 w, u32 h)
if (rc->pixels) gf_free(rc->pixels);
rc->width = w;
rc->height = h;
- rc->pixels = gf_malloc(sizeof(char) * NBPP * w * h);
+ rc->pixels = gf_malloc(sizeof(char) * rc->bpp * w * h);
if (!rc->pixels) return GF_OUT_OF_MEM;
return GF_OK;
}
GF_Err RAW_Setup(GF_VideoOutput *dr, void *os_handle, void *os_display, u32 init_flags)
{
+ RAWCTX;
+ if (init_flags & GF_TERM_WINDOW_TRANSPARENT) {
+ rc->bpp = 4;
+ rc->pixel_format = GF_PIXEL_ARGB;
+ } else {
+ rc->bpp = 3;
+ rc->pixel_format = GF_PIXEL_RGB_24;
+ }
raw_resize(dr, 100, 100);
return GF_OK;
}
vi->height = rc->height;
vi->width = rc->width;
vi->video_buffer = rc->pixels;
- vi->pitch_x = NBPP;
- vi->pitch_y = NBPP * vi->width;
- vi->pixel_format = RAW_OUT_PIXEL_FORMAT;
+ vi->pitch_x = rc->bpp;
+ vi->pitch_y = rc->bpp * vi->width;
+ vi->pixel_format = rc->pixel_format;
}
return GF_OK;
}
\r
vpath %.c $(SRC_PATH)/modules/redirect_av\r
\r
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include\r
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(ffmpeg_cflags)\r
\r
ifeq ($(DEBUGBUILD), yes)\r
CFLAGS+=-g\r
LDFLAGS+=-pg\r
endif\r
\r
-LINKLIBS= -lgpac\r
+LINKLIBS= -lgpac $(ffmpeg_lflags)\r
LOCAL_LIB=../../bin/gcc\r
\r
#common objects\r
--- /dev/null
+#include "ts_muxer.h"
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
+#define STREAM_FRAME_RATE 25 /* 25 images/s */
+#define STREAM_NB_FRAMES ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
+#define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */
+
+#define PACKETS_BUFFER_LEN 1024
+
+struct avr_ts_muxer {
+ AVFormatContext *oc;
+ AVStream *audio_st, *video_st;
+ AVPacketList * videoPackets;
+ AVPacketList * audioPackets;
+ volatile Bool encode;
+ GF_Mutex *videoMx, *audioMx;
+ GF_Thread * tsEncodingThread;
+ const char * destination;
+};
+
+static Bool has_packet_ready(GF_AbstractTSMuxer* ts, GF_Mutex * mx, AVPacketList ** pkts) {
+ Bool ret;
+ gf_mx_p(mx);
+ ret = (*pkts) != NULL;
+ gf_mx_v(mx);
+ return ret;
+}
+
+
+/*!
+ * Wait for a packet on a given queue
+ * \param ts The muxer
+ * \param mx The mutex to use
+ * \param pkts The list of packets to watch
+ * \param idx a pointer to the index in the list
+ * \return NULL if encoding is ended, the first packet available otherwise
+ */
+static AVPacketList * wait_for_packet(GF_AbstractTSMuxer* ts, GF_Mutex * mx, AVPacketList ** pkts) {
+ AVPacketList * p;
+ gf_mx_p(mx);
+ while (ts->encode && !(*pkts)) {
+ gf_mx_v(mx);
+ gf_mx_p(mx);
+ }
+ if (!ts->encode) {
+ gf_mx_v(mx);
+ return NULL;
+ }
+ p = *pkts;
+ *pkts = p->next;
+ gf_mx_v(mx);
+ return p;
+}
+
+
+static Bool ts_interleave_thread_run(void *param) {
+ GF_AbstractTSMuxer * mux = (GF_AbstractTSMuxer *) param;
+ AVStream * video_st = mux->video_st;
+ AVStream * audio_st = mux->audio_st;
+ u64 audio_pts, video_pts;
+ u64 audioSize, videoSize, videoKbps, audioKbps;
+ u32 pass;
+ u32 now, start;
+ /* open the output file, if needed */
+ if (!(mux->oc->oformat->flags & AVFMT_NOFILE)) {
+ if (url_fopen(&mux->oc->pb, mux->destination, URL_WRONLY) < 0) {
+ fprintf(stderr, "Could not open '%s'\n", mux->destination);
+ return 0;
+ }
+ }
+ /* write the stream header, if any */
+ av_write_header(mux->oc);
+ audio_pts = video_pts = 0;
+ // Buffering...
+ gf_sleep(1000);
+ now = start = gf_sys_clock();
+ audioSize = videoSize = 0;
+ audioKbps = videoKbps = 0;
+ pass = 0;
+ while ( mux->encode) {
+ pass++;
+ if (0== (pass%16)) {
+ now = gf_sys_clock();
+ if (now - start > 1000) {
+ videoKbps = videoSize * 8000 / (now-start) / 1024;
+ audioKbps = audioSize * 8000 / (now-start) / 1024;
+ audioSize = videoSize = 0;
+ start = now;
+ printf("\rPTS audio="LLU" ("LLU"kbps), video="LLU" ("LLU"kbps)", audio_pts, audioKbps, video_pts, videoKbps);
+ fflush(stdout);
+ }
+ }
+ /* write interleaved audio and video frames */
+ if (!video_st ||
+ (audio_pts == AV_NOPTS_VALUE && has_packet_ready(mux, mux->audioMx, &mux->audioPackets)) ||
+ ((audio_st && audio_pts < video_pts && audio_pts!= AV_NOPTS_VALUE))) {
+ AVPacketList * pl = wait_for_packet(mux, mux->audioMx, &mux->audioPackets);
+ if (!pl)
+ goto exit;
+ audio_pts = pl->pkt.pts ;
+ audioSize+=pl->pkt.size;
+ if (pl->pkt.pts == AV_NOPTS_VALUE) {
+ pl->pkt.pts = 0;
+ }
+ if (av_interleaved_write_frame(mux->oc, &(pl->pkt)) < 0) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] : failed to write audio interleaved frame audio_pts="LLU", video_pts="LLU"\n", audio_pts, video_pts));
+ }
+ gf_free(pl);
+ } else {
+ AVPacketList * pl = wait_for_packet(mux, mux->videoMx, &mux->videoPackets);
+ if (!pl)
+ goto exit;
+ video_pts = pl->pkt.pts;
+ /* write the compressed frame in the media file */
+ if (0 && audio_pts != AV_NOPTS_VALUE && audio_pts > video_pts && pl->next) {
+ u32 skipped = 0;
+ u64 first = video_pts;
+ /* We may be too slow... */
+ gf_mx_p(mux->videoMx);
+ while (video_pts < audio_pts && pl->next) {
+ AVPacketList * old = pl;
+ // We skip frames...
+ pl = pl->next;
+ video_pts = pl->pkt.pts;
+ skipped++;
+ gf_free(old);
+ }
+ mux->videoPackets = pl->next;
+ gf_mx_v(mux->videoMx);
+ if (skipped > 0)
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Skipped %u video frames, frame was "LLU", but is now "LLU"\n", skipped, first, video_pts));
+ }
+ videoSize+=pl->pkt.size;
+ video_pts = pl->pkt.pts; // * video_st->time_base.num / video_st->time_base.den;
+ assert( video_pts);
+ if (av_interleaved_write_frame(mux->oc, &(pl->pkt)) < 0) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] : failed to write video interleaved frame audio_pts="LLU", video_pts="LLU"\n", audio_pts, video_pts));
+ }
+ gf_free(pl);
+ }
+ }
+exit:
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Ending TS thread...\n"));
+ av_write_trailer(mux->oc);
+ if (!(mux->oc->oformat->flags & AVFMT_NOFILE)) {
+ /* close the output file */
+ url_fclose(mux->oc->pb);
+ }
+ return 0;
+}
+
+
+#if LIBAVFORMAT_VERSION_MAJOR < 53 && LIBAVFORMAT_VERSION_MINOR < 45
+#define GUESS_FORMAT guess_stream_format
+#else
+#define GUESS_FORMAT av_guess_format
+#endif /* LIBAVFORMAT_VERSION_MAJOR < 53 && LIBAVFORMAT_VERSION_MINOR < 45 */
+
+GF_AbstractTSMuxer * ts_amux_new(GF_AVRedirect * avr, u32 videoBitrateInBitsPerSec, u32 width, u32 height, u32 audioBitRateInBitsPerSec) {
+ GF_AbstractTSMuxer * ts = gf_malloc( sizeof(GF_AbstractTSMuxer));
+ memset( ts, 0, sizeof( GF_AbstractTSMuxer));
+ ts->oc = avformat_alloc_context();
+ ts->destination = avr->destination;
+ av_register_all();
+ ts->oc->oformat = GUESS_FORMAT(NULL, avr->destination, NULL);
+ if (!ts->oc->oformat)
+ ts->oc->oformat = GUESS_FORMAT("mpegts", NULL, NULL);
+ assert( ts->oc->oformat);
+ ts->audio_st = av_new_stream(ts->oc, avr->audioCodec->id);
+ {
+ AVCodecContext * c = ts->audio_st->codec;
+ c->codec_id = avr->audioCodec->id;
+ c->codec_type = AVMEDIA_TYPE_AUDIO;
+ /* put sample parameters */
+ c->sample_fmt = SAMPLE_FMT_S16;
+ c->bit_rate = audioBitRateInBitsPerSec;
+ c->sample_rate = avr->audioSampleRate;
+ c->channels = 2;
+ c->time_base.num = 1;
+ c->time_base.den = 1000;
+ // some formats want stream headers to be separate
+ if (ts->oc->oformat->flags & AVFMT_GLOBALHEADER)
+ c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ }
+ ts->video_st = av_new_stream(ts->oc, avr->videoCodec->id);
+
+ {
+ AVCodecContext * c = ts->video_st->codec;
+ c->codec_id = avr->videoCodec->id;
+ c->codec_type = AVMEDIA_TYPE_VIDEO;
+
+ /* put sample parameters */
+ c->bit_rate = videoBitrateInBitsPerSec;
+ /* resolution must be a multiple of two */
+ c->width = width;
+ c->height = height;
+ /* time base: this is the fundamental unit of time (in seconds) in terms
+ of which frame timestamps are represented. for fixed-fps content,
+ timebase should be 1/framerate and timestamp increments should be
+ identically 1. */
+ c->time_base.den = STREAM_FRAME_RATE;
+ c->time_base.num = 1;
+ c->gop_size = 12; /* emit one intra frame every twelve frames at most */
+ c->pix_fmt = STREAM_PIX_FMT;
+ if (c->codec_id == CODEC_ID_MPEG2VIDEO) {
+ /* just for testing, we also add B frames */
+ c->max_b_frames = 2;
+ }
+ if (c->codec_id == CODEC_ID_MPEG1VIDEO) {
+ /* Needed to avoid using macroblocks in which some coeffs overflow.
+ This does not happen with normal video, it just happens here as
+ the motion of the chroma plane does not match the luma plane. */
+ c->mb_decision=2;
+ }
+ // some formats want stream headers to be separate
+ if (ts->oc->oformat->flags & AVFMT_GLOBALHEADER)
+ c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+
+ }
+ //av_set_pts_info(ts->audio_st, 33, 1, audioBitRateInBitsPerSec);
+ /* set the output parameters (must be done even if no
+ parameters). */
+ if (av_set_parameters(ts->oc, NULL) < 0) {
+ fprintf(stderr, "Invalid output format parameters\n");
+ return NULL;
+ }
+ dump_format(ts->oc, 0, avr->destination, 1);
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] DUMPING to %s...\n", ts->destination));
+
+ if (avcodec_open(ts->video_st->codec, avr->videoCodec) < 0) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] failed to open video codec\n"));
+ return NULL;
+ }
+ if (avcodec_open(ts->audio_st->codec, avr->audioCodec) < 0) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] failed to open audio codec\n"));
+ return NULL;
+ }
+ ts->videoMx = gf_mx_new("TS_VideoMx");
+ ts->audioMx = gf_mx_new("TS_AudioMx");
+ ts->tsEncodingThread = gf_th_new("ts_interleave_thread_run");
+ ts->encode = 1;
+ ts->audioPackets = NULL;
+ ts->videoPackets = NULL;
+ gf_th_run(ts->tsEncodingThread, ts_interleave_thread_run, ts);
+ return ts;
+}
+
+void ts_amux_del(GF_AbstractTSMuxer * muxerToDelete) {
+ if (!muxerToDelete)
+ return;
+ muxerToDelete->encode = 0;
+ gf_sleep(100);
+ gf_th_stop(muxerToDelete->tsEncodingThread);
+ muxerToDelete->tsEncodingThread = NULL;
+ gf_mx_del(muxerToDelete->audioMx);
+ muxerToDelete->audioMx = NULL;
+ gf_mx_del(muxerToDelete->videoMx);
+ muxerToDelete->videoMx = NULL;
+ if (muxerToDelete->video_st) {
+ avcodec_close(muxerToDelete->video_st->codec);
+ muxerToDelete->video_st = NULL;
+ }
+ if (muxerToDelete->audio_st) {
+ avcodec_close(muxerToDelete->audio_st->codec);
+ muxerToDelete->audio_st = NULL;
+ }
+ /* write the trailer, if any. the trailer must be written
+ * before you close the CodecContexts open when you wrote the
+ * header; otherwise write_trailer may try to use memory that
+ * was freed on av_codec_close() */
+ if (muxerToDelete->oc) {
+ u32 i;
+ /* free the streams */
+ for (i = 0; i < muxerToDelete->oc->nb_streams; i++) {
+ av_freep(&muxerToDelete->oc->streams[i]->codec);
+ av_freep(&muxerToDelete->oc->streams[i]);
+ }
+
+ /* free the stream */
+ av_free(muxerToDelete->oc);
+ muxerToDelete->oc = NULL;
+ }
+}
+
+Bool ts_encode_audio_frame(GF_AbstractTSMuxer * ts, uint8_t * data, int encoded, u64 pts) {
+ AVPacketList *pl;
+ AVPacket * pkt;
+ if (!ts->encode)
+ return 1;
+ pl = gf_malloc(sizeof(AVPacketList));
+ pl->next = NULL;
+ pkt = &(pl->pkt);
+ av_init_packet(pkt);
+ assert( ts->audio_st);
+ assert( ts->audio_st->codec);
+ pkt->flags = 0;
+ if (ts->audio_st->codec->coded_frame) {
+ if (ts->audio_st->codec->coded_frame->key_frame)
+ pkt->flags = AV_PKT_FLAG_KEY;
+ if (ts->audio_st->codec->coded_frame->pts != AV_NOPTS_VALUE) {
+ pkt->pts = av_rescale_q(ts->audio_st->codec->coded_frame->pts, ts->audio_st->codec->time_base, ts->audio_st->time_base);
+ } else {
+ if (pts == AV_NOPTS_VALUE)
+ pkt->pts = AV_NOPTS_VALUE;
+ else {
+ pkt->pts = av_rescale_q(pts, ts->audio_st->codec->time_base, ts->audio_st->time_base);
+ }
+ }
+ } else {
+ if (pts == AV_NOPTS_VALUE)
+ pkt->pts = AV_NOPTS_VALUE;
+ else
+ pkt->pts = av_rescale_q(pts, ts->audio_st->codec->time_base, ts->audio_st->time_base);
+ }
+ pkt->stream_index= ts->audio_st->index;
+ pkt->data = data;
+ pkt->size = encoded;
+ //printf("AUDIO PTS="LLU" was: "LLU" (%p)\n", pkt->pts, pts, pl);
+ gf_mx_p(ts->audioMx);
+ if (!ts->audioPackets)
+ ts->audioPackets = pl;
+ else {
+ AVPacketList * px = ts->audioPackets;
+ while (px->next)
+ px = px->next;
+ px->next = pl;
+ }
+ gf_mx_v(ts->audioMx);
+ return 0;
+}
+
+Bool ts_encode_video_frame(GF_AbstractTSMuxer* ts, uint8_t* data, int encoded) {
+ AVPacketList *pl;
+ AVPacket * pkt;
+ if (!ts->encode)
+ return 1;
+ pl = gf_malloc(sizeof(AVPacketList));
+ pl->next = NULL;
+ pkt = &(pl->pkt);
+
+ av_init_packet(pkt);
+
+ if (ts->video_st->codec->coded_frame->pts != AV_NOPTS_VALUE) {
+ //pkt->pts= av_rescale_q(ts->video_st->codec->coded_frame->pts, ts->video_st->codec->time_base, ts->video_st->time_base);
+ pkt->pts = ts->video_st->codec->coded_frame->pts * ts->video_st->time_base.den / ts->video_st->time_base.num / 1000;
+ //pkt->pts = ts->video_st->codec->coded_frame->pts;
+ }
+ if (ts->video_st->codec->coded_frame->key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ pkt->stream_index= ts->video_st->index;
+ pkt->data= data;
+ pkt->size= encoded;
+ //printf("VIDEO PTS="LLU" was: "LLU" (%p)\n", pkt->pts, ts->video_st->codec->coded_frame->pts, pl);
+ gf_mx_p(ts->videoMx);
+ if (!ts->videoPackets)
+ ts->videoPackets = pl;
+ else {
+ AVPacketList * px = ts->videoPackets;
+ while (px->next)
+ px = px->next;
+ px->next = pl;
+ }
+ gf_mx_v(ts->videoMx);
+ return 0;
+}
+
+AVCodecContext * ts_get_video_codec_context(GF_AbstractTSMuxer * ts) {
+ return !ts ? NULL : ts->video_st->codec;
+}
+
+AVCodecContext * ts_get_audio_codec_context(GF_AbstractTSMuxer * ts) {
+ return !ts ? NULL : ts->audio_st->codec;
+}
--- /dev/null
+#include "ts_muxer.h"
+#include <gpac/mpegts.h>
+
+struct avr_ts_muxer {
+ GF_M2TS_Mux *muxer;
+ GF_ESIPacket videoCurrentTSPacket;
+ GF_ESIPacket audioCurrentTSPacket;
+ GF_ESInterface * video, * audio;
+ u64 frameTimeSentOverTS;
+ GF_Socket * ts_output_udp_sk;
+};
+
+/*!
+ * Sends the TS mux to socket
+ * \param avr The AVRedirect structure pointer
+ */
+static GF_Err sendTSMux(GF_AbstractTSMuxer * ts)
+{
+ u32 status;
+ const char * pkt;
+ GF_Err e;
+ u32 padding, data;
+ padding = data = 0;
+ while ( (NULL!= ( pkt = gf_m2ts_mux_process ( ts->muxer, &status ))))
+ {
+ switch (status) {
+ case GF_M2TS_STATE_IDLE:
+ break;
+ case GF_M2TS_STATE_DATA:
+ data+=188;
+ break;
+ case GF_M2TS_STATE_PADDING:
+ padding+=188;
+ break;
+ default:
+ break;
+ }
+ if (ts->ts_output_udp_sk) {
+ e = gf_sk_send ( ts->ts_output_udp_sk, pkt, 188);
+ if ( e )
+ {
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Unable to send TS data : %s\n", gf_error_to_string(e)) );
+ return e;
+ }
+ }
+ }
+ if (data || padding)
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[AVRedirect] : Sent TS data=%u/padding=%u\n", data, padding));
+ return GF_OK;
+}
+
+//Bool *add_video_stream(GF_AbstractTSMuxer * ts, int codec_id)
+
+Bool ts_encode_audio_frame(GF_AbstractTSMuxer * ts, AVFrame * encodedFrame, uint8_t * data, int encoded) {
+ ts->audioCurrentTSPacket.data = data;
+ ts->audioCurrentTSPacket.data_len = encoded;
+ ts->audioCurrentTSPacket.flags = GF_ESI_DATA_AU_START|GF_ESI_DATA_AU_END | GF_ESI_DATA_HAS_CTS | GF_ESI_DATA_HAS_DTS;
+ //avr->audioCurrentTSPacket.cts = avr->audioCurrentTSPacket.dts = myTime;
+ ts->videoCurrentTSPacket.dts = ts->videoCurrentTSPacket.cts = gf_m2ts_get_sys_clock(ts->muxer);
+ ts->audio->output_ctrl(ts->audio, GF_ESI_OUTPUT_DATA_DISPATCH, &(ts->audioCurrentTSPacket));
+ return 0;
+}
+
+static GF_Err void_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
+{
+ GF_AbstractTSMuxer * ts = (GF_AbstractTSMuxer *) ifce->input_udta;
+ if (!ts)
+ return GF_BAD_PARAM;
+ switch (act_type) {
+ case GF_ESI_INPUT_DATA_FLUSH:
+ break;
+ case GF_ESI_INPUT_DESTROY:
+ break;
+ /* case GF_ESI_INPUT_DATA_PULL:
+ gf_mx_p(ts->encodingMutex);
+ if (ts->frameTimeEncoded > ts->frameTimeSentOverTS) {
+ //printf("Data PULL, avr=%p, avr->video=%p, encoded="LLU", sent over TS="LLU"\n", avr, &avr->video, avr->frameTimeEncoded, avr->frameTimeSentOverTS);
+ ts->video->output_ctrl( ts->video, GF_ESI_OUTPUT_DATA_DISPATCH, &(ts->videoCurrentTSPacket));
+ ts->frameTimeSentOverTS = ts->frameTime;
+ } else {
+ //printf("Data PULL IGNORED : encoded = "LLU", sent on TS="LLU"\n", avr->frameTimeEncoded, avr->frameTimeSentOverTS);
+ }
+ gf_mx_v(avr->encodingMutex);
+ break;*/
+ case GF_ESI_INPUT_DATA_RELEASE:
+ break;
+ default:
+ printf("Asking unknown : %u\n", act_type);
+ }
+ return GF_OK;
+}
+
+Bool ts_encode_video_frame(GF_AbstractTSMuxer * ts, AVFrame * encodedFrame, uint8_t * data, int encoded, AVCodecContext * videoCodecContext) {
+ if ( ts->muxer )
+ { // currentFrameTimeProcessed / 1000; //
+ ts->videoCurrentTSPacket.dts = videoCodecContext->coded_frame->coded_picture_number;
+ ts->videoCurrentTSPacket.cts = videoCodecContext->coded_frame->display_picture_number;
+ //avr->videoCurrentTSPacket.dts = avr->videoCurrentTSPacket.cts = sysclock;
+ //ts->videoCurrentTSPacket.dts = ts->videoCurrentTSPacket.cts = currentFrameTimeProcessed;
+ ts->videoCurrentTSPacket.dts = ts->videoCurrentTSPacket.cts = gf_m2ts_get_sys_clock(ts->muxer);
+ ts->videoCurrentTSPacket.data = data;
+ ts->videoCurrentTSPacket.data_len = encoded;
+ //printf("\rSending frame DTS="LLU", CTS="LLU", len=%u, FPS=%u, delta=%u...", ts->videoCurrentTSPacket.dts, avr->videoCurrentTSPacket.cts, avr->videoCurrentTSPacket.data_len, fps, currentFrameTimeProcessed - lastEncodedFrameTime);
+ fflush(stdout);
+ ts->videoCurrentTSPacket.flags = GF_ESI_DATA_HAS_CTS | GF_ESI_DATA_HAS_DTS;
+ //if (ts_packets_sent == 0) {
+ // printf("First Packet !\n");
+ ts->videoCurrentTSPacket.flags|=GF_ESI_DATA_AU_START|GF_ESI_DATA_AU_END ;
+ //}
+ void_input_ctrl(ts->video, GF_ESI_INPUT_DATA_PULL, NULL);
+ sendTSMux(ts);
+ }
+ return 0;
+}
+
+GF_AbstractTSMuxer * ts_amux_new(GF_AVRedirect * avr, u32 videoBitrateInBitsPerSec, u32 audioBitRateInBitsPerSec, GF_Socket * ts_output_udp_sk) {
+ GF_AbstractTSMuxer * ts = malloc(sizeof(GF_AbstractTSMuxer));
+ ts->muxer = gf_m2ts_mux_new ( videoBitrateInBitsPerSec * audioBitRateInBitsPerSec + 1000000, 0, 1 );
+ ts->ts_output_udp_sk = ts_output_udp_sk;
+ {
+ //u32 cur_pid = 100; /*PIDs start from 100*/
+ GF_M2TS_Mux_Program *program = gf_m2ts_mux_program_add ( ts->muxer, 1, 100, 0, 0 );
+
+ ts->video = gf_malloc( sizeof( GF_ESInterface));
+ memset( ts->video, 0, sizeof( GF_ESInterface));
+ //audio.stream_id = 101;
+ //gf_m2ts_program_stream_add ( program, &audifero, 101, 1 );
+ ts->video->stream_id = 101;
+ ts->video->stream_type = GF_STREAM_VISUAL;
+ ts->video->bit_rate = 410000;
+ /* ms resolution */
+ ts->video->timescale = 1000;
+
+ ts->video->object_type_indication = GPAC_OTI_VIDEO_MPEG2_SIMPLE;
+ ts->video->input_udta = ts;
+#ifdef TS_MUX_MODE_PUT
+ ts->video->caps = GF_ESI_SIGNAL_DTS;
+#else
+ avr->video->input_ctrl = void_input_ctrl;
+ avr->video->caps = GF_ESI_AU_PULL_CAP | GF_ESI_SIGNAL_DTS;
+#endif /* TS_MUX_MODE_PUT */
+
+
+ ts->audio = gf_malloc( sizeof( GF_ESInterface));
+ memset( ts->audio, 0, sizeof( GF_ESInterface));
+ ts->audio->stream_id = 102;
+ ts->audio->stream_type = GF_STREAM_AUDIO;
+ ts->audio->bit_rate = audioBitRateInBitsPerSec;
+ /* ms resolution */
+ ts->audio->timescale = 1000;
+
+ ts->audio->object_type_indication = GPAC_OTI_AUDIO_MPEG2_PART3;
+ ts->audio->input_udta = ts;
+#ifdef TS_MUX_MODE_PUT
+ ts->audio->caps = 0;
+#else
+ ts->audio->input_ctrl = void_input_ctrl;
+ ts->audio->caps = GF_ESI_AU_PULL_CAP;
+#endif /* TS_MUX_MODE_PUT */
+
+ gf_m2ts_program_stream_add ( program, ts->video, 101, 0 );
+ gf_m2ts_program_stream_add ( program, ts->audio, 102, 1 );
+
+ assert( program->streams->mpeg2_stream_type = GF_M2TS_VIDEO_MPEG2);
+ }
+ gf_m2ts_mux_update_config ( ts->muxer, 1 );
+ return ts;
+}
+
+void ts_amux_del(GF_AbstractTSMuxer * ts) {
+ if (!ts)
+ return;
+ if ( ts->ts_output_udp_sk )
+ {
+ gf_sk_del ( ts->ts_output_udp_sk );
+ ts->ts_output_udp_sk = NULL;
+ }
+
+
+}
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
*\r
*/\r
+#include <stdlib.h>\r
\r
+#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(__MINGW32__)\r
\r
-#include <gpac/modules/term_ext.h>\r
-#include <gpac/internal/terminal_dev.h>\r
-#include <gpac/internal/compositor_dev.h>\r
+#define EMULATE_INTTYPES\r
+#define EMULATE_FAST_INT\r
+#ifndef inline\r
+#define inline __inline\r
+#endif\r
\r
-/*sample raw AVI writing*/\r
-#include <gpac/internal/avilib.h>\r
+#if defined(__SYMBIAN32__)\r
+#define EMULATE_INTTYPES\r
+#endif\r
\r
\r
-typedef struct\r
-{\r
- GF_Terminal *term;\r
+#ifndef __MINGW32__\r
+#define __attribute__(s)\r
+#endif\r
+\r
+\r
+/*include FFMPEG APIs*/\r
+#ifdef _WIN32_WCE\r
+#define inline __inline\r
+#endif\r
+\r
+\r
+# define INT64_C(x) (x ## i64)\r
+# define UINT64_C(x) (x ## Ui64)\r
+\r
+\r
+#endif\r
+\r
+\r
+#include "ts_muxer.h"\r
+\r
+#define USE_GPAC_MPEG2TS\r
+#undef USE_GPAC_MPEG2TS\r
+\r
+#ifdef USE_GPAC_MPEG2TS\r
+#include "gpac_ts_muxer.c"\r
+#else\r
+#include "ffmpeg_ts_muxer.c"\r
+#endif /* USE_GPAC_MPEG2TS */\r
+\r
+#include <libavcodec/avcodec.h>\r
+#include <libswscale/swscale.h>\r
+#include <libavutil/avutil.h>\r
+\r
+\r
+#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(__GNUC__)\r
+\r
+#if defined(_WIN32_WCE) \r
+#pragma comment(lib, "toolhelp")\r
+#pragma comment(lib, "winsock")\r
+#endif\r
+\r
+#define _TOSTR(_val) #_val\r
+#define TOSTR(_val) _TOSTR(_val)\r
+\r
+#pragma comment(lib, "avcodec-"TOSTR(LIBAVCODEC_VERSION_MAJOR) )\r
+#pragma comment(lib, "avformat-"TOSTR(LIBAVFORMAT_VERSION_MAJOR) )\r
+#pragma comment(lib, "avutil-"TOSTR(LIBAVUTIL_VERSION_MAJOR) )\r
+#pragma comment(lib, "swscale-"TOSTR(LIBSWSCALE_VERSION_MAJOR) )\r
+\r
+#endif\r
+\r
+\r
+/* This number * 188 should be lower than the UDP packet size */\r
+#define TS_PACKETS_PER_UDP_PACKET 1\r
+\r
+#define audioCodecBitrate 96000\r
+\r
+#if !defined(WIN32) && !defined(_WIN32_WCE)\r
+#include <unistd.h>\r
+#endif\r
+\r
+static const u32 maxFPS = 25;\r
+\r
+static const char * moduleName = "AVRedirect";\r
\r
- Bool is_open;\r
- GF_AudioListener audio_listen;\r
- GF_VideoListener video_listen;\r
+static const char * AVR_VIDEO_CODEC_OPTION = "VideoCodec";\r
\r
- avi_t *avi_out; \r
\r
- char *frame;\r
- u32 size;\r
-} GF_AVRedirect;\r
+#define AVR_TIMERS_LENGHT 25\r
\r
-static void avr_on_audio_frame(void *udta, char *buffer, u32 buffer_size, u32 time, u32 delay_ms)\r
+#define U32_ABS( a, b ) (a > b ? a - b : b - a)\r
+\r
+#define DUMP_MP3\r
+#undef DUMP_MP3\r
+\r
+/**\r
+ * This thread sends the frame to TS mux\r
+ * \param Parameter The GF_AVRedirect pointer\r
+ */\r
+static Bool audio_encoding_thread_run(void *param)\r
{\r
- GF_AVRedirect *avr = (GF_AVRedirect *)udta;\r
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[AVRedirect] Audio frame size %d - delay %d\n", buffer_size, delay_ms));\r
- AVI_write_audio(avr->avi_out, buffer, buffer_size);\r
+ u8 * inBuff;\r
+ u8 * outBuff;\r
+ u32 inBuffSize, outBuffSize, samplesReaden, toRead;\r
+ u64 myTime = 0;\r
+ u32 frameCountSinceReset = 0;\r
+ u32 lastCurrentTime;\r
+ Bool sendPts = 1;\r
+ GF_AVRedirect * avr = (GF_AVRedirect*) param;\r
+ AVCodecContext * ctx = NULL;\r
+ assert( avr );\r
+\r
+ outBuffSize = FF_MIN_BUFFER_SIZE;\r
+\r
+ outBuff = gf_malloc(outBuffSize* sizeof(u8));\r
+ inBuff = NULL;\r
+#ifdef DUMP_MP3\r
+ FILE * mp3 = fopen("/tmp/dump.mp3", "w");\r
+#endif /* DUMP_MP3 */\r
+ sendPts = 1;\r
+ gf_sc_add_audio_listener ( avr->term->compositor, &avr->audio_listen );\r
+ while (avr->is_running && !ctx) {\r
+ ctx = ts_get_audio_codec_context(avr->ts_implementation);\r
+ gf_sleep(16);\r
+ }\r
+ if (!ctx) {\r
+ goto exit;\r
+ }\r
+\r
+ printf("******* Audio Codec Context = %d/%d, start="LLU", frame_size=%u\n", ctx->time_base.num, ctx->time_base.den, ctx->timecode_frame_start, ctx->frame_size);\r
+ samplesReaden = ctx->frame_size * ctx->channels;\r
+\r
+ //printf("SETUP input sample size=%u, output samplesize=%u, buffsize=%u, samplesReaden=%u\n", ctx->input_sample_size, ctx->frame_size, sizeof(outbuf), samplesReaden);\r
+ // 2 chars are needed for each short\r
+ toRead = samplesReaden * 2;\r
+ inBuffSize = toRead;\r
+ inBuff = gf_malloc(inBuffSize * sizeof(u8));\r
+ while (avr->is_running && !avr->audioCurrentTime) {\r
+ gf_sleep(16);\r
+ }\r
+ myTime = lastCurrentTime = avr->audioCurrentTime;\r
+ frameCountSinceReset = 0;\r
+ while (avr->is_running) {\r
+ u32 readen;\r
+ if (U32_ABS(avr->audioCurrentTime, myTime) > 25000) {\r
+ //GF_LOG( GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] Drift in audio : audioCurrentTime = %u, myTime=%u, resync...\n", avr->audioCurrentTime, myTime));\r
+ //myTime = lastCurrentTime = avr->audioCurrentTime;\r
+ //frameCountSinceReset = 0;\r
+ sendPts = 1;\r
+ }\r
+ while (toRead <= gf_ringbuffer_available_for_read(avr->pcmAudio) ) {\r
+ memset( inBuff, 0, inBuffSize);\r
+ memset( outBuff, 0, outBuffSize);\r
+ readen = gf_ringbuffer_read(avr->pcmAudio, inBuff, toRead);\r
+ assert( readen == toRead );\r
+ if (avr->encode)\r
+ {\r
+ //u32 oldFrameSize = ctx->frame_size;\r
+ //ctx->frame_size = readable / (2 * ctx->channels);\r
+ //assert( oldFrameSize <= ctx->frame_size );\r
+ /* buf_size * input_sample_size / output_sample_size */\r
+ int encoded = avcodec_encode_audio(ctx, outBuff, outBuffSize, (const short *) inBuff);\r
+ if (encoded < 0) {\r
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[RedirectAV]: failed to encode audio, buffer size=%u, readen=%u, frame_size=%u\n", outBuffSize, readen, ctx->frame_size));\r
+ } else if (encoded > 0) {\r
+ ts_encode_audio_frame(avr->ts_implementation, outBuff, encoded, sendPts ? myTime : AV_NOPTS_VALUE );\r
+ frameCountSinceReset++;\r
+#ifdef DUMP_MP3\r
+ fwrite( outBuff, sizeof(char), encoded, mp3);\r
+#endif /* DUMP_MP3 */\r
+ //if (ctx->codec->id == CODEC_ID_MP3) {\r
+ /* It seems the MP3 codec only fetches 50% of data... */\r
+ // myTime= lastCurrentTime + (frameCountSinceReset * ctx->frame_size * 500 / ctx->sample_rate);\r
+ //} else\r
+ //myTime = lastCurrentTime + (frameCountSinceReset * toRead * 1000 / ctx->sample_rate/ ctx->channels / 4);\r
+ /* Avoid overflow , multiply by 10 and divide sample rate by 100 instead of *1000 / sampleRate */\r
+ myTime = lastCurrentTime + (frameCountSinceReset * toRead * 10 / (ctx->sample_rate / 100) / ctx->channels / 4);\r
+ //sendPts = 0;\r
+ sendPts = 1;\r
+ } else {\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[RedirectAV]: no encoded frame.\n"));\r
+ //frameCountSinceReset++;\r
+ }\r
+ //ctx->frame_size = oldFrameSize;\r
+ }\r
+ }\r
+ }\r
+exit:\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Ending audio encoding thread...\n"));\r
+ if (inBuff)\r
+ gf_free( inBuff );\r
+ if (outBuff)\r
+ gf_free( outBuff );\r
+#ifdef DUMP_MP3\r
+ if (mp3)\r
+ fclose(mp3);\r
+#endif /* DUMP_MP3 */\r
+ if (avr->term)\r
+ gf_sc_remove_audio_listener ( avr->term->compositor, &avr->audio_listen );\r
+ return GF_OK;\r
}\r
\r
-static void avr_on_audio_reconfig(void *udta, u32 samplerate, u32 bits_per_sample, u32 nb_channel, u32 channel_cfg)\r
+/**\r
+ * This thread sends the frame to TS mux\r
+ * \param Parameter The GF_AVRedirect pointer\r
+ */\r
+static Bool video_encoding_thread_run(void *param)\r
{\r
- GF_AVRedirect *avr = (GF_AVRedirect *)udta;\r
- GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Audio reconfig sr %d bps %d nb_ch %d\n", samplerate, bits_per_sample, nb_channel));\r
- AVI_set_audio(avr->avi_out, nb_channel, samplerate, bits_per_sample, WAVE_FORMAT_PCM, 0);\r
+ GF_AVRedirect * avr = (GF_AVRedirect*) param;\r
+ u64 currentFrameTimeProcessed = 0;\r
+ u32 lastEncodedFrameTime = 0;\r
+ AVCodecContext * ctx = NULL;\r
+ assert( avr );\r
+ gf_sc_add_video_listener ( avr->term->compositor, &avr->video_listen );\r
+ while (avr->is_running && (!ctx || !avr->swsContext)) {\r
+ ctx = ts_get_video_codec_context(avr->ts_implementation);\r
+ gf_sleep(16);\r
+ }\r
+ if (!ctx) {\r
+ goto exit;\r
+ }\r
+ printf("******* Video Codec Context = %d/%d, start="LLU"\n", ctx->time_base.num, ctx->time_base.den, ctx->timecode_frame_start);\r
+ while (avr->is_running) {\r
+ {\r
+ gf_mx_p(avr->frameMutex);\r
+ while (!avr->frameTime || currentFrameTimeProcessed == avr->frameTime) {\r
+ gf_mx_v(avr->frameMutex);\r
+ if (!avr->is_running) {\r
+ goto exit;\r
+ }\r
+ gf_mx_p(avr->frameMutex);\r
+ }\r
+ assert( currentFrameTimeProcessed != avr->frameTime);\r
+ currentFrameTimeProcessed = avr->frameTime;\r
+ {\r
+ avpicture_fill ( ( AVPicture * ) avr->RGBpicture, avr->frame, PIX_FMT_RGB24, avr->srcWidth, avr->srcHeight );\r
+ assert( avr->swsContext );\r
+ sws_scale ( avr->swsContext,\r
+#ifdef USE_AVCODEC2\r
+ ( const uint8_t * const * )\r
+#else\r
+ ( uint8_t ** )\r
+#endif /* USE_AVCODEC2 */\r
+ avr->RGBpicture->data, avr->RGBpicture->linesize,\r
+ 0, avr->srcHeight,\r
+ avr->YUVpicture->data, avr->YUVpicture->linesize );\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ if ( AVI_write_frame ( avr->avi_out, avr->frame, avr->size, 1 ) <0 )\r
+ {\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Error writing video frame\n" ) );\r
+ }\r
+#endif /* AVR_DUMP_RAW_AVI */\r
+ gf_mx_v(avr->frameMutex);\r
+ if (avr->encode)\r
+ {\r
+ int written;\r
+ //u32 sysclock = gf_sys_clock();\r
+ avr->YUVpicture->pts = currentFrameTimeProcessed;\r
+ //printf("Encoding frame PTS="LLU", frameNum=%u, time=%u...", avr->YUVpicture->pts, avr->YUVpicture->coded_picture_number, currentFrameTimeProcessed);\r
+ written = avcodec_encode_video ( ctx, avr->videoOutbuf, avr->videoOutbufSize, avr->YUVpicture );\r
+ //ctx->coded_frame->pts = currentFrameTimeProcessed;\r
+ if ( written < 0 )\r
+ {\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Error while encoding video frame =%d\n", written ) );\r
+ } else\r
+ if ( written > 0 )\r
+ {\r
+ ts_encode_video_frame(avr->ts_implementation, avr->videoOutbuf, written);\r
+ }\r
+ lastEncodedFrameTime = currentFrameTimeProcessed;\r
+ }\r
+ }\r
+ }\r
+ avr->frameTimeEncoded = currentFrameTimeProcessed;\r
+ } /* End of main loop */\r
+exit:\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Ending video encoding thread...\n"));\r
+ if (avr->term)\r
+ gf_sc_remove_video_listener ( avr->term->compositor, &avr->video_listen );\r
+ return 0;\r
+}\r
+\r
+#define VIDEO_RATE 400000\r
+\r
+static Bool start_if_needed(GF_AVRedirect *avr) {\r
+ enum PixelFormat pxlFormatForCodec = PIX_FMT_YUV420P;\r
+ if (avr->is_open)\r
+ return 0;\r
+ gf_mx_p(avr->frameMutex);\r
+ if (avr->is_open) {\r
+ gf_mx_v(avr->frameMutex);\r
+ return 0;\r
+ }\r
+ if (!avr->srcWidth || !avr->srcHeight || !avr->audioSampleRate || !avr->audioChannels) {\r
+ gf_mx_v(avr->frameMutex);\r
+ return 3;\r
+ }\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ avr->avi_out = AVI_open_output_file ( "dump.avi" );\r
+ if ( !avr->avi_out )\r
+ {\r
+ gf_mx_v(avr->frameMutex);\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Error opening output AVI file\n" ) );\r
+ return 4;\r
+ }\r
+#endif /* AVR_DUMP_RAW_AVI */\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Initializing...\n"));\r
+ if (!avr->pcmAudio)\r
+ avr->pcmAudio = gf_ringbuffer_new(32768);\r
+\r
+ /* Setting up the video encoding ... */\r
+ {\r
+ avr->YUVpicture = avr->RGBpicture = NULL;\r
+ avr->videoOutbuf = NULL;\r
+ if ( !avr->audioCodec)\r
+ {\r
+ gf_mx_v(avr->frameMutex);\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Cannot find audio codec.\n" ) );\r
+ return 1;\r
+ }\r
+\r
+ if ( !avr->videoCodec )\r
+ {\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Cannot find video codec.\n" ) );\r
+ return 2;\r
+ }\r
+\r
+ if (avr->videoCodec->id == CODEC_ID_MJPEG) {\r
+ pxlFormatForCodec = PIX_FMT_YUVJ420P;\r
+ }\r
+\r
+ avr->RGBpicture = avcodec_alloc_frame();\r
+ assert ( avr->RGBpicture );\r
+ avr->RGBpicture->data[0] = NULL;\r
+ avr->YUVpicture = avcodec_alloc_frame();\r
+ assert ( avr->YUVpicture );\r
+ {\r
+ u32 sz = sizeof ( uint8_t ) * avpicture_get_size ( pxlFormatForCodec, avr->srcWidth, avr->srcHeight );\r
+ avr->yuv_data = av_malloc ( sz ); /* size for YUV 420 */\r
+ assert ( avr->yuv_data );\r
+ memset ( avr->yuv_data, 0, sz );\r
+ avpicture_fill ( ( AVPicture* ) avr->YUVpicture, avr->yuv_data, pxlFormatForCodec, avr->srcWidth, avr->srcHeight );\r
+ avr->YUVpicture->coded_picture_number = 0;\r
+ }\r
+ avr->videoOutbufSize = avr->srcHeight * avr->srcWidth * 4;\r
+ avr->videoOutbuf = gf_malloc ( avr->videoOutbufSize );\r
+ memset ( avr->videoOutbuf, 0, avr->videoOutbufSize );\r
+ }\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ GF_LOG ( GF_LOG_INFO, GF_LOG_MODULE, ( "[AVRedirect] Open output AVI file %s\n", "dump.avi" ) );\r
+#endif /* AVR_DUMP_RAW_AVI */\r
+ /* Setting up the TS mux */\r
+ {\r
+ /*\r
+ GF_Socket * ts_output_udp_sk = gf_sk_new ( GF_SOCK_TYPE_UDP );\r
+ if ( gf_sk_is_multicast_address ( avr->udp_address ) )\r
+ {\r
+ e = gf_sk_setup_multicast ( ts_output_udp_sk, avr->udp_address, avr->udp_port, 0, 0, NULL );\r
+ }\r
+ else\r
+ {\r
+ e = gf_sk_bind ( ts_output_udp_sk, NULL, avr->udp_port, avr->udp_address, avr->udp_port, GF_SOCK_REUSE_PORT );\r
+ }\r
+ gf_sk_set_buffer_size(ts_output_udp_sk, 0, 188 * TS_PACKETS_PER_UDP_PACKET);\r
+ gf_sk_set_block_mode(ts_output_udp_sk, 0);*/\r
+ assert( avr->destination );\r
+ avr->ts_implementation = ts_amux_new(avr, VIDEO_RATE, avr->srcWidth, avr->srcHeight, audioCodecBitrate);\r
+ }\r
+ /*\r
+ if ( e )\r
+ {\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Error while initializing UDP address %s\n", gf_error_to_string ( e ) ) );\r
+ return e;\r
+ }\r
+ */\r
+ avr->is_open = avr->ts_implementation != NULL;\r
+ gf_mx_v(avr->frameMutex);\r
+ return avr->is_open ? 1 : 0;\r
}\r
\r
-static void avr_on_video_frame(void *udta, u32 time)\r
+\r
+static GF_Err avr_open ( GF_AVRedirect *avr )\r
{\r
- u32 i, j;\r
- GF_Err e;\r
- GF_VideoSurface fb;\r
- GF_AVRedirect *avr = (GF_AVRedirect *)udta;\r
+ assert( avr );\r
+ if ( avr->is_open)\r
+ return GF_OK;\r
+ if (!avr->is_running) {\r
+ avr->is_running = 1;\r
+ gf_th_run(avr->encodingThread, video_encoding_thread_run, avr);\r
+ gf_th_run(avr->audioEncodingThread, audio_encoding_thread_run, avr);\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
\r
- e = gf_sc_get_screen_buffer(avr->term->compositor, &fb, 0);\r
- if (e) {\r
- GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] Error grabing frame buffer %s\n", gf_error_to_string(e)));\r
- return;\r
- }\r
- /*convert frame*/\r
- for (i=0; i<fb.height; i++) {\r
- char *dst = avr->frame + i * fb.width * 3;\r
- char *src = fb.video_buffer + (fb.height-i-1) * fb.pitch_y;\r
- for (j=0; j<fb.width; j++) {\r
- dst[0] = src[0];\r
- dst[1] = src[1];\r
- dst[2] = src[2];\r
- src+=4;\r
- dst += 3;\r
- }\r
- }\r
\r
- if (AVI_write_frame(avr->avi_out, avr->frame, avr->size, 1) <0) {\r
- GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] Error writing video frame\n"));\r
- }\r
- gf_sc_release_screen_buffer(avr->term->compositor, &fb);\r
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[AVRedirect] Writing video frame\n"));\r
+static void avr_on_audio_frame ( void *udta, char *buffer, u32 buffer_size, u32 time, u32 delay_ms )\r
+{\r
+ GF_AVRedirect *avr = ( GF_AVRedirect * ) udta;\r
+ if (start_if_needed(avr))\r
+ return;\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ AVI_write_audio ( avr->avi_out, buffer, buffer_size );\r
+#endif /* AVR_DUMP_RAW_AVI */\r
+ {\r
+ gf_ringbuffer_write(avr->pcmAudio, buffer, buffer_size);\r
+ avr->audioCurrentTime = time - delay_ms;\r
+ }\r
}\r
\r
-static void avr_on_video_reconfig(void *udta, u32 width, u32 height)\r
+static void avr_on_audio_reconfig ( void *udta, u32 samplerate, u32 bits_per_sample, u32 nb_channel, u32 channel_cfg )\r
{\r
- char comp[5];\r
- GF_AVRedirect *avr = (GF_AVRedirect *)udta;\r
- GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Video reconfig width %d height %d\n", width, height));\r
+ GF_AVRedirect *avr = ( GF_AVRedirect * ) udta;\r
+ if (avr->audioSampleRate != samplerate || avr->audioChannels != nb_channel) {\r
+ GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Audio %u Hz, bitsPerSample=%u, nbchannels=%u\n", samplerate, bits_per_sample, nb_channel));\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ AVI_set_audio ( avr->avi_out, nb_channel, samplerate, bits_per_sample, WAVE_FORMAT_PCM, 0 );\r
+#endif /* AVR_DUMP_RAW_AVI */\r
+ avr->audioChannels = nb_channel;\r
+ avr->audioSampleRate = samplerate;\r
+ }\r
+}\r
\r
+static void avr_on_video_frame ( void *udta, u32 time )\r
+{\r
+ u32 i, j;\r
+ GF_Err e;\r
+ GF_VideoSurface fb;\r
+ GF_AVRedirect *avr = ( GF_AVRedirect * ) udta;\r
+ if (start_if_needed(avr))\r
+ return;\r
+ gf_mx_p(avr->frameMutex);\r
+ e = gf_sc_get_screen_buffer ( avr->term->compositor, &fb, 0 );\r
+ if ( e )\r
+ {\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Error grabing frame buffer %s\n", gf_error_to_string ( e ) ) );\r
+ return;\r
+ }\r
+ /*convert frame*/\r
+ for ( i=0; i<fb.height; i++ )\r
+ {\r
+ char *dst = avr->frame + i * fb.width * 3;\r
+ char *src = fb.video_buffer + i * fb.pitch_y;\r
+ for ( j=0; j<fb.width; j++ )\r
+ {\r
+ dst[0] = src[2];\r
+ dst[1] = src[1];\r
+ dst[2] = src[0];\r
+ src+=4;\r
+ dst += 3;\r
+ }\r
+ }\r
+ avr->frameTime = time;\r
+ gf_mx_v(avr->frameMutex);\r
+ gf_sc_release_screen_buffer ( avr->term->compositor, &fb );\r
+ GF_LOG ( GF_LOG_DEBUG, GF_LOG_MODULE, ( "[AVRedirect] Writing video frame\n" ) );\r
+}\r
\r
- comp[0] = comp[1] = comp[2] = comp[3] = comp[4] = 0;\r
- AVI_set_video(avr->avi_out, width, height, 30, comp);\r
+static void avr_on_video_reconfig ( void *udta, u32 width, u32 height )\r
+{\r
\r
- if (avr->frame) free(avr->frame);\r
- avr->size = 3*width*height;\r
- avr->frame = malloc(sizeof(char)*avr->size);\r
+ GF_AVRedirect *avr = ( GF_AVRedirect * ) udta;\r
+\r
+ if ((avr->srcHeight != height || avr->srcWidth != width))\r
+ {\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ char comp[5];\r
+ comp[0] = comp[1] = comp[2] = comp[3] = comp[4] = 0;\r
+ AVI_set_video ( avr->avi_out, width, height, 30, comp );\r
+#endif /* AVR_DUMP_RAW_AVI */\r
+ GF_LOG ( GF_LOG_INFO, GF_LOG_MODULE, ( "[AVRedirect] Video reconfig width %d height %d\n", width, height ) );\r
+ gf_mx_p(avr->frameMutex);\r
+ if ( avr->frame ) gf_free ( avr->frame );\r
+ avr->size = 3*width*height;\r
+ avr->frame = gf_malloc ( sizeof ( char ) *avr->size );\r
+ avr->srcWidth = width;\r
+ avr->srcHeight = height;\r
+ avr->swsContext = sws_getCachedContext ( avr->swsContext, avr->srcWidth, avr->srcHeight, PIX_FMT_RGB24, avr->srcWidth, avr->srcHeight, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL );\r
+ gf_mx_v(avr->frameMutex);\r
+ }\r
}\r
\r
\r
-static void avr_open(GF_AVRedirect *avr)\r
+#ifdef MULTITHREAD_REDIRECT_AV\r
+/**\r
+ * This thread sends the TS packets over the network\r
+ * \param Parameter The GF_AVRedirect pointer\r
+ */\r
+static Bool ts_thread_run(void *param)\r
{\r
- if (avr->is_open) return;\r
+ GF_Err e;\r
+ GF_AVRedirect * avr = (GF_AVRedirect*) param;\r
+ assert( avr );\r
+ gf_mx_p(avr->tsMutex);\r
+ while (!avr->frameTimeEncoded && avr->is_running) {\r
+ gf_mx_v(avr->tsMutex);\r
+ gf_sleep(1);\r
+ gf_mx_p(avr->tsMutex);\r
+ }\r
+ printf("avr->frameTimeEncoded="LLU"\n", avr->frameTimeEncoded);\r
+\r
+ while (avr->is_running) {\r
+ e = sendTSMux(avr);\r
+ gf_mx_v(avr->tsMutex);\r
+ gf_mx_p(avr->tsMutex);\r
+ }\r
+ gf_mx_v(avr->tsMutex);\r
+ return 0;\r
+}\r
+#endif /* MULTITHREAD_REDIRECT_AV */\r
\r
- avr->avi_out = AVI_open_output_file("dump.avi");\r
- if (!avr->avi_out) {\r
- GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[AVRedirect] Error opening output AVI file\n"));\r
- return;\r
- }\r
- gf_sc_add_audio_listener(avr->term->compositor, &avr->audio_listen);\r
- gf_sc_add_video_listener(avr->term->compositor, &avr->video_listen);\r
- avr->is_open = 1;\r
+static const char * possibleCodecs = "supported codecs : MPEG-1, MPEG-2, MPEG-4, MSMPEG-4, H263, H263I, H263P, RV10, MJPEG";\r
\r
- GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Open output AVI file %s\n", "dump.avi"));\r
-}\r
+/*#define DEFAULT_UDP_OUT_ADDRESS "127.0.0.1"\r
+#define DEFAULT_UDP_OUT_PORT 1234\r
+#define DEFAULT_UDP_OUT_PORT_STR "1234"*/\r
+\r
+#define AVR_DEFAULT_DESTINATION "udp://224.0.0.1:1234"\r
\r
-static void avr_close(GF_AVRedirect *avr)\r
+#include <libavutil/pixfmt.h>\r
+\r
+\r
+static void avr_close ( GF_AVRedirect *avr )\r
{\r
- if (!avr->is_open) return;\r
- gf_sc_remove_audio_listener(avr->term->compositor, &avr->audio_listen);\r
- gf_sc_remove_video_listener(avr->term->compositor, &avr->video_listen);\r
- avr->is_open = 0;\r
- AVI_close(avr->avi_out);\r
- GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("[AVRedirect] Closing output AVI file\n"));\r
+ if ( !avr->is_open ) return;\r
+ avr->is_open = 0;\r
+#ifdef AVR_DUMP_RAW_AVI\r
+ GF_LOG ( GF_LOG_INFO, GF_LOG_MODULE, ( "[AVRedirect] Closing output AVI file\n" ) );\r
+ AVI_close ( avr->avi_out );\r
+ avr->avi_out = NULL;\r
+#endif /* AVR_DUMP_RAW_AVI */\r
}\r
\r
-static Bool avr_process(GF_TermExt *termext, u32 action, void *param)\r
+static Bool avr_on_event ( void *udta, GF_Event *evt, Bool consumed_by_compositor )\r
{\r
- const char *opt;\r
- GF_AVRedirect *avr = termext->udta;\r
+ GF_AVRedirect *avr = udta;\r
+ switch ( evt->type )\r
+ {\r
+ case GF_EVENT_CONNECT:\r
+ if ( evt->connect.is_connected )\r
+ {\r
+ avr_open ( avr );\r
+ }\r
+ else\r
+ {\r
+ avr_close ( avr );\r
+ }\r
+ break;\r
+ }\r
+ return 0;\r
+}\r
\r
- switch (action) {\r
- case GF_TERM_EXT_START:\r
- avr->term = (GF_Terminal *)param;\r
- opt = gf_modules_get_option((GF_BaseInterface*)termext, "AVRedirect", "Enabled");\r
- if (!opt || strcmp(opt, "yes")) return 0;\r
- termext->caps |= GF_TERM_EXTENSION_FILTER_EVENT;\r
+static const char * AVR_ENABLED_OPTION = "Enabled";\r
\r
- avr->audio_listen.udta = avr;\r
- avr->audio_listen.on_audio_frame = avr_on_audio_frame;\r
- avr->audio_listen.on_audio_reconfig = avr_on_audio_reconfig;\r
- avr->video_listen.udta = avr;\r
- avr->video_listen.on_video_frame = avr_on_video_frame;\r
- avr->video_listen.on_video_reconfig = avr_on_video_reconfig;\r
- return 1;\r
+//static const char * AVR_UDP_PORT_OPTION = "udp.port";\r
\r
- case GF_TERM_EXT_STOP:\r
- avr->term = NULL;\r
- break;\r
+//static const char * AVR_UDP_ADDRESS_OPTION = "udp.address";\r
\r
- case GF_TERM_EXT_EVENT:\r
- {\r
- GF_Event *evt = (GF_Event *)param;\r
- switch (evt->type) {\r
- case GF_EVENT_CONNECT:\r
- if (evt->connect.is_connected) {\r
- avr_open(avr);\r
- } else {\r
- avr_close(avr);\r
- }\r
- break;\r
- }\r
- }\r
- break;\r
+static const char * AVR_DESTINATION = "destination";\r
\r
- /*if not threaded, perform our tasks here*/\r
- case GF_TERM_EXT_PROCESS:\r
- break;\r
- }\r
- return 0;\r
+static Bool avr_process ( GF_TermExt *termext, u32 action, void *param )\r
+{\r
+ const char *opt;\r
+ GF_AVRedirect *avr = termext->udta;\r
+\r
+ switch ( action )\r
+ {\r
+ case GF_TERM_EXT_START:\r
+ avr->term = ( GF_Terminal * ) param;\r
+ opt = gf_modules_get_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_ENABLED_OPTION );\r
+ if ( !opt )\r
+ gf_modules_set_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_ENABLED_OPTION, "no" );\r
+ if ( !opt || strcmp ( opt, "yes" ) ) return 0;\r
+ opt = gf_modules_get_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_VIDEO_CODEC_OPTION );\r
+ avr->globalLock = gf_global_resource_lock("AVRedirect:output");\r
+ if (!avr->globalLock) {\r
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("Failed to lock global resource 'AVRedirect:output', another GPAC instance must be running, disabling AVRedirect\n"));\r
+ return 0;\r
+ }\r
+ /* must be called before using avcodec lib */\r
+ avcodec_init();\r
+\r
+ /* register all the codecs */\r
+ avcodec_register_all();\r
+ if ( !opt )\r
+ gf_modules_set_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_VIDEO_CODEC_OPTION, possibleCodecs );\r
+ {\r
+ if ( !opt )\r
+ {\r
+ avr->videoCodec = avcodec_find_encoder ( CODEC_ID_MPEG2VIDEO );\r
+ }\r
+ else if ( !strcmp ( "MPEG-1", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_MPEG1VIDEO );\r
+ }\r
+ else if ( !strcmp ( "MPEG-2", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_MPEG2VIDEO );\r
+ }\r
+ else if ( !strcmp ( "MPEG-4", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_MPEG4 );\r
+ }\r
+ else if ( !strcmp ( "MSMPEG-4", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_MSMPEG4V3 );\r
+ }\r
+ else if ( !strcmp ( "H263", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_H263 );\r
+ }\r
+ else if ( !strcmp ( "RV10", opt ) )\r
+ {\r
+ avr->videoCodec = avcodec_find_encoder ( CODEC_ID_RV10 );\r
+ }\r
+ else if ( !strcmp ( "H263P", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_H263P );\r
+ }\r
+ else if ( !strcmp ( "H263I", opt ) )\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder ( CODEC_ID_H263I );\r
+ }\r
+ else if ( !strcmp( "MJPEG", opt))\r
+ {\r
+ avr->videoCodec=avcodec_find_encoder( CODEC_ID_MJPEG);\r
+ }\r
+ else\r
+ {\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] Not a known Video codec : %s, using MPEG-2 video instead, %s\n", opt, possibleCodecs ) );\r
+ avr->videoCodec = avcodec_find_encoder ( CODEC_ID_MPEG2VIDEO );\r
+ }\r
+ }\r
+ avr->audioCodec = avcodec_find_encoder( CODEC_ID_MP3);\r
+ /*\r
+ opt = gf_modules_get_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_UDP_ADDRESS_OPTION);\r
+ if (!opt) {\r
+ gf_modules_set_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_UDP_ADDRESS_OPTION, DEFAULT_UDP_OUT_ADDRESS);\r
+ avr->udp_address = DEFAULT_UDP_OUT_ADDRESS;\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] %s not set, using %s\n", AVR_UDP_ADDRESS_OPTION, DEFAULT_UDP_OUT_ADDRESS ) );\r
+ } else\r
+ avr->udp_address = opt;\r
+ opt = gf_modules_get_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_UDP_PORT_OPTION);\r
+ if (opt) {\r
+ char *endPtr = NULL;\r
+ unsigned int x = strtoul(opt, &endPtr, 10);\r
+ if (endPtr == opt || x > 65536) {\r
+ printf("Failed to parse : %s\n", opt);\r
+ opt = NULL;\r
+ } else\r
+ avr->udp_port = (u16) x;\r
+ }\r
+ if (!opt) {\r
+ gf_modules_set_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_UDP_PORT_OPTION, DEFAULT_UDP_OUT_PORT_STR);\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] %s is not set or valid, using %s\n", AVR_UDP_PORT_OPTION, DEFAULT_UDP_OUT_PORT_STR ) );\r
+ avr->udp_port = DEFAULT_UDP_OUT_PORT;\r
+ }\r
+ */\r
+ opt = gf_modules_get_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_DESTINATION);\r
+ if (!opt) {\r
+ gf_modules_set_option ( ( GF_BaseInterface* ) termext, moduleName, AVR_DESTINATION, AVR_DEFAULT_DESTINATION);\r
+ avr->destination = AVR_DEFAULT_DESTINATION;\r
+ GF_LOG ( GF_LOG_ERROR, GF_LOG_MODULE, ( "[AVRedirect] %s not set, using %s\n", AVR_DESTINATION, AVR_DEFAULT_DESTINATION ) );\r
+ } else\r
+ avr->destination = opt;\r
+ avr->audio_listen.udta = avr;\r
+ avr->audio_listen.on_audio_frame = avr_on_audio_frame;\r
+ avr->audio_listen.on_audio_reconfig = avr_on_audio_reconfig;\r
+ avr->video_listen.udta = avr;\r
+ avr->video_listen.on_video_frame = avr_on_video_frame;\r
+ avr->video_listen.on_video_reconfig = avr_on_video_reconfig;\r
+\r
+ avr->term_listen.udta = avr;\r
+ avr->term_listen.on_event = avr_on_event;\r
+ gf_term_add_event_filter ( avr->term, &avr->term_listen );\r
+ return 1;\r
+\r
+ case GF_TERM_EXT_STOP:\r
+ gf_term_remove_event_filter ( avr->term, &avr->term_listen );\r
+ avr->term = NULL;\r
+ break;\r
+\r
+ /*if not threaded, perform our tasks here*/\r
+ case GF_TERM_EXT_PROCESS:\r
+ break;\r
+ }\r
+ return 0;\r
}\r
\r
\r
GF_TermExt *avr_new()\r
{\r
- GF_TermExt *dr;\r
- GF_AVRedirect *uir;\r
- dr = gf_malloc(sizeof(GF_TermExt));\r
- memset(dr, 0, sizeof(GF_TermExt));\r
- GF_REGISTER_MODULE_INTERFACE(dr, GF_TERM_EXT_INTERFACE, "GPAC Output Recorder", "gpac distribution");\r
-\r
- GF_SAFEALLOC(uir, GF_AVRedirect);\r
- dr->process = avr_process;\r
- dr->udta = uir;\r
- return dr;\r
+ GF_TermExt *dr;\r
+ GF_AVRedirect *uir;\r
+ dr = gf_malloc ( sizeof ( GF_TermExt ) );\r
+ memset ( dr, 0, sizeof ( GF_TermExt ) );\r
+ GF_REGISTER_MODULE_INTERFACE ( dr, GF_TERM_EXT_INTERFACE, "GPAC Output Recorder", "gpac distribution" );\r
+\r
+ GF_SAFEALLOC ( uir, GF_AVRedirect );\r
+ dr->process = avr_process;\r
+ dr->udta = uir;\r
+ uir->encodingMutex = gf_mx_new("RedirectAV_encodingMutex");\r
+ assert( uir->encodingMutex);\r
+ uir->frameMutex = gf_mx_new("RedirectAV_frameMutex");\r
+ uir->encodingThread = gf_th_new("RedirectAV_EncodingThread");\r
+ uir->audioEncodingThread = gf_th_new("RedirectAV_AudioEncodingThread");\r
+ uir->encode = 1;\r
+ uir->is_open = 0;\r
+ uir->is_running = 0;\r
+ return dr;\r
}\r
\r
\r
-void avr_delete(GF_BaseInterface *ifce)\r
+void avr_delete ( GF_BaseInterface *ifce )\r
{\r
- GF_TermExt *dr = (GF_TermExt *) ifce;\r
- GF_AVRedirect *uir = dr->udta;\r
- gf_free(uir);\r
- gf_free(dr);\r
+ GF_TermExt *dr = ( GF_TermExt * ) ifce;\r
+ GF_AVRedirect *avr = dr->udta;\r
+ avr->is_running = 0;\r
+ /* Ensure encoding is finished */\r
+ gf_mx_p(avr->frameMutex);\r
+ gf_mx_v(avr->frameMutex);\r
+ gf_sleep(200);\r
+ gf_th_stop(avr->encodingThread);\r
+ gf_mx_del(avr->frameMutex);\r
+ avr->frameMutex = NULL;\r
+ gf_th_del(avr->encodingThread);\r
+ avr->encodingThread = NULL;\r
+ gf_mx_del(avr->encodingMutex);\r
+ avr->encodingMutex = NULL;\r
+ if ( avr->ts_implementation )\r
+ {\r
+ ts_amux_del(avr->ts_implementation);\r
+ avr->ts_implementation = NULL;\r
+ }\r
+ avr->videoCodec = NULL;\r
+ if ( avr->YUVpicture )\r
+ {\r
+ av_free ( avr->YUVpicture );\r
+ }\r
+ if ( avr->yuv_data )\r
+ av_free ( avr->yuv_data );\r
+ avr->yuv_data = NULL;\r
+ avr->YUVpicture = NULL;\r
+ if ( avr->RGBpicture )\r
+ {\r
+ av_free ( avr->RGBpicture );\r
+ }\r
+ avr->RGBpicture = NULL;\r
+ if ( avr->swsContext )\r
+ sws_freeContext ( avr->swsContext );\r
+ avr->swsContext = NULL;\r
+ if ( avr->videoOutbuf )\r
+ gf_free ( avr->videoOutbuf );\r
+ avr->videoOutbuf = NULL;\r
+ if ( avr->pcmAudio )\r
+ gf_ringbuffer_del(avr->pcmAudio);\r
+ avr->pcmAudio = NULL;\r
+ gf_global_resource_unlock(avr->globalLock);\r
+ avr->globalLock = NULL;\r
+ if (avr->audioEncodingThread){\r
+ gf_th_stop(avr->audioEncodingThread);\r
+ gf_th_del(avr->audioEncodingThread);\r
+ }\r
+ avr->audioEncodingThread = NULL;\r
+ gf_free ( avr );\r
+ gf_free ( dr );\r
}\r
\r
GF_EXPORT\r
-const u32 *QueryInterfaces() \r
+const u32 *QueryInterfaces()\r
{\r
- static u32 si [] = {\r
- GF_TERM_EXT_INTERFACE,\r
- 0\r
- };\r
- return si;\r
+ static u32 si [] =\r
+ {\r
+ GF_TERM_EXT_INTERFACE,\r
+ 0\r
+ };\r
+ return si;\r
}\r
\r
GF_EXPORT\r
-GF_BaseInterface *LoadInterface(u32 InterfaceType)\r
+GF_BaseInterface *LoadInterface ( u32 InterfaceType )\r
{\r
- if (InterfaceType == GF_TERM_EXT_INTERFACE) return (GF_BaseInterface *)avr_new();\r
- return NULL;\r
+ if ( InterfaceType == GF_TERM_EXT_INTERFACE ) return ( GF_BaseInterface * ) avr_new();\r
+ return NULL;\r
}\r
\r
GF_EXPORT\r
-void ShutdownInterface(GF_BaseInterface *ifce)\r
+void ShutdownInterface ( GF_BaseInterface *ifce )\r
{\r
- switch (ifce->InterfaceType) {\r
- case GF_TERM_EXT_INTERFACE:\r
- avr_delete(ifce);\r
- break;\r
- }\r
+ switch ( ifce->InterfaceType )\r
+ {\r
+ case GF_TERM_EXT_INTERFACE:\r
+ avr_delete ( ifce );\r
+ break;\r
+ }\r
}\r
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Authors: Jean le Feuvre
+ * Copyright (c) 2010-20XX Telecom ParisTech
+ * All rights reserved
+ *
+ * This file is part of GPAC / AVI Recorder demo module
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#ifndef _AVR_TS_MUXER_H_
+#define _AVR_TS_MUXER_H_
+
+#include <gpac/modules/term_ext.h>
+#include <gpac/internal/terminal_dev.h>
+#include <gpac/internal/compositor_dev.h>
+#include <gpac/network.h>
+#include <gpac/tools.h>
+#include <libavcodec/avcodec.h>
+
+#if (LIBAVCODEC_VERSION_MAJOR <= 52) && (LIBAVCODEC_VERSION_MINOR <= 20)
+#undef USE_AVCODEC2
+#else
+#define USE_AVCODEC2 1
+#endif
+
+#define TS_MUX_MODE_PUT
+
+#undef AVR_DUMP_RAW_AVI
+
+#ifdef AVR_DUMP_RAW_AVI
+/*sample raw AVI writing*/
+#include <gpac/internal/avilib.h>
+#endif /* AVR_DUMP_RAW_AVI */
+
+typedef struct avr_ts_muxer GF_AbstractTSMuxer;
+
+#if LIBAVUTIL_VERSION_MAJOR<51
+#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
+#endif
+
+
+#include <gpac/ringbuffer.h>
+
+typedef struct
+{
+ GF_Terminal *term;
+
+ Bool is_open;
+ GF_AudioListener audio_listen;
+ GF_VideoListener video_listen;
+ GF_TermEventFilter term_listen;
+#ifdef AVR_DUMP_RAW_AVI
+ avi_t *avi_out;
+#endif
+ char *frame;
+ u32 size;
+ GF_AbstractTSMuxer * ts_implementation;
+ Bool encode;
+ AVCodec *audioCodec;
+ AVCodec *videoCodec;
+ AVFrame *YUVpicture, *RGBpicture;
+ struct SwsContext * swsContext;
+ uint8_t * yuv_data;
+ uint8_t * videoOutbuf;
+ u32 videoOutbufSize;
+ GF_Ringbuffer * pcmAudio;
+ u32 audioCurrentTime;
+ GF_Thread * encodingThread;
+ GF_Thread * audioEncodingThread;
+ GF_Mutex * frameMutex;
+ GF_Mutex * encodingMutex;
+ volatile Bool is_running;
+ u64 frameTime;
+ u64 frameTimeEncoded;
+ /**
+ * Audio parameters for encoding
+ */
+ u32 audioSampleRate;
+ u16 audioChannels;
+ /**
+ * Video parameters for encoding
+ */
+ u32 srcWidth;
+ u32 srcHeight;
+ const char * destination;
+ GF_GlobalLock * globalLock;
+ Bool started;
+} GF_AVRedirect;
+
+GF_AbstractTSMuxer * ts_amux_new(GF_AVRedirect * avr, u32 videoBitrateInBitsPerSec, u32 width, u32 height, u32 audioBitRateInBitsPerSec);
+
+void ts_amux_del(GF_AbstractTSMuxer * muxerToDelete);
+
+Bool ts_encode_audio_frame(GF_AbstractTSMuxer * ts, uint8_t * data, int encoded, u64 pts);
+
+Bool ts_encode_video_frame(GF_AbstractTSMuxer* ts, uint8_t* data, int encoded);
+
+AVCodecContext * ts_get_video_codec_context(GF_AbstractTSMuxer * ts);
+
+AVCodecContext * ts_get_audio_codec_context(GF_AbstractTSMuxer * ts);
+
+#endif /* _AVR_TS_MUXER_H_ */
vpath %.c $(SRC_PATH)/modules/rtp_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / RTP input module
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include "rtp_in.h"
}
if ((rtp->default_port == 80) || (rtp->default_port == 8080))
gf_modules_set_option((GF_BaseInterface *)plug, "Streaming", "RTPoverRTSP", "yes");
-
+
sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "Streaming", "RTPoverRTSP");
if (sOpt && !stricmp(sOpt, "yes")) {
rtp->transport_mode = 1;
/*turn it off*/
gf_modules_set_option((GF_BaseInterface *)plug, "Network", "UDPNotAvailable", "no");
}
-
+
if (!rtp->transport_mode) {
sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "Network", "UDPTimeout");
if (sOpt ) {
rtp->udp_time_out = 10000;
}
}
-
+
sOpt = gf_modules_get_option((GF_BaseInterface *)plug, "Streaming", "RTSPTimeout");
if (sOpt ) {
rtp->time_out = atoi(sOpt);
RP_ReadStream(ch);
}
}
-
+
/*and process commands / flush TCP*/
i=0;
while ((sess = (RTSPSession *)gf_list_enum(rtp->sessions, &i))) {
return 0;
}
+static const char * sdp_mime = "application/sdp";
+
+static const char * sdp_exts = "sdp";
+
+static const char * sdp_desc = "OnDemand Media/Multicast Session";
+
+static u32 RP_RegisterMimeTypes(const GF_InputService *plug){
+ if (!plug)
+ return 0;
+ gf_term_register_mime_type(plug, sdp_mime, sdp_exts, sdp_desc);
+ return 1;
+}
static Bool RP_CanHandleURL(GF_InputService *plug, const char *url)
{
- char *sExt = strrchr(url, '.');
+ char *sExt;
+ if (!plug || !url)
+ return 0;
+ sExt = strrchr(url, '.');
- if (sExt && gf_term_check_extension(plug, "application/sdp", "sdp", "OnDemand Media/Multicast Session", sExt)) return 1;
+ if (sExt && gf_term_check_extension(plug, sdp_mime, sdp_exts, sdp_desc, sExt)) return 1;
/*local */
if (strstr(url, "data:application/sdp")) return 1;
/*embedded data*/
- if (strstr(url, "data:application/mpeg4-od-au;base64") ||
+ if (strstr(url, "data:application/mpeg4-od-au;base64") ||
strstr(url, "data:application/mpeg4-bifs-au;base64") ||
strstr(url, "data:application/mpeg4-es-au;base64")) return 1;
RP_FetchSDP(priv, (char *) url, NULL, NULL);
return GF_OK;
}
-
+
/*rtsp and rtsp over udp*/
if (!strnicmp(url, "rtsp://", 7) || !strnicmp(url, "rtspu://", 8)) {
char *the_url = gf_strdup(url);
if (rtp->session_state_data) {
gf_free(rtp->session_state_data);
rtp->session_state_data = NULL;
- }
+ }
/*send teardown on all sessions*/
i=0;
es_url = NULL;
sess = NULL;
if (strstr(url, "ES_ID=")) {
- sscanf(url, "ES_ID=%d", &ESID);
+ sscanf(url, "ES_ID=%ud", &ESID);
/*first case: simple URL (same namespace)*/
ch = RP_FindChannel(priv, NULL, ESID, NULL, 0);
/*this should not happen, the sdp must describe all streams in the service*/
if (!ch) return GF_STREAM_NOT_FOUND;
-
+
/*assign app channel*/
ch->channel = channel;
sess = ch->rtsp;
es_url = (char *) url;
}
/*data: url*/
- else if (strstr(url, "data:application/mpeg4-od-au;base64")
+ else if (strstr(url, "data:application/mpeg4-od-au;base64")
|| strstr(url, "data:application/mpeg4-bifs-au;base64")
|| strstr(url, "data:application/mpeg4-es-au;base64")
) {
-
+
GF_SAFEALLOC(ch, RTPStream);
ch->control = gf_strdup(url);
ch->owner = priv;
}
return GF_OK;
-
+
case GF_NET_GET_STATS:
memset(&com->net_stats, 0, sizeof(GF_NetComStats));
if (ch->rtp_ch) {
RTSPSession *sess;
RTPClient *priv = (RTPClient *)plug->priv;
- if (strstr(url, "data:application/mpeg4-od-au;base64")
+ if (strstr(url, "data:application/mpeg4-od-au;base64")
|| strstr(url, "data:application/mpeg4-bifs-au;base64")
|| strstr(url, "data:application/mpeg4-es-au;base64")
) return 1;
u32 i=0;
RTPStream *st;
while ((st = (RTPStream *)gf_list_enum(priv->channels, &i))) {
- if (st->depacketizer && (st->depacketizer->sl_map.StreamType==st_type))
+ if (st->depacketizer && (st->depacketizer->sl_map.StreamType==st_type))
return 1;
}
}
RTPClient *priv;
GF_InputService *plug;
GF_SAFEALLOC(plug, GF_InputService);
-
+ memset(plug, 0, sizeof(GF_InputService));
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC RTP/RTSP Client", "gpac distribution")
plug->CanHandleURL = RP_CanHandleURL;
plug->ConnectChannel = RP_ConnectChannel;
plug->DisconnectChannel = RP_DisconnectChannel;
plug->ServiceCommand = RP_ServiceCommand;
+ plug->RegisterMimeTypes = RP_RegisterMimeTypes;
/*PULL mode for embedded streams*/
plug->ChannelGetSLP = RP_ChannelGetSLP;
priv->channels = gf_list_new();
plug->priv = priv;
-
+
priv->time_out = 30000;
priv->mx = gf_mx_new("RTPDemux");
priv->th = gf_th_new("RTPDemux");
-
+
return plug;
}
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_STREAMING
#endif
0
};
- return si;
+ return si;
}
GF_EXPORT
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
{
#ifndef GPAC_DISABLE_STREAMING
if (InterfaceType == GF_NET_CLIENT_INTERFACE) return (GF_BaseInterface *)RTP_Load();
else if (!stricmp(att->Name, "mpeg4-odid") && att->Value) ODID = atoi(att->Value);
else if (!stricmp(att->Name, "range") && !range) range = gf_rtsp_range_parse(att->Value);
else if (!stricmp(att->Name, "x-stream-state") ) {
- sscanf(att->Value, "server-port=%d-%d;ssrc=%X;npt=%g;seq=%d;rtptime=%d",
+ sscanf(att->Value, "server-port=%u-%u;ssrc=%X;npt=%g;seq=%u;rtptime=%u",
&s_port_first, &s_port_last, &ssrc, &CurrentTime, &rtp_seq, &rtp_time);
is_migration = 1;
}
else if (!stricmp(att->Name, "x-server-port") ) {
- sscanf(att->Value, "%d-%d", &s_port_first, &s_port_last);
+ sscanf(att->Value, "%u-%u", &s_port_first, &s_port_last);
}
}
sdp_buf = NULL;
if (file_name && strstr(file_name, "file://")) file_name += strlen("file://");
- if (!file_name || !(_sdp = fopen(file_name, "rt")) ) {
+ if (!file_name || !(_sdp = gf_f64_open(file_name, "rt")) ) {
gf_term_on_connect(rtp->service, NULL, GF_URL_ERROR);
return;
}
- fseek(_sdp, 0, SEEK_END);
- sdp_size = ftell(_sdp);
- fseek(_sdp, 0, SEEK_SET);
+ gf_f64_seek(_sdp, 0, SEEK_END);
+ sdp_size = (u32) gf_f64_tell(_sdp);
+ gf_f64_seek(_sdp, 0, SEEK_SET);
sdp_buf = (char*)gf_malloc(sdp_size);
- fread(sdp_buf, sdp_size, 1, _sdp);
- RP_LoadSDP(rtp, sdp_buf, sdp_size, stream);
-
+ if (1 > fread(sdp_buf, 1, sdp_size, _sdp)){
+ gf_term_on_connect(rtp->service, NULL, GF_URL_ERROR);
+ } else {
+ RP_LoadSDP(rtp, sdp_buf, sdp_size, stream);
+ }
fclose(_sdp);
gf_free(sdp_buf);
}
vpath %.c $(SRC_PATH)/modules/saf_in
-CFLAGS= $(OPTFLAGS) -w -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
#include <gpac/modules/service.h>
return NULL;
}
+static const char * SAF_MIME = "application/x-saf";
+
+static const char * SAF_MIME_EXT = "saf lsr";
+
+static const char * SAF_MIME_DESC = "SAF Rich Media";
+
+static u32 SAF_RegisterMimeTypes(const GF_InputService *plug)
+{
+ if (!plug)
+ return 0;
+ gf_term_register_mime_type(plug, SAF_MIME, SAF_MIME_EXT, SAF_MIME_DESC);
+ return 1;
+}
+
static Bool SAF_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ if (!plug || !url)
+ return 0;
sExt = strrchr(url, '.');
- if (!sExt) return 0;
- if (gf_term_check_extension(plug, "application/x-saf", "saf lsr", "SAF Rich Media", sExt)) return 1;
+ if (gf_term_check_extension(plug, SAF_MIME, SAF_MIME_EXT, SAF_MIME_DESC, sExt)) return 1;
return 0;
}
u64 bs_pos;
GF_BitStream *bs;
GF_SLHeader sl_hdr;
-
+
SAFIn *read = (SAFIn *) cbk;
e = param->error;
}
}
-
GF_InputService *NewSAFReader()
{
SAFIn *reader;
GF_SAFEALLOC(plug, GF_InputService);
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC SAF Reader", "gpac distribution")
+ plug->RegisterMimeTypes = SAF_RegisterMimeTypes;
plug->CanHandleURL = SAF_CanHandleURL;
plug->ConnectService = SAF_ConnectService;
plug->CloseService = SAF_CloseService;
{
GF_InputService *plug = (GF_InputService *) ifce;
SAFIn *read = (SAFIn *)plug->priv;
-
+ if (!ifce)
+ return;
while (gf_list_count(read->channels)) {
SAFChannel *ch = (SAFChannel *)gf_list_last(read->channels);
gf_list_rem_last(read->channels);
gf_free(ch);
}
gf_list_del(read->channels);
- if (read->saf_data) gf_free(read->saf_data);
+ if (read->saf_data)
+ gf_free(read->saf_data);
+ read->saf_data = NULL;
gf_free(read);
+ plug->priv = NULL;
gf_free(plug);
}
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
GF_NET_CLIENT_INTERFACE,
0
};
- return si;
+ return si;
}
GF_EXPORT
vpath %.c $(SRC_PATH)/modules/sdl_out
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include $(SDL_CFLAGS)
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(SDL_CFLAGS)
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
*
*/
+#ifdef GPAC_IPHONE
+#include "libgpac_symbols.h"
+#endif
+
#include "sdl_out.h"
#define SDLAUD() SDLAudCtx *ctx = (SDLAudCtx *)dr->opaque
+static void sdl_close_audio(){
+ SDL_CloseAudio();
+}
+
+
void sdl_fill_audio(void *udata, Uint8 *stream, int len)
{
GF_AudioOutput *dr = (GF_AudioOutput *)udata;
- dr->FillBuffer(dr->audio_renderer, stream, len);
+ SDLAUD();
+ if (ctx->volume != SDL_MIX_MAXVOLUME){
+ ctx->audioBuff = gf_realloc( ctx->audioBuff, sizeof(Uint8) * len);
+ dr->FillBuffer(dr->audio_renderer, ctx->audioBuff, len);
+ SDL_MixAudio(stream, ctx->audioBuff, len, ctx->volume);
+ } else {
+ dr->FillBuffer(dr->audio_renderer, stream, len);
+ }
}
want_format.callback = sdl_fill_audio;
want_format.userdata = dr;
if ( SDL_OpenAudio(&want_format, &got_format) < 0 ) {
+ sdl_close_audio();
SDL_QuitSubSystem(SDL_INIT_AUDIO);
SDLOUT_CloseSDL();
return GF_IO_ERR;
}
- SDL_CloseAudio();
+ sdl_close_audio();
ctx->is_init = 1;
ctx->num_buffers = num_buffers;
ctx->total_duration = total_duration;
static void SDLAud_Shutdown(GF_AudioOutput *dr)
{
SDLAUD();
-
- if (ctx->is_running) SDL_CloseAudio();
+ sdl_close_audio();
if (ctx->is_init) {
SDL_QuitSubSystem(SDL_INIT_AUDIO);
SDLOUT_CloseSDL();
}
}
+void SDL_DeleteAudio(void *ifce){
+ SDLAudCtx *ctx;
+ GF_AudioOutput * dr;
+ if (!ifce)
+ return;
+ dr = ( GF_AudioOutput *) ifce;
+ ctx = (SDLAudCtx *)dr->opaque;
+ if (!ctx)
+ return;
+ if (ctx->audioBuff)
+ gf_free(ctx->audioBuff);
+ ctx->audioBuff = NULL;
+ gf_free( ctx );
+ dr->opaque = NULL;
+ gf_free( dr );
+}
+
static GF_Err SDLAud_ConfigureOutput(GF_AudioOutput *dr, u32 *SampleRate, u32 *NbChannels, u32 *nbBitsPerSample, u32 channel_cfg)
{
s32 nb_samples;
SDL_AudioSpec want_format, got_format;
SDLAUD();
- if (ctx->is_running) SDL_CloseAudio();
+ sdl_close_audio();
ctx->is_running = 0;
memset(&want_format, 0, sizeof(SDL_AudioSpec));
static void SDLAud_SetVolume(GF_AudioOutput *dr, u32 Volume)
{
- /*not supported by SDL*/
+ SDLAUD();
+ if (Volume > 98)
+ ctx->volume = SDL_MIX_MAXVOLUME;
+ else
+ ctx->volume = Volume * SDL_MIX_MAXVOLUME / 100;
}
static void SDLAud_SetPan(GF_AudioOutput *dr, u32 pan)
dr->QueryOutputSampleRate = SDLAud_QueryOutputSampleRate;
/*always threaded*/
dr->SelfThreaded = 1;
+ ctx->audioBuff = NULL;
+ ctx->volume = SDL_MIX_MAXVOLUME;
return dr;
}
-void SDL_DeleteAudio(void *ifce)
-{
- GF_AudioOutput *dr = (GF_AudioOutput*)ifce;
- SDLAUD();
-
- gf_free(ctx);
- gf_free(ifce);
-}
-
*
*/
+#ifndef _GF_SDL_OUT_H_
+#define _GF_SDL_OUT_H_
/*SDL*/
#include <SDL.h>
Bool SDLOUT_InitSDL();
void SDLOUT_CloseSDL();
-//#define SDL_WINDOW_THREAD
-
+/*when not threaded on win32, locks happen randomly when setting the window's caption*/
+#ifdef WIN32
+#define SDL_WINDOW_THREAD
+#endif
typedef struct
{
u32 output_3d_type;
void *os_handle;
+ Bool force_alpha;
u32 last_mouse_move;
Bool cursor_on;
*/
typedef struct
{
- u32 num_buffers, total_duration, delay_ms, total_size;
+ u32 num_buffers, total_duration, delay_ms, total_size, volume;
Bool is_init, is_running;
+ Uint8 * audioBuff;
} SDLAudCtx;
void SDL_DeleteAudio(void *ifce);
void *SDL_NewAudio();
-
+#endif
*
*/
-
+#ifdef GPAC_IPHONE
+#include "libgpac_symbols.h"
+#else
#include "sdl_out.h"
#include <gpac/user.h>
+#endif
#ifdef WIN32
evt->key_code = GF_KEY_ALT;
evt->flags = GF_KEY_EXT_RIGHT;
break;
- case SDLK_LSUPER:
+/* case SDLK_LSUPER:
evt->key_code = GF_KEY_META;
evt->flags = GF_KEY_EXT_LEFT;
break;
case SDLK_RSUPER:
evt->key_code = GF_KEY_META;
evt->flags = GF_KEY_EXT_RIGHT;
- break;
+ break;*/
case SDLK_MODE: evt->key_code = GF_KEY_MODECHANGE; break;
case SDLK_COMPOSE: evt->key_code = GF_KEY_COMPOSE; break;
case SDLK_HELP: evt->key_code = GF_KEY_HELP; break;
case SDLK_PRINT: evt->key_code = GF_KEY_PRINTSCREEN; break;
+#if (SDL_MAJOR_VERSION>=1) && (SDL_MINOR_VERSION>=3)
/*
SDLK_CARET = 94,
- SDLK_a = 97,
- SDLK_b = 98,
- SDLK_c = 99,
- SDLK_d = 100,
- SDLK_e = 101,
- SDLK_f = 102,
- SDLK_g = 103,
- SDLK_h = 104,
- SDLK_i = 105,
- SDLK_j = 106,
- SDLK_k = 107,
- SDLK_l = 108,
- SDLK_m = 109,
- SDLK_n = 110,
- SDLK_o = 111,
- SDLK_p = 112,
- SDLK_q = 113,
- SDLK_r = 114,
- SDLK_s = 115,
- SDLK_t = 116,
- SDLK_u = 117,
- SDLK_v = 118,
- SDLK_w = 119,
- SDLK_x = 120,
- SDLK_y = 121,
- SDLK_z = 122,
- SDLK_DELETE = 127,
+ */
+ case SDLK_a:
+ case SDLK_b:
+ case SDLK_c:
+ case SDLK_d:
+ case SDLK_e:
+ case SDLK_f:
+ case SDLK_g:
+ case SDLK_h:
+ case SDLK_i:
+ case SDLK_j:
+ case SDLK_k:
+ case SDLK_l:
+ case SDLK_m:
+ case SDLK_n:
+ case SDLK_o:
+ case SDLK_p:
+ case SDLK_q:
+ case SDLK_r:
+ case SDLK_s:
+ case SDLK_t:
+ case SDLK_u:
+ case SDLK_v:
+ case SDLK_w:
+ case SDLK_x:
+ case SDLK_y:
+ case SDLK_z:
+ evt->key_code = GF_KEY_A + SDLkey - SDLK_a;
+ break;
+ /*
+ SDLK_DELETE = 127,
SDLK_SYSREQ = 317,
SDLK_POWER = 320,
*/
-
+#endif
+
default:
if ((SDLkey>=0x30) && (SDLkey<=0x39)) evt->key_code = GF_KEY_0 + SDLkey-0x30;
else if ((SDLkey>=0x41) && (SDLkey<=0x5A)) evt->key_code = GF_KEY_A + SDLkey-0x51;
else
+ {
evt->key_code = GF_KEY_UNIDENTIFIED;
+ }
break;
}
}
}
+#ifdef GPAC_IPHONE
+#define SDL_WINDOW_FLAGS SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE | SDL_NOFRAME
+#define SDL_FULLSCREEN_FLAGS SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_FULLSCREEN | SDL_NOFRAME
+#define SDL_GL_WINDOW_FLAGS SDL_HWSURFACE | SDL_OPENGL | SDL_HWACCEL | SDL_RESIZABLE | SDL_NOFRAME
+#define SDL_GL_FULLSCREEN_FLAGS SDL_HWSURFACE | SDL_OPENGL | SDL_HWACCEL | SDL_FULLSCREEN | SDL_NOFRAME
+#else
#define SDL_WINDOW_FLAGS SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE
#define SDL_FULLSCREEN_FLAGS SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_FULLSCREEN
#define SDL_GL_WINDOW_FLAGS SDL_HWSURFACE | SDL_OPENGL | SDL_HWACCEL | SDL_RESIZABLE
#define SDL_GL_FULLSCREEN_FLAGS SDL_HWSURFACE | SDL_OPENGL | SDL_HWACCEL | SDL_FULLSCREEN
+#endif
+
GF_Err SDLVid_ResizeWindow(GF_VideoOutput *dr, u32 width, u32 height)
{
}
flags = SDL_GL_WINDOW_FLAGS;
if (ctx->os_handle) flags &= ~SDL_RESIZABLE;
+ if (ctx->fullscreen) flags |= SDL_FULLSCREEN_FLAGS;
if (!ctx->screen) ctx->screen = SDL_SetVideoMode(width, height, 0, flags);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
evt.type = GF_EVENT_VIDEO_SETUP;
dr->on_event(dr->evt_cbk_hdl, &evt);
} else {
- u32 flags = SDL_WINDOW_FLAGS;
+ u32 flags;
+#ifdef GPAC_IPHONE
+ flags = SDL_FULLSCREEN_FLAGS;
+ //SDL readme says it would make us faster
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
+ SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1);
+#else
+ flags = SDL_WINDOW_FLAGS;
+#endif
if (ctx->os_handle) flags &= ~SDL_RESIZABLE;
ctx->screen = SDL_SetVideoMode(width, height, 0, flags);
}
u32 flags;
const SDL_VideoInfo *vinf;
+ putenv("directx");
flags = SDL_WasInit(SDL_INIT_VIDEO);
if (!(flags & SDL_INIT_VIDEO)) {
if (SDL_InitSubSystem(SDL_INIT_VIDEO)<0) {
/*save display resolution - SDL seems to get the screen resolution if asked for video info before
changing the video mode - to check on other platforms*/
vinf = SDL_GetVideoInfo();
+#if SDL_VERSION_ATLEAST(1, 2, 10)
dr->max_screen_width = vinf->current_w;
dr->max_screen_height = vinf->current_h;
+#else
+ {
+ SDL_Rect** modes;
+ modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
+ assert( (modes != (SDL_Rect**)0));
+ if ( modes == (SDL_Rect**)-1 ){
+ fprintf(stderr, "SDL : DONT KNOW WHICH MODE TO USE, using 640x480\n");
+ dr->max_screen_width = 640;
+ dr->max_screen_height = 480;
+ } else {
+ int i;
+ dr->max_screen_width = 0;
+ for (i=0; modes[i]; ++i){
+ int w = modes[i]->w;
+ if (w > dr->max_screen_width){
+ dr->max_screen_width = w;
+ dr->max_screen_height = modes[i]->h;
+ }
+ }
+ }
+ }
+#endif /* versions prior to 1.2.10 do not have the size of screen */
SDLVid_ResizeWindow(dr, 100, 100);
if (!ctx->os_handle) SDLVid_SetCaption();
-
GF_LOG(GF_LOG_INFO, GF_LOG_MMIO, ("[SDL] Video output initialized - screen resolution %d %d\n", dr->max_screen_width, dr->max_screen_height));
return 1;
}
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
+#if defined SDL_TEXTINPUTEVENT_TEXT_SIZE && !defined GPAC_IPHONE
+#include <gpac/unicode.h>
+#endif
+
Bool SDLVid_ProcessMessageQueue(SDLVidCtx *ctx, GF_VideoOutput *dr)
{
gpac_evt.type = GF_EVENT_REFRESH;
dr->on_event(dr->evt_cbk_hdl, &gpac_evt);
break;
-
+#ifdef SDL_TEXTINPUTEVENT_TEXT_SIZE
/*keyboard*/
+ case SDL_TEXTINPUT: /* Since SDL 1.3, text-input is handled in a specific event */
+ {
+ u32 len = strlen( sdl_evt.text.text);
+ u32 ucs4_len;
+ assert( len < 5 );
+ ucs4_len = utf8_to_ucs4 (&(gpac_evt.character.unicode_char), len, sdl_evt.text.text);
+ gpac_evt.type = GF_EVENT_TEXTINPUT;
+ dr->on_event(dr->evt_cbk_hdl, &gpac_evt);
+ break;
+ }
+#endif /* SDL_TEXTINPUTEVENT_TEXT_SIZE */
case SDL_KEYDOWN:
case SDL_KEYUP:
sdl_translate_key(sdl_evt.key.keysym.sym, &gpac_evt.key);
gpac_evt.type = (sdl_evt.key.type==SDL_KEYDOWN) ? GF_EVENT_KEYDOWN : GF_EVENT_KEYUP;
dr->on_event(dr->evt_cbk_hdl, &gpac_evt);
+#ifndef SDL_TEXTINPUTEVENT_TEXT_SIZE
if ((sdl_evt.key.type==SDL_KEYDOWN) && sdl_evt.key.keysym.unicode) {
gpac_evt.character.unicode_char = sdl_evt.key.keysym.unicode;
gpac_evt.type = GF_EVENT_TEXTINPUT;
dr->on_event(dr->evt_cbk_hdl, &gpac_evt);
}
+#endif /* SDL_TEXTINPUTEVENT_TEXT_SIZE */
break;
/*mouse*/
#ifdef SDL_WINDOW_THREAD
u32 SDLVid_EventProc(void *par)
{
- u32 flags, last_mouse_move;
+#if 0
+ u32 last_mouse_move;
+#endif
Bool ret;
GF_VideoOutput *dr = (GF_VideoOutput *)par;
SDLVID();
- ctx->sdl_th_state = 1;
if (!SDLVid_InitializeWindow(ctx, dr)) {
ctx->sdl_th_state = 3;
}
+ ctx->sdl_th_state = 1;
while (ctx->sdl_th_state==1) {
/*after much testing: we must ensure nothing is using the event queue when resizing window.
ctx->os_handle = os_handle;
ctx->is_init = 0;
ctx->output_3d_type = 0;
+ ctx->force_alpha = (init_flags & GF_TERM_WINDOW_TRANSPARENT) ? 1 : 0;
if (!SDLOUT_InitSDL()) return GF_IO_ERR;
if (ctx->output_3d_type==1) return GF_BAD_PARAM;
+ opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "HardwareMemory");
if (system_mem) {
- opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "UseHardwareMemory");
- if (opt && !strcmp(opt, "yes")) system_mem = 0;
+ if (opt && !strcmp(opt, "Always")) system_mem = 0;
+ } else {
+ if (opt && !strcmp(opt, "Never")) system_mem = 1;
}
ctx->use_systems_memory = system_mem;
return GF_OK;
}
-u32 SDLVid_MapPixelFormat(SDL_PixelFormat *format)
+u32 SDLVid_MapPixelFormat(SDL_PixelFormat *format, Bool force_alpha)
{
if (format->palette) return 0;
switch (format->BitsPerPixel) {
return 0;
case 32:
if (format->Amask==0xFF000000) return GF_PIXEL_ARGB;
- if (format->Rmask==0x00FF0000) return GF_PIXEL_RGB_32;
- if (format->Rmask==0x000000FF) return GF_PIXEL_BGR_32;
+ if (format->Rmask==0x00FF0000) return force_alpha ? GF_PIXEL_ARGB : GF_PIXEL_RGB_32;
+ if (format->Rmask==0x000000FF) return force_alpha ? GF_PIXEL_RGBA : GF_PIXEL_BGR_32;
return 0;
default:
return 0;
}
}
+#ifdef UNUSED_FUNC
+static char szTYPE[5];
+static const char *my_gf_4cc_to_str(u32 type)
+{
+ u32 ch, i;
+ char *ptr, *name = (char *)szTYPE;
+ ptr = name;
+ for (i = 0; i < 4; i++, name++) {
+ ch = type >> (8 * (3-i) ) & 0xff;
+ if ( ch >= 0x20 && ch <= 0x7E ) {
+ *name = ch;
+ } else {
+ *name = '.';
+ }
+ }
+ *name = 0;
+ return (const char *) ptr;
+}
+#endif /* UNUSED_FUNC */
+
static GF_Err SDLVid_LockBackBuffer(GF_VideoOutput *dr, GF_VideoSurface *video_info, u32 do_lock)
{
SDLVID();
video_info->pitch_x = 0;
video_info->pitch_y = ctx->back_buffer->pitch;
video_info->video_buffer = ctx->back_buffer->pixels;
- video_info->pixel_format = SDLVid_MapPixelFormat(ctx->back_buffer->format);
+ video_info->pixel_format = SDLVid_MapPixelFormat(ctx->back_buffer->format, ctx->force_alpha);
video_info->is_hardware_memory = !ctx->use_systems_memory;
} else {
SDL_UnlockSurface(ctx->back_buffer);
src.width = ctx->back_buffer->w;
src.pitch_x = 0;
src.pitch_y = ctx->back_buffer->pitch;
- src.pixel_format = SDLVid_MapPixelFormat(ctx->back_buffer->format);
+ src.pixel_format = SDLVid_MapPixelFormat(ctx->back_buffer->format, ctx->force_alpha);
src.video_buffer = ctx->back_buffer->pixels;
dst.height = ctx->screen->h;
dst.width = ctx->screen->w;
dst.pitch_x = 0;
dst.pitch_y = ctx->screen->pitch;
- dst.pixel_format = SDLVid_MapPixelFormat(ctx->screen->format);
+ dst.pixel_format = SDLVid_MapPixelFormat(ctx->screen->format, 0);
dst.video_buffer = ctx->screen->pixels;
gf_stretch_bits(&dst, &src, dest, NULL, 0xFF, 0, NULL, NULL);
}
}
+
+#ifdef WIN32
+u32 get_sys_col(int idx)
+{
+ u32 res;
+ DWORD val = GetSysColor(idx);
+ res = (val)&0xFF; res<<=8;
+ res |= (val>>8)&0xFF; res<<=8;
+ res |= (val>>16)&0xFF;
+ return res;
+}
+#endif
+
static GF_Err SDLVid_ProcessEvent(GF_VideoOutput *dr, GF_Event *evt)
{
if (!evt) {
SDLVID();
switch (evt->setup.opengl_mode) {
case 0:
+ /*force a resetup of the window*/
+ if (ctx->output_3d_type) {
+ ctx->width = ctx->height = 0;
+ }
ctx->output_3d_type = 0;
return SDLVid_SetBackbufferSize(dr, evt->setup.width, evt->setup.height, evt->setup.system_memory);
case 1:
+ /*force a resetup of the window*/
+ if (!ctx->output_3d_type) {
+ ctx->width = ctx->height = 0;
+ }
ctx->output_3d_type = 1;
return SDLVid_ResizeWindow(dr, evt->setup.width, evt->setup.height);
case 2:
/*find a way to do that in SDL*/
ctx->output_3d_type = 2;
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[SDL] 3D not supported with SDL.\n"));
return GF_NOT_SUPPORTED;
}
+ default:
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[SDL] Trying to set an Unknown Mode %d !\n", evt->setup.opengl_mode));
+ return GF_NOT_SUPPORTED;
}
break;
+ case GF_EVENT_SYS_COLORS:
+#ifdef WIN32
+ evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER);
+ evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION);
+ evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE);
+ evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND);
+ evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE);
+ evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT);
+ evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW);
+ evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT);
+ evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT);
+ evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT);
+ evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT);
+ evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT);
+ evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER);
+ evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION);
+ evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT);
+ evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK);
+ evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT);
+ evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU);
+ evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT);
+ evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR);
+ evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW);
+ evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE);
+ evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT);
+ evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT);
+ evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW);
+ evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW);
+ evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME);
+ evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT);
+ return GF_OK;
+#else
+ return GF_NOT_SUPPORTED;
+#endif
}
return GF_OK;
}
return GF_NOT_SUPPORTED;
}
- if (! *pool || ((*pool)->w < src_wnd->w) || ((*pool)->h < src_wnd->h) ) {
+ if (! *pool || ((*pool)->w < (int) src_wnd->w) || ((*pool)->h < (int) src_wnd->h) ) {
if ((*pool)) SDL_FreeSurface((*pool));
(*pool) = SDL_CreateRGBSurface(ctx->use_systems_memory ? SDL_SWSURFACE : SDL_HWSURFACE,
src_wnd->w, src_wnd->h, 8*bpp,
driv->overlay_color_key ? "Yes" : "No", driv->overlay_color_key
));
#endif
+#ifndef SDL_TEXTINPUTEVENT_TEXT_SIZE
+ SDL_EnableUNICODE(1);
+#else
+ SDL_StartTextInput();
+#endif /* SDL_TEXTINPUTEVENT_TEXT_SIZE */
return driv;
}
vpath %.c $(SRC_PATH)/modules/soft_raster
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
/*(2^EVGGRADIENTBITS)-1 colors in gradient. Below 6 bits the gradient is crappy */
#define EVGGRADIENTBITS 10
-/*scale factor for linear - MUST BE greater than EVGGRADIENTBITS. 12 should be enough for decent results in both fixed point and float versions*/
-#define EVGGRADIENTSCALEBITS 12
/*base gradient stencil*/
#define EVGGRADIENT \
GF_Err evg_surface_clear(GF_SURFACE surf, GF_IRect *rc, u32 color);
-/*FT raster callbacks - it's better to have a bit bigger code than using extra
-get/set pixels routines on the surface*/
-void evg_argb_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_argb_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_argb_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-GF_Err evg_surface_clear_argb(GF_SURFACE surf, GF_IRect rc, GF_Color col);
+/*FT raster callbacks */
+void evg_bgra_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_bgra_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_bgra_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+GF_Err evg_surface_clear_bgra(GF_SURFACE surf, GF_IRect rc, GF_Color col);
void evg_rgba_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
void evg_rgba_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
void evg_rgba_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
GF_Err evg_surface_clear_rgba(GF_SURFACE surf, GF_IRect rc, GF_Color col);
-void evg_rgb32_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_rgb32_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_rgb32_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_bgrx_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_bgrx_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_bgrx_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_bgr32_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_bgr32_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-void evg_bgr32_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
-GF_Err evg_surface_clear_bgr32(GF_SURFACE surf, GF_IRect rc, GF_Color col);
+void evg_rgbx_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_rgbx_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+void evg_rgbx_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
+GF_Err evg_surface_clear_rgbx(GF_SURFACE surf, GF_IRect rc, GF_Color col);
void evg_rgb_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
void evg_rgb_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf);
#include "rast_soft.h"
+
+/*
+ FIXME / WARNING - this code only works for little endian platfoms
+ not seen any big endian platform using RGB565/RGB555 output
+*/
+
+
static GFINLINE s32
mul255(s32 a, s32 b)
{
#include "rast_soft.h"
-/*
- Note: this we force ARGB textures to be endian-dependent (eg BGRA on little-endian and ARGB on big-endian)
- and we always handle pixel mem as (u32 *) for 32 bits (ARGB/XRGB), we don't need to bother about endianness
- here.
-*/
static GFINLINE s32
mul255(s32 a, s32 b)
{
-// return (a * b) >> 8;
return ((a+1) * b) >> 8;
}
32 bit ARGB
*/
-static u32 overmask_argb(u32 src, u32 dst, u32 alpha)
+static void overmask_bgra(u32 src, u8 *dst, u32 alpha)
{
- u32 resa, resr, resg, resb;
-
s32 srca = (src >> 24) & 0xff;
s32 srcr = (src >> 16) & 0xff;
s32 srcg = (src >> 8) & 0xff;
s32 srcb = (src >> 0) & 0xff;
- s32 dsta = (dst >> 24) & 0xff;
+ s32 dsta = dst[3];
srca = mul255(srca, alpha);
if (dsta) {
- s32 dstr = (dst >> 16) & 0xff;
- s32 dstg = (dst >> 8) & 0xff;
- s32 dstb = (dst >> 0) & 0xff;
- resa = mul255(srca, srca) + mul255(255-srca, dsta);
- resr = mul255(srca, srcr - dstr) + dstr;
- resg = mul255(srca, srcg - dstg) + dstg;
- resb = mul255(srca, srcb - dstb) + dstb;
- return (resa << 24) | (resr << 16) | (resg << 8) | (resb);
+ s32 dstr = dst[1];
+ s32 dstg = dst[1];
+ s32 dstb = dst[0];
+ dst[0] = mul255(srca, srcb - dstb) + dstb;
+ dst[1] = mul255(srca, srcg - dstg) + dstg;
+ dst[2] = mul255(srca, srcr - dstr) + dstr;
+ dst[3] = mul255(srca, srca) + mul255(255-srca, dsta);
+ } else {
+ dst[0] = srcb;
+ dst[1] = srcg;
+ dst[2] = srcr;
+ dst[3] = srca;
}
- /*special case for ARGB: if dst alpha is 0, consider the surface is empty and copy pixel*/
- return (srca << 24) | (srcr << 16) | (srcg << 8) | (srcb);
}
-static void overmask_argb_const_run(u32 src, u32 *dst, s32 dst_pitch_x, u32 count)
+static void overmask_bgra_const_run(u32 src, u8 *dst, s32 dst_pitch_x, u32 count)
{
- u32 resa ,resr, resg, resb;
-
s32 srca = (src >> 24) & 0xff;
s32 srcr = (src >> 16) & 0xff;
s32 srcg = (src >> 8) & 0xff;
while (count) {
- u32 val = *dst;
- s32 dsta = (val >> 24) & 0xff;
+ s32 dsta = dst[3];
/*special case for ARGB: if dst alpha is 0, consider the surface is empty and copy pixel*/
if (dsta) {
- s32 dstr = (val >> 16) & 0xff;
- s32 dstg = (val >> 8) & 0xff;
- s32 dstb = (val) & 0xff;
-
- resa = mul255(srca, srca) + mul255(255-srca, dsta);
- resr = mul255(srca, srcr - dstr) + dstr;
- resg = mul255(srca, srcg - dstg) + dstg;
- resb = mul255(srca, srcb - dstb) + dstb;
-
- *dst = (resa << 24) | (resr << 16) | (resg << 8) | (resb);
+ s32 dstb = dst[0];
+ s32 dstg = dst[1];
+ s32 dstr = dst[2];
+
+ dst[0] = mul255(srca, srcb - dstb) + dstb;
+ dst[1] = mul255(srca, srcg - dstg) + dstg;
+ dst[2] = mul255(srca, srcr - dstr) + dstr;
+ dst[3] = mul255(srca, srca) + mul255(255-srca, dsta);
} else {
- *dst = src;
+ dst[0] = srcr;
+ dst[1] = srcg;
+ dst[2] = srcr;
+ dst[3] = srca;
}
- dst = (u32*) ( ((u8 *)dst) +dst_pitch_x);
+ dst += dst_pitch_x;
count--;
}
}
-void evg_argb_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_bgra_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u32 col = surf->fill_col;
u32 a, fin, col_no_a;
u8 *dst = surf->pixels + y * surf->pitch_y;
s32 i, x;
u32 len;
+ u8 col_a, col_r, col_g, col_b;
u8 aa_lev = surf->AALevel;
+ col_a = GF_COL_A(col);
+ col_r = GF_COL_R(col);
+ col_g = GF_COL_G(col);
+ col_b = GF_COL_B(col);
col_no_a = col & 0x00FFFFFF;
for (i=0; i<count; i++) {
if (spans[i].coverage<aa_lev) continue;
if (spans[i].coverage != 0xFF) {
a = mul255(0xFF, spans[i].coverage);
fin = (a<<24) | col_no_a;
- overmask_argb_const_run(fin, (u32 *) (dst + x), surf->pitch_x, len);
+ overmask_bgra_const_run(fin, dst + x, surf->pitch_x, len);
} else {
while (len--) {
- * ((u32 *) (dst + x) ) = col;
+ dst[x] = col_b;
+ dst[x+1] = col_g;
+ dst[x+2] = col_r;
+ dst[x+3] = col_a;
x += surf->pitch_x;
}
}
}
}
-void evg_argb_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_bgra_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u8 *dst = surf->pixels + y * surf->pitch_y;
u32 col = surf->fill_col;
if (spans[i].coverage<aa_lev) continue;
fin = mul255(a, spans[i].coverage);
fin = (fin<<24) | col_no_a;
- overmask_argb_const_run(fin, (u32 *) (dst + surf->pitch_x*spans[i].x), surf->pitch_x, spans[i].len);
+ overmask_bgra_const_run(fin, dst + surf->pitch_x*spans[i].x, surf->pitch_x, spans[i].len);
}
}
-void evg_argb_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_bgra_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u8 *dst = surf->pixels + y * surf->pitch_y;
u8 spanalpha, col_a;
s32 i, x;
u32 len;
- u32 *col;
+ u32 *col, _col;
u8 aa_lev = surf->AALevel;
for (i=0; i<count; i++) {
x = spans[i].x * surf->pitch_x;
col = surf->stencil_pix_run;
while (len--) {
- col_a = GF_COL_A(*col);
+ _col = *col;
+ col_a = GF_COL_A(_col);
if (col_a) {
if ((spanalpha!=0xFF) || (col_a != 0xFF)) {
- *(u32*) (dst + x) = overmask_argb(*col, *(u32*) (dst + x) , spanalpha);
+ overmask_bgra(*col, (dst + x) , spanalpha);
} else {
- *(u32*) (dst + x) = *col;
+ dst[x] = GF_COL_B(_col);
+ dst[x+1] = GF_COL_G(_col);
+ dst[x+2] = GF_COL_R(_col);
+ dst[x+3] = col_a;
}
}
col++;
}
}
-GF_Err evg_surface_clear_argb(GF_SURFACE surf, GF_IRect rc, GF_Color col)
+GF_Err evg_surface_clear_bgra(GF_SURFACE surf, GF_IRect rc, GF_Color col)
{
- u32 *data;
+ u8 *data;
+ u8 col_a, col_b, col_g, col_r;
u32 x, y, w, h, sx, sy;
s32 st;
+ Bool use_memset;
EVGSurface *_this = (EVGSurface *)surf;
st = _this->pitch_y;
+ col_a = GF_COL_A(col);
+ col_r = GF_COL_R(col);
+ col_g = GF_COL_G(col);
+ col_b = GF_COL_B(col);
+
h = rc.height;
w = rc.width;
sx = rc.x;
sy = rc.y;
+
+ use_memset = 0;
+ if (_this->pitch_x !=4) use_memset = 0;
+ else if (!col_a) use_memset = 1;
+ else if ((col_a==col_r) && (col_a==col_g) && (col_a==col_b)) use_memset = 1;
- for (y = 0; y < h; y++) {
- data = (u32 *) (_this ->pixels + (sy+y)* st + _this->pitch_x*sx);
- for (x = 0; x < w; x++) {
- *data = col;
- data = (u32*) ( ((u8*)data)+_this->pitch_x);
+ if (!use_memset) {
+ for (y = 0; y < h; y++) {
+ data = _this ->pixels + (sy+y)* st + _this->pitch_x*sx;
+ for (x = 0; x < w; x++) {
+ data[0] = col_b;
+ data[1] = col_g;
+ data[2] = col_r;
+ data[3] = col_a;
+ data += _this->pitch_x;
+ }
+ }
+ } else {
+ u32 sw = 4*w;
+ for (y = 0; y < h; y++) {
+ memset(_this ->pixels + (sy+y)* st + _this->pitch_x * sx, col_a, sizeof(char)*sw);
}
}
return GF_OK;
32 bit RGB
*/
-static u32 overmask_rgb32(u32 src, u32 dst, u32 alpha)
+static void overmask_bgrx(u32 src, u8 *dst, u32 alpha)
{
- u32 resr, resg, resb;
-
s32 srca = (src >> 24) & 0xff;
s32 srcr = (src >> 16) & 0xff;
s32 srcg = (src >> 8) & 0xff;
s32 srcb = (src >> 0) & 0xff;
- s32 dstr = (dst >> 16) & 0xff;
- s32 dstg = (dst >> 8) & 0xff;
- s32 dstb = (dst) & 0xff;
+
+ s32 dstb = dst[0];
+ s32 dstg = dst[1];
+ s32 dstr = dst[2];
srca = mul255(srca, alpha);
- resr = mul255(srca, srcr - dstr) + dstr;
- resg = mul255(srca, srcg - dstg) + dstg;
- resb = mul255(srca, srcb - dstb) + dstb;
- return (0xFF << 24) | (resr << 16) | (resg << 8) | resb;
+ dst[0] = mul255(srca, srcb - dstb) + dstb;
+ dst[1] = mul255(srca, srcg - dstg) + dstg;
+ dst[2] = mul255(srca, srcr - dstr) + dstr;
+ dst[3] = 0xFF;
}
-GFINLINE void overmask_rgb32_const_run(u32 src, u32 *dst, s32 dst_pitch_x, u32 count)
+GFINLINE static void overmask_bgrx_const_run(u32 src, u8 *dst, s32 dst_pitch_x, u32 count)
{
- u32 val, res;
s32 srca = (src>>24) & 0xff;
u32 srcr = mul255(srca, ((src >> 16) & 0xff)) ;
u32 srcg = mul255(srca, ((src >> 8) & 0xff)) ;
u32 inva = 1 + 0xFF - srca;
while (count) {
- val = *dst;
- res = 0xFF00;
- res |= srcr + ((inva*((val >> 16) & 0xff))>>8);
- res <<=8;
- res |= srcg + ((inva*((val >> 8) & 0xff))>>8);
- res <<=8;
- res |= srcb + ((inva*((val) & 0xff))>>8);
- *dst = res;
- dst = (u32*) ( ((u8*)dst) + dst_pitch_x);
+ dst[0] = srcb + ((inva*dst[0])>>8);
+ dst[1] = srcg + ((inva*dst[1])>>8);
+ dst[2] = srcr + ((inva*dst[2])>>8);
+ dst[3] = 0xFF;
+ dst += dst_pitch_x;
count--;
}
}
-void evg_rgb32_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_bgrx_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u32 col = surf->fill_col;
- u32 fin, col_no_a, col2, spana;
+ u32 fin, col_no_a, spana;
+ u8 col_r, col_g, col_b;
u8 *dst = surf->pixels + y * surf->pitch_y;
s32 i, x;
u32 len;
u8 aa_lev = surf->AALevel;
col_no_a = col & 0x00FFFFFF;
- col2 = (0xFF<<24) | col_no_a;
+ col_r = GF_COL_R(col);
+ col_g = GF_COL_G(col);
+ col_b = GF_COL_B(col);
for (i=0; i<count; i++) {
spana = spans[i].coverage;
if (spana<aa_lev) continue;
if (spana != 0xFF) {
fin = (spana<<24) | col_no_a;
- overmask_rgb32_const_run(fin, (u32*) (dst + x), surf->pitch_x, len);
+ overmask_bgrx_const_run(fin, dst + x, surf->pitch_x, len);
} else {
while (len--) {
- *(u32*) (dst + x) = col2;
+ dst[x] = col_b;
+ dst[x+1] = col_g;
+ dst[x+2] = col_r;
+ dst[x+3] = 0xFF;
x += surf->pitch_x;
}
}
}
}
-void evg_rgb32_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_bgrx_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u8 *dst = surf->pixels + y * surf->pitch_y;
u32 col = surf->fill_col;
if (spans[i].coverage<aa_lev) continue;
fin = mul255(a, spans[i].coverage);
fin = (fin<<24) | col_no_a;
- overmask_rgb32_const_run(fin, (u32*) (dst + surf->pitch_x*spans[i].x), surf->pitch_x, spans[i].len);
+ overmask_bgrx_const_run(fin, dst + surf->pitch_x*spans[i].x, surf->pitch_x, spans[i].len);
}
}
-void evg_rgb32_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_bgrx_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u8 *dst = surf->pixels + y * surf->pitch_y;
u8 spanalpha, col_a;
col = surf->stencil_pix_run;
x = spans[i].x * surf->pitch_x;
while (len--) {
- col_a = GF_COL_A(*col);
+ u32 _col = *col;
+ col_a = GF_COL_A(_col);
if (col_a) {
if ((spanalpha!=0xFF) || (col_a != 0xFF)) {
- *(u32*)(dst+x) = overmask_rgb32(*col, *(u32*)(dst+x), spanalpha);
+ overmask_bgrx(*col, dst+x, spanalpha);
} else {
- *(u32*)(dst+x) = *col;
+ dst[x] = GF_COL_B(_col);
+ dst[x+1] = GF_COL_G(_col);
+ dst[x+2] = GF_COL_R(_col);
+ dst[x+3] = 0xFF;
}
}
col++;
}
}
-GF_Err evg_surface_clear_rgb32(GF_SURFACE surf, GF_IRect rc, GF_Color col)
-{
- u32 x, y, w, h, sx, sy;
- s32 st;
- EVGSurface *_this = (EVGSurface *)surf;
- st = _this->pitch_x;
-
- h = rc.height;
- w = rc.width;
- sx = rc.x;
- sy = rc.y;
-
- col = 0xFF000000 | (col & 0x00FFFFFF);
- for (y = 0; y < h; y++) {
- u32 *data = (u32 *) (_this ->pixels + (y + sy) * st + _this->pitch_x*sx);
- for (x = 0; x < w; x++) {
- *data = col;
- data = (u32*) (((u8*)data)+_this->pitch_x);
- }
- }
- return GF_OK;
-}
-
-
-
/*
32 bit BGR
*/
-static u32 overmask_bgr32(u32 src, u32 dst, u32 alpha)
+static void overmask_rgbx(u32 src, u8 *dst, u32 alpha)
{
- u32 resr, resg, resb;
-
s32 srca = (src >> 24) & 0xff;
s32 srcr = (src >> 16) & 0xff;
s32 srcg = (src >> 8) & 0xff;
s32 srcb = (src >> 0) & 0xff;
- s32 dstb = (dst >> 16) & 0xff;
- s32 dstg = (dst >> 8) & 0xff;
- s32 dstr = (dst) & 0xff;
+ s32 dstr = dst[0];
+ s32 dstg = dst[1];
+ s32 dstb = dst[2];
srca = mul255(srca, alpha);
- resr = mul255(srca, srcr - dstr) + dstr;
- resg = mul255(srca, srcg - dstg) + dstg;
- resb = mul255(srca, srcb - dstb) + dstb;
- return (0xFF << 24) | (resb << 16) | (resg << 8) | resr;
+ dst[0] = mul255(srca, srcr - dstr) + dstr;
+ dst[1] = mul255(srca, srcg - dstg) + dstg;
+ dst[2] = mul255(srca, srcb - dstb) + dstb;
+ dst[3] = 0xFF;
}
-GFINLINE void overmask_bgr32_const_run(u32 src, u32 *dst, s32 dst_pitch_x, u32 count)
+GFINLINE static void overmask_rgbx_const_run(u32 src, u8 *dst, s32 dst_pitch_x, u32 count)
{
- u32 val, res;
s32 srca = (src>>24) & 0xff;
u32 srcr = mul255(srca, ((src >> 16) & 0xff)) ;
u32 srcg = mul255(srca, ((src >> 8) & 0xff)) ;
u32 inva = 1 + 0xFF - srca;
while (count) {
- val = *dst;
- res = 0xFF00;
- res |= srcb + ((inva*((val >> 16) & 0xff))>>8);
- res <<=8;
- res |= srcg + ((inva*((val >> 8) & 0xff))>>8);
- res <<=8;
- res |= srcr + ((inva*((val) & 0xff))>>8);
- *dst = res;
- dst = (u32*) ( ((u8*)dst) + dst_pitch_x);
+ dst[0] = srcr + ((inva*dst[0])>>8);
+ dst[1] = srcg + ((inva*dst[1])>>8);
+ dst[2] = srcb + ((inva*dst[2])>>8);
+ dst += dst_pitch_x;
count--;
}
}
-void evg_bgr32_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_rgbx_fill_const(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u32 col = surf->fill_col;
- u32 fin, col_no_a, col2, spana;
+ u32 fin, col_no_a, spana;
u8 *dst = surf->pixels + y * surf->pitch_y;
u8 r, g, b;
s32 i, x;
r = GF_COL_R(col);
g = GF_COL_G(col);
b = GF_COL_B(col);
- col2 = GF_COL_ARGB(0xFF, b, g, r);
+
for (i=0; i<count; i++) {
spana = spans[i].coverage;
if (spana<aa_lev) continue;
if (spana != 0xFF) {
fin = (spana<<24) | col_no_a;
- overmask_bgr32_const_run(fin, (u32*) (dst + x), surf->pitch_x, len);
+ overmask_rgbx_const_run(fin, dst + x, surf->pitch_x, len);
} else {
while (len--) {
- *(u32*) (dst + x) = col2;
+ dst[x] = r;
+ dst[x+1] = g;
+ dst[x+2] = b;
+ dst[x+3] = 0xFF;
x += surf->pitch_x;
}
}
}
}
-void evg_bgr32_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_rgbx_fill_const_a(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u8 *dst = surf->pixels + y * surf->pitch_y;
u32 col = surf->fill_col;
if (spans[i].coverage<aa_lev) continue;
fin = mul255(a, spans[i].coverage);
fin = (fin<<24) | col_no_a;
- overmask_bgr32_const_run(fin, (u32*) (dst + surf->pitch_x*spans[i].x), surf->pitch_x, spans[i].len);
+ overmask_rgbx_const_run(fin, dst + surf->pitch_x*spans[i].x, surf->pitch_x, spans[i].len);
}
}
-void evg_bgr32_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
+void evg_rgbx_fill_var(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf)
{
u8 *dst = surf->pixels + y * surf->pitch_y;
u8 spanalpha, col_a;
s32 i, x;
u32 len;
- u32 *col;
+ u32 *col, _col;
u8 aa_lev = surf->AALevel;
for (i=0; i<count; i++) {
col = surf->stencil_pix_run;
x = spans[i].x * surf->pitch_x;
while (len--) {
- col_a = GF_COL_A(*col);
+ _col = *col;
+ col_a = GF_COL_A(_col);
if (col_a) {
if ((spanalpha!=0xFF) || (col_a != 0xFF)) {
- *(u32*)(dst+x) = overmask_bgr32(*col, *(u32*)(dst+x), spanalpha);
+ overmask_rgbx(*col, dst+x, spanalpha);
} else {
- *(u32*)(dst+x) = *col;
+ dst[x] = GF_COL_R(_col);
+ dst[x+1] = GF_COL_G(_col);
+ dst[x+2] = GF_COL_B(_col);
+ dst[x+3] = 0xFF;
}
}
col++;
}
}
-GF_Err evg_surface_clear_bgr32(GF_SURFACE surf, GF_IRect rc, GF_Color col)
+GF_Err evg_surface_clear_rgbx(GF_SURFACE surf, GF_IRect rc, GF_Color col)
{
u32 x, y, w, h, sx, sy;
u8 r,g,b;
for (y = 0; y < h; y++) {
u32 *data = (u32 *) (_this ->pixels + (y + sy) * _this->pitch_y + st*sx);
for (x = 0; x < w; x++) {
- *data = col;
- data = (u32*) (((u8*)data)+st);
+ data[0] = r;
+ data[1] = g;
+ data[2] = b;
+ data[3] = 0xFF;
+ data += st;
}
}
return GF_OK;
32 bit RGBA
*/
-static void overmask_rgba(u32 src, char *dst, u32 alpha)
+GFINLINE static void overmask_rgba(u32 src, u8 *dst, u32 alpha)
{
u8 srca = GF_COL_A(src);
u8 srcr = GF_COL_R(src);
dst[0] = mul255(srca, srcr - dstr) + dstr;
dst[1] = mul255(srca, srcg - dstg) + dstg;
dst[2] = mul255(srca, srcb - dstb) + dstb;
- dst[3] = mul255(srca, srca) + mul255(255-srca, dsta);
+ if (dsta==0xFF) dst[3] = (u8)0xFF;
+ else dst[3] = mul255(srca, srca) + mul255(255-srca, dsta);
} else {
dst[0] = srcr;
dst[1] = srcg;
}
}
-static void overmask_rgba_const_run(u32 src, char *dst, s32 dst_pitch_x, u32 count)
+GFINLINE static void overmask_rgba_const_run(u32 src, u8 *dst, s32 dst_pitch_x, u32 count)
{
u8 srca = GF_COL_A(src);
u8 srcr = GF_COL_R(src);
dst[0] = (u8) mul255(srca, srcr - dstr) + dstr;
dst[1] = (u8) mul255(srca, srcg - dstg) + dstg;
dst[2] = (u8) mul255(srca, srcb - dstb) + dstb;
- dst[3] = (u8) mul255(srca, srca) + mul255(255-srca, dsta);
+ if (dsta==0xFF) dst[3] = (u8)0xFF;
+ else dst[3] = (u8) mul255(srca, srca) + mul255(255-srca, dsta);
} else {
dst[0] = srcr;
dst[1] = srcg;
u8 a, r, g, b;
u32 x, y, w, h, sy;
s32 st;
+ Bool use_memset;
EVGSurface *_this = (EVGSurface *)surf;
st = _this->pitch_y;
g = GF_COL_G(col);
b = GF_COL_B(col);
- if (a || (_this->pitch_x !=4) ) {
+ use_memset = 0;
+ if (_this->pitch_x !=4) use_memset = 0;
+ else if (!a) use_memset = 1;
+ else if ((a==r) && (a==g) && (a==b)) use_memset = 1;
+
+
+ if (!use_memset) {
for (y = 0; y < h; y++) {
data = (_this ->pixels + (sy+y)* st + _this->pitch_x * rc.x);
for (x = 0; x < w; x++) {
} else {
u32 sw = 4*w;
for (y = 0; y < h; y++) {
- memset(_this ->pixels + (sy+y)* st + _this->pitch_x * rc.x, 0, sizeof(char)*sw);
+ memset(_this ->pixels + (sy+y)* st + _this->pitch_x * rc.x, a, sizeof(char)*sw);
}
}
return GF_OK;
u8 spanalpha, col_a;
s32 i, x;
u32 len;
- u32 *col;
+ u32 *col, _col;
u8 aa_lev = surf->AALevel;
for (i=0; i<count; i++) {
if (spans[i].coverage<aa_lev) continue;
- x = spans[i].x * surf->pitch_x;
+ x = spans[i].x;
len = spans[i].len;
spanalpha = spans[i].coverage;
surf->sten->fill_run(surf->sten, surf, x, y, len);
+ x *= surf->pitch_x;
col = surf->stencil_pix_run;
while (len--) {
- col_a = GF_COL_A(*col);
+ _col = *col;
+ col_a = GF_COL_A(_col);
if (col_a) {
if ((spanalpha!=0xFF) || (col_a != 0xFF)) {
- overmask_bgr(*col, dst + x, spanalpha);
+ overmask_bgr(_col, dst + x, spanalpha);
} else {
- *(dst + x) = GF_COL_B(*col);
- *(dst + x + 1) = GF_COL_G(*col);
- *(dst + x + 2) = GF_COL_R(*col);
+ *(dst + x) = GF_COL_B(_col);
+ *(dst + x + 1) = GF_COL_G(_col);
+ *(dst + x + 2) = GF_COL_R(_col);
}
}
col++;
s32 val;
u32 col, ca;
u32 *data = surf->stencil_pix_run;
- u32 shifter = (EVGGRADIENTSCALEBITS - EVGGRADIENTBITS);
EVG_LinearGradient *_this = (EVG_LinearGradient *) p;
has_cmat = _this->cmat.identity ? 0 : 1;
val = FIX2INT(_res);
_res += _this->smat.m[0];
- col = gradient_get_color((EVG_BaseGradient *)_this, (val >> shifter) );
+ col = gradient_get_color((EVG_BaseGradient *)_this, val );
if (has_a) {
ca = ((GF_COL_A(col) + 1) * _this->alpha) >> 8;
col = ( ((ca<<24) & 0xFF000000) ) | (col & 0x00FFFFFF);
}
-/*by casting to u32 the input ARGB (BGRA on little endian) we get back to 0xAARRGGBB format on all machines*/
-u32 get_pix_argb(char *pix) {return *(u32 *) pix;}
+u32 get_pix_argb(char *pix) { return GF_COL_ARGB(*(pix+3) & 0xFF, *(pix+2) & 0xFF, *(pix+1) & 0xFF, *pix & 0xFF); }
u32 get_pix_rgba(char *pix) { return GF_COL_ARGB(*(pix+3) & 0xFF, *pix & 0xFF, *(pix+1) & 0xFF, *(pix+2) & 0xFF); }
-/*same as argb: xxrgb, with indianness support*/
-u32 get_pix_rgb_32(char *pix) { return ((*(u32 *) pix) | 0xFF000000); }
+u32 get_pix_rgb_32(char *pix) { return GF_COL_ARGB(0xFF, *(pix+2) & 0xFF, *(pix+1) & 0xFF, *pix & 0xFF); }
u32 get_pix_rgb_24(char *pix) { return GF_COL_ARGB(0xFF, *pix & 0xFF, *(pix+1) & 0xFF, *(pix+2) & 0xFF); }
u32 get_pix_bgr_24(char *pix) { return GF_COL_ARGB(0xFF, *(pix+2) & 0xFF, * (pix+1) & 0xFF, *pix & 0xFF); }
u32 get_pix_444(char *pix) { u16 val = *(u16*)pix; return GF_COL_ARGB(0xFF, (u8) ( (val >> 4) & 0xf0), (u8) ( (val) & 0xf0), (u8) ( (val << 4) & 0xf0) ); }
void evg_surface_delete(GF_SURFACE _this)
{
EVGSurface *surf = (EVGSurface *)_this;
+ if (!surf)
+ return;
#ifndef INLINE_POINT_CONVERSION
if (surf->points) gf_free(surf->points);
+ surf->points = NULL;
#endif
if (surf->stencil_pix_run) gf_free(surf->stencil_pix_run);
- evg_raster_del(surf->raster);
+ surf->stencil_pix_run = NULL;
+ if (surf->raster) evg_raster_del(surf->raster);
+ surf->raster = NULL;
gf_free(surf);
}
switch (surf->pixelFormat) {
case GF_PIXEL_ARGB:
case GF_PIXEL_RGB_32:
- return evg_surface_clear_argb(surf, clear, color);
+ return evg_surface_clear_bgra(surf, clear, color);
case GF_PIXEL_BGR_32:
- return evg_surface_clear_bgr32(surf, clear, color);
+ return evg_surface_clear_rgbx(surf, clear, color);
case GF_PIXEL_RGBA:
return evg_surface_clear_rgba(surf, clear, color);
case GF_PIXEL_BGR_24:
if (use_const) {
if (!a) return 0;
if (a!=0xFF) {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_argb_fill_const_a;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgra_fill_const_a;
} else {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_argb_fill_const;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgra_fill_const;
}
} else {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_argb_fill_var;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgra_fill_var;
}
break;
if (use_const) {
if (!a) return 0;
if (a!=0xFF) {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_rgb32_fill_const_a;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgrx_fill_const_a;
} else {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_rgb32_fill_const;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgrx_fill_const;
}
} else {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_rgb32_fill_var;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgrx_fill_var;
}
break;
if (use_const) {
if (!a) return 0;
if (a!=0xFF) {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgr32_fill_const_a;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_rgbx_fill_const_a;
} else {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgr32_fill_const;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_rgbx_fill_const;
}
} else {
- surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_bgr32_fill_var;
+ surf->ftparams.gray_spans = (EVG_Raster_Span_Func) evg_rgbx_fill_var;
}
break;
return GF_OK;
}
-//static void gray_spans_stub(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf){}
+/* static void gray_spans_stub(s32 y, s32 count, EVG_Span *spans, EVGSurface *surf){} */
GF_Err evg_surface_fill(GF_SURFACE _this, GF_STENCIL stencil)
{
/*setup ft raster calllbacks*/
if (!setup_grey_callback(surf)) return GF_OK;
-// surf->ftparams.gray_spans = gray_spans_stub;
+/* surf->ftparams.gray_spans = gray_spans_stub; */
get_surface_world_matrix(surf, &mat);
gf_mx2d_inverse(&sten->smat);
/*and finalize matrix in gradient coord system*/
gf_mx2d_add_matrix(&sten->smat, &lin->vecmat);
- gf_mx2d_add_scale(&sten->smat, INT2FIX(1<<EVGGRADIENTSCALEBITS), INT2FIX(1<<EVGGRADIENTSCALEBITS));
+ gf_mx2d_add_scale(&sten->smat, INT2FIX(1<<EVGGRADIENTBITS), INT2FIX(1<<EVGGRADIENTBITS));
}
break;
vpath %.c $(SRC_PATH)/modules/svg_in
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
endif
ifeq ($(CONFIG_ZLIB), local)
-CFLAGS+= -I$(LOCAL_INC_PATH)/zlib
+CFLAGS+= -I"$(LOCAL_INC_PATH)/zlib"
EXTRALIBS+=-L../../extra_lib/lib/gcc
endif
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define SVG_PROGRESSIVE_BUFFER_SIZE 4096
-static GF_Err svgin_deflate(SVGIn *svgin, char *buffer, u32 buffer_len)
+static GF_Err svgin_deflate(SVGIn *svgin, const char *buffer, u32 buffer_len)
{
GF_Err e;
char svg_data[2049];
return GF_NON_COMPLIANT_BITSTREAM;
}
-static GF_Err SVG_ProcessData(GF_SceneDecoder *plug, char *inBuffer, u32 inBufferLength,
+static GF_Err SVG_ProcessData(GF_SceneDecoder *plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 stream_time, u32 mmlevel)
{
GF_Err e = GF_OK;
}
e = GF_OK;
entry_time = gf_sys_clock();
-
+
while (1) {
u32 diff;
s32 nb_read;
gf_set_progress("SVG Parsing", svgin->file_pos, svgin->file_size);
diff = gf_sys_clock() - entry_time;
- if (diff > svgin->sax_max_duration) {
+ if (diff > svgin->sax_max_duration) {
break;
}
}
u8 prev, dims_hdr;
u32 nb_bytes, size;
u64 pos;
+ char * buf2 = gf_malloc(inBufferLength);
GF_BitStream *bs = gf_bs_new(inBuffer, inBufferLength, GF_BITSTREAM_READ);
-//
+ memcpy(buf2, inBuffer, inBufferLength);
// FILE *f = gf_f64_open("dump.svg", "wb");
//
while (gf_bs_available(bs)) {
size = gf_bs_read_u32(bs);
nb_bytes = 6;
}
-// fwrite( inBuffer + pos + nb_bytes + 1, 1, size - 1, f );
+// fwrite( inBuffer + pos + nb_bytes + 1, 1, size - 1, f );
dims_hdr = gf_bs_read_u8(bs);
- prev = inBuffer[pos + nb_bytes + size];
+ prev = buf2[pos + nb_bytes + size];
- inBuffer[pos + nb_bytes + size] = 0;
+ buf2[pos + nb_bytes + size] = 0;
if (dims_hdr & GF_DIMS_UNIT_C) {
- e = svgin_deflate(svgin, inBuffer + pos + nb_bytes + 1, size - 1);
+ e = svgin_deflate(svgin, buf2 + pos + nb_bytes + 1, size - 1);
} else {
- e = gf_sm_load_string(&svgin->loader, inBuffer + pos + nb_bytes + 1, 0);
+ e = gf_sm_load_string(&svgin->loader, buf2 + pos + nb_bytes + 1, 0);
}
- inBuffer[pos + nb_bytes + size] = prev;
+ buf2[pos + nb_bytes + size] = prev;
gf_bs_skip_bytes(bs, size-1);
}
-// fclose(f);
+// fclose(f);
gf_bs_del(bs);
}
break;
-
- default:
+
+ default:
return GF_BAD_PARAM;
}
case GPAC_OTI_SCENE_DIMS:
svgin->loader.type = GF_SM_LOAD_DIMS;
svgin->loader.flags |= GF_SM_LOAD_CONTEXT_STREAMING;
- /*decSpecInfo not yet supported for DIMS svg - we need properties at the scene level to store the
+ /*decSpecInfo not yet supported for DIMS svg - we need properties at the scene level to store the
various indications*/
break;
case GPAC_OTI_PRIVATE_SCENE_SVG:
if (svgin->oti==GPAC_OTI_PRIVATE_SCENE_SVG) return ((svgin->sax_max_duration==(u32)-1) && svgin->file_size) ? "GPAC SVG SAX Parser" : "GPAC SVG Progressive Parser";
if (svgin->oti==GPAC_OTI_SCENE_SVG) return "GPAC Streaming SVG Parser";
if (svgin->oti==GPAC_OTI_SCENE_SVG_GZ) return "GPAC Streaming SVGZ Parser";
- if (svgin->oti==GPAC_OTI_SCENE_DIMS) return "GPAC DIMS Parser";
+ if (svgin->oti==GPAC_OTI_SCENE_DIMS) return "GPAC DIMS Parser";
return "INTERNAL ERROR";
}
-Bool SVG_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool SVG_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
+ /*don't reply to media type query*/
+ if (!esd) return 0;
+
if (StreamType==GF_STREAM_PRIVATE_SCENE) {
- if (ObjectType==GPAC_OTI_PRIVATE_SCENE_SVG) return 1;
+ if (esd->decoderConfig->objectTypeIndication == GPAC_OTI_PRIVATE_SCENE_SVG) return 1;
return 0;
} else if (StreamType==GF_STREAM_SCENE) {
- if (ObjectType==GPAC_OTI_SCENE_SVG) return 1;
- if (ObjectType==GPAC_OTI_SCENE_SVG_GZ) return 1;
- if (ObjectType==GPAC_OTI_SCENE_DIMS) return 1;
- return 0;
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_SCENE_SVG:
+ case GPAC_OTI_SCENE_SVG_GZ:
+ case GPAC_OTI_SCENE_DIMS:
+ return 1;
+ default:
+ return 0;
+ }
}
return 0;
}
GF_SceneDecoder *sdec;
if (InterfaceType != GF_SCENE_DECODER_INTERFACE) return NULL;
-
+
GF_SAFEALLOC(sdec, GF_SceneDecoder)
GF_REGISTER_MODULE_INTERFACE(sdec, GF_SCENE_DECODER_INTERFACE, "GPAC SVG Parser", "gpac distribution");
GF_EXPORT
void ShutdownInterface(GF_BaseInterface *ifce)
{
- GF_SceneDecoder *sdec = (GF_SceneDecoder *)ifce;
- SVGIn *svgin = (SVGIn *) sdec->privateStack;
+ SVGIn *svgin;
+ GF_SceneDecoder *sdec = (GF_SceneDecoder *)ifce;
+ if (!sdec)
+ return;
if (sdec->InterfaceType != GF_SCENE_DECODER_INTERFACE) return;
-
- gf_free(svgin);
+ svgin = (SVGIn *) sdec->privateStack;
+ if (svgin)
+ gf_free(svgin);
+ sdec->privateStack = NULL;
gf_free(sdec);
}
/*interface query*/
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifndef GPAC_DISABLE_SVG
#endif
0
};
- return si;
+ return si;
}
vpath %.c $(SRC_PATH)/modules/timedtext
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
- this decoder is simply a scene decoder generating its own scene graph based on input data,
+ this decoder is simply a scene decoder generating its own scene graph based on input data,
this scene graph is then used as an extra graph by the renderer, and manipulated by the decoder
for any time animation handling.
Translation from text to MPEG-4 scene graph:
- * all modifiers (styles, hilight, etc) are unrolled into chunks forming a unique, linear
+ * all modifiers (styles, hilight, etc) are unrolled into chunks forming a unique, linear
sequence of text data (startChar, endChar) with associated styles & modifs
* chunks are mapped to classic MPEG-4/VRML text
- * these chunks are then gathered in a Form node (supported by 2D and 3D renderers), with
+ * these chunks are then gathered in a Form node (supported by 2D and 3D renderers), with
text truncation at each newline char.
* the Form then performs all alignment of the chunks
* dynamic hilighting (karaoke)
* wrap
- The decoder only accepts complete timed text units TTU(1). In band reconfig (TTU(5) is not supported,
+ The decoder only accepts complete timed text units TTU(1). In band reconfig (TTU(5) is not supported,
nor fragmented TTUs (2, 3, 4).
UTF16 support should workbut MP4Box does not support it at encoding time.
*/
-typedef struct
+typedef struct
{
GF_Scene *inlineScene;
GF_Terminal *app;
else if (offset - thw > vw/2) offset = vw/2 - thw;
*/
priv->tr_track->translation.x = INT2FIX(offset);
-
+
offset = vh/2 - priv->cfg->vert_offset - thh;
/*safety checks ?
if (offset + thh > vh/2) offset = vh/2 - thh;
gf_scene_register_extra_graph(priv->inlineScene, priv->sg, 0);
} else {
gf_scene_register_extra_graph(priv->inlineScene, priv->sg, 1);
- }
+ }
}
return GF_OK;
}
gf_node_set_private((GF_Node *) priv->process_blink, priv);
/*route from fraction_changed to set_fraction*/
gf_sg_route_new(priv->sg, (GF_Node *) priv->ts_blink, 6, (GF_Node *) priv->process_blink, 0);
-
+
priv->ts_scroll = (M_TimeSensor *) ttd_create_node(priv, TAG_MPEG4_TimeSensor, "TimerScroll");
priv->ts_scroll->cycleInterval = 0;
priv->ts_scroll->startTime = -1;
M_Material2D *m;
u32 i;
TTDPriv *priv = (TTDPriv *)gf_node_get_private(node);
-
+
Bool blink_on = 1;
if (priv->process_blink->set_fraction>FIX_ONE/2) blink_on = 0;
i=0;
frac = priv->process_scroll->set_fraction;
if (frac==FIX_ONE) priv->is_active = 0;
if (!priv->tr_scroll) return;
-
+
switch (priv->scroll_type - 1) {
case GF_TXT_SCROLL_CREDITS:
case GF_TXT_SCROLL_DOWN:
text = (M_Text *) n2;
fs = (M_FontStyle *) ttd_create_node(priv, TAG_MPEG4_FontStyle, NULL);
gf_free(fs->family.vals[0]);
-
+
/*translate default fonts to MPEG-4/VRML names*/
if (!stricmp(fontName, "Serif")) fs->family.vals[0] = gf_strdup("SERIF");
else if (!stricmp(fontName, "Sans-Serif")) fs->family.vals[0] = gf_strdup("SANS");
strcat(szStyle, " HIGHLIGHT#RV");
}
}
- /*a better way would be to draw the entire text box in a composite texture & bitmap but we can't really rely
+ /*a better way would be to draw the entire text box in a composite texture & bitmap but we can't really rely
on text box size (in MP4Box, it actually defaults to the entire video area) and drawing a too large texture
& bitmap could slow down rendering*/
if (priv->use_texture) strcat(szStyle, " TEXTURED");
SFURL *s;
M_Anchor *anc = (M_Anchor *) ttd_create_node(priv, TAG_MPEG4_Anchor, NULL);
gf_sg_vrml_mf_append(&anc->url, GF_SG_VRML_MFURL, (void **) &s);
- s->OD_ID = 0;
+ s->OD_ID = 0;
s->url = gf_strdup(tc->hlink->URL);
if (tc->hlink->URL_hint) anc->description.buffer = gf_strdup(tc->hlink->URL_hint);
gf_node_list_add_child(& anc->children, txt_model);
for (i=tc->start_char; i<tc->end_char; i++) {
Bool new_line = 0;
if ((utf16_txt[i] == '\n') || (utf16_txt[i] == '\r') || (utf16_txt[i] == 0x85) || (utf16_txt[i] == 0x2028) || (utf16_txt[i] == 0x2029)) new_line = 1;
-
+
if (new_line || (i+1==tc->end_char) ) {
SFString *st;
ttd_add_item(form);
/*clone node always register by default*/
gf_node_unregister(n2, NULL);
-
+
if (tc->has_blink && txt_material) gf_list_add(priv->blink_nodes, txt_material);
-
+
memcpy(wsChunk, &utf16_txt[start_char], sizeof(s16)*(i-start_char));
wsChunk[i-start_char] = 0;
sp = &wsChunk[0];
TTDTextChunk *tc;
GF_Box *a;
GF_TextSampleDescriptor *td = NULL;
-
+
/*stop timer sensor*/
if (gf_list_count(priv->blink_nodes)) {
priv->ts_blink->stopTime = gf_node_get_scene_time((GF_Node *) priv->ts_blink);
gf_node_changed((GF_Node *) priv->ts_blink, NULL);
- }
+ }
priv->ts_scroll->stopTime = gf_node_get_scene_time((GF_Node *) priv->ts_scroll);
gf_node_changed((GF_Node *) priv->ts_scroll, NULL);
/*flush routes to avoid getting the set_fraction of the scroll sensor deactivation*/
}
if (!td) return;
-
+
vertical = (td->displayFlags & GF_TXT_VERTICAL) ? 1 : 0;
/*set back color*/
n->emissiveColor.green = INT2FIX((td->back_color>>8) & 0xFF) / 255;
n->emissiveColor.blue = INT2FIX((td->back_color) & 0xFF) / 255;
gf_node_changed((GF_Node *) n, NULL);
-
+
if (txt->box) {
br = txt->box->box;
} else {
priv->rec_track->size.x = priv->rec_track->size.y = 0;
gf_node_changed((GF_Node *) priv->rec_box, NULL);
}
-
+
if (priv->mat_box->transparency<FIX_ONE) {
if (priv->rec_box->size.x != priv->dlist->size.x) {
priv->rec_box->size.x = priv->dlist->size.x;
if (offset + thw < - tw/2) offset = - tw/2 + thw;
else if (offset - thw > tw/2) offset = tw/2 - thw;
priv->tr_box->translation.x = INT2FIX(offset);
-
+
offset = th/2 - br.top - thh;
if (offset + thh > th/2) offset = th/2 - thh;
else if (offset - thh < -th/2) offset = -th/2 + thh;
priv->tr_box->translation.y = INT2FIX(offset);
-
+
gf_node_dirty_set((GF_Node *)priv->tr_box, 0, 1);
idx.vals = form->groupsIndex.vals;
form->groupsIndex.vals = NULL;
form->groupsIndex.count = 0;
-
+
nb_lines = 0;
start_idx = 0;
for (i=0; i<idx.count; i++) {
/*vertical alignment: first align all items vertically, 0 pixel */
- gf_sg_vrml_mf_append(&form->constraints, GF_SG_VRML_MFSTRING, (void **) &s); s->buffer = gf_strdup(vertical ? "SH 0" : "SV 0");
+ gf_sg_vrml_mf_append(&form->constraints, GF_SG_VRML_MFSTRING, (void **) &s); s->buffer = gf_strdup(vertical ? "SH 0" : "SV 0");
gf_sg_vrml_mf_append(&form->groupsIndex, GF_SG_VRML_MFINT32, (void **) &id); (*id) = 0;
for (i=0; i<nb_lines; i++) {
gf_sg_vrml_mf_append(&form->groupsIndex, GF_SG_VRML_MFINT32, (void **) &id); (*id) = i+start_idx;
gf_node_changed((GF_Node *) priv->ts_scroll, NULL);
}
-static GF_Err TTD_ProcessData(GF_SceneDecoder*plug, char *inBuffer, u32 inBufferLength,
+static GF_Err TTD_ProcessData(GF_SceneDecoder*plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 AU_time, u32 mmlevel)
{
GF_BitStream *bs;
gf_bs_read_int(bs, 4);
type = gf_bs_read_int(bs, 3);
length = gf_bs_read_u16(bs);
-
+
/*currently only full text samples are supported*/
if (type != 1) {
gf_bs_del(bs);
return e;
}
-Bool TTD_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool TTD_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
TTDPriv *priv = (TTDPriv *)ifce->privateStack;
if (StreamType!=GF_STREAM_TEXT) return 0;
- if (ObjectType!=0x08) return 0;
- priv->PL = PL;
- return 1;
+ /*media type query*/
+ if (!esd) return 1;
+ if (esd->decoderConfig->objectTypeIndication==0x08) {
+ priv->PL = PL;
+ return 1;
+ }
+ return 0;
}
{
TTDPriv *priv;
GF_SceneDecoder *tmp;
-
+
GF_SAFEALLOC(tmp, GF_SceneDecoder);
if (!tmp) return NULL;
GF_SAFEALLOC(priv, TTDPriv);
#endif /*!defined(GPAC_DISABLE_VRML) && !defined(GPAC_DISABLE_ISOM)*/
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#if !defined(GPAC_DISABLE_VRML) && !defined(GPAC_DISABLE_ISOM)
#endif
0
};
- return si;
+ return si;
}
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
} TTIn;
+const char * TTIN_MIME_TYPES[] = {
+ "x-subtitle/srt", "srt", "SRT SubTitles",
+ "x-subtitle/sub", "sub", "SUB SubTitles",
+ "x-subtitle/ttxt", "ttxt", "3GPP TimedText",
+ NULL
+};
+
+static u32 TTIN_RegisterMimeTypes(const GF_InputService *plug){
+ u32 i;
+ if (!plug)
+ return 0;
+ for (i = 0 ; TTIN_MIME_TYPES[i]; i+=3){
+ gf_term_register_mime_type(plug, TTIN_MIME_TYPES[i], TTIN_MIME_TYPES[i+1], TTIN_MIME_TYPES[i+2]);
+ }
+ return i/3;
+}
+
static Bool TTIn_CanHandleURL(GF_InputService *plug, const char *url)
{
char *sExt;
+ u32 i;
+ if (!plug || !url)
+ return 0;
sExt = strrchr(url, '.');
if (!sExt) return 0;
- if (gf_term_check_extension(plug, "x-subtitle/srt", "srt", "SRT SubTitles", sExt)) return 1;
- if (gf_term_check_extension(plug, "x-subtitle/sub", "sub", "SUB SubTitles", sExt)) return 1;
- if (gf_term_check_extension(plug, "x-subtitle/ttxt", "ttxt", "3GPP TimedText", sExt)) return 1;
+ for (i = 0 ; TTIN_MIME_TYPES[i]; i+=3){
+ if (gf_term_check_extension(plug, TTIN_MIME_TYPES[i], TTIN_MIME_TYPES[i+1], TTIN_MIME_TYPES[i+2], sExt)) return 1;
+ }
return 0;
}
static Bool TTIn_is_local(const char *url)
{
+ if (!url)
+ return 0;
if (!strnicmp(url, "file://", 7)) return 1;
if (strstr(url, "://")) return 0;
return 1;
{
GF_Err e;
GF_MediaImporter import;
-
char szFILE[GF_MAX_PATH];
TTIn *tti = (TTIn *)plug->priv;
- const char *cache_dir = gf_modules_get_option((GF_BaseInterface *)plug, "General", "CacheDirectory");
-
+ const char *cache_dir;
+ if (!tti || !url)
+ return GF_BAD_PARAM;
+ cache_dir = gf_modules_get_option((GF_BaseInterface *)plug, "General", "CacheDirectory");
if (cache_dir && strlen(cache_dir)) {
if (cache_dir[strlen(cache_dir)-1] != GF_PATH_SEPARATOR) {
- sprintf(szFILE, "%s%csrt_%d_mp4", cache_dir, GF_PATH_SEPARATOR, (u32) tti);
+ sprintf(szFILE, "%s%csrt_%p_mp4", cache_dir, GF_PATH_SEPARATOR, tti);
} else {
- sprintf(szFILE, "%ssrt_%d_mp4", cache_dir, (u32) tti);
+ sprintf(szFILE, "%ssrt_%p_mp4", cache_dir, tti);
}
} else {
- sprintf(szFILE, "%d_temp_mp4", (u32) tti);
+ sprintf(szFILE, "%p_temp_mp4", tti);
}
tti->mp4 = gf_isom_open(szFILE, GF_ISOM_OPEN_WRITE, NULL);
if (!tti->mp4) return gf_isom_last_error(NULL);
-
+ if (tti->szFile)
+ gf_free(tti->szFile);
tti->szFile = gf_strdup(szFILE);
memset(&import, 0, sizeof(GF_MediaImporter));
import.dest = tti->mp4;
/*override layout from sub file*/
import.flags = GF_IMPORT_SKIP_TXT_BOX;
- import.in_name = (char *) url;
-
+ import.in_name = gf_strdup(url);
+
e = gf_media_import(&import);
if (!e) {
tti->tt_track = 1;
gf_isom_text_set_streaming_mode(tti->mp4, 1);
}
+ if (import.in_name)
+ gf_free(import.in_name);
return e;
}
const char *szCache;
GF_InputService *plug = (GF_InputService *)cbk;
TTIn *tti = (TTIn *) plug->priv;
-
+ if (!tti)
+ return;
gf_term_download_update_stats(tti->dnload);
e = param->error;
else {
e = TTIn_LoadFile(plug, szCache, 1);
}
- }
- else if (param->msg_type==GF_NETIO_DATA_EXCHANGE)
+ }
+ else if (param->msg_type==GF_NETIO_DATA_EXCHANGE)
return;
/*OK confirm*/
void TTIn_download_file(GF_InputService *plug, const char *url)
{
TTIn *tti = (TTIn *) plug->priv;
-
+ if (!plug || !url)
+ return;
tti->needs_connection = 1;
tti->dnload = gf_term_download_new(tti->service, url, 0, TTIn_NetIO, plug);
if (!tti->dnload) {
{
GF_Err e;
TTIn *tti = (TTIn *)plug->priv;
-
+ if (!plug || !url)
+ return GF_BAD_PARAM;
tti->service = serv;
if (tti->dnload) gf_term_download_del(tti->dnload);
static GF_Err TTIn_CloseService(GF_InputService *plug)
{
- TTIn *tti = (TTIn *)plug->priv;
- if (tti->samp) gf_isom_sample_del(&tti->samp);
- if (tti->mp4) gf_isom_delete(tti->mp4);
+ TTIn *tti;
+ if (!plug)
+ return GF_BAD_PARAM;
+ tti = (TTIn *)plug->priv;
+ if (!tti)
+ return GF_BAD_PARAM;
+ if (tti->samp)
+ gf_isom_sample_del(&tti->samp);
+ tti->samp = NULL;
+ if (tti->mp4)
+ gf_isom_delete(tti->mp4);
tti->mp4 = NULL;
if (tti->szFile) {
gf_delete_file(tti->szFile);
gf_free(tti->szFile);
tti->szFile = NULL;
}
- if (tti->dnload) gf_term_download_del(tti->dnload);
+ if (tti->dnload)
+ gf_term_download_del(tti->dnload);
tti->dnload = NULL;
-
- gf_term_on_disconnect(tti->service, NULL, GF_OK);
+ if (tti->service)
+ gf_term_on_disconnect(tti->service, NULL, GF_OK);
+ tti->service = NULL;
return GF_OK;
}
static GF_Descriptor *TTIn_GetServiceDesc(GF_InputService *plug, u32 expect_type, const char *sub_url)
{
- TTIn *tti = (TTIn *)plug->priv;
+ TTIn *tti;
+ if (!plug)
+ return NULL;
+ tti = (TTIn *)plug->priv;
+ if (!tti)
+ return NULL;
/*visual object*/
switch (expect_type) {
case GF_MEDIA_OBJECT_UNDEF:
u32 ES_ID;
GF_Err e;
TTIn *tti = (TTIn *)plug->priv;
-
+ if (!tti)
+ return GF_BAD_PARAM;
e = GF_SERVICE_ERROR;
- if (tti->ch==channel) goto exit;
+ if (!tti || tti->ch==channel) goto exit;
e = GF_STREAM_NOT_FOUND;
ES_ID = 0;
- if (strstr(url, "ES_ID")) sscanf(url, "ES_ID=%d", &ES_ID);
+ if (strstr(url, "ES_ID")) sscanf(url, "ES_ID=%ud", &ES_ID);
if (ES_ID==1) {
tti->ch = channel;
static GF_Err TTIn_ServiceCommand(GF_InputService *plug, GF_NetworkCommand *com)
{
TTIn *tti = (TTIn *)plug->priv;
-
+ if (!tti)
+ return GF_BAD_PARAM;
if (!com->base.on_channel) return GF_NOT_SUPPORTED;
switch (com->command_type) {
case GF_NET_CHAN_SET_PADDING:
GF_SAFEALLOC(plug, GF_InputService);
GF_REGISTER_MODULE_INTERFACE(plug, GF_NET_CLIENT_INTERFACE, "GPAC SubTitle Reader", "gpac distribution")
+ plug->RegisterMimeTypes = TTIN_RegisterMimeTypes;
plug->CanHandleURL = TTIn_CanHandleURL;
plug->CanHandleURLInService = NULL;
plug->ConnectService = TTIn_ConnectService;
void DeleteTTReader(void *ifce)
{
- GF_InputService *plug = (GF_InputService *) ifce;
- TTIn *tti = (TTIn *)plug->priv;
- gf_free(tti);
+ TTIn *tti;
+ GF_InputService *plug = (GF_InputService *) ifce;
+ if (!plug)
+ return;
+ tti = (TTIn *)plug->priv;
+ if (tti){
+ TTIn_CloseService(plug);
+ gf_free(tti);
+ }
+ plug->priv = NULL;
gf_free(plug);
}
vpath %.c $(SRC_PATH)/modules/ui_rec
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
u32 next_time;
Bool evt_loaded;
- Bool (*on_event)(struct __ui_rec *uir , GF_Event *event);
+ GF_TermEventFilter evt_filter;
} GF_UIRecord;
-Bool uir_on_event_play(GF_UIRecord *uir , GF_Event *event)
+Bool uir_on_event_play(GF_UIRecord *uir , GF_Event *event, Bool consumed_by_compositor)
{
switch (event->type) {
case GF_EVENT_CONNECT:
return 0;
}
-Bool uir_on_event_record(GF_UIRecord *uir , GF_Event *event)
+Bool uir_on_event_record(GF_UIRecord *uir , GF_Event *event, Bool consumed_by_compositor)
{
switch (event->type) {
case GF_EVENT_CONNECT:
if (!opt) return 0;
if (!strcmp(opt, "Play")) {
- uir->uif = fopen(uifile, "rb");
+ uir->uif = gf_f64_open(uifile, "rb");
if (!uir->uif) return 0;
uir->bs = gf_bs_from_file(uir->uif, GF_BITSTREAM_READ);
termext->caps |= GF_TERM_EXTENSION_NOT_THREADED;
- uir->on_event = uir_on_event_play;
- termext->caps |= GF_TERM_EXTENSION_FILTER_EVENT;
+ uir->evt_filter.on_event = uir_on_event_play;
+ uir->evt_filter.udta = uir;
+ gf_term_add_event_filter(uir->term, &uir->evt_filter);
uir_load_event(uir);
} else if (!strcmp(opt, "Record")) {
if (!uir->uif) return 0;
uir->bs = gf_bs_from_file(uir->uif, GF_BITSTREAM_WRITE);
- uir->on_event = uir_on_event_record;
- termext->caps |= GF_TERM_EXTENSION_FILTER_EVENT;
+ uir->evt_filter.on_event = uir_on_event_record;
+ uir->evt_filter.udta = uir;
+ gf_term_add_event_filter(uir->term, &uir->evt_filter);
} else {
return 0;
}
case GF_TERM_EXT_STOP:
if (uir->uif) fclose(uir->uif);
if (uir->bs) gf_bs_del(uir->bs);
+ gf_term_remove_event_filter(uir->term, &uir->evt_filter);
uir->term = NULL;
/*auto-disable the plugin by default*/
gf_modules_set_option((GF_BaseInterface*)termext, "UIRecord", "Mode", "Disable");
uir_load_event(uir);
}
break;
- case GF_TERM_EXT_EVENT:
- return uir->on_event(uir, (GF_Event*)param);
}
return 0;
}
{
GF_TermExt *dr;
GF_UIRecord *uir;
- dr = malloc(sizeof(GF_TermExt));
+ dr = (GF_TermExt*)gf_malloc(sizeof(GF_TermExt));
memset(dr, 0, sizeof(GF_TermExt));
GF_REGISTER_MODULE_INTERFACE(dr, GF_TERM_EXT_INTERFACE, "GPAC UI Recorder", "gpac distribution");
{
GF_TermExt *dr = (GF_TermExt *) ifce;
GF_UIRecord *uir = dr->udta;
- free(uir);
- free(dr);
+ gf_free(uir);
+ gf_free(dr);
}
GF_EXPORT
vpath %.c $(SRC_PATH)/modules/wav_out
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include -DDISABLE_WAVE_EX
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" -DDISABLE_WAVE_EX
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
vpath %.c $(SRC_PATH)/modules/widgetman
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
OBJS=widgetman.o unzip.o widget.o wgt_load.o
ifeq ($(CONFIG_ZLIB), local)
-CFLAGS+=-I$(LOCAL_INC_PATH)/zlib
+CFLAGS+=-I"$(LOCAL_INC_PATH)/zlib"
LOCAL_LIB+= -L../../extra_lib/lib/gcc
endif
#else
# include <unistd.h>
# include <utime.h>
+# include <sys/stat.h>
#endif
#endif
-# include "unzip.h"
+#include "unzip.h"
+#include <gpac/tools.h>
uLong *pX;
{
uLong x ;
- int i;
int err;
+ int i = 0;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
x = (uLong)i;
uLong *pX;
{
uLong x ;
- int i;
int err;
+ int i = 0;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
x = (uLong)i;
/* we check the magic */
- if (err==UNZ_OK)
+ if (err==UNZ_OK){
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x02014b50)
err=UNZ_BADZIPFILE;
+ }
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO;
else
uSizeRead = extraFieldBufferSize;
- if (lSeek!=0)
+ if (lSeek!=0){
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
+ }
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
else
uSizeRead = commentBufferSize;
- if (lSeek!=0)
+ if (lSeek!=0){
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
+ }
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
return UNZ_ERRNO;
- if (err==UNZ_OK)
+ if (err==UNZ_OK){
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE;
+ }
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
err=UNZ_ERRNO;
if (len <= 0)
return 0;
- buffer = (char*)malloc(len+1);
+ buffer = (char*)gf_malloc(len+1);
strcpy(buffer,newdir);
if (buffer[len-1] == '/') {
}
if (mymkdir(buffer) == 0)
{
- free(buffer);
+ gf_free(buffer);
return 1;
}
if ((mymkdir(buffer) == -1) && (errno == ENOENT))
{
printf("couldn't create directory %s\n",buffer);
- free(buffer);
+ gf_free(buffer);
return 0;
}
if (hold == 0)
break;
*p++ = hold;
}
- free(buffer);
+ gf_free(buffer);
return 1;
}
#else
uInt size_buf;
unz_file_info file_info;
- uLong ratio=0;
err = unzlocal_GetCurrentFileInfoInternal(uf,&file_info,NULL,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
if (err!=UNZ_OK)
}
size_buf = WRITEBUFFERSIZE;
- buf = (void*)malloc(size_buf);
+ buf = (void*)gf_malloc(size_buf);
if (buf==NULL)
{
printf("Error allocating memory\n");
unzCloseCurrentFile(uf); /* don't lose the error */
}
- free(buf);
+ gf_free(buf);
return err;
}
uLong i;
unz_global_info gi;
int err;
- FILE* fout=NULL;
unzFile uf=NULL;
//This software module was originally developed by TelecomParisTech in the
//course of the development of MPEG-U Widgets (ISO/IEC 23007-1) standard.
//
-//This software module is an implementation of a part of one or
+//This software module is an implementation of a part of one or
//more MPEG-U Widgets (ISO/IEC 23007-1) tools as specified by the MPEG-U Widgets
//(ISO/IEC 23007-1) standard. ISO/IEC gives users of the MPEG-U Widgets
//(ISO/IEC 23007-1) free license to this software module or modifications
//module in hardware or software products are advised that its use may
//infringe existing patents.
//The original developer of this software module and his/her company, the
-//subsequent editors and their companies, and ISO/IEC have no liability
-//for use of this software module or modifications thereof in an implementation.
-//Copyright is not released for non MPEG-U Widgets (ISO/IEC 23007-1) conforming
-//products.
-//Telecom ParisTech retains full right to use the code for his/her own purpose,
-//assign or donate the code to a third party and to inhibit third parties from
-//using the code for non MPEG-U Widgets (ISO/IEC 23007-1) conforming products.
+//subsequent editors and their companies, and ISO/IEC have no liability
+//for use of this software module or modifications thereof in an implementation.
+//Copyright is not released for non MPEG-U Widgets (ISO/IEC 23007-1) conforming
+//products.
+//Telecom ParisTech retains full right to use the code for his/her own purpose,
+//assign or donate the code to a third party and to inhibit third parties from
+//using the code for non MPEG-U Widgets (ISO/IEC 23007-1) conforming products.
//
//This copyright notice must be included in all copies or derivative works.
//
/////////////////////////////////////////////////////////////////////////////////
//
-// Authors:
+// Authors:
// Cyril Concolato, Telecom ParisTech
// Jean Le Feuvre, Telecom ParisTech
//
Bool loaded;
} WgtLoad;
-static GF_Err WGT_ProcessData(GF_SceneDecoder *plug, char *inBuffer, u32 inBufferLength,
+static GF_Err WGT_ProcessData(GF_SceneDecoder *plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 stream_time, u32 mmlevel)
{
GF_Err e = GF_OK;
switch (wgtload->oti) {
case GPAC_OTI_PRIVATE_SCENE_WGT:
- if (wgtload->file_name && !wgtload->loaded) {
+ if (wgtload->file_name && !wgtload->loaded) {
const char *path, *wmpath;
char *tmp;
GF_Node *n, *root;
GF_FieldInfo info;
FILE *jsfile;
GF_ChildNodeItem *last;
-
+
wgtload->loaded = 1;
- gf_sg_add_namespace(wgtload->scene->graph, "http://www.w3.org/2000/svg", NULL);
- gf_sg_add_namespace(wgtload->scene->graph, "http://www.w3.org/1999/xlink", "xlink");
- gf_sg_add_namespace(wgtload->scene->graph, "http://www.w3.org/2001/xml-events", "ev");
+ gf_sg_add_namespace(wgtload->scene->graph, "http://www.w3.org/2000/svg", NULL);
+ gf_sg_add_namespace(wgtload->scene->graph, "http://www.w3.org/1999/xlink", "xlink");
+ gf_sg_add_namespace(wgtload->scene->graph, "http://www.w3.org/2001/xml-events", "ev");
gf_sg_set_scene_size_info(wgtload->scene->graph, 800, 600, 1);
- /* modify the scene with an Inline/Animation pointing to the widget start file URL */
- n = root = gf_node_new(wgtload->scene->graph, TAG_SVG_svg);
- gf_node_register(root, NULL);
+ /* modify the scene with an Inline/Animation pointing to the widget start file URL */
+ n = root = gf_node_new(wgtload->scene->graph, TAG_SVG_svg);
+ gf_node_register(root, NULL);
gf_sg_set_root_node(wgtload->scene->graph, root);
gf_node_get_attribute_by_tag(n, TAG_SVG_ATT_viewBox, 1, 0, &info);
gf_svg_parse_attribute(n, &info, "0 0 320 240", 0);
*/
gf_node_init(n);
- n = gf_node_new(wgtload->scene->graph, TAG_SVG_animation);
+ n = gf_node_new(wgtload->scene->graph, TAG_SVG_animation);
gf_node_set_id(n, 1, "w_anim");
gf_node_register(n, root);
gf_node_list_add_child_last(&((GF_ParentNode *)root)->children, n, &last);
gf_node_get_attribute_by_tag(n, TAG_SVG_ATT_height, 1, 0, &info);
gf_svg_parse_attribute(n, &info, "240", 0);
gf_node_init(n);
-
+
tmp = wgtload->file_name;
- while (tmp = strchr(tmp, '\\')) {
+ while ((tmp = strchr(tmp, '\\'))) {
tmp[0] = '/';
tmp++;
}
" if (wid != null) {\n"
" wid.activate(anim);"
" anim.setAttributeNS('http://www.w3.org/1999/xlink', 'href', wid.main);\n"
- " } else {\n"
- " alert('Widget ' + wid_url + ' is not valid');\n"
+ " } else {\n"
+ " alert('Widget ' + wid_url + ' is not valid');\n"
" }\n"
"}\n";
}
}
break;
-
- default:
+
+ default:
return GF_BAD_PARAM;
}
return e;
return "GPAC W3C Widget Loader";
}
-Bool WGT_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+Bool WGT_CanHandleStream(GF_BaseDecoder *ifce, u32 StreamType, GF_ESD *esd, u8 PL)
{
+ /*don't reply to media type query*/
+ if (!esd) return 0;
+
if (StreamType==GF_STREAM_PRIVATE_SCENE) {
- if (ObjectType==GPAC_OTI_PRIVATE_SCENE_WGT) return 1;
+ if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_PRIVATE_SCENE_WGT) return 1;
return 0;
- }
+ }
return 0;
}
{
WgtLoad *wgtload;
GF_SceneDecoder *sdec;
-
+
GF_SAFEALLOC(sdec, GF_SceneDecoder)
GF_REGISTER_MODULE_INTERFACE(sdec, GF_SCENE_DECODER_INTERFACE, "GPAC W3C Widget Loader", "gpac distribution");
void ShutdownWidgetReader(GF_BaseInterface *ifce)
{
GF_SceneDecoder *sdec = (GF_SceneDecoder *)ifce;
- WgtLoad *wgtload = (WgtLoad *) sdec->privateStack;
-
- gf_free(wgtload);
+ WgtLoad *wgtload;
+ if (!ifce)
+ return;
+ wgtload = (WgtLoad *) sdec->privateStack;
+ if (wgtload)
+ gf_free(wgtload);
+ sdec->privateStack = NULL;
gf_free(sdec);
}
#ifdef GPAC_HAS_SPIDERMONKEY
-JSBool widget_has_feature(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(widget_has_feature)
{
- const char *feat_name;
+ char *feat_name;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- feat_name = JS_GetStringBytes(JSVAL_TO_STRING( argv[0] ));
- *rval = BOOLEAN_TO_JSVAL( JS_FALSE );
-
- if (!strcmp(feat_name, "urn:mpeg:systems:mpeg-u:2009")) *rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+ feat_name = SMJS_CHARS(c, argv[0]);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( JS_FALSE ) );
+ if (!strcmp(feat_name, "urn:mpeg:systems:mpeg-u:2009")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( JS_TRUE ));
+ SMJS_FREE(c, feat_name);
return JS_TRUE;
}
-JSBool widget_open_url(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(widget_open_url)
{
GF_Event evt;
+ Bool res;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
memset(&evt, 0, sizeof(GF_Event));
evt.type = GF_EVENT_NAVIGATE;
- evt.navigate.to_url = JS_GetStringBytes(JSVAL_TO_STRING( argv[0] ));
- return gf_term_send_event(wid->widget->wm->term, &evt);
+ evt.navigate.to_url = SMJS_CHARS(c, argv[0]);
+ res = gf_term_send_event(wid->widget->wm->term, &evt);
+ SMJS_FREE(c, (char *)evt.navigate.to_url);
+
return JS_TRUE;
}
-JSBool widget_get_attention(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(widget_get_attention)
{
jsval fval;
+ SMJS_OBJ
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_TRUE;
if ((JS_LookupProperty(c, wid->widget->wm->obj, "getAttention", &fval)==JS_TRUE) && JSVAL_IS_OBJECT(fval)) {
jsval args[1];
args[0] = OBJECT_TO_JSVAL(wid->obj);
- JS_CallFunctionValue(c, wid->widget->wm->obj, fval, 1, args, rval);
+ JS_CallFunctionValue(c, wid->widget->wm->obj, fval, 1, args, SMJS_GET_RVAL);
}
return JS_TRUE;
}
-JSBool widget_show_notification(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(widget_show_notification)
{
jsval fval;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_TRUE;
for (i=0; i<argc; i++)
vars[i+1] = argv[i];
- JS_CallFunctionValue(c, wid->widget->wm->obj, fval, argc+1, vars, rval);
+ JS_CallFunctionValue(c, wid->widget->wm->obj, fval, argc+1, vars, SMJS_GET_RVAL);
}
return JS_TRUE;
}
-static JSBool widget_call_message_reply_callback(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_call_message_reply_callback)
{
JSObject *list;
jsval *vals, fval;
u32 i, count;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetMessage *msg = JS_GetPrivate(c, obj);
if (!msg || !argc || !JSVAL_IS_OBJECT(argv[0]) ) return JS_FALSE;
for (i=0; i<count; i++) {
JS_GetElement(c, list, (jsint) i, &vals[i+1]);
}
- JS_CallFunctionValue(c, obj, fval, count, vals, rval);
+ JS_CallFunctionValue(c, obj, fval, count, vals, SMJS_GET_RVAL);
gf_free(vals);
}
return JS_TRUE;
}
-static JSBool widget_message_handler_factory(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_message_handler_factory)
{
char *msg_name;
u32 i, count;
- GF_WidgetInstance *wid = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInterfaceInstance *bifce = (GF_WidgetInterfaceInstance *)JS_GetPrivate(c, obj);
if (!bifce) return JS_FALSE;
if (!argc) return JS_FALSE;
if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
- msg_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ msg_name = SMJS_CHARS(c, argv[0]);
if (!msg_name ) return JS_FALSE;
- *rval = JSVAL_NULL;
+ SMJS_SET_RVAL( JSVAL_NULL );
count = gf_list_count(bifce->ifce->messages);
for (i=0; i<count; i++) {
GF_WidgetMessage *msg = gf_list_get(bifce->ifce->messages, i);
if ((argc==2) && JSVAL_IS_OBJECT(argv[1]) && !JSVAL_IS_NULL(argv[1]))
JS_DefineProperty(c, an_obj, "replyCallback", argv[1], 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
- *rval = OBJECT_TO_JSVAL(an_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(an_obj) );
}
}
+ SMJS_FREE(c, msg_name);
return JS_TRUE;
}
-static JSBool widget_invoke_message(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_invoke_message)
{
jsval oval;
GF_WidgetMessage *msg = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInterfaceInstance *bifce = (GF_WidgetInterfaceInstance *)JS_GetPrivate(c, obj);
if (!bifce) return JS_FALSE;
- *rval = JSVAL_NULL;
+ SMJS_SET_RVAL( JSVAL_NULL );
if (!JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
if (JSVAL_IS_NULL(argv[0])) return JS_FALSE;
/*look for JS Callback "invoke" in the widget manager script*/
if (JS_LookupProperty(c, bifce->ifce->obj, "invoke", &oval)==JS_TRUE) {
if (JSVAL_IS_OBJECT(oval)) {
- JS_CallFunctionValue(bifce->wid->widget->wm->ctx, bifce->ifce->obj, oval, argc, argv, rval);
+ JS_CallFunctionValue(bifce->wid->widget->wm->ctx, bifce->ifce->obj, oval, argc, argv, SMJS_GET_RVAL );
}
}
return JS_TRUE;
}
-static JSBool widget_invoke_message_reply(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_invoke_message_reply)
{
jsval oval;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetMessage *msg = NULL;
GF_WidgetInterfaceInstance *bifce = (GF_WidgetInterfaceInstance *)JS_GetPrivate(c, obj);
if (!bifce) return JS_FALSE;
- *rval = JSVAL_NULL;
+ SMJS_SET_RVAL( JSVAL_NULL );
if (!JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
if (JSVAL_IS_NULL(argv[0])) return JS_FALSE;
/*look for JS Callback "invokeReply" in the widget manager script*/
if (JS_LookupProperty(c, bifce->ifce->obj, "invokeReply", &oval)==JS_TRUE) {
if (JSVAL_IS_OBJECT(oval)) {
- JS_CallFunctionValue(bifce->wid->widget->wm->ctx, bifce->ifce->obj, oval, argc, argv, rval);
+ JS_CallFunctionValue(bifce->wid->widget->wm->ctx, bifce->ifce->obj, oval, argc, argv, SMJS_GET_RVAL);
}
}
return JS_TRUE;
if (!ifce->obj) {
ifce->obj = JS_NewObject(c, &ifce->wid->widget->wm->widgetAnyClass, 0, 0);
JS_SetPrivate(c, ifce->obj, ifce);
- gf_js_add_root(c, &ifce->obj);
+ gf_js_add_root(c, &ifce->obj, GF_JSGC_OBJECT);
JS_DefineProperty(c, ifce->obj, "type", STRING_TO_JSVAL( JS_NewStringCopyZ(c, ifce->ifce->type) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(c, ifce->obj, "bound", STRING_TO_JSVAL( JS_NewStringCopyZ(c, ifce->hostname) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(c, ifce->obj, "invoke", widget_invoke_message, 1, 0);
}
}
-static JSBool widget_get_interfaces(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_get_interfaces)
{
u32 i, count;
char *ifce_name;
JSObject *list;
jsuint idx;
jsval v;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- ifce_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ ifce_name = SMJS_CHARS(c, argv[0]);
list = JS_NewArrayObject(c, 0, 0);
v = OBJECT_TO_JSVAL(ifce->obj);
JS_SetElement(c, list, idx, &v);
}
- *rval = OBJECT_TO_JSVAL(list);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(list) );
+ SMJS_FREE(c, ifce_name);
return JS_TRUE;
}
-static JSBool widget_activate_component(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, Bool is_deactivate)
+static JSBool SMJS_FUNCTION_EXT(widget_activate_component, Bool is_deactivate)
{
u32 i, count;
char *comp_id;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- comp_id = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ comp_id = SMJS_CHARS(c, argv[0]);
count = gf_list_count(wid->widget->main->components);
for (i=0; i<count; i++) {
} else {
wm_activate_component(c, wid, comp, 0);
}
- return JS_TRUE;
+ break;
}
+ SMJS_FREE(c, comp_id);
return JS_TRUE;
}
-static JSBool widget_activate_widget(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_activate_widget)
{
- return widget_activate_component(c, obj, argc, argv, rval, 0);
+ return widget_activate_component(SMJS_CALL_ARGS, 0);
}
-static JSBool widget_deactivate_widget(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(widget_deactivate_widget)
{
- return widget_activate_component(c, obj, argc, argv, rval, 1);
+ return widget_activate_component(SMJS_CALL_ARGS, 1);
}
void widget_on_interface_bind(GF_WidgetInterfaceInstance *ifce, Bool unbind)
}
-JSBool widget_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *rval)
+JSBool widget_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *rval)
{
const char *opt;
char *prop_name;
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (!strcmp(prop_name, "viewMode")) {
}
else if (!strcmp(prop_name, "width")) {
opt = gf_cfg_get_key(wid->widget->wm->term->user->config, wid->secname, "width");
- *rval = INT_TO_JSVAL( JS_NewDouble(c, opt ? atoi(opt) : 0) );
+ *rval = INT_TO_JSVAL( (opt ? atoi(opt) : 0) );
}
else if (!strcmp(prop_name, "height")) {
opt = gf_cfg_get_key(wid->widget->wm->term->user->config, wid->secname, "height");
- *rval = INT_TO_JSVAL( JS_NewDouble(c, opt ? atoi(opt) : 0) );
+ *rval = INT_TO_JSVAL( (opt ? atoi(opt) : 0) );
}
else if (!strcmp(prop_name, "preferences")) {
}
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-JSBool widget_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+JSBool widget_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
return JS_TRUE;
}
GF_WidgetInterfaceInstance *ifce = gf_list_get(wi->bound_ifces, i);
if (ifce->obj) {
JS_SetPrivate(c, ifce->obj, NULL);
- gf_js_remove_root(c, &ifce->obj);
+ gf_js_remove_root(c, &ifce->obj, GF_JSGC_OBJECT);
ifce->obj = NULL;
}
}
};
JSFunctionSpec widgetClassFuncs[] = {
/*W3C*/
- {"has_feature", widget_has_feature, 1, 0, 0},
- {"openURL", widget_open_url, 1, 0, 0},
- {"getAttention", widget_get_attention, 0, 0, 0},
- {"showNotification", widget_show_notification, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("has_feature", widget_has_feature, 1),
+ SMJS_FUNCTION_SPEC("openURL", widget_open_url, 1),
+ SMJS_FUNCTION_SPEC("getAttention", widget_get_attention, 0),
+ SMJS_FUNCTION_SPEC("showNotification", widget_show_notification, 0),
/*MPEG*/
- {"getInterfaceHandlersByType", widget_get_interfaces, 1, 0, 0},
- {"activateComponentWidget", widget_activate_widget, 1, 0, 0},
- {"deactivateComponentWidget", widget_deactivate_widget, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("getInterfaceHandlersByType", widget_get_interfaces, 1),
+ SMJS_FUNCTION_SPEC("activateComponentWidget", widget_activate_widget, 1),
+ SMJS_FUNCTION_SPEC("deactivateComponentWidget", widget_deactivate_widget, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(c, global, 0, &wm->widgetClass, 0, 0,widgetClassProps, widgetClassFuncs, 0, 0);
//This software module was originally developed by TelecomParisTech in the
//course of the development of MPEG-U Widgets (ISO/IEC 23007-1) standard.
//
-//This software module is an implementation of a part of one or
+//This software module is an implementation of a part of one or
//more MPEG-U Widgets (ISO/IEC 23007-1) tools as specified by the MPEG-U Widgets
//(ISO/IEC 23007-1) standard. ISO/IEC gives users of the MPEG-U Widgets
//(ISO/IEC 23007-1) free license to this software module or modifications
//module in hardware or software products are advised that its use may
//infringe existing patents.
//The original developer of this software module and his/her company, the
-//subsequent editors and their companies, and ISO/IEC have no liability
-//for use of this software module or modifications thereof in an implementation.
-//Copyright is not released for non MPEG-U Widgets (ISO/IEC 23007-1) conforming
-//products.
-//Telecom ParisTech retains full right to use the code for his/her own purpose,
-//assign or donate the code to a third party and to inhibit third parties from
-//using the code for non MPEG-U Widgets (ISO/IEC 23007-1) conforming products.
+//subsequent editors and their companies, and ISO/IEC have no liability
+//for use of this software module or modifications thereof in an implementation.
+//Copyright is not released for non MPEG-U Widgets (ISO/IEC 23007-1) conforming
+//products.
+//Telecom ParisTech retains full right to use the code for his/her own purpose,
+//assign or donate the code to a third party and to inhibit third parties from
+//using the code for non MPEG-U Widgets (ISO/IEC 23007-1) conforming products.
//
//This copyright notice must be included in all copies or derivative works.
//
/////////////////////////////////////////////////////////////////////////////////
//
-// Authors:
+// Authors:
// Jean Le Feuvre, Telecom ParisTech
// Cyril Concolato, Telecom ParisTech
//
#ifdef GPAC_HAS_SPIDERMONKEY
#if !defined(__GNUC__)
-# if defined(_WIN32_WCE)
-# pragma comment(lib, "js")
-# elif defined (WIN32)
# pragma comment(lib, "js32")
-# endif
#endif
char c1, c2;
u32 i=0;
do {
- if (len && (i==len))
+ if (len && (i==len))
break;
c1 = p1[i];
c2 = p2[i];
}
unzOpenCurrentFile3(uf, NULL, NULL, 0, NULL/*password*/);
-
+
fout=gf_f64_open(res->extracted_path, "wb");
if (!fout) break;
do {
return 0;
}
-/* Checks if a resource in the package has the given rel_path, potentially in a localized sub-folder */
+/* Checks if a resource in the package has the given rel_path, potentially in a localized sub-folder */
static Bool widget_package_relocate_uri(void *__self, const char *parent_uri, const char *rel_path, char *relocated_path, char *localized_rel_path)
{
char path[GF_MAX_PATH];
else if (strstr(parent_uri, wpack->archive_id)) {
}
/*resource doesn't belong to our archive*/
- else {
+ else {
return 0;
}
if (sep_lang) {
sep_lang[0] = ';';
opt = sep_lang+1;
- } else {
+ } else {
opt = NULL;
}
}
sprintf(path, "locales/%s/%s", lan, rel_path);
- if (package_find_res(wpack, path, relocated_path, localized_rel_path))
+ if (package_find_res(wpack, path, relocated_path, localized_rel_path))
return 1;
/*recursively remove region (sub)tags*/
if (!sep) break;
sep[0] = 0;
sprintf(path, "locales/%s/%s", lan, rel_path);
- if (package_find_res(wpack, path, relocated_path, localized_rel_path))
+ if (package_find_res(wpack, path, relocated_path, localized_rel_path))
return 1;
}
}
const char *dir;
GF_WidgetPackage *wzip;
u32 brand = 0;
- u32 meta = 0;
u32 i, count;
GF_ISOFile *isom = gf_isom_open(path, GF_ISOM_OPEN_READ, 0);
if (!isom ) return NULL;
strcat(szPath, filename_inzip);
}
-
+
if (!strcmp(filename_inzip, "config.xml")) {
int err;
char buf[8192];
FILE *fout;
unzOpenCurrentFile3(uf, NULL, NULL, 0, NULL/*password*/);
-
+
fout=gf_f64_open(szPath,"wb");
if (!fout) return NULL;
do {
err = unzReadCurrentFile(uf,buf,8192);
if (err<0) break;
-
+
if (err>0)
if (fwrite(buf,err,1,fout)!=1) {
err=UNZ_ERRNO;
gf_list_del(ifce->messages);
wm_delete_message_param(ifce->bind_action);
wm_delete_message_param(ifce->unbind_action);
- if (ifce->obj) gf_js_remove_root(ifce->content->widget->wm->ctx, &ifce->obj);
+ if (ifce->obj) gf_js_remove_root(ifce->content->widget->wm->ctx, &ifce->obj, GF_JSGC_OBJECT);
if (ifce->connectTo) gf_free(ifce->connectTo);
gf_free(ifce->type);
wm_delete_message_param(comp->activateTrigger);
wm_delete_message_param(comp->deactivateTrigger);
-
+
while (gf_list_count(comp->required_interfaces)) {
char *type = gf_list_last(comp->required_interfaces);
gf_list_rem_last(comp->required_interfaces);
static void wm_delete_widget(GF_WidgetManager *wm, GF_Widget *wid)
{
gf_list_del_item(wm->widgets, wid);
-
+
if (wid->url) gf_free(wid->url);
if (wid->manifest_path) gf_free(wid->manifest_path);
wm_delete_widget_content(wid->main);
if (bifce->hostname) gf_free(bifce->hostname);
if (bifce->obj) {
JS_SetPrivate(wm->ctx, bifce->obj, NULL);
- gf_js_remove_root(wm->ctx, &bifce->obj);
+ gf_js_remove_root(wm->ctx, &bifce->obj, GF_JSGC_OBJECT);
}
gf_free(bifce);
}
if (widg->obj) {
JS_SetPrivate(wm->ctx, widg->obj, NULL);
- gf_js_remove_root(wm->ctx, &widg->obj);
+ gf_js_remove_root(wm->ctx, &widg->obj, GF_JSGC_OBJECT);
}
gf_list_del_item(wm->widget_instances, widg);
widg->widget->nb_instances--;
static JSBool wm_widget_set_scene_input_value(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, u32 type, GF_WidgetInstance *wid, GF_WidgetPin *param, const char *value)
{
- const char *str_val;
+ char *str_val;
GF_Node *n;
GF_FieldInfo info;
GF_WidgetMessage *msg;
GF_WidgetInterface *ifce;
-
+
if (!wid && obj) wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
if (!wid->scene) return JS_TRUE;
}
if (!param || !param->node) return JS_TRUE;
- /*this is a script call*/
+ /*this is a script call*/
if (!param->attribute) {
return wm_widget_call_script(wid, param, 0, NULL, rval);
}
if (n->sgprivate->tag >= GF_NODE_FIRST_DOM_NODE_TAG) {
u32 evt_type;
if (!type) {
+ char *_str_val = NULL;
if (value) {
- str_val = value;
+ str_val = (char *)value;
} else {
if (!JSVAL_IS_STRING(argv[1])) goto exit;
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = _str_val = SMJS_CHARS(c, argv[1]);
}
-
+
/* first check if the set_input refers to an attribute name or to an event name */
evt_type = gf_dom_event_type_by_name(param->attribute);
if (!strcmp(param->attribute, "textContent")) {
gf_dom_set_textContent(n, (char *)str_val);
gf_node_changed(n, NULL);
- }
+ }
else {
if (gf_node_get_attribute_by_name(n, param->attribute, 0, 1, 0, &info)==GF_OK) {
gf_svg_parse_attribute(n, &info, (char *)str_val, 0);
}
}
}
+ SMJS_FREE(c, _str_val);
+
} else {
GF_DOM_Event evt;
memset(&evt, 0, sizeof(GF_DOM_Event));
}
}
}
- } else
+ } else
#endif
if (gf_node_get_field_by_name(n, param->attribute, &info) != GF_OK) return JS_TRUE;
if (!type) {
+ char *_str_val = NULL;
jsdouble val;
switch (info.fieldType) {
case GF_SG_VRML_SFSTRING:
if (value) {
- str_val = value;
+ str_val = (char *)value;
} else {
if (!JSVAL_IS_STRING(argv[1]))goto exit;
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = SMJS_CHARS(c, argv[1]);
}
if ( ((SFString*)info.far_ptr)->buffer) gf_free(((SFString*)info.far_ptr)->buffer);
((SFString*)info.far_ptr)->buffer = str_val ? gf_strdup(str_val) : NULL;
else if (JSVAL_IS_BOOLEAN(argv[1])) *((SFBool*)info.far_ptr) = JSVAL_TO_BOOLEAN(argv[1]);
else if (JSVAL_IS_INT(argv[1])) *((SFBool*)info.far_ptr) = JSVAL_TO_INT(argv[1]);
else if (JSVAL_IS_STRING(argv[1])) {
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = SMJS_CHARS(c, argv[1]);
*((SFBool*)info.far_ptr) = (str_val && !strcmp(str_val, "true")) ? 1 : 0;
- } else
+ SMJS_FREE(c, str_val);
+ } else
goto exit;
break;
case GF_SG_VRML_SFINT32:
*((SFInt32*)info.far_ptr) = (s32) val;
} else if (JSVAL_IS_STRING(argv[1])) {
Double a_val;
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = SMJS_CHARS(c, argv[1]);
a_val = str_val ? atof(str_val) : 0;
*((SFInt32*)info.far_ptr) = (s32) a_val;
- } else
+ SMJS_FREE(c, str_val);
+ } else
goto exit;
break;
case GF_SG_VRML_SFFLOAT:
*((SFFloat *)info.far_ptr) = FLT2FIX( val );
} else if (JSVAL_IS_STRING(argv[1])) {
Double a_val;
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = SMJS_CHARS(c, argv[1]);
a_val = str_val ? atof(str_val) : 0;
*((SFFloat*)info.far_ptr) = FLT2FIX(a_val);
- } else
+ SMJS_FREE(c, str_val);
+ } else
goto exit;
break;
case GF_SG_VRML_SFTIME:
*((SFTime *)info.far_ptr) = val;
} else if (JSVAL_IS_STRING(argv[1])) {
Double a_val;
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = SMJS_CHARS(c, argv[1]);
a_val = str_val ? atof(str_val) : 0;
*((SFTime *)info.far_ptr) = a_val;
- } else
+ SMJS_FREE(c, str_val);
+ } else
goto exit;
break;
case GF_SG_VRML_MFSTRING:
if (value) {
- str_val = value;
+ str_val = (char *)value;
} else {
if (!JSVAL_IS_STRING(argv[1])) goto exit;
- str_val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ str_val = _str_val = SMJS_CHARS(c, argv[1]);
}
if ( ((GenMFField *)info.far_ptr)->count != 1) {
gf_sg_vrml_mf_reset(info.far_ptr, GF_SG_VRML_MFSTRING);
}
if ( ((MFString*)info.far_ptr)->vals[0]) gf_free( ((MFString*)info.far_ptr)->vals[0] );
((MFString*)info.far_ptr)->vals[0] = str_val ? gf_strdup(str_val) : NULL;
+
+ SMJS_FREE(c, _str_val);
break;
}
}
//if this is a script eventIn call directly script
- if ((n->sgprivate->tag==TAG_MPEG4_Script) || (n->sgprivate->tag==TAG_X3D_Script) )
+ if ((n->sgprivate->tag==TAG_MPEG4_Script) || (n->sgprivate->tag==TAG_X3D_Script) )
gf_sg_script_event_in(n, &info);
gf_node_changed(n, &info);
}
-static JSBool wm_widget_set_input(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_set_input)
{
+ SMJS_OBJ
+ SMJS_ARGS
+ SMJS_DECL_RVAL
return wm_widget_set_scene_input_value(c, obj, argc, argv, rval, 0, NULL, NULL, NULL);
}
-static JSBool wm_widget_call_input_action(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_call_input_action)
{
+ SMJS_OBJ
+ SMJS_ARGS
+ SMJS_DECL_RVAL
return wm_widget_set_scene_input_value(c, obj, 1, argv, rval, 1, NULL, NULL, NULL);
}
-static JSBool wm_widget_call_input_script(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_call_input_script)
{
GF_WidgetMessage *msg;
GF_WidgetPin *param;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || (argc!=2) ) return JS_FALSE;
if (!wid->scene) return JS_TRUE;
msg = JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0]) );
param = msg ? msg->input_action : NULL;
if (!param || !param->node || param->attribute) return JS_FALSE;
-
+
if (JSVAL_IS_OBJECT(argv[1])) {
jsval *args;
JSObject *list = JSVAL_TO_OBJECT(argv[1]);
JS_GetElement(c, list, (jsint) i, &args[i] );
}
- wm_widget_call_script(wid, param, count, args, rval);
+ wm_widget_call_script(wid, param, count, args, SMJS_GET_RVAL);
gf_free(args);
}
if (is_destroy) {
SVG_handlerElement *handler = (SVG_handlerElement *)node;
if (handler->js_fun_val) {
- gf_js_remove_root(handler->js_context, &handler->js_fun_val);
+ gf_js_remove_root(handler->js_context, &handler->js_fun_val, GF_JSGC_VAL);
handler->js_fun_val=0;
}
}
/* modify textContent */
if (!strcmp(param->attribute, "textContent")) {
att_name = (u32) -1;
- }
+ }
/* modify an attribute */
else if (gf_node_get_attribute_by_name(n, param->attribute, 0, 1, 0, &info)==GF_OK) {
att_name = info.fieldIndex;
return NULL;
}
}
- } else
+ } else
#endif
{
- if (gf_node_get_field_by_name(n, param->attribute, &info) != GF_OK)
+ if (gf_node_get_field_by_name(n, param->attribute, &info) != GF_OK)
return NULL;
att_name = info.fieldIndex;
}
listener = gf_node_new(wid->scene, TAG_SVG_listener);
-
+
handler = (SVG_handlerElement *) gf_node_new(wid->scene, TAG_SVG_handler);
/*we register the handler with the listener node to avoid modifying the DOM*/
gf_node_register((GF_Node *)handler, listener);
GF_XMLNode *context = NULL;
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || wid->activated) return;
-
+
/*widget is now activated*/
wid->activated = 1;
if (pref->connectTo) {
SVG_handlerElement *hdl;
-
+
if (value)
wm_widget_set_scene_input_value(NULL, NULL, 0, 0, 0, 0, wid, pref->connectTo, value);
wid->mpegu_context = NULL;
}
+ gf_sg_lock_javascript(wid->widget->wm->ctx, 1);
/*refresh all interface bindings*/
JS_LookupProperty(wid->widget->wm->ctx, wid->widget->wm->obj, "check_bindings", &funval);
if (JSVAL_IS_OBJECT(funval)) {
if (JSVAL_IS_OBJECT(funval)) {
JS_CallFunctionValue(wid->widget->wm->ctx, wid->obj, funval, 0, 0, &rval);
}
+ gf_sg_lock_javascript(wid->widget->wm->ctx, 0);
}
}
-static JSBool wm_widget_activate(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_activate)
{
SVG_handlerElement *handler;
GF_MediaObject *mo;
MFURL url;
SFURL _url;
GF_Node *inl;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !argc) return JS_FALSE;
-
+
if (!JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
inl = gf_sg_js_get_node(c, JSVAL_TO_OBJECT(argv[0]) );
GF_WidgetPin *param = handler->js_fun;
GF_WidgetInstance *wid = (GF_WidgetInstance *)handler->evt_listen_obj;
- if (!wid->scene)
+ if (!wid->scene)
return;
n = gf_sg_find_node_by_name(wid->scene, param->node);
} else {
return;
}
- } else
+ } else
#endif
{
if (gf_node_get_field_by_name(n, param->attribute, &info) != GF_OK) return;
argv[0] = DOUBLE_TO_JSVAL( JS_NewDouble(handler->js_context, *((SFTime *)info.far_ptr) ) );
break;
}
- }
+ }
jsfun = (jsval) handler->js_fun_val;
if (JSVAL_IS_OBJECT(jsfun))
ret = JS_CallFunctionValue(handler->js_context, wid->obj, (jsval) handler->js_fun_val, 1, argv, &rval);
}
-static JSBool wm_widget_get_param_value(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_get_param_value)
{
GF_Node *n;
GF_FieldInfo info;
GF_WidgetPin *param;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !wid->scene || !argc || !JSVAL_IS_OBJECT(argv[0]) ) return JS_FALSE;
if (!param->node) {
if (param->default_value) {
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, param->default_value) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, param->default_value) ) );
return JS_TRUE;
}
return JS_FALSE;
if (n->sgprivate->tag >= GF_NODE_FIRST_DOM_NODE_TAG) {
if (!strcmp(param->attribute, "textContent")) {
char *txt = gf_dom_flatten_textContent(n);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, txt ? txt : "") );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, txt ? txt : "") ));
if (txt) gf_free(txt);
} else if (gf_node_get_attribute_by_name(n, param->attribute, 0, 1, 0, &info)==GF_OK) {
char *attValue = gf_node_dump_attribute(n, &info);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, attValue) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, attValue) ));
if (attValue) gf_free(attValue);
} else {
return JS_FALSE;
}
- } else
+ } else
#endif
{
if (gf_node_get_field_by_name(n, param->attribute, &info) != GF_OK) return JS_FALSE;
switch (info.fieldType) {
case GF_SG_VRML_SFSTRING:
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, ((SFString*)info.far_ptr)->buffer ) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, ((SFString*)info.far_ptr)->buffer ) ) );
break;
case GF_SG_VRML_SFINT32:
- *rval = INT_TO_JSVAL( *((SFInt32*)info.far_ptr) );
+ SMJS_SET_RVAL( INT_TO_JSVAL( *((SFInt32*)info.far_ptr) ));
break;
case GF_SG_VRML_SFBOOL:
- *rval = BOOLEAN_TO_JSVAL( *((SFBool*)info.far_ptr) );
+ SMJS_SET_RVAL(BOOLEAN_TO_JSVAL( *((SFBool*)info.far_ptr) ));
break;
case GF_SG_VRML_SFFLOAT:
- *rval = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT( *((SFFloat*)info.far_ptr) ) ) );
+ SMJS_SET_RVAL( DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT( *((SFFloat*)info.far_ptr) ) ) ));
break;
case GF_SG_VRML_SFTIME:
- *rval = DOUBLE_TO_JSVAL( JS_NewDouble(c, *((SFTime *)info.far_ptr) ) );
+ SMJS_SET_RVAL( DOUBLE_TO_JSVAL( JS_NewDouble(c, *((SFTime *)info.far_ptr) ) ));
break;
}
- }
+ }
return JS_TRUE;
}
-static JSBool wm_wm_widget_get_message_param(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_get_message_param)
{
GF_WidgetPin *par = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetMessage *msg = (GF_WidgetMessage *)JS_GetPrivate(c, obj);
if (!msg || !argc ) return JS_FALSE;
par = gf_list_get(msg->params, idx);
} else if (JSVAL_IS_STRING(argv[0])) {
u32 i, count = gf_list_count(msg->params);
- char *name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ char *name = SMJS_CHARS(c, argv[0]);
for (i=0; i<count; i++) {
par = gf_list_get(msg->params, i);
if (!strcmp(par->name, name)) break;
par = NULL;
}
+ SMJS_FREE(c, name);
}
if (par) {
JS_DefineProperty(c, obj, "script_type", STRING_TO_JSVAL( JS_NewStringCopyZ(c, "string") ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
break;
}
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
}
return JS_TRUE;
}
-static JSBool wm_widget_get_message(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_get_message)
{
GF_WidgetMessage *msg;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInterface *ifce = (GF_WidgetInterface*)JS_GetPrivate(c, obj);
if (!ifce || !argc) return JS_FALSE;
+ msg = NULL;
if (JSVAL_IS_INT(argv[0])) {
u32 idx;
msg = gf_list_get(ifce->messages, idx);
} else if (JSVAL_IS_STRING(argv[0])) {
u32 i, count = gf_list_count(ifce->messages);
- char *name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ char *name = SMJS_CHARS(c, argv[0]);
for (i=0; i<count; i++) {
msg = gf_list_get(ifce->messages, i);
if (!strcmp(msg->name, name)) break;
msg = NULL;
}
+ SMJS_FREE(c, name);
}
if (msg) {
JSObject *obj = JS_NewObject(c, &ifce->content->widget->wm->widgetAnyClass, 0, 0);
JS_DefineProperty(c, obj, "name", STRING_TO_JSVAL( JS_NewStringCopyZ(c, msg->name) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(c, obj, "is_input", BOOLEAN_TO_JSVAL( msg->is_output ? JS_FALSE : JS_TRUE ) , 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(c, obj, "has_output_trigger", BOOLEAN_TO_JSVAL( msg->output_trigger ? JS_TRUE : JS_FALSE) , 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
- JS_DefineProperty(c, obj, "has_input_action", BOOLEAN_TO_JSVAL( (msg->input_action && msg->input_action->attribute) ? JS_TRUE : JS_FALSE) , 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
- JS_DefineProperty(c, obj, "has_script_input", BOOLEAN_TO_JSVAL( (msg->input_action && !msg->input_action->attribute) ? JS_TRUE : JS_FALSE) , 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
- JS_DefineFunction(c, obj, "get_param", wm_wm_widget_get_message_param, 1, 0);
+ JS_DefineProperty(c, obj, "has_input_action", BOOLEAN_TO_JSVAL( (msg->input_action && msg->input_action->attribute) ? JS_TRUE : JS_FALSE) , 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
+ JS_DefineProperty(c, obj, "has_script_input", BOOLEAN_TO_JSVAL( (msg->input_action && !msg->input_action->attribute) ? JS_TRUE : JS_FALSE) , 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
+ JS_DefineFunction(c, obj, "get_param", wm_widget_get_message_param, 1, 0);
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
}
return JS_TRUE;
}
-static JSBool wm_widget_get_component(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_get_component)
{
- const char *comp_id;
+ char *comp_id;
u32 i, count;
GF_WidgetComponentInstance *comp_inst;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE;
- comp_id = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ comp_id = SMJS_CHARS(c, argv[0]);
count = gf_list_count(wid->components);
for (i=0; i<count;i++) {
comp_inst = gf_list_get(wid->components, i);
if (comp_inst->comp->id && !strcmp(comp_inst->comp->id, comp_id)) {
- *rval = OBJECT_TO_JSVAL(comp_inst->wid->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(comp_inst->wid->obj) );
+ SMJS_FREE(c, comp_id);
return JS_TRUE;
}
}
for (i=0; i<count; i++) {
GF_WidgetComponent *comp = gf_list_get(wid->widget->main->components, i);
if (!comp->id || strcmp(comp->id, comp_id)) continue;
-
+
comp_inst = wm_activate_component(c, wid, comp, 1);
if (comp_inst) {
- *rval = OBJECT_TO_JSVAL(comp_inst->wid->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(comp_inst->wid->obj) );
+ SMJS_FREE(c, comp_id);
return JS_TRUE;
}
+ SMJS_FREE(c, comp_id);
return JS_TRUE;
}
-
-
}
+
+ SMJS_FREE(c, comp_id);
return JS_TRUE;
}
-
-
-static JSBool wm_widget_get_interface(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_get_interface)
{
u32 idx;
GF_WidgetInterface *ifce;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !argc || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE;
JS_DefineProperty(c, ifce->obj, "serviceProvider", BOOLEAN_TO_JSVAL( ifce->provider ? JS_TRUE : JS_FALSE ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(c, ifce->obj, "multipleBinding", BOOLEAN_TO_JSVAL( ifce->multiple_binding ? JS_TRUE : JS_FALSE ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(c, ifce->obj, "get_message", wm_widget_get_message, 1, 0);
- gf_js_add_root(c, &ifce->obj);
+ gf_js_add_root(c, &ifce->obj, GF_JSGC_OBJECT);
}
- *rval = OBJECT_TO_JSVAL(ifce->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(ifce->obj) );
}
return JS_TRUE;
}
-
-
-static JSBool wm_widget_bind_output_trigger(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_bind_output_trigger)
{
GF_WidgetMessage *msg;
GF_WidgetPin *param;
SVG_handlerElement *handler;
-
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !wid->scene || (argc!=3)) return JS_FALSE;
handler = wm_create_scene_listener(wid, param);
if (!handler) return JS_FALSE;
handler->js_fun_val = argv[1];
- gf_js_add_root(c, &handler->js_fun_val);
+ gf_js_add_root(c, &handler->js_fun_val, GF_JSGC_VAL);
handler->evt_listen_obj = wid;
handler->js_fun = param;
handler->js_context = c;
handler->sgprivate->UserPrivate = JSVAL_TO_OBJECT(argv[2]);
gf_list_add(wid->output_triggers, handler);
-
+
return JS_TRUE;
}
-static JSBool wm_widget_get_context(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_get_context)
{
GF_BitStream *bs;
u32 i, count;
const char *str;
char *att;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
- if (!wid || !wid->scene) return JS_FALSE;
+ if (!wid) return JS_FALSE;
+ if (!wid->scene) {
+ SMJS_SET_RVAL(JSVAL_NULL);
+ return JS_TRUE;
+ }
bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<contextInformation xmlns=\"urn:mpeg:mpegu:schema:widgets:contextinfo:2010\">\n";
GF_Node *n = gf_sg_find_node_by_name(wid->scene, pref->connectTo->node);
if (n) {
-#ifndef GPAC_DISABLE_SVG
+#ifndef GPAC_DISABLE_SVG
if ((n->sgprivate->tag >= GF_NODE_FIRST_DOM_NODE_TAG) && !strcmp(pref->connectTo->attribute, "textContent")) {
char *txt = gf_dom_flatten_textContent(n);
gf_bs_write_data(bs, (u8 *) txt, strlen(txt) );
- } else
+ } else
#endif
if (gf_node_get_field_by_name(n, pref->connectTo->attribute, &info)==GF_OK) {
att = gf_node_dump_attribute(n, &info);
gf_bs_get_content(bs, &att, &count);
gf_bs_del(bs);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, att) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, att) ) );
gf_free(att);
return JS_TRUE;
}
-static JSBool wm_widget_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool wm_widget_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
JSString *s;
char *prop_name;
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
/*
icon_obj_val = OBJECT_TO_JSVAL(icon_obj);
JS_SetElement(c, arr, i, &icon_obj_val);
gf_free(abs_reloc_url);
- }
+ }
}
*vp = OBJECT_TO_JSVAL(arr);
}
JS_DefineProperty(c, pref_obj, "readonly", STRING_TO_JSVAL( JS_NewStringCopyZ(c, ((pref->flags & GF_WM_PREF_READONLY)?"true":"false")) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
pref_obj_val = OBJECT_TO_JSVAL(pref_obj);
JS_SetElement(c, arr, i, &pref_obj_val);
- }
+ }
}
*vp = OBJECT_TO_JSVAL(arr);
}
}
feat_obj_val = OBJECT_TO_JSVAL(feat_obj);
JS_SetElement(c, arr, i, &feat_obj_val);
- }
+ }
}
*vp = OBJECT_TO_JSVAL(arr);
}
}
}
}
-
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool wm_widget_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool wm_widget_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
char szVal[32];
jsdouble val;
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
/*internal to WidgetManager, never stored*/
if (!strcmp(prop_name, "permanent")) {
/*any widget properties*/
else {
- char szName[1024], *value;
+ char szName[1024], *value, *_val = NULL;
if (JSVAL_IS_STRING(*vp)) {
- value = JS_GetStringBytes(JSVAL_TO_STRING(*vp));
+ value = _val = SMJS_CHARS(c, *vp);
if (!value) value = "";
}
else if (JSVAL_IS_BOOLEAN(*vp)) {
sprintf(szVal, "%f", val);
value = szVal;
} else {
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
sprintf(szName, "WM:%s", prop_name);
gf_cfg_set_key(wid->widget->wm->term->user->config, wid->secname, szName, value);
+ SMJS_FREE(c, _val);
}
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
char *hostname;
JSObject *cookie;
if ((argc<3) || !JSVAL_IS_OBJECT(argv[1]) || !JSVAL_IS_STRING(argv[2])) return JS_FALSE;
-
+
cookie = JSVAL_TO_OBJECT(argv[1]);
- hostname = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]) );
+ hostname = SMJS_CHARS(c, argv[2]);
count = gf_list_count(wid->bound_ifces);
for (i=0; i<count; i++) {
bifce = gf_list_get(wid->bound_ifces, i);
- if (!strcmp(bifce->ifce->type, ifce->type) && (bifce->cookie==cookie) ) return JS_TRUE;
+ if (!strcmp(bifce->ifce->type, ifce->type) && (bifce->cookie==cookie) ) {
+ SMJS_FREE(c, hostname);
+ return JS_TRUE;
+ }
}
GF_SAFEALLOC(bifce, GF_WidgetInterfaceInstance);
bifce->wid = wid;
bifce->ifce = ifce;
bifce->cookie = cookie;
bifce->hostname = gf_strdup(hostname);
+ SMJS_FREE(c, hostname);
gf_list_add(wid->bound_ifces, bifce);
if (ifce->bind_action) {
return JS_TRUE;
}
-static JSBool wm_widget_bind_interface(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_bind_interface)
{
+ SMJS_OBJ
+ SMJS_ARGS
+ SMJS_DECL_RVAL
return wm_widget_bind_interface_ex(c, obj, argc, argv, rval, 0);
}
-static JSBool wm_widget_unbind_interface(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_unbind_interface)
{
+ SMJS_OBJ
+ SMJS_ARGS
+ SMJS_DECL_RVAL
return wm_widget_bind_interface_ex(c, obj, argc, argv, rval, 1);
}
-static JSBool wm_widget_deactivate(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_deactivate)
{
u32 i, count;
jsval funval;
+ SMJS_OBJ
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid) return JS_FALSE;
if (JSVAL_IS_OBJECT(funval)) {
jsval an_argv[1];
an_argv[0] = OBJECT_TO_JSVAL(obj);
- JS_CallFunctionValue(wid->widget->wm->ctx, wid->widget->wm->obj, funval, 1, an_argv, rval);
+ JS_CallFunctionValue(wid->widget->wm->ctx, wid->widget->wm->obj, funval, 1, an_argv, SMJS_GET_RVAL );
}
/*unbind all interfaces of this widget*/
- wm_widget_bind_interface_ex(c, obj, 0, NULL, rval, 1);
+ wm_widget_bind_interface_ex(c, obj, 0, NULL, SMJS_GET_RVAL, 1);
/*detach scene now that all unbind events have been sent*/
wid->scene = NULL;
wid->obj = JS_NewObject(wm->ctx, &wm->wmWidgetClass, 0, 0);
JS_SetPrivate(wm->ctx, wid->obj, wid);
/*protect from GC*/
- gf_js_add_root(wm->ctx, &wid->obj);
+ gf_js_add_root(wm->ctx, &wid->obj, GF_JSGC_OBJECT);
}
void wm_deactivate_component(JSContext *c, GF_WidgetInstance *wid, GF_WidgetComponent *comp, GF_WidgetComponentInstance *comp_inst)
}
if (!comp_wid) return NULL;
- if (!comp_wid->activated)
+ if (!comp_wid->activated)
fun_name = "on_widget_add";
GF_SAFEALLOC(comp_inst, GF_WidgetComponentInstance);
return NULL;
}
-static JSBool wm_widget_is_interface_bound(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_widget_is_interface_bound)
{
u32 i, count;
Bool check_fake_bind = 0;
JSObject *cookie;
GF_WidgetInterface *ifce;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetInstance *wid = (GF_WidgetInstance *)JS_GetPrivate(c, obj);
if (!wid || !wid->scene || (argc<1) || !JSVAL_IS_OBJECT(argv[0]) ) return JS_FALSE;
check_fake_bind = JSVAL_TO_BOOLEAN(argv[2])==JS_TRUE ? 1 : 0;
- *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+ SMJS_SET_RVAL(BOOLEAN_TO_JSVAL(JS_FALSE));
count = gf_list_count(wid->bound_ifces);
for (i=0; i<count; i++) {
GF_WidgetInterfaceInstance *bifce = gf_list_get(wid->bound_ifces, i);
if (!strcmp(bifce->ifce->type, ifce->type) && (!cookie || (bifce->cookie==cookie))) {
- *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
break;
}
}
}
-static JSBool wm_load(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_load)
{
u32 i, count;
- const char *manifest;
+ char *manifest;
GF_WidgetInstance *wid;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- manifest = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ manifest = SMJS_CHARS(c, argv[0]);
wid=NULL;
count = gf_list_count(wm->widget_instances);
}
if (!wid) {
wid = wm_load_widget(wm, manifest, 0);
- if (!wid) return JS_TRUE;
}
- wm_widget_jsbind(wm, wid);
- *rval = OBJECT_TO_JSVAL(wid->obj);
+ if (wid) {
+ wm_widget_jsbind(wm, wid);
+ SMJS_SET_RVAL(OBJECT_TO_JSVAL(wid->obj));
+ }
+ SMJS_FREE(c, manifest);
return JS_TRUE;
}
-static JSBool wm_unload(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_unload)
{
GF_WidgetInstance *wid;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
if (!argc || !JSVAL_IS_OBJECT(argv[0])) return JS_TRUE;
-static JSBool wm_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool wm_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
char *prop_name;
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
if (!wm) return JS_FALSE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!prop_name) return JS_FALSE;
if (!strcmp(prop_name, "num_widgets")) {
*vp = INT_TO_JSVAL(gf_list_count(wm->widget_instances));
- return JS_TRUE;
}
- if (!strcmp(prop_name, "last_widget_dir")) {
+ else if (!strcmp(prop_name, "last_widget_dir")) {
const char *opt = gf_cfg_get_key(wm->term->user->config, "Widgets", "last_widget_dir");
if (!opt) opt = "/";
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(c, opt));
- return JS_TRUE;
}
-
-
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool wm_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool wm_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
char *prop_name;
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
if (!wm) return JS_FALSE;
if (!JSVAL_IS_STRING(*vp)) return JS_TRUE;
- if (!JSVAL_IS_STRING(id)) return JS_TRUE;
- prop_name = JS_GetStringBytes(JSVAL_TO_STRING(id));
+ if (!SMJS_ID_IS_STRING(id)) return JS_TRUE;
+ prop_name = SMJS_CHARS_FROM_STRING(c, SMJS_ID_TO_STRING(id));
if (!strcmp(prop_name, "last_widget_dir")) {
- gf_cfg_set_key(wm->term->user->config, "Widgets", "last_widget_dir", JS_GetStringBytes(JSVAL_TO_STRING(*vp)));
- return JS_TRUE;
+ char *v = SMJS_CHARS(c, *vp);
+ gf_cfg_set_key(wm->term->user->config, "Widgets", "last_widget_dir", v);
+ SMJS_FREE(c, v);
}
-
+ SMJS_FREE(c, prop_name);
return JS_TRUE;
}
-static JSBool wm_get(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_get)
{
u32 i;
GF_WidgetInstance *wid;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
if (!argc || !JSVAL_IS_INT(argv[0])) return JS_TRUE;
i = JSVAL_TO_INT(argv[0]);
wid = gf_list_get(wm->widget_instances, i);
- if (wid) *rval = OBJECT_TO_JSVAL(wid->obj);
+ if (wid) SMJS_SET_RVAL( OBJECT_TO_JSVAL(wid->obj) );
return JS_TRUE;
}
-static JSBool wm_find_interface(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_find_interface)
{
char *ifce_name;
u32 i;
GF_WidgetInstance *wid;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- ifce_name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ ifce_name = SMJS_CHARS(c, argv[0]);
i=0;
while ( (wid = gf_list_enum(wm->widget_instances, &i) )) {
u32 j=0;
GF_WidgetInterface *wid_ifce;
while ((wid_ifce = gf_list_enum(wid->widget->main->interfaces, &j))) {
if (!strcmp(wid_ifce->type, ifce_name)) {
- *rval = OBJECT_TO_JSVAL(wid->obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(wid->obj) );
+ SMJS_FREE(c, ifce_name);
return JS_TRUE;
}
}
}
+ SMJS_FREE(c, ifce_name);
return JS_TRUE;
}
}
/* TODO Implement real language check according to BCP 47*/
-static Bool wm_check_language(const char *xml_lang_value, const char *user_locale)
+static Bool wm_check_language(const char *xml_lang_value, const char *user_locale)
{
Bool ret = 0;
char *sep, *val;
else return non_localized;
}
-static GF_WidgetPin *wm_parse_pin(const char *value, u16 type, const char *pin_name, const char *scriptType, const char *default_value)
+static GF_WidgetPin *wm_parse_pin(const char *value, u16 type, const char *pin_name, const char *scriptType, const char *default_value)
{
GF_WidgetPin *pin;
char *sep;
if (!value && !scriptType && !default_value) return NULL;
-
+
GF_SAFEALLOC(pin, GF_WidgetPin);
pin->type = type;
if (pin_name) pin->name = gf_strdup(pin_name);
else {
pin->node = gf_strdup(value);
}
- }
+ }
if (scriptType) {
if (!strcmp(scriptType, "boolean")) pin->script_type = GF_WM_PARAM_SCRIPT_BOOL;
act = wm_xml_get_attr(ifce_node, "multipleBindings");
if (act && !strcmp(act, "true")) ifce->multiple_binding = 1;
-
+
act = wm_xml_get_attr(ifce_node, "required");
if (act && !strcmp(act, "true")) ifce->required = 1;
}
}
-/* Implements the W3C P&C rule for getting a single attribute value
- see http://www.w3.org/TR/widgets/#rule-for-getting-a-single-attribute-valu0
+/* Implements the W3C P&C rule for getting a single attribute value
+ see http://www.w3.org/TR/widgets/#rule-for-getting-a-single-attribute-valu0
should be different from getting normalized text but for now it's ok
*/
static char *wm_get_single_attribute(const char *input) {
output[j] = input[i];
j++;
first_space_copied = 0;
- }
+ }
}
if (j && output[j-1] == ' ') output[j-1] = 0;
output[j] = 0;
return output;
}
-/* Implements the W3C P&C rule for getting a single attribute value
+/* Implements the W3C P&C rule for getting a single attribute value
see http://www.w3.org/TR/widgets/#rule-for-getting-a-single-attribute-valu0 */
static u32 wm_parse_non_neg(const char *input) {
u32 result = 0;
return result;
}
-/* returns the localized concatenated text content
+/* returns the localized concatenated text content
see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent
and http://www.w3.org/TR/widgets/#rule-for-getting-text-content0
*/
char *xml_lang = (char *)wm_xml_get_attr(node, "xml:lang");
if (!xml_lang) xml_lang = inherited_locale;
/*
- if (xml_lang && user_locale && wm_check_language(xml_lang, user_locale))
+ if (xml_lang && user_locale && wm_check_language(xml_lang, user_locale))
*/
{
u32 i, count;
gf_free(child_content);
}
return text_content;
- }
+ }
/*
} else {
return gf_strdup("");
*/
- }
+ }
}
static char *wm_get_normalized_text_content(GF_XMLNode *node, char *inherited_locale, const char *user_locale) {
return result;
}
-/* When relocating resources over HTTP, we check if the resources for a given locale exists
+/* When relocating resources over HTTP, we check if the resources for a given locale exists
on the server by sending a HEAD message with an Accept-Language header. */
void wm_relocate_proc(void *usr_cbk, GF_NETIO_Parameter *parameter)
{
/* relocate the given resource name (res_name) using registered relocators (e.g. locales, package folder)
The result is the path of the file, possibly uncompressed, possibly localized.
The parameter widget_path provides the path for converting relative resource paths into absolute paths.*/
-static Bool wm_relocate_url(GF_WidgetManager *wm, const char *widget_path, const char *res_name, char *relocated_name, char *localized_res_name)
+static Bool wm_relocate_url(GF_WidgetManager *wm, const char *widget_path, const char *res_name, char *relocated_name, char *localized_res_name)
{
Bool ok = 0;
char *res_url;
GF_WidgetContent *icon;
u32 i, count;
Bool already_in = 0;
-
+
count = gf_list_count(widget->icons);
for (i =0; i<count; i++) {
GF_WidgetContent *in_icon = gf_list_get(widget->icons, i);
u32 i, count;
GF_Widget *widget = NULL;
GF_WidgetInstance *wi = NULL;
- GF_XMLNode *root, *icon, *main, *name, *xml_node;
+ GF_XMLNode *root, *icon, *nmain, *name, *xml_node;
GF_Err e;
GF_DOMParser *dom = NULL;
GF_WidgetPackage *wpackage = NULL;
-
+
GF_DownloadSession *sess = NULL;
const char *widget_ns_prefix = NULL;
const char *mpegu_ns_prefix = NULL;
const char *user_locale = gf_cfg_get_key(wm->term->user->config, "Systems", "Language2CC");
-
+
/* Try to see if this widget is already loaded */
e = GF_OK;
count = gf_list_count(wm->widgets);
count = gf_list_count(wpackage->resources);
for (i=0; i<count; i++) {
GF_WidgetPackageResource *wu = gf_list_get(wpackage->resources, i);
- /* According to W3C WPC, the config.xml file (lower case) shall only be located
- at the root of the package
+ /* According to W3C WPC, the config.xml file (lower case) shall only be located
+ at the root of the package
see http://www.w3.org/TR/widgets/#ta-dxzVDWpaWg */
if (!strcmp(wu->inner_path, "config.xml")) {
szManifestPath = wu->extracted_path;
/*pre-parse the root-level preference for use when parsing MPEG-U elements */
global_prefs = gf_list_new();
i=0;
- while ((main = gf_list_enum(root->content, &i))) {
+ while ((nmain = gf_list_enum(root->content, &i))) {
const char *pname, *pvalue;
/* 'normalized' preference name and readonly*/
char *npname, *npro;
u32 i, count;
Bool pref_exists = 0;
Bool readOnly = 0;
- if (main->type != GF_XML_NODE_TYPE) continue;
- if (strcmp(main->name, "preference")) continue;
- pname = wm_xml_get_attr(main, "name");
+ if (nmain->type != GF_XML_NODE_TYPE) continue;
+ if (strcmp(nmain->name, "preference")) continue;
+ pname = wm_xml_get_attr(nmain, "name");
npname = wm_get_single_attribute(pname);
if (!npname || !strlen(npname)) continue;
}
if (pref_exists) continue;
- pvalue = wm_xml_get_attr(main, "readonly");
+ pvalue = wm_xml_get_attr(nmain, "readonly");
npro = wm_get_single_attribute(pvalue);
if (npro && strlen(npro) && !strcmp(npro, "true")) readOnly=1;
if (npro) gf_free(npro);
- pvalue = wm_xml_get_attr(main, "value");
+ pvalue = wm_xml_get_attr(nmain, "value");
GF_SAFEALLOC(pref, GF_WidgetPreference);
pref->name = npname;
content->interfaces = gf_list_new();
content->components = gf_list_new();
content->preferences = gf_list_new();
- main = wm_xml_find(root, widget_ns_prefix, "content", NULL);
- if (!main) {
+ nmain = wm_xml_find(root, widget_ns_prefix, "content", NULL);
+ if (!nmain) {
/* if not found, use the default table of start files */
- wm_set_default_start_file(wm, content, szWidgetPath);
+ wm_set_default_start_file(wm, content, szWidgetPath);
} else {
const char *src, *encoding, *mimetype;
- src = wm_xml_get_attr(main, "src");
+ src = wm_xml_get_attr(nmain, "src");
/*check the resource exists*/
if (src) {
content->src = gf_strdup(localized_path);
}
}
-
- encoding = wm_xml_get_attr(main, "encoding");
+
+ encoding = wm_xml_get_attr(nmain, "encoding");
if (encoding && strlen(encoding)) content->encoding = wm_get_single_attribute(encoding);
else content->encoding = gf_strdup("utf-8");
- mimetype = wm_xml_get_attr(main, "type");
+ mimetype = wm_xml_get_attr(nmain, "type");
if (mimetype && strlen(mimetype)) {
char *sep = strchr(mimetype, ';');
if (sep) sep[0] = 0;
}
/* We need to call the parse of the MPEG-U elements to clone the global preferences into widget preferences,
this should probably be changed to extract the clone from that function */
- wm_parse_mpegu_content_element(content, main, mpegu_ns_prefix, global_prefs);
+ wm_parse_mpegu_content_element(content, nmain, mpegu_ns_prefix, global_prefs);
GF_SAFEALLOC(widget, GF_Widget);
widget->url = gf_strdup(path);
/*check for icon - can be optional*/
i=0;
while ((icon = gf_list_enum(root->content, &i))) {
- if (icon->type==GF_XML_NODE_TYPE &&
- icon->name && !strcmp(icon->name, "icon") &&
- ((!widget_ns_prefix && !icon->ns) || !strcmp(widget_ns_prefix, icon->ns))) {
+ if (icon->type==GF_XML_NODE_TYPE &&
+ icon->name && !strcmp(icon->name, "icon") &&
+ ((!widget_ns_prefix && !icon->ns) || !strcmp(widget_ns_prefix, icon->ns))) {
char *sep;
char relocated[GF_MAX_PATH], localized_path[GF_MAX_PATH];
char *icon_width, *icon_height;
char *pname = (char *)wm_xml_get_attr(icon, "src");
if (!pname || !strlen(pname)) continue;
-
+
/*remove any existing fragment*/
sep = strchr(pname, '#');
if (sep) sep[0] = 0;
}
}
}
- /* after processing the icon elements (wether there are valid icons or not), we use the default icon table
+ /* after processing the icon elements (wether there are valid icons or not), we use the default icon table
see http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-FAFYMEGELU/004/ */
wm_set_default_icon_files(wm, szWidgetPath, widget);
desc = wm_xml_get_attr(root, "id");
if (desc) {
- /* TODO check if this is a valid IRI, for the moment, just hack to pass the test, check for ':'
+ /* TODO check if this is a valid IRI, for the moment, just hack to pass the test, check for ':'
see http://dev.w3.org/2006/waf/widgets/test-suite/test-cases/ta-RawAIWHoMs/ */
- if (strchr(desc, ':'))
+ if (strchr(desc, ':'))
widget->identifier = wm_get_single_attribute(desc);
}
if (desc) {
widget->height = wm_parse_non_neg(desc);
}
-
+
name = wm_xml_find(root, widget_ns_prefix, "description", user_locale);
if (name) {
widget->description = wm_get_normalized_text_content(name, NULL, user_locale);
i=0;
while ((xml_node = gf_list_enum(root->content, &i))) {
- if (xml_node->type==GF_XML_NODE_TYPE &&
- xml_node->name && !strcmp(xml_node->name, "feature") &&
+ if (xml_node->type==GF_XML_NODE_TYPE &&
+ xml_node->name && !strcmp(xml_node->name, "feature") &&
((!widget_ns_prefix && !xml_node->ns) || !strcmp(widget_ns_prefix, xml_node->ns))) {
u32 i, count;
j = 0;
while ((param_node = gf_list_enum(xml_node->content, &j))) {
- if (param_node->type==GF_XML_NODE_TYPE &&
- param_node->name && !strcmp(param_node->name, "param") &&
+ if (param_node->type==GF_XML_NODE_TYPE &&
+ param_node->name && !strcmp(param_node->name, "param") &&
((!widget_ns_prefix && !param_node->ns) || !strcmp(widget_ns_prefix, param_node->ns))) {
GF_WidgetFeatureParam *wfp;
const char *param_name, *param_value;
gf_cfg_set_key(wm->term->user->config, wi->secname, "WM:Manifest", wi->widget->url);
sprintf(szInst, "%d", wi->instance_id);
gf_cfg_set_key(wm->term->user->config, wi->secname, "WM:InstanceID", szInst);
- }
+ }
gf_list_add(wm->widget_instances, wi);
GF_XMLNode *context;
GF_DownloadSession *ctx_sess = NULL;
char *ctxPath;
+ context = NULL;
/*fetch the remote widget context synchronously and load it */
ctxPath = gf_malloc(sizeof(char) * (strlen(path) + 1 + 15/*?mpeg-u-context*/));
}
/*try to fetch the associated context*/
- ctx_sess = gf_dm_sess_new(wm->term->downloader, (char *)ctxPath, GF_NETIO_SESSION_NOT_THREADED|GF_NETIO_SESSION_FORCE_RESTART, NULL, NULL, &e);
+ ctx_sess = gf_dm_sess_new(wm->term->downloader, (char *)ctxPath, GF_NETIO_SESSION_NOT_THREADED, NULL, NULL, &e);
if (ctx_sess) {
e = gf_dm_sess_process(ctx_sess);
- if (e==GF_OK) {
+ if (e==GF_OK) {
wi->mpegu_context = gf_xml_dom_new();
e = gf_xml_dom_parse(wi->mpegu_context , gf_dm_sess_get_cache_name(ctx_sess), NULL, NULL);
if (!e) {
context = gf_xml_dom_get_root(wi->mpegu_context);
if (strcmp(context->name, "contextInformation")) context = NULL;
- }
+ }
}
gf_dm_sess_del(ctx_sess);
+ e = GF_OK;
}
gf_free(ctxPath);
+ ctxPath = NULL;
if (!context && wi->mpegu_context) {
gf_xml_dom_del(wi->mpegu_context);
}
-static JSBool wm_initialize(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(wm_initialize)
{
u32 i, count;
const char*opt;
+ SMJS_OBJ
+ SMJS_ARGS
GF_WidgetManager *wm = (GF_WidgetManager *)JS_GetPrivate(c, obj);
count = gf_cfg_get_key_count(wm->term->user->config, "Widgets");
opt = gf_cfg_get_key(wm->term->user->config, "Widgets", "WidgetStore");
if (opt) gf_enum_directory(opt, 1, wm_enum_dir, wm, NULL);
-
+
return JS_TRUE;
}
{0, 0, 0, 0, 0}
};
JSFunctionSpec wmClassFuncs[] = {
- {"initialize", wm_initialize, 0, 0, 0},
- {"load", wm_load, 1, 0, 0},
- {"unload", wm_unload, 1, 0, 0},
- {"get", wm_get, 1, 0, 0},
- {"findByInterface", wm_find_interface, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("initialize", wm_initialize, 0),
+ SMJS_FUNCTION_SPEC("load", wm_load, 1),
+ SMJS_FUNCTION_SPEC("unload", wm_unload, 1),
+ SMJS_FUNCTION_SPEC("get", wm_get, 1),
+ SMJS_FUNCTION_SPEC("findByInterface", wm_find_interface, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
wm = jsext->udta;
/*unload widgets*/
if (unload) {
if (wm->obj) {
- gf_js_remove_root(wm->ctx, &wm->obj);
+ gf_js_remove_root(wm->ctx, &wm->obj, GF_JSGC_OBJECT);
wm->obj = NULL;
}
if (!scene) return;
/*setup JS bindings*/
- _SETUP_CLASS(wm->widmanClass, "WIDGETMANAGER", JSCLASS_HAS_PRIVATE, wm_getProperty, wm_setProperty, JS_FinalizeStub);
+ JS_SETUP_CLASS(wm->widmanClass, "WIDGETMANAGER", JSCLASS_HAS_PRIVATE, wm_getProperty, wm_setProperty, JS_FinalizeStub);
JS_InitClass(c, global, 0, &wm->widmanClass, 0, 0, wmClassProps, wmClassFuncs, 0, 0);
wm->obj = JS_DefineObject(c, global, "WidgetManager", &wm->widmanClass, 0, 0);
JS_SetPrivate(c, wm->obj, wm);
- gf_js_add_root(c, &wm->obj);
+ gf_js_add_root(c, &wm->obj, GF_JSGC_OBJECT);
{
{0, 0, 0, 0, 0}
};
JSFunctionSpec wmWidgetClassFuncs[] = {
- {"activate", wm_widget_activate, 1, 0, 0},
- {"deactivate", wm_widget_deactivate, 0, 0, 0},
- {"get_interface", wm_widget_get_interface, 1, 0, 0},
- {"bind_output_trigger", wm_widget_bind_output_trigger, 2, 0, 0},
- {"set_input", wm_widget_set_input, 2, 0, 0},
- {"bind_interface", wm_widget_bind_interface, 2, 0, 0},
- {"unbind_interface", wm_widget_unbind_interface, 1, 0, 0},
- {"call_input_action", wm_widget_call_input_action, 1, 0, 0},
- {"call_input_script", wm_widget_call_input_script, 2, 0, 0},
- {"is_interface_bound", wm_widget_is_interface_bound, 1, 0, 0},
- {"get_param_value", wm_widget_get_param_value, 1, 0, 0},
- {"get_context", wm_widget_get_context, 0, 0, 0},
- {"get_component", wm_widget_get_component, 2, 0, 0},
-
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("activate", wm_widget_activate, 1),
+ SMJS_FUNCTION_SPEC("deactivate", wm_widget_deactivate, 0),
+ SMJS_FUNCTION_SPEC("get_interface", wm_widget_get_interface, 1),
+ SMJS_FUNCTION_SPEC("bind_output_trigger", wm_widget_bind_output_trigger, 2),
+ SMJS_FUNCTION_SPEC("set_input", wm_widget_set_input, 2),
+ SMJS_FUNCTION_SPEC("bind_interface", wm_widget_bind_interface, 2),
+ SMJS_FUNCTION_SPEC("unbind_interface", wm_widget_unbind_interface, 1),
+ SMJS_FUNCTION_SPEC("call_input_action", wm_widget_call_input_action, 1),
+ SMJS_FUNCTION_SPEC("call_input_script", wm_widget_call_input_script, 2),
+ SMJS_FUNCTION_SPEC("is_interface_bound", wm_widget_is_interface_bound, 1),
+ SMJS_FUNCTION_SPEC("get_param_value", wm_widget_get_param_value, 1),
+ SMJS_FUNCTION_SPEC("get_context", wm_widget_get_context, 0),
+ SMJS_FUNCTION_SPEC("get_component", wm_widget_get_component, 2),
+
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
/*setup JS bindings*/
- _SETUP_CLASS(wm->wmWidgetClass, "WMWIDGET", JSCLASS_HAS_PRIVATE, wm_widget_getProperty, wm_widget_setProperty, JS_FinalizeStub);
+ JS_SETUP_CLASS(wm->wmWidgetClass, "WMWIDGET", JSCLASS_HAS_PRIVATE, wm_widget_getProperty, wm_widget_setProperty, JS_FinalizeStub);
JS_InitClass(c, global, 0, &wm->wmWidgetClass, 0, 0, wmWidgetClassProps, wmWidgetClassFuncs, 0, 0);
- _SETUP_CLASS(wm->widgetAnyClass, "WIDGETANY", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub, JS_FinalizeStub);
+ JS_SETUP_CLASS(wm->widgetAnyClass, "WIDGETANY", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_InitClass(c, global, 0, &wm->widgetAnyClass, 0, 0, 0, 0, 0, 0);
}
-
- _SETUP_CLASS(wm->widgetClass, "MPEGWidget", JSCLASS_HAS_PRIVATE, widget_getProperty, widget_setProperty, JS_FinalizeStub);
+
+ JS_SETUP_CLASS(wm->widgetClass, "MPEGWidget", JSCLASS_HAS_PRIVATE, widget_getProperty, widget_setProperty, JS_FinalizeStub);
if (scene->script_action) {
if (!scene->script_action(scene->script_action_cbck, GF_JSAPI_OP_GET_TERM, scene->RootNode, &par))
static void gwm_delete(GF_BaseInterface *ifce)
{
+ GF_WidgetManager *wm;
GF_JSUserExtension *dr = (GF_JSUserExtension *) ifce;
- GF_WidgetManager *wm = dr->udta;
- gf_list_del(wm->widget_instances);
- gf_list_del(wm->widgets);
+ if (!dr)
+ return;
+ wm = dr->udta;
+ if (!wm)
+ return;
+ if (wm->widget_instances)
+ gf_list_del(wm->widget_instances);
+ wm->widget_instances = NULL;
+ if (wm->widgets)
+ gf_list_del(wm->widgets);
+ wm->widgets = NULL;
gf_free(wm);
+ dr->udta = NULL;
gf_free(dr);
}
#endif
GF_EXPORT
-const u32 *QueryInterfaces()
+const u32 *QueryInterfaces()
{
static u32 si [] = {
#ifdef GPAC_HAS_SPIDERMONKEY
#endif
0
};
- return si;
+ return si;
}
GF_EXPORT
-GF_BaseInterface *LoadInterface(u32 InterfaceType)
+GF_BaseInterface *LoadInterface(u32 InterfaceType)
{
#ifdef GPAC_HAS_SPIDERMONKEY
if (InterfaceType == GF_JS_USER_EXT_INTERFACE) return (GF_BaseInterface *)gwm_new();
#include "unzip.h"
-#include <jsapi.h>
+#include <gpac/internal/smjs_api.h>
#include <gpac/internal/terminal_dev.h>
#include <gpac/internal/compositor_dev.h>
GF_WidgetInstance *wm_load_widget(GF_WidgetManager *wm, const char *path, u32 InstanceID);
-#define _SETUP_CLASS(the_class, cname, flag, getp, setp, fin) \
- memset(&the_class, 0, sizeof(the_class)); \
- the_class.name = cname; \
- the_class.flags = flag; \
- the_class.addProperty = JS_PropertyStub; \
- the_class.delProperty = JS_PropertyStub; \
- the_class.getProperty = getp; \
- the_class.setProperty = setp; \
- the_class.enumerate = JS_EnumerateStub; \
- the_class.resolve = JS_ResolveStub; \
- the_class.convert = JS_ConvertStub; \
- the_class.finalize = fin;
-
-
-
-
-JSBool widget_has_feature(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-JSBool widget_open_url(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-JSBool widget_get_attention(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-JSBool widget_show_notification(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-JSBool widget_get_interface(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-JSBool widget_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp);
-JSBool widget_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp);
+JSBool SMJS_FUNCTION(widget_has_feature);
+JSBool SMJS_FUNCTION(widget_open_url);
+JSBool SMJS_FUNCTION(widget_get_attention);
+JSBool SMJS_FUNCTION(widget_show_notification);
+JSBool SMJS_FUNCTION(widget_get_interface);
+JSBool widget_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp);
+JSBool widget_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp);
void widget_on_interface_bind(GF_WidgetInterfaceInstance *ifce, Bool unbind);
vpath %.c $(SRC_PATH)/modules/wiiis
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
LDFLAGS+=-pg
endif
-CFLAGS+= -I$(LOCAL_INC_PATH)
+CFLAGS+= -I"$(LOCAL_INC_PATH)"
EXTRALIBS+= -L../../extra_lib/lib/gcc -lwiiuse
#common obj
LDFLAGS+=-pg
endif
-CFLAGS+=-I$(SRC_PATH)/include
+CFLAGS+=-I"$(SRC_PATH)/include"
# -I/usr/local/arm/3.3.2/include
#include "x11_out.h"
#include <gpac/constants.h>
+#include <gpac/user.h>
#include <sys/time.h>
+#include <X11/XKBlib.h>
void X11_SetupWindow (GF_VideoOutput * vout);
autorepeat = 1;
XkbSetDetectableAutoRepeat(xWindow->display, autorepeat, &supported);
+
+ if (xWindow->init_flags & GF_TERM_WINDOW_NO_DECORATION) {
+#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
+#define MWM_HINTS_DECORATIONS (1L << 1)
+ struct {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long inputMode;
+ unsigned long status;
+ } hints = {2, 0, 0, 0, 0};
+
+ hints.flags = MWM_HINTS_DECORATIONS;
+ hints.decorations = 0;
+
+ XChangeProperty(xWindow->display, xWindow->wnd, XInternAtom(xWindow->display,"_MOTIF_WM_HINTS", False), XInternAtom(xWindow->display, "_MOTIF_WM_HINTS", False), 32, PropModeReplace, (unsigned char *)&hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
+
+ }
+
xWindow->the_gc = XCreateGC (xWindow->display, xWindow->wnd, 0, NULL);
xWindow->use_shared_memory = 0;
XSetWMProtocols(xWindow->display, xWindow->wnd, &xWindow->WM_DELETE_WINDOW, 1);
}
+
{
XEvent ev;
long mask;
int i, nb_bits;
sOpt = gf_modules_get_option((GF_BaseInterface *)vout, "Video", "GLNbBitsPerComponent");
- nb_bits = sOpt ? atoi(sOpt) : 5;
+ /* Most outputs are 24/32 bits these days, use 8 bits per channel instead of 5, works better on MacOS X */
+ nb_bits = sOpt ? atoi(sOpt) : 8;
+ if (!sOpt){
+ gf_modules_set_option((GF_BaseInterface *)vout, "Video", "GLNbBitsPerComponent", "8");
+ }
i=0;
attribs[i++] = GLX_RGBA;
attribs[i++] = GLX_RED_SIZE;
attribs[i++] = GLX_BLUE_SIZE;
attribs[i++] = nb_bits;
sOpt = gf_modules_get_option((GF_BaseInterface *)vout, "Video", "GLNbBitsDepth");
- nb_bits = sOpt ? atoi(sOpt) : 0;
+ nb_bits = sOpt ? atoi(sOpt) : 16;
+ if (!sOpt){
+ gf_modules_set_option((GF_BaseInterface *)vout, "Video", "GLNbBitsDepth", "16");
+ }
if (nb_bits) {
attribs[i++] = GLX_DEPTH_SIZE;
attribs[i++] = nb_bits;
}
sOpt = gf_modules_get_option((GF_BaseInterface *)vout, "Video", "UseGLDoubleBuffering");
+ if (!sOpt){
+ gf_modules_set_option((GF_BaseInterface *)vout, "Video", "UseGLDoubleBuffering", "yes");
+ }
if (!sOpt || !strcmp(sOpt, "yes")) attribs[i++] = GLX_DOUBLEBUFFER;
attribs[i++] = None;
xWindow->glx_visualinfo = glXChooseVisual(xWindow->display, xWindow->screennum, attribs);
XSync(xWindow->display, False);
sOpt = gf_modules_get_option((GF_BaseInterface *)vout, "Video", "X113DOffscreenMode");
+ if (!sOpt)
+ gf_modules_set_option((GF_BaseInterface *)vout, "Video", "X113DOffscreenMode", "Pixmap");
if (sOpt && !strcmp(sOpt, "Window")) {
xWindow->offscreen_type = 1;
} else if (sOpt && !strcmp(sOpt, "VisibleWindow")) {
XFree (Hints);
}
-GF_Err X11_Setup(struct _video_out *vout, void *os_handle, void *os_display, u32 no_proc_override)
+GF_Err X11_Setup(struct _video_out *vout, void *os_handle, void *os_display, u32 flags)
{
X11VID ();
/*assign window if any, NEVER display*/
xWindow->par_wnd = (Window) os_handle;
+ xWindow->init_flags = flags;
/*OSMOZILLA HACK*/
if (os_display) xWindow->no_select_input = 1;
void X11_Shutdown (struct _video_out *vout)
{
X11VID ();
- int err=0;
if (xWindow->output_3d_mode==1) {
#ifdef GPAC_HAS_OPENGL
} else {
X11_ReleaseBackBuffer (vout);
}
+#ifdef GPAC_HAS_OPENGL
+ if (xWindow->glx_visualinfo)
+ XFree(xWindow->glx_visualinfo);
+ xWindow->glx_visualinfo = NULL;
+#endif
XFreeGC (xWindow->display, xWindow->the_gc);
XUnmapWindow (xWindow->display, (Window) xWindow->wnd);
XDestroyWindow (xWindow->display, (Window) xWindow->wnd);
XImage *surface; //main drawing image: software mode
Pixmap pixmap;
u32 pwidth, pheight;
+ u32 init_flags;
Atom WM_DELETE_WINDOW; //window deletion
Bool use_shared_memory; //
vpath %.c $(SRC_PATH)/modules/xvid_dec
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
#local xvid lib
ifeq ($(CONFIG_XVID), local)
-CFLAGS+= -I$(LOCAL_INC_PATH)/xvid
+CFLAGS+= -I"$(LOCAL_INC_PATH)/xvid"
LDFLAGS+= -L../../extra_lib/lib/gcc
endif
-EXTRALIBS+= -lxvidcore
+EXTRALIBS+= -lxvidcore -lpthread
SRCS := $(OBJS:.o=.c)
return GF_OK;
}
-static Bool XVID_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool XVID_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
if (StreamType != GF_STREAM_VISUAL) return 0;
- switch (ObjectType) {
- case GPAC_OTI_VIDEO_MPEG4_PART2:
- return 1;
- /*cap query*/
- case 0:
- return 1;
- }
+ /*media type query*/
+ if (!esd) return 1;
+
+ if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_MPEG4_PART2) return 1;
return 0;
}
return "XviD 1.0 for WinCE";
}
-static Bool XVID_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, u32 ObjectType, char *decSpecInfo, u32 decSpecInfoSize, u32 PL)
+static Bool XVID_CanHandleStream(GF_BaseDecoder *dec, u32 StreamType, GF_ESD *esd, u8 PL)
{
if (StreamType != GF_STREAM_VISUAL) return 0;
- switch (ObjectType) {
- case GPAC_OTI_VIDEO_MPEG4_PART2:
- return 1;
- /*cap query*/
- case 0:
- return 1;
- }
+ /*media type query*/
+ if (!esd) return 1;
+ if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_MPEG4_PART2) return 1;
return 0;
}
<body>
<object id="gpac" width="600" height="200" type="application/x-gpac" >
- <param name="src" value="bifs-2D-painting-material2D.bt" />
+ <param name="src" value="bifs/bifs-2D-painting-material2D.bt" />
<param name="use3d" value="false" />
Your browser doesn't support GPAC ...
</object>
<object id="gpac" width="300" height="200" type="application/x-gpac" >
<!--param name="src" value="bifs-command-animated-osmo4logo.bt" /-->
<!--param name="src" value="D:\MediaStreams\raw_streams\mpeg\dead.mpeg" /-->
- <param name="src" value="bifs-3D-shapes-box.bt" />
+ <param name="src" value="bifs/bifs-3D-shapes-box.bt" />
Your browser doesn't support GPAC ...
</object>
<body>
<object id="gpac" width="600" height="200" CLASSID="clsid:181D18E6-4DC1-4B55-B72E-BE2A10064995">
- <param name="src" value="bifs-2D-painting-material2D.bt" />
+ <param name="src" value="bifs/bifs-2D-painting-material2D.bt" />
<param name="use3d" value="false" />
Your browser doesn't support GPAC ...
</object>
ID="gpac"
width="200"
height="200" >
- <param name="src" value="bifs-command-animated-osmo4logo.mp4" />
+ <param name="src" value="bifs/bifs-command-animated-osmo4logo.mp4" />
Your browser doesn't support GPAC ...
</object>
--- /dev/null
+InitialObjectDescriptor {\r
+ objectDescriptorID 1\r
+ ODProfileLevelIndication 1\r
+ esDescr [\r
+ ES_Descriptor {\r
+ ES_ID 1\r
+ decConfigDescr DecoderConfigDescriptor {\r
+ objectTypeIndication 1\r
+ streamType 3\r
+ bufferSizeDB 177\r
+ decSpecificInfo BIFSConfig {\r
+ nodeIDbits 24\r
+ isCommandStream true\r
+ pixelMetric true\r
+ pixelWidth 400\r
+ pixelHeight 300\r
+ }\r
+ }\r
+ }\r
+ ]\r
+}\r
+\r
+OrderedGroup {\r
+ children [\r
+ Background2D {backColor 1 1 1}\r
+ WorldInfo {\r
+ info [\r
+ "This test shows usage of the CacheTexture node. The texture is cached for 3 seconds only."\r
+ "" \r
+ "GPAC Regression Tests" "$Date: $ - $Revision: $" \r
+ "(C) 2010-200X GPAC Team"\r
+ ]\r
+ title "CacheTexture Node for testing cache"\r
+ }\r
+ DEF TR Transform2D {\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ texture CacheTexture {\r
+ objectTypeIndication 108\r
+ image "../auxiliary_files/sky.jpg"\r
+ cacheURL "MyCachedPicture.jpg"\r
+ expirationDate 3\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 160 120\r
+ }\r
+ }\r
+ ]\r
+ }\r
+ ]\r
+}\r
+\r
+AT 1000 {\r
+ REPLACE TR.children[0] BY Shape {}\r
+}\r
+\r
+AT 2000 {\r
+ REPLACE TR.children[0] BY Shape {\r
+ appearance Appearance {\r
+ texture ImageTexture {\r
+ url "MyCachedPicture.jpg"\r
+ }\r
+ }\r
+ geometry Circle {\r
+ radius 80\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+AT 3000 {\r
+ REPLACE TR.children[0] BY Shape {}\r
+}\r
+\r
+AT 4000 {\r
+ REPLACE TR.children[0] BY Shape {\r
+ appearance Appearance {\r
+ texture ImageTexture {\r
+ url "MyCachedPicture.jpg"\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 160 80\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
--- /dev/null
+InitialObjectDescriptor {\r
+ objectDescriptorID 1\r
+ ODProfileLevelIndication 1\r
+ esDescr [\r
+ ES_Descriptor {\r
+ ES_ID 1\r
+ decConfigDescr DecoderConfigDescriptor {\r
+ objectTypeIndication 1\r
+ streamType 3\r
+ bufferSizeDB 177\r
+ decSpecificInfo BIFSConfig {\r
+ nodeIDbits 24\r
+ isCommandStream true\r
+ pixelMetric true\r
+ pixelWidth 400\r
+ pixelHeight 300\r
+ }\r
+ }\r
+ }\r
+ ]\r
+}\r
+\r
+OrderedGroup {\r
+ children [\r
+ Background2D {backColor 1 1 1}\r
+ WorldInfo {\r
+ info [\r
+ "This test shows usage of the CacheTexture node for embedding images in the BIFS bitstream."\r
+ "" \r
+ "GPAC Regression Tests" "$Date: $ - $Revision: $" \r
+ "(C) 2010-200X GPAC Team"\r
+ ]\r
+ title "CacheTexture Node for in-band images"\r
+ }\r
+ DEF TR Transform2D {\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ texture CacheTexture {\r
+ objectTypeIndication 108\r
+ image "sky.jpg"\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 160 120\r
+ }\r
+ }\r
+ DEF PS PlaneSensor2D {\r
+ maxPosition -1 -1\r
+ autoOffset TRUE\r
+ }\r
+ ]\r
+ }\r
+ ]\r
+}\r
+\r
+ROUTE PS.translation_changed TO TR.translation\r
--- /dev/null
+InitialObjectDescriptor {\r
+ objectDescriptorID 1\r
+ ODProfileLevelIndication 1\r
+ esDescr [\r
+ ES_Descriptor {\r
+ ES_ID 1\r
+ decConfigDescr DecoderConfigDescriptor {\r
+ objectTypeIndication 1\r
+ streamType 3\r
+ bufferSizeDB 177\r
+ decSpecificInfo BIFSConfig {\r
+ nodeIDbits 24\r
+ isCommandStream true\r
+ pixelMetric true\r
+ pixelWidth 400\r
+ pixelHeight 300\r
+ }\r
+ }\r
+ }\r
+ ]\r
+}\r
+\r
+OrderedGroup {\r
+ children [\r
+ Background2D {backColor 1 1 1}\r
+ WorldInfo {\r
+ info [\r
+ "This test shows usage of the EnvironmentTest node. The various settings of the node are tested."\r
+ "" \r
+ "GPAC Regression Tests" "$Date: $ - $Revision: $" \r
+ "(C) 2010-200X GPAC Team"\r
+ ]\r
+ title "EnvironmentTest Node testing"\r
+ }\r
+\r
+ Transform2D {\r
+ translation 0 50\r
+ children [\r
+ Shape {\r
+ appearance DEF APP Appearance {\r
+ material Material2D {\r
+ emissiveColor 0 0 0\r
+ filled true\r
+ }\r
+ }\r
+ geometry Text {\r
+ string ["Width:"]\r
+ fontStyle DEF FSEND FontStyle {\r
+ size 24\r
+ justify "END"\r
+ }\r
+ }\r
+ }\r
+ Shape {\r
+ appearance USE APP \r
+ geometry DEF T1 Text {\r
+ string [""]\r
+ fontStyle DEF FSBEGIN FontStyle {\r
+ size 24\r
+ justify "BEGIN"\r
+ }\r
+ }\r
+ }\r
+ ]\r
+ }\r
+ Transform2D {\r
+ children [\r
+ Shape {\r
+ appearance USE APP\r
+ geometry Text {\r
+ string ["Height:"]\r
+ fontStyle USE FSEND\r
+ }\r
+ }\r
+ Shape {\r
+ appearance USE APP \r
+ geometry DEF T2 Text {\r
+ string [""]\r
+ fontStyle USE FSBEGIN \r
+ }\r
+ }\r
+ ]\r
+ }\r
+\r
+ Transform2D {\r
+ translation 0 -50\r
+ children [\r
+ Shape {\r
+ appearance USE APP\r
+ geometry Text {\r
+ string ["Portrait:"]\r
+ fontStyle USE FSEND\r
+ }\r
+ }\r
+ Shape {\r
+ appearance USE APP \r
+ geometry DEF T3 Text {\r
+ string [""]\r
+ fontStyle USE FSBEGIN \r
+ }\r
+ }\r
+ ]\r
+ }\r
+\r
+ DEF V1 Valuator {}\r
+ DEF EV1 EnvironmentTest {\r
+ parameter 2\r
+ }\r
+\r
+ DEF V2 Valuator {}\r
+ DEF EV2 EnvironmentTest {\r
+ parameter 3\r
+ }\r
+\r
+ DEF V3 Valuator {}\r
+ DEF EV3 EnvironmentTest {\r
+ parameter 1\r
+ }\r
+ ]\r
+}\r
+\r
+ROUTE EV1.parameterValue TO V1.inSFString\r
+ROUTE V1.outMFString TO T1.string \r
+\r
+ROUTE EV2.parameterValue TO V2.inSFString\r
+ROUTE V2.outMFString TO T2.string \r
+\r
+ROUTE EV3.valueEqual TO V3.inSFBool\r
+ROUTE V3.outMFString TO T3.string \r
--- /dev/null
+InitialObjectDescriptor {\r
+ objectDescriptorID 1\r
+ ODProfileLevelIndication 1\r
+ esDescr [\r
+ ES_Descriptor {\r
+ ES_ID 1\r
+ decConfigDescr DecoderConfigDescriptor {\r
+ objectTypeIndication 1\r
+ streamType 3\r
+ bufferSizeDB 177\r
+ decSpecificInfo BIFSConfig {\r
+ nodeIDbits 24\r
+ isCommandStream true\r
+ pixelMetric true\r
+ pixelWidth 400\r
+ pixelHeight 300\r
+ }\r
+ }\r
+ }\r
+ ]\r
+}\r
+\r
+OrderedGroup {\r
+ children [\r
+ Background2D {backColor 1 1 1}\r
+ WorldInfo {\r
+ info [\r
+ "This test shows usage of the KeyNavigator node. Navigate through the keypad between the various items."\r
+ "" \r
+ "GPAC Regression Tests" "$Date: $ - $Revision: $" \r
+ "(C) 2010-200X GPAC Team"\r
+ ]\r
+ title "KeyNavigator Node for testing keypad navigation"\r
+ }\r
+ Transform2D {\r
+ translation -100 100\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ material DEF M1 Material2D {\r
+ emissiveColor 1 0 0\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 60 60\r
+ }\r
+ }\r
+ DEF TS1 TouchSensor {}\r
+ DEF V1 Valuator { Factor1 0.75 }\r
+ ]\r
+ }\r
+\r
+ Transform2D {\r
+ translation 100 100\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ material DEF M2 Material2D {\r
+ emissiveColor 0 1 0\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 60 60\r
+ }\r
+ }\r
+ DEF TS2 TouchSensor {}\r
+ DEF V2 Valuator { Factor1 0.75 }\r
+ ]\r
+ }\r
+\r
+ Transform2D {\r
+ translation -100 -50\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ material DEF M3 Material2D {\r
+ emissiveColor 1 0 1\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 60 60\r
+ }\r
+ }\r
+ DEF TS3 TouchSensor {}\r
+ DEF V3 Valuator { Factor1 0.75 }\r
+ ]\r
+ }\r
+\r
+ Transform2D {\r
+ translation 100 -50\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ material DEF M4 Material2D {\r
+ emissiveColor 0 0 1\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 60 60\r
+ }\r
+ }\r
+ DEF TS4 TouchSensor {}\r
+ DEF V4 Valuator { Factor1 0.75 }\r
+ ]\r
+ }\r
+ \r
+ Transform2D {\r
+ translation 0 -100\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ material Material2D {\r
+ emissiveColor 0 0 0\r
+ filled TRUE\r
+ }\r
+ }\r
+ geometry DEF TXT Text {\r
+ string [".", "."]\r
+ fontStyle FontStyle {\r
+ justify ["MIDDLE"]\r
+ size 24\r
+ }\r
+ }\r
+ }\r
+ ]\r
+ }\r
+\r
+ DEF C1 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[0] BY "KN1 got focus" \r
+ }\r
+ }\r
+ DEF RC1 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[1] BY "KN1 lost focus" \r
+ }\r
+ }\r
+ DEF KN1 KeyNavigator {\r
+ sensor USE TS1\r
+ right USE KN2\r
+ down USE KN3\r
+ }\r
+\r
+ DEF C2 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[0] BY "KN2 got focus" \r
+ }\r
+ }\r
+ DEF RC2 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[1] BY "KN2 lost focus" \r
+ }\r
+ }\r
+ DEF KN2 KeyNavigator {\r
+ sensor USE TS2\r
+ left USE KN1\r
+ down USE KN4\r
+ }\r
+\r
+ DEF C3 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[0] BY "KN3 got focus" \r
+ }\r
+ }\r
+ DEF RC3 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[1] BY "KN3 lost focus" \r
+ }\r
+ }\r
+ DEF KN3 KeyNavigator {\r
+ sensor USE TS3\r
+ right USE KN4\r
+ up USE KN1\r
+ select USE KN2\r
+ }\r
+\r
+ DEF C4 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[0] BY "KN4 got focus" \r
+ }\r
+ }\r
+ DEF RC4 Conditional {\r
+ buffer {\r
+ REPLACE TXT.string[1] BY "KN4 lost focus" \r
+ }\r
+ }\r
+ DEF KN4 KeyNavigator {\r
+ sensor USE TS4\r
+ left USE KN3\r
+ up USE KN2\r
+ }\r
+ \r
+ DEF AC1 Conditional { buffer { REPLACE KN4.setFocus BY TRUE}}\r
+ ]\r
+}\r
+\r
+ROUTE TS1.isOver TO M1.filled\r
+ROUTE TS1.isActive TO V1.inSFBool\r
+ROUTE V1.outSFFloat TO M1.transparency\r
+ROUTE TS1.isActive TO AC1.activate\r
+ROUTE KN1.focusSet TO C1.activate\r
+ROUTE KN1.focusSet TO RC1.reverseActivate\r
+\r
+ROUTE TS2.isOver TO M2.filled\r
+ROUTE TS2.isActive TO V2.inSFBool\r
+ROUTE V2.outSFFloat TO M2.transparency\r
+ROUTE KN2.focusSet TO C2.activate\r
+ROUTE KN2.focusSet TO RC2.reverseActivate\r
+\r
+ROUTE TS3.isOver TO M3.filled\r
+ROUTE TS3.isActive TO V3.inSFBool\r
+ROUTE V3.outSFFloat TO M3.transparency\r
+ROUTE KN3.focusSet TO C3.activate\r
+ROUTE KN3.focusSet TO RC3.reverseActivate\r
+\r
+ROUTE TS4.isOver TO M4.filled\r
+ROUTE TS4.isActive TO V4.inSFBool\r
+ROUTE V4.outSFFloat TO M4.transparency\r
+ROUTE KN4.focusSet TO C4.activate\r
+ROUTE KN4.focusSet TO RC4.reverseActivate\r
--- /dev/null
+InitialObjectDescriptor {\r
+ objectDescriptorID 1\r
+ ODProfileLevelIndication 1\r
+ esDescr [\r
+ ES_Descriptor {\r
+ ES_ID 1\r
+ decConfigDescr DecoderConfigDescriptor {\r
+ objectTypeIndication 1\r
+ streamType 3\r
+ bufferSizeDB 177\r
+ decSpecificInfo BIFSConfig {\r
+ nodeIDbits 24\r
+ isCommandStream true\r
+ pixelMetric true\r
+ pixelWidth 400\r
+ pixelHeight 300\r
+ }\r
+ }\r
+ }\r
+ ]\r
+}\r
+\r
+OrderedGroup {\r
+ children [\r
+ Background2D {backColor 1 1 1}\r
+ WorldInfo {\r
+ info [\r
+ "This test shows usage of the Storage node. The rectangle position is stored upon closing of the scene in the player. It is restored if the scene is re-opened less than 10 seconds later."\r
+ "" \r
+ "GPAC Regression Tests" "$Date: $ - $Revision: $" \r
+ "(C) 2010-200X GPAC Team"\r
+ ]\r
+ title "Storage Node for testing persistent storage"\r
+ }\r
+ DEF TR Transform2D {\r
+ children [\r
+ Shape {\r
+ appearance Appearance {\r
+ material Material2D {\r
+ emissiveColor 1 0 0\r
+ filled true\r
+ }\r
+ }\r
+ geometry Rectangle {\r
+ size 160 120\r
+ }\r
+ }\r
+ DEF PS PlaneSensor2D {\r
+ maxPosition -1 -1\r
+ autoOffset TRUE\r
+ }\r
+ ]\r
+ }\r
+ Storage {\r
+ expireAfter 10\r
+ name "test storage"\r
+ storageList [\r
+ TR.translation\r
+ PS.offset\r
+ ]\r
+ }\r
+ ]\r
+}\r
+\r
+ROUTE PS.translation_changed TO TR.translation\r
vpath %.c $(SRC_PATH)/src
-CFLAGS= $(OPTFLAGS) -I$(SRC_PATH)/include
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include"
ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
endif
## libgpac objects gathering: src/utils
-LIBGPAC_UTILS=utils/os_divers.o utils/os_net.o utils/os_module.o utils/os_thread.o utils/list.o utils/base_encoding.o utils/bitstream.o utils/color.o utils/configfile.o utils/downloader.o utils/error.o utils/math.o utils/path2d.o utils/path2d_stroker.o utils/module.o utils/token.o utils/uni_bidi.o utils/url.o utils/utf.o utils/xml_parser.o utils/dlmalloc.o
+LIBGPAC_UTILS=utils/os_divers.o utils/os_net.o utils/os_module.o utils/os_thread.o utils/list.o utils/base_encoding.o utils/bitstream.o utils/color.o utils/configfile.o utils/cache.o utils/downloader.o utils/error.o utils/math.o utils/path2d.o utils/path2d_stroker.o utils/module.o utils/token.o utils/uni_bidi.o utils/url.o utils/utf.o utils/xml_parser.o utils/alloc.o utils/ringbuffer.o utils/unicode.o
## libgpac objects gathering: src/ietf
LIBGPAC_IETF=ietf/rtcp.o ietf/rtp.o ietf/rtp_packetizer.o ietf/rtp_pck_3gpp.o ietf/rtp_pck_mpeg12.o ietf/rtp_pck_mpeg4.o ietf/rtsp_command.o ietf/rtsp_common.o ietf/rtsp_response.o ietf/rtsp_session.o ietf/sdp.o ietf/rtp_depacketizer.o ietf/rtp_streamer.o
LIBGPAC_MCRYPT=mcrypt/cbc.o mcrypt/cfb.o mcrypt/ctr.o mcrypt/des.o mcrypt/ecb.o mcrypt/g_crypt.o mcrypt/ncfb.o mcrypt/nofb.o mcrypt/ofb.o mcrypt/rijndael-128.o mcrypt/rijndael-192.o mcrypt/rijndael-256.o mcrypt/stream.o mcrypt/tripledes.o mcrypt/sha1.o
## libgpac objects gathering: src/media tools
-LIBGPAC_MEDIATOOLS=media_tools/av_parsers.o media_tools/avilib.o media_tools/filestreamer.o media_tools/gpac_ogg.o media_tools/img.o media_tools/ismacryp.o media_tools/isom_hinter.o media_tools/isom_tools.o media_tools/media_export.o media_tools/media_import.o media_tools/mpeg2_ps.o media_tools/text_import.o media_tools/saf.o media_tools/mpegts.o media_tools/dvb_mpe.o media_tools/reedsolomon.o media_tools/vobsub.o media_tools/m2ts_mux.o
+LIBGPAC_MEDIATOOLS=media_tools/av_parsers.o media_tools/avilib.o media_tools/filestreamer.o media_tools/gpac_ogg.o media_tools/img.o media_tools/ismacryp.o media_tools/isom_hinter.o media_tools/isom_tools.o media_tools/media_export.o media_tools/media_import.o media_tools/mpeg2_ps.o media_tools/text_import.o media_tools/saf.o media_tools/mpegts.o media_tools/dvb_mpe.o media_tools/reedsolomon.o media_tools/vobsub.o media_tools/m2ts_mux.o media_tools/m3u8.o media_tools/mpd.o
## libgpac objects gathering: src/scene_manager
LIBGPAC_SCENEMANAGER=scene_manager/loader_bt.o scene_manager/loader_isom.o scene_manager/loader_qt.o scene_manager/loader_xmt.o scene_manager/scene_dump.o scene_manager/scene_manager.o scene_manager/scene_stats.o scene_manager/swf_parse.o scene_manager/swf_bifs.o scene_manager/text_to_bifs.o scene_manager/scene_engine.o scene_manager/encode_isom.o scene_manager/loader_svg.o
#1 - zlib support
ifeq ($(CONFIG_ZLIB), local)
-CFLAGS+= -I$(LOCAL_INC_PATH)/zlib
+CFLAGS+= -I"$(LOCAL_INC_PATH)/zlib"
NEED_LOCAL_LIB="yes"
endif
LINKLIBS+=-lz
ifeq ($(CONFIG_JS),local)
NEED_LOCAL_LIB="yes"
endif
-LINKLIBS+= $(JS_LIBS)
+LINKLIBS+=$(JS_LIBS)
endif
#4 - JPEG support
#local lib
ifeq ($(CONFIG_JPEG), local)
NEED_LOCAL_LIB="yes"
-MEDIATOOLS_CFLAGS+=-I$(LOCAL_INC_PATH)/jpeg
+MEDIATOOLS_CFLAGS+=-I"$(LOCAL_INC_PATH)/jpeg"
endif
endif
LINKLIBS+= -lpng
ifeq ($(CONFIG_PNG), local)
NEED_LOCAL_LIB="yes"
-MEDIATOOLS_CFLAGS+=-I$(LOCAL_INC_PATH)/png
+MEDIATOOLS_CFLAGS+=-I"$(LOCAL_INC_PATH)/png"
endif
endif
COMPOSITOR_CFLAGS+=-DGPAC_DISABLE_SVG
endif
+## Add prefix before every lib
+ifneq ($(prefix), /usr/local)
+EXTRALIBS+=-L$(prefix)/lib
+else
+ifneq ($(prefix), /usr)
+EXTRALIBS+=-L$(prefix)/lib
+endif
+endif
+
## OpenGL available
ifeq ($(HAS_OPENGL),yes)
EXTRALIBS+= $(OGL_LIBS)
endif
EXTRALIBS+=$(LINKLIBS)
-ifneq ($(prefix), /usr/local)
-EXTRALIBS+=-L$(prefix)/lib
-else
-ifneq ($(prefix), /usr)
-EXTRALIBS+=-L$(prefix)/lib
-endif
-endif
-
ifeq ($(GPAC_USE_TINYGL), yes)
-COMPOSITOR_CFLAGS+=-I$(SRC_PATH)/../TinyGL/include
+COMPOSITOR_CFLAGS+=-I"$(SRC_PATH)/../TinyGL/include"
else
COMPOSITOR_CFLAGS+=-DGPAC_HAS_GLU
endif
lib: $(LIB)
#there's a bunch of warnings in there, get rid of them
-mcrypt: CFLAGS= $(OPTFLAGS) -w -I$(SRC_PATH)/include
+mcrypt: CFLAGS= $(OPTFLAGS) -w -I"$(SRC_PATH)/include"
mcrypt: $(LIBGPAC_MCRYPT)
scenegraph: CFLAGS += $(SCENEGRAPH_CFLAGS)
ifeq ($(CONFIG_DARWIN),yes)
libtool -s -o ../bin/gcc/libgpac_static.a $(OBJS)
ranlib ../bin/gcc/libgpac_static.a
- $(CC) $(SHFLAGS) $(LD_SONAME) $(LDFLAGS) -o ../bin/gcc/$@ $(OBJS) $(EXTRALIBS)
+ $(CC) $(SHFLAGS) $(LD_SONAME) $(LDFLAGS) -o ../bin/gcc/$@ $(OBJS) $(EXTRALIBS)
else
ar cr ../bin/gcc/libgpac_static.a $(OBJS)
ranlib ../bin/gcc/libgpac_static.a
BIFSStreamInfo *ptr;
i=0;
+ if (!codec || !codec->streamInfo)
+ return NULL;
while ((ptr = (BIFSStreamInfo *) gf_list_enum(codec->streamInfo, &i))) {
if(ptr->ESID==ESID) return ptr;
}
pInfo->ESID = ESID;
pInfo->config.PixelMetrics = 1;
pInfo->config.version = (objectTypeIndication==2) ? 1 : 2;
+ assert( codec );
+ assert( codec->streamInfo );
return gf_list_add(codec->streamInfo, pInfo);
}
// gf_mx_p(codec->mx);
+ assert( codec );
if (gf_bifs_dec_get_stream(codec, ESID) != NULL) {
// gf_mx_v(codec->mx);
return GF_BAD_PARAM;
}
-
-
bs = gf_bs_new(DecoderSpecificInfo, DecoderSpecificInfoLength, GF_BITSTREAM_READ);
GF_SAFEALLOC(pInfo, BIFSStreamInfo);
pInfo->ESID = ESID;
}
gf_bs_del(bs);
+ assert( codec->streamInfo );
//first stream, configure size
if (!codec->ignore_size && !gf_list_count(codec->streamInfo)) {
gf_sg_set_scene_size_info(codec->scenegraph, pInfo->config.Width, pInfo->config.Height, pInfo->config.PixelMetrics);
void gf_bs_set_eos_callback(GF_BitStream *bs, void (*EndOfStream)(void *par), void *par);
GF_EXPORT
-GF_Err gf_bifs_decode_au(GF_BifsDecoder *codec, u16 ESID, char *data, u32 data_length, Double ts_offset)
+GF_Err gf_bifs_decode_au(GF_BifsDecoder *codec, u16 ESID, const char *data, u32 data_length, Double ts_offset)
{
GF_BitStream *bs;
GF_Err e;
return gf_node_replace(node, NULL, 1);
}
+#ifdef UNUSED_FUNC
static GF_Err BD_DecOperandReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
s32 pos;
gf_sg_vrml_field_copy(dst_ptr, src_ptr, src_type);
return GF_OK;
}
+#endif /* UNUSED_FUNC */
static GF_Err BD_DecExtendedUpdate(GF_BifsDecoder * codec, GF_BitStream *bs)
{
if (gf_bs_available(bs) < length) return GF_NON_COMPLIANT_BITSTREAM;
if (node && (node->sgprivate->tag==TAG_MPEG4_CacheTexture) && (field->fieldIndex<=2)) {
+ Bool skip_file_url_proto=0;
char *name;
FILE *f;
M_CacheTexture *ct = (M_CacheTexture *) node;
if (codec->extraction_path) {
char *path;
u32 len = strlen(name)+strlen(codec->extraction_path)+2;
+ if (strnicmp(codec->extraction_path, "file://", 7)) len+=7;
+ /*SHA1 of service in hexa*/
if (codec->service_url) len += 41;
path = gf_malloc(sizeof(char)*len);
+
+ path[0] = 0;
+ /*force using file:// URL prototype to avoid confusion with resources adressed from the root of the source server*/
+ if (strnicmp(codec->extraction_path, "file://", 7)) strcpy(path, "file://");
+ strcat(path, codec->extraction_path);
+ strcat(path, "/");
+
if (codec->service_url) {
u8 hash[20];
u32 i;
gf_sha1_csum(codec->service_url, strlen(codec->service_url), hash);
- sprintf(path, "%s/", codec->extraction_path);
for (i=0; i<20; i++) {
char t[3];
t[2] = 0;
strcat(path, t);
}
strcat(path, "_");
- strcat(path, name);
- } else {
- sprintf(path, "%s/%s", codec->extraction_path, name);
- }
+ }
+ strcat(path, name);
+
gf_free(name);
name = path;
+ skip_file_url_proto = 1;
}
((SFString *)field->far_ptr)->buffer = name;
- f = gf_f64_open(name, "wb");
+ /*skip the initial file://*/
+ f = gf_f64_open(name + (skip_file_url_proto ? 7 : 0), "wb");
fwrite(buf, 1, length, f);
fclose(f);
+ gf_free(buf);
} else {
if ( ((SFString *)field->far_ptr)->buffer ) gf_free( ((SFString *)field->far_ptr)->buffer);
((SFString *)field->far_ptr)->buffer = (char *)gf_malloc(sizeof(char)*(length+1));
/*predictiveMFField*/
if (codec->info->config.UsePredictiveMFField) {
flag = gf_bs_read_int(bs, 1);
- if (flag)
+ if (flag) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CODING, ("[BIFS] Stream uses Predictive Field Coding!\n"));
#ifdef GPAC_ENABLE_BIFS_PMF
return gf_bifs_dec_pred_mf_field(codec, bs, node, field);
#else
return GF_NOT_SUPPORTED;
#endif
-
+ }
}
/*reserved*/
#include <gpac/internal/compositor_dev.h>
-#define ENABLE_EARLY_FRAME_DETECTION
-#define MIN_RESYNC_TIME 500
+//#define ENABLE_EARLY_FRAME_DETECTION
+
/*diff time in ms to consider an audio frame too early and insert silence*/
#define MIN_RESYNC_TIME 500
+
/*diff time in ms to consider an audio frame too late and drop it*/
#define MAX_RESYNC_TIME 500
GF_AudioFilterItem *gf_af_new(GF_Compositor *compositor, GF_AudioInterface *src, char *filter_name)
{
GF_AudioFilterItem *filter;
- GF_AudioFilter *filter_module = NULL;
if (!src || !filter_name) return NULL;
GF_SAFEALLOC(filter, GF_AudioFilterItem);
/*not completely filled*/
if (buffer_size) {
if (!data) {
- GF_LOG(GF_LOG_WARNING, GF_LOG_AUDIO, ("[AudioMixer] not enough input data (%d still to fill)\n", buffer_size));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_AUDIO, ("[AudioMixer] not enough input data (%d still to fill)\n", buffer_size));
}
memset(ptr, 0, buffer_size);
}
}
if (e) {
- GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[AudioRender] reconfigure error %e\n", e));
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[AudioRender] reconfigure error %d\n", e));
if (nb_chan>2) {
nb_chan=2;
+ in_ch=2;
+ ch_cfg=0;
e = ar->audio_out->ConfigureOutput(ar->audio_out, &freq, &nb_chan, &nb_bits, ch_cfg);
}
if (e) return e;
/*if not init we run with a NULL audio compositor*/
if (ar->audio_out) {
- struct _audiofilterentry *prev_filter=NULL;
ar->audio_out->FillBuffer = gf_ar_fill_output;
ar->audio_out->audio_renderer = ar;
gf_mixer_lock(ar->mixer, 1);
if (ar->audio_out->SelfThreaded) ar->audio_out->Shutdown(ar->audio_out);
gf_modules_close_interface((GF_BaseInterface *)ar->audio_out);
+ ar->audio_out = NULL;
gf_mixer_lock(ar->mixer, 0);
}
gf_mixer_del(ar->mixer);
#include <gpac/internal/camera.h>
#include <gpac/options.h>
+#include "visual_manager.h"
+#define FORCE_CAMERA_3D
GF_Camera *new_camera()
{
return gf_quat_to_rotation(&rot);
}
-void camera_update(GF_Camera *cam, GF_Matrix2D *user_transform, Bool center_coords)
+#define FAR_PLANE_2D -60000
+#define NEAR_PLANE_2D 6000
+
+void camera_set_2d(GF_Camera *cam)
+{
+ cam->is_3D = 0;
+#ifdef FORCE_CAMERA_3D
+ cam->position.x = cam->position.y = 0; cam->position.z = INT2FIX(NEAR_PLANE_2D);
+ cam->up.x = cam->up.z = 0; cam->up.y = FIX_ONE;
+ cam->target.x = cam->target.y = cam->target.z = 0;
+ cam->vp_position = cam->position;
+ cam->vp_orientation.x = cam->vp_orientation.y = 0; cam->vp_orientation.q = 0; cam->vp_orientation.y = FIX_ONE;
+ cam->vp_fov = cam->fieldOfView = FLT2FIX(0.785398);
+ cam->vp_dist = INT2FIX(NEAR_PLANE_2D);
+ cam->end_zoom = FIX_ONE;
+#endif
+}
+
+void camera_update(GF_Camera *cam, GF_Matrix2D *user_transform, Bool center_coords, Fixed horizontal_shift, Fixed nominal_view_distance, Fixed view_distance_offset, u32 camera_layout)
{
Fixed vlen, h, w, ar;
SFVec3f corner, center;
+ GF_Matrix post_model_view;
if (! (cam->flags & CAM_IS_DIRTY)) return;
ar = gf_divfix(cam->width, cam->height);
+ gf_mx_init(post_model_view);
+
if (cam->is_3D) {
/*setup perspective*/
- gf_mx_perspective(&cam->projection, cam->fieldOfView, ar, cam->z_near, cam->z_far);
- /*setup modelview*/
- gf_mx_lookat(&cam->modelview, cam->position, cam->target, cam->up);
+ if (camera_layout==GF_3D_CAMERA_OFFAXIS) {
+ Fixed left, right, top, bottom, shift, wd2, ndfl, viewing_distance;
+ SFVec3f eye, pos, tar, disp;
+
+ viewing_distance = (nominal_view_distance + view_distance_offset);
+
+ wd2 = cam->z_near * gf_tan(cam->fieldOfView/2);
+ ndfl = gf_divfix(cam->z_near, viewing_distance);
+ /*compute h displacement*/
+ shift = gf_mulfix(horizontal_shift, ndfl);
+
+ top = wd2;
+ bottom = -top;
+ left = -ar * wd2 - shift;
+ right = ar * wd2 - shift;
+
+ gf_mx_init(cam->projection);
+ cam->projection.m[0] = gf_divfix(2*cam->z_near, (right-left));
+ cam->projection.m[5] = gf_divfix(2*cam->z_near, (top-bottom));
+ cam->projection.m[8] = gf_divfix(right+left, right-left);
+ cam->projection.m[9] = gf_divfix(top+bottom, top-bottom);
+ cam->projection.m[10] = gf_divfix(cam->z_far+cam->z_near, cam->z_near-cam->z_far);
+ cam->projection.m[11] = -FIX_ONE;
+ cam->projection.m[14] = 2*gf_muldiv(cam->z_near, cam->z_far, cam->z_near-cam->z_far);
+ cam->projection.m[15] = 0;
+
+ gf_vec_diff(eye, cam->target, cam->position);
+ gf_vec_norm(&eye);
+ disp = gf_vec_cross(eye, cam->up);
+ gf_vec_norm(&disp);
+
+ gf_vec_diff(center, cam->world_bbox.center, cam->position);
+ vlen = gf_vec_len(center);
+ vlen += view_distance_offset * (vlen/nominal_view_distance);
+ shift = horizontal_shift * vlen / viewing_distance;
+
+ pos = gf_vec_scale(disp, shift);
+ gf_vec_add(pos, pos, cam->position);
+ gf_vec_add(tar, pos, eye);
+
+ /*setup modelview*/
+ gf_mx_lookat(&cam->modelview, pos, tar, cam->up);
+ } else {
+ gf_mx_perspective(&cam->projection, cam->fieldOfView, ar, cam->z_near, cam->z_far);
+
+ /*setup modelview*/
+ gf_mx_lookat(&cam->modelview, cam->position, cam->target, cam->up);
+ }
if (!center_coords) {
- gf_mx_add_scale(&cam->modelview, 1, -1, 1);
- gf_mx_add_translation(&cam->modelview, -cam->width / 2, -cam->height / 2, 0);
+ gf_mx_add_scale(&post_model_view, 1, -1, 1);
+ gf_mx_add_translation(&post_model_view, -cam->width / 2, -cam->height / 2, 0);
}
/*compute center and radius - CHECK ME!*/
Fixed hw, hh;
hw = cam->width / 2;
hh = cam->height / 2;
- cam->z_near = -INT2FIX(512);
- cam->z_far = INT2FIX(512);
+ cam->z_near = INT2FIX(NEAR_PLANE_2D);
+ cam->z_far = INT2FIX(FAR_PLANE_2D);
/*setup ortho*/
gf_mx_ortho(&cam->projection, -hw, hw, -hh, hh, cam->z_near, cam->z_far);
+
/*setup modelview*/
+#ifdef FORCE_CAMERA_3D
+ gf_mx_lookat(&cam->modelview, cam->position, cam->target, cam->up);
+#else
gf_mx_init(cam->modelview);
+#endif
if (!center_coords) {
- gf_mx_add_scale(&cam->modelview, 1, -1, 1);
- gf_mx_add_translation(&cam->modelview, -hw, -hh, 0);
+ gf_mx_add_scale(&post_model_view, 1, -1, 1);
+ gf_mx_add_translation(&post_model_view, -hw, -hh, 0);
+ }
+ if (user_transform) {
+#ifdef FORCE_CAMERA_3D
+ GF_Matrix mx;
+ gf_mx_from_mx2d(&mx, user_transform);
+ mx.m[10] = mx.m[0];
+ gf_mx_add_matrix(&post_model_view, &mx);
+#else
+ gf_mx_add_matrix_2d(&post_model_view, user_transform);
+#endif
}
- if (user_transform) gf_mx_add_matrix_2d(&cam->modelview, user_transform);
- if (cam->flags & CAM_HAS_VIEWPORT) gf_mx_add_matrix(&cam->modelview, &cam->viewport);
+ if (cam->end_zoom != FIX_ONE) gf_mx_add_scale(&post_model_view, cam->end_zoom, cam->end_zoom, cam->end_zoom);
+ if (cam->flags & CAM_HAS_VIEWPORT) gf_mx_add_matrix(&post_model_view, &cam->viewport);
/*compute center & radius*/
b.max_edge.x = hw;
cam->center = b.center;
cam->radius = b.radius;
}
+
+ if (camera_layout == GF_3D_CAMERA_CIRCULAR) {
+ GF_Matrix mx;
+ Fixed viewing_distance = nominal_view_distance + view_distance_offset;
+ SFVec3f pos, target;
+ Fixed angle;
+
+ gf_vec_diff(center, cam->world_bbox.center, cam->position);
+ vlen = gf_vec_len(center);
+ vlen += view_distance_offset * (vlen/nominal_view_distance);
+
+ gf_vec_diff(pos, cam->target, cam->position);
+ gf_vec_norm(&pos);
+ pos = gf_vec_scale(pos, vlen);
+ gf_vec_add(target, pos, cam->position);
+
+ gf_mx_init(mx);
+ gf_mx_add_translation(&mx, target.x, target.y, target.z);
+ angle = gf_atan2(horizontal_shift, viewing_distance);
+ gf_mx_add_rotation(&mx, angle, cam->up.x, cam->up.y, cam->up.z);
+ gf_mx_add_translation(&mx, -target.x, -target.y, -target.z);
+
+ pos = cam->position;
+ gf_mx_apply_vec(&mx, &pos);
+
+ gf_mx_lookat(&cam->modelview, pos, target, cam->up);
+ } else if (camera_layout == GF_3D_CAMERA_LINEAR) {
+ Fixed viewing_distance = nominal_view_distance + view_distance_offset;
+ GF_Vec eye, disp, pos, tar;
+
+ gf_vec_diff(center, cam->world_bbox.center, cam->position);
+ vlen = gf_vec_len(center);
+ vlen += view_distance_offset * (vlen/nominal_view_distance);
+
+ gf_vec_diff(eye, cam->target, cam->position);
+ gf_vec_norm(&eye);
+ tar = gf_vec_scale(eye, vlen);
+ gf_vec_add(tar, tar, cam->position);
+
+ disp = gf_vec_cross(eye, cam->up);
+ gf_vec_norm(&disp);
+
+ disp= gf_vec_scale(disp, vlen*horizontal_shift/viewing_distance);
+ gf_vec_add(pos, cam->position, disp);
+
+ gf_mx_lookat(&cam->modelview, pos, tar, cam->up);
+ }
+ gf_mx_add_matrix(&cam->modelview, &post_model_view);
+
/*compute frustum planes*/
gf_mx_copy(cam->unprojection, cam->projection);
gf_mx_add_matrix_4x4(&cam->unprojection, &cam->modelview);
cam->last_pos = cam->vp_position;
return;
}
- if (cam->is_3D) {
+#ifndef FORCE_CAMERA_3D
+ if (cam->is_3D)
+#endif
+ {
cam->start_pos = cam->position;
cam->start_ori = camera_get_orientation(cam->position, cam->target, cam->up);
cam->start_fov = cam->fieldOfView;
cam->flags |= CAM_IS_DIRTY;
cam->anim_start = 0;
cam->anim_len = 1000;
- } else {
+ }
+#ifndef FORCE_CAMERA_3D
+ else {
cam->start_zoom = FIX_ONE;
cam->start_trans.x = cam->start_trans.y = 0;
cam->start_rot.x = cam->start_rot.y = 0;
/*no animation on 3D viewports*/
cam->anim_start = cam->anim_len = 0;
}
+#endif
}
void camera_move_to(GF_Camera *cam, SFVec3f pos, SFVec3f target, SFVec3f up)
now = gf_sys_clock() - cam->anim_start;
if (now > cam->anim_len) {
cam->anim_len = 0;
- if (cam->is_3D) {
+#ifndef FORCE_CAMERA_3D
+ if (cam->is_3D)
+#endif
+ {
camera_set_vectors(cam, cam->end_pos, cam->end_ori, cam->end_fov);
- } else {
+ cam->end_zoom = FIX_ONE;
+ }
+#ifndef FORCE_CAMERA_3D
+ else {
cam->flags |= CAM_IS_DIRTY;
}
+#endif
+
if (cam->flags & CF_STORE_VP) {
cam->flags &= ~CF_STORE_VP;
cam->vp_position = cam->position;
}
}
- if (cam->is_3D) {
+#ifndef FORCE_CAMERA_3D
+ if (cam->is_3D)
+#endif
+ {
SFVec3f pos, dif;
SFRotation rot;
Fixed fov;
dif = gf_vec_scale(dif, frac);
gf_vec_add(pos, cam->start_pos, dif);
fov = gf_mulfix(cam->end_fov - cam->start_fov, frac) + cam->start_fov;
+ cam->end_zoom = frac + gf_mulfix((FIX_ONE-frac), cam->start_zoom);
camera_set_vectors(cam, pos, rot, fov);
}
return 1;
compositor->msg_type &= ~GF_SR_CFG_WINDOWSIZE_NOTIF;
if (restore_fs) {
- //gf_sc_set_fullscreen(compositor);
- compositor->display_width = fs_width;
- compositor->display_height = fs_height;
- compositor->recompute_ar = 1;
+ if ((compositor->display_width != fs_width) || (compositor->display_height != fs_height)) {
+ compositor->display_width = fs_width;
+ compositor->display_height = fs_height;
+ compositor->recompute_ar = 1;
+ }
} else {
compositor->display_width = evt.size.width;
compositor->display_height = evt.size.height;
#ifndef GPAC_DISABLE_3D
compositor->offscreen_width = compositor->offscreen_height = 0;
#endif
+ gf_sc_lock(compositor, 0);
evt.type = GF_EVENT_SYS_COLORS;
- if (gf_term_send_event(compositor->term, &evt) ) {
+ if (compositor->video_out->ProcessEvent(compositor->video_out, &evt) ) {
u32 i;
for (i=0; i<28; i++) {
compositor->sys_colors[i] = evt.sys_cols.sys_colors[i] & 0x00FFFFFF;
}
}
+ gf_sc_lock(compositor, 1);
}
}
compositor->video_out->on_event = gf_sc_on_event;
/*init hw*/
if (compositor->video_out->Setup(compositor->video_out, compositor->user->os_window_handler, compositor->user->os_display, compositor->user->init_flags) != GF_OK) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("Failed to Setup Video Driver %s!\n", sOpt));
gf_modules_close_interface((GF_BaseInterface *)compositor->video_out);
compositor->video_out = NULL;
}
} else {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("Failed to load module %s, no video driver.\n", sOpt));
sOpt = NULL;
}
}
if (!compositor->video_out) {
u32 i, count;
count = gf_modules_get_count(compositor->user->modules);
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Trying to find a suitable video driver amongst %d modules...\n", count));
for (i=0; i<count; i++) {
compositor->video_out = (GF_VideoOutput *) gf_modules_load_interface(compositor->user->modules, i, GF_VIDEO_OUTPUT_INTERFACE);
if (!compositor->video_out) continue;
}
}
if (!compositor->video_out ) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Failed to create compositor->video_out, did not find any suitable driver."));
return GF_IO_ERR;
}
+ sOpt = gf_cfg_get_key(compositor->user->config, "Video", "DPI");
+ if (sOpt) {
+ compositor->video_out->dpi_x = compositor->video_out->dpi_y = atoi(sOpt);
+ }
+
/*try to load a raster driver*/
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "Raster2D");
if (sOpt) {
#endif
/*load audio renderer*/
- compositor->audio_renderer = gf_sc_ar_load(compositor->user);
+ if (!compositor->audio_renderer)
+ compositor->audio_renderer = gf_sc_ar_load(compositor->user);
gf_sc_reset_framerate(compositor);
compositor->font_manager = gf_font_manager_new(compositor->user);
compositor->video_th_state = GF_COMPOSITOR_THREAD_RUN;
while (compositor->video_th_state == GF_COMPOSITOR_THREAD_RUN) {
- if (compositor->is_hidden)
+ if (compositor->is_hidden==1)
gf_sleep(compositor->frame_duration);
else
gf_sc_simulation_tick(compositor);
GF_SAFEALLOC(tmp, GF_Compositor);
- if (!tmp) return NULL;
+ if (!tmp){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Failed to allocate compositor : OUT OF MEMORY!\n"));
+ return NULL;
+ }
tmp->user = user;
tmp->term = term;
tmp->mx = gf_mx_new("Compositor");
}
/*init failure*/
if (tmp->video_th_state == GF_COMPOSITOR_THREAD_INIT_FAILED) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("GF_COMPOSITOR_THREAD_INIT_FAILED : Deleting compositor.\n"));
gf_sc_del(tmp);
return NULL;
}
} else {
e = gf_sc_create(tmp);
if (e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Error while calling gf_sc_create() : %s, deleting compositor.\n", gf_error_to_string(e)));
gf_sc_del(tmp);
return NULL;
}
}
+
+ if ((tmp->user->init_flags & GF_TERM_NO_REGULATION) || !tmp->VisualThread)
+ tmp->no_regulation = 1;
/*set default size if owning output*/
if (!tmp->user->os_window_handler) {
gf_sc_set_size(tmp, SC_DEF_WIDTH, SC_DEF_HEIGHT);
}
+ /*try to load GL extensions*/
+#ifndef GPAC_DISABLE_3D
+ gf_sc_load_opengl_extensions(tmp);
+#endif
GF_LOG(GF_LOG_DEBUG, GF_LOG_RTI, ("[RTI]\tCompositor Cycle Log\tNetworks\tDecoders\tFrame\tDirect Draw\tVisual Config\tEvent\tRoute\tSMIL Timing\tTime node\tTexture\tSMIL Anim\tTraverse setup\tTraverse (and direct Draw)\tTraverse (and direct Draw) without anim\tIndirect Draw\tTraverse And Draw (Indirect or Not)\tFlush\tCycle\n"));
-
return tmp;
}
GF_LOG(GF_LOG_DEBUG, GF_LOG_COMPOSE, ("[Compositor] Unloading visual compositor module\n"));
if (compositor->audio_renderer) gf_sc_ar_del(compositor->audio_renderer);
+ compositor->audio_renderer = NULL;
#ifdef GF_SR_EVENT_QUEUE
gf_mx_p(compositor->ev_mx);
compositor->has_size_info = (width && height) ? 1 : 0;
if (compositor->has_size_info != had_size_info) compositor->scene_width = compositor->scene_height = 0;
+#ifndef GPAC_DISABLE_3D
+ compositor->visual->camera.world_bbox.is_set = 0;
+#endif
+
/*default back color is black*/
if (! (compositor->user->init_flags & GF_TERM_WINDOWLESS)) compositor->back_color = 0xFF000000;
/*we consider that SVG has no size onfo per say, everything is handled by the viewBox if any*/
if (is_svg) {
compositor->has_size_info = 0;
- gf_sc_focus_switch_ring(compositor, 0);
+ gf_sc_focus_switch_ring(compositor, 0, NULL, 0);
} else
#endif
{
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "FocusHighlightStroke");
if (sOpt) sscanf(sOpt, "%x", &compositor->highlight_stroke);
else compositor->highlight_stroke = 0xFF000000;
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "FocusHighlightStrokeWidth");
+ if (sOpt) {
+ Float v;
+ sscanf(sOpt, "%f", &v);
+ compositor->highlight_stroke_width = FLT2FIX(v);
+ }
+ else compositor->highlight_stroke_width = FIX_ONE;
+
compositor->text_sel_color = 0xFFAAAAFF;
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "TextSelectHighlight");
compositor->opengl_raster = (sOpt && !strcmp(sOpt, "raster")) ? 1 : 0;
#endif
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "DefaultNavigationMode");
+ if (sOpt && !strcmp(sOpt, "Walk")) compositor->default_navigation_mode = GF_NAVIGATE_WALK;
+ else if (sOpt && !strcmp(sOpt, "Examine")) compositor->default_navigation_mode = GF_NAVIGATE_EXAMINE;
+ else if (sOpt && !strcmp(sOpt, "Fly")) compositor->default_navigation_mode = GF_NAVIGATE_FLY;
+
#ifdef GPAC_HAS_GLU
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "RasterOutlines");
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "DisableYUVGL");
compositor->disable_yuvgl = (sOpt && !stricmp(sOpt, "yes") ) ? 1 : 0;
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "DepthScale");
+ if (!sOpt) {
+ sOpt = "100";
+ gf_cfg_set_key(compositor->user->config, "Compositor", "DepthScale", sOpt);
+ }
+ compositor->depth_gl_scale = (Float) atof(sOpt);
+
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "DepthType");
+ if (!sOpt) {
+ sOpt = "Strips";
+ gf_cfg_set_key(compositor->user->config, "Compositor", "DepthType", sOpt);
+ }
+ if (sOpt && !strcmp(sOpt, "Points")) compositor->depth_gl_type = 1;
+ else if (sOpt && !strnicmp(sOpt, "Strips", 6)) {
+ compositor->depth_gl_type = 2;
+ compositor->depth_gl_strips_filter = 0;
+ if (strlen(sOpt)>7) compositor->depth_gl_strips_filter = (Float) atof(sOpt+7);
+ }
+ else compositor->depth_gl_type = 0;
+
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "NumViews");
+ if (!sOpt) {
+ sOpt = "1";
+ gf_cfg_set_key(compositor->user->config, "Compositor", "NumViews", "1");
+ }
+ compositor->visual->nb_views = atoi(sOpt);
+ if (!compositor->visual->nb_views) compositor->visual->nb_views = 1;
+
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "StereoType");
+ if (!sOpt) {
+ sOpt = "none";
+ gf_cfg_set_key(compositor->user->config, "Compositor", "StereoType", "none");
+ }
+ if (!strcmp(sOpt, "SideBySide")) compositor->visual->autostereo_type = GF_3D_STEREO_SIDE;
+ else if (!strcmp(sOpt, "TopToBottom")) compositor->visual->autostereo_type = GF_3D_STEREO_TOP;
+ else if (!strcmp(sOpt, "Anaglyph")) compositor->visual->autostereo_type = GF_3D_STEREO_ANAGLYPH;
+ else if (!strcmp(sOpt, "Columns")) compositor->visual->autostereo_type = GF_3D_STEREO_COLUMNS;
+ else if (!strcmp(sOpt, "Rows")) compositor->visual->autostereo_type = GF_3D_STEREO_ROWS;
+ else if (!strcmp(sOpt, "Custom")) compositor->visual->autostereo_type = GF_3D_STEREO_CUSTOM;
+ else {
+ compositor->visual->autostereo_type = GF_3D_STEREO_NONE;
+ compositor->visual->nb_views = 1;
+ }
+
+ switch (compositor->visual->autostereo_type) {
+ case GF_3D_STEREO_ANAGLYPH:
+ case GF_3D_STEREO_COLUMNS:
+ case GF_3D_STEREO_ROWS:
+ if (compositor->visual->nb_views != 2) {
+ compositor->visual->nb_views = 2;
+ gf_cfg_set_key(compositor->user->config, "Compositor", "NumViews", "2");
+ }
+ break;
+ }
+
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "CameraLayout");
+ if (!sOpt) {
+ sOpt = "OffAxis";
+ gf_cfg_set_key(compositor->user->config, "Compositor", "CameraLayout", "OffAxis");
+ }
+ if (!strcmp(sOpt, "Linear")) compositor->visual->camera_layout = GF_3D_CAMERA_LINEAR;
+ else if (!strcmp(sOpt, "Circular")) compositor->visual->camera_layout = GF_3D_CAMERA_CIRCULAR;
+ else if (!strcmp(sOpt, "OffAxis")) compositor->visual->camera_layout = GF_3D_CAMERA_OFFAXIS;
+ else compositor->visual->camera_layout = GF_3D_CAMERA_STRAIGHT;
+
+ sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "ReverseViews");
+ if (sOpt && !strcmp(sOpt, "yes")) compositor->visual->reverse_views = 1;
#endif
#ifdef GF_SR_USE_DEPTH
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "AutoStereoCalibration");
- compositor->auto_calibration = (!sOpt || !strcmp(sOpt, "yes")) ? 1 : 0;
+ compositor->auto_calibration = (sOpt && !strcmp(sOpt, "yes")) ? 1 : 0;
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "DisplayDepth");
compositor->display_depth = sOpt ? (!strcmp(sOpt, "auto") ? -1 : atoi(sOpt)) : 0;
if (!compositor->video_out->view_distance) {
- Float v;
sOpt = gf_cfg_get_key(compositor->user->config, "Compositor", "ViewDistance");
- v = sOpt ? (Float) atof(sOpt) : 50.0f;
- compositor->video_out->view_distance = FLT2FIX(v * 0.3937f * compositor->video_out->dpi_x);
+ compositor->video_out->view_distance = FLT2FIX( sOpt ? (Float) atof(sOpt) : 50.0f );
}
#endif
- /*RECT texture support - we must reload HW*/
- compositor->reset_graphics = 1;
+ compositor->reset_graphics = 1;
gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
gf_sc_lock(compositor, 0);
break;
case GF_OPT_REFRESH:
compositor->reset_graphics = value;
+ compositor->traverse_state->invalidate_all = 1;
+ gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
break;
case GF_OPT_FULLSCREEN:
if (compositor->fullscreen != value) compositor->msg_type |= GF_SR_CFG_FULLSCREEN;
compositor->enable_yuv_hw = value;
break;
case GF_OPT_NAVIGATION_TYPE:
+ compositor->rotation = 0;
compositor_2d_set_user_transform(compositor, FIX_ONE, 0, 0, 0);
#ifndef GPAC_DISABLE_3D
compositor_3d_reset_camera(compositor);
#endif
+ gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
break;
case GF_OPT_NAVIGATION:
if (compositor->navigation_disabled) {
if (compositor->visual->type_3d || compositor->active_layer) {
GF_Camera *cam = compositor_3d_get_camera(compositor);
if (!(cam->navigation_flags & NAV_ANY)) return GF_NAVIGATE_TYPE_NONE;
- return ((cam->is_3D || compositor->active_layer) ? GF_NAVIGATE_TYPE_3D : GF_NAVIGATE_TYPE_2D);
+// return ((cam->is_3D || compositor->active_layer) ? GF_NAVIGATE_TYPE_3D : GF_NAVIGATE_TYPE_2D);
+ return GF_NAVIGATE_TYPE_3D;
} else
#endif
{
return NULL;
}
-static void gf_sc_forward_event(GF_Compositor *compositor, GF_Event *ev, Bool consumed)
-{
- gf_term_forward_event(compositor->term, ev, consumed);
- if (consumed) return;
-
- if ((ev->type==GF_EVENT_MOUSEUP) && (ev->mouse.button==GF_MOUSE_LEFT)) {
- u32 now;
- GF_Event event;
- /*emulate doubleclick*/
- now = gf_sys_clock();
- if (now - compositor->last_click_time < DOUBLECLICK_TIME_MS) {
- event.type = GF_EVENT_DBLCLICK;
- event.mouse.key_states = compositor->key_states;
- event.mouse.x = ev->mouse.x;
- event.mouse.y = ev->mouse.y;
- gf_term_send_event(compositor->term, &event);
- }
- compositor->last_click_time = now;
- }
-}
-
static void gf_sc_setup_root_visual(GF_Compositor *compositor, GF_Node *top_node)
{
if (top_node && !compositor->root_visual_setup) {
+ Bool force_navigate=0;
GF_SceneGraph *scene = compositor->scene;
u32 node_tag;
#ifndef GPAC_DISABLE_3D
/*request for OpenGL drawing in 2D*/
else if (compositor->force_opengl_2d && !compositor->visual->type_3d) {
compositor->visual->type_3d = 1;
- compositor->visual->camera.is_3D = 0;
+ camera_set_2d(&compositor->visual->camera);
+ if (compositor->force_opengl_2d==2) force_navigate=1;
}
if (! (compositor->video_out->hw_caps & GF_VIDEO_HW_OPENGL)) {
}
compositor->visual->camera.is_3D = (compositor->visual->type_3d>1) ? 1 : 0;
camera_invalidate(&compositor->visual->camera);
+ if (force_navigate) {
+ compositor->visual->camera.navigate_mode = GF_NAVIGATE_EXAMINE;
+ compositor->visual->camera.had_nav_info = 0;
+ }
#endif
GF_LOG(GF_LOG_INFO, GF_LOG_COMPOSE, ("[Compositor] Main scene setup - pixel metrics %d - center coords %d\n", compositor->traverse_state->pixel_metrics, compositor->visual->center_coords));
compositor->recompute_ar = 1;
}
+}
+
+static void gf_sc_recompute_ar(GF_Compositor *compositor, GF_Node *top_node)
+{
#ifndef GPAC_DISABLE_LOG
compositor->visual_config_time = 0;
return;
}
- gf_sc_setup_root_visual(compositor, top_node);
+ gf_sc_recompute_ar(compositor, top_node);
#ifdef GF_SR_USE_VIDEO_CACHE
if (!compositor->video_cache_max_size)
flags = compositor->traverse_state->immediate_draw;
- visual_draw_frame(compositor->visual, top_node, compositor->traverse_state, 1);
+ if (! visual_draw_frame(compositor->visual, top_node, compositor->traverse_state, 1))
+ compositor->skip_flush = 1;
compositor->traverse_state->immediate_draw = flags;
/*first thing to do, let the video output handle user event if it is not threaded*/
compositor->video_out->ProcessEvent(compositor->video_out, NULL);
-
if (compositor->freeze_display) {
gf_sc_lock(compositor, 0);
- gf_sleep(compositor->frame_duration);
+ if (!compositor->no_regulation) gf_sleep(compositor->frame_duration);
return;
}
if (!compositor->scene && !gf_list_count(compositor->extra_scenes) ) {
gf_sc_draw_scene(compositor);
gf_sc_lock(compositor, 0);
- gf_sleep(compositor->frame_duration);
+ if (!compositor->no_regulation) gf_sleep(compositor->frame_duration);
return;
}
in_time = gf_sys_clock();
- if (compositor->reset_graphics)
- gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
+ if (compositor->reset_graphics) {
+ gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
+ visual_reset_graphics(compositor->visual);
+ }
#ifdef GF_SR_EVENT_QUEUE
/*process pending user events*/
GF_Event *ev = (GF_Event*)gf_list_get(compositor->events, 0);
gf_list_rem(compositor->events, 0);
ret = gf_sc_exec_event(compositor, ev);
- gf_sc_forward_event(compositor, ev, ret);
gf_free(ev);
}
gf_mx_v(compositor->ev_mx);
time_node_time = gf_sys_clock() - time_node_time;
#endif
+ if (compositor->focus_text_type) {
+ if (!compositor->caret_next_draw_time) {
+ compositor->caret_next_draw_time = gf_sys_clock();
+ compositor->show_caret = 1;
+ }
+ if (compositor->caret_next_draw_time <= compositor->last_frame_time) {
+ compositor->frame_draw_type=GF_SC_DRAW_FRAME;
+ compositor->caret_next_draw_time+=500;
+ compositor->show_caret = !compositor->show_caret;
+ compositor->text_edit_changed = 1;
+ }
+ }
+
+ /*setup root visual BEFORE updating the texture, because of potential composite texture */
+ gf_sc_setup_root_visual(compositor, gf_sg_get_root_node(compositor->scene));
+
#ifndef GPAC_DISABLE_LOG
texture_time = gf_sys_clock();
#endif
if (compositor->reset_graphics && txh->tx_io) gf_sc_texture_reset(txh);
txh->update_texture_fcnt(txh);
}
- compositor->reset_graphics = 0;
+ compositor->text_edit_changed = 0;
+ compositor->rebuild_offscreen_textures = 0;
#ifndef GPAC_DISABLE_LOG
texture_time = gf_sys_clock() - texture_time;
compositor->frame_draw_type=GF_SC_DRAW_FRAME;
}
+ if (compositor->is_hidden) {
+#if 0
+ gf_sc_lock(compositor, 0);
+ if (compositor->no_regulation) return;
+ gf_sleep(compositor->frame_duration);
+ return;
+#else
+ compositor->frame_draw_type = 0;
+#endif
+ }
frame_drawn = (compositor->frame_draw_type==GF_SC_DRAW_FRAME) ? 1 : 0;
compositor->indirect_draw_time = 0;
#endif
}
+ compositor->reset_graphics = 0;
/*release all textures - we must release them to handle a same OD being used by several textures*/
count = gf_list_count(compositor->textures);
txh->flags &= ~GF_SR_TEXTURE_USED;
}
- end_time = gf_sys_clock() - in_time;
+ compositor->last_frame_time = gf_sys_clock();
+ end_time = compositor->last_frame_time - in_time;
GF_LOG(GF_LOG_DEBUG, GF_LOG_RTI, ("[RTI]\tCompositor Cycle Log\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
compositor->networks_time,
#endif
/*not threaded, let the owner decide*/
- if ((compositor->user->init_flags & GF_TERM_NO_THREAD) || !compositor->frame_duration) return;
+ if (compositor->no_regulation) return;
/*TO CHECK - THERE WAS A BUG HERE WITH TRISCOPE@SHIX*/
if (end_time > compositor->frame_duration) {
/*we don't traverse subscenes until the root one is setup*/
if (!compositor->root_visual_setup) return;
- if (!gf_scene_lock(subscene, 1))
- return;
-
inline_root = gf_sg_get_root_node(subscene);
- if (!inline_root) {
- gf_scene_lock(subscene, 0);
- return;
- }
+ if (!inline_root) return;
+
+ if (!gf_scene_is_over(subscene))
+ tr_state->subscene_not_over ++;
flip_coords = 0;
in_scene = gf_node_get_graph(inline_root);
tr_state->min_hsize = min_hsize;
tr_state->vp_size = prev_vp;
tr_state->fliped_coords = prev_coord;
-
- gf_scene_lock(subscene, 0);
}
gf_sc_lock(compositor, 0);
if (!from_user) {
- gf_sc_forward_event(compositor, event, ret);
}
return ret;
#endif
}
break;
case GF_EVENT_VIDEO_SETUP:
- gf_sc_reset_graphics(compositor);
+ {
+ Bool locked = gf_mx_try_lock(compositor->mx);
+ compositor->reset_graphics = 2;
+ if (locked) gf_mx_v(compositor->mx);
+ }
break;
case GF_EVENT_SIZE:
/*resize message from plugin: if we own the output, resize*/
/*EXTRA CARE HERE: the caller (video output) is likely a different thread than the compositor one, and the
compositor may be locked on the video output (flush or whatever)!!
*/
+ Bool lock_ok = gf_mx_try_lock(compositor->mx);
if ((compositor->display_width!=event->size.width) || (compositor->display_height!=event->size.height)) {
- Bool lock_ok = gf_mx_try_lock(compositor->mx);
compositor->new_width = event->size.width;
compositor->new_height = event->size.height;
compositor->msg_type |= GF_SR_CFG_SET_SIZE;
- if (lock_ok) gf_sc_lock(compositor, 0);
+ if (from_user) compositor->msg_type &= ~GF_SR_CFG_WINDOWSIZE_NOTIF;
+ } else {
+ /*remove pending resize notif*/
+ compositor->msg_type = 0;
}
+ if (lock_ok) gf_sc_lock(compositor, 0);
}
/*otherwise let the user decide*/
else {
return gf_sc_handle_event_intern(compositor, event, from_user);
/*switch fullscreen off!!!*/
case GF_EVENT_SHOWHIDE:
- gf_sc_set_option(compositor, GF_OPT_FULLSCREEN, !compositor->fullscreen);
+ compositor->is_hidden = event->show.show_type ? 0 : 1;
break;
case GF_EVENT_SET_CAPTION:
event->mouse.key_states = compositor->key_states;
return gf_sc_handle_event_intern(compositor, event, from_user);
+ case GF_EVENT_PASTE_TEXT:
+ gf_sc_paste_text(compositor, event->message.message);
+ break;
+ case GF_EVENT_COPY_TEXT:
+ if (gf_sc_has_text_selection(compositor)) {
+ event->message.message = gf_sc_get_selected_text(compositor);
+ } else {
+ event->message.message = NULL;
+ }
+ break;
/*when we process events we don't forward them to the user*/
default:
return gf_term_send_event(compositor->term, event);
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
line[1] = FIX2FLT(y);
line[2] = FIX2FLT(x+run_h_len);
line[3] = line[1];
-
+
glColor4ub(GF_COL_R(color), GF_COL_G(color), GF_COL_B(color), 0xFF);
glVertexPointer(2, GL_FLOAT, 0, line);
glEnableClientState(GL_VERTEX_ARRAY);
line[1] = FIX2FLT(y);
line[2] = FIX2FLT(x+run_h_len);
line[3] = line[1];
-
+
glEnable(GL_BLEND);
glColor4ub(GF_COL_R(color), GF_COL_G(color), GF_COL_B(color), (u8) alpha);
line[5] = FIX2FLT(y+height);
line[6] = FIX2FLT(x);
line[7] = FIX2FLT(y+height);
-
+
glEnable(GL_BLEND);
glColor4ub(GF_COL_R(color), GF_COL_G(color), GF_COL_B(color), GF_COL_A(color));
Bool c2d_gl_draw_bitmap(GF_VisualManager *visual, GF_TraverseState *tr_state, DrawableContext *ctx, GF_ColorKey *col_key)
{
u8 alpha = GF_COL_A(ctx->aspect.fill_color);
-
+
if (ctx->transform.m[1] || ctx->transform.m[3]) return 0;
visual_3d_set_state(visual, V3D_STATE_LIGHT, 0);
#ifdef OPENGL_RASTER
if (compositor->opengl_raster && compositor->rasterizer->surface_attach_to_callbacks) {
- GLenum err;
GF_RasterCallback callbacks;
callbacks.cbk = visual;
callbacks.fill_run_alpha = c2d_gl_fill_alpha;
hw = INT2FIX(compositor->vp_width)/2;
hh = INT2FIX(compositor->vp_height)/2;
gf_mx_ortho(&mx, -hw, hw, -hh, hh, 50, -50);
- glMatrixMode(GL_PROJECTION);
-#ifdef GPAC_USE_OGL_ES
- glLoadMatrixx(mx.m);
-#else
- glLoadMatrixf(mx.m);
-#endif
- err = glGetError();
- glMatrixMode(GL_MODELVIEW);
+
+ visual_3d_set_matrix_mode(visual, V3D_MATRIX_PROJECTION);
+ visual_3d_matrix_load(visual, mx.m);
+
+ visual_3d_set_matrix_mode(visual, V3D_MATRIX_MODELVIEW);
gf_mx_init(mx);
gf_mx_add_scale(&mx, 1, -1, 1);
gf_mx_add_translation(&mx, -hw, -hh, 0);
-#ifdef GPAC_USE_OGL_ES
- glLoadMatrixx(mx.m);
-#else
- glLoadMatrixf(mx.m);
-#endif
- err = glGetError();
+ visual_3d_matrix_load(visual, mx.m);
+
return GF_OK;
}
}
compositor->hw_locked = 0;
e = GF_IO_ERR;
-
+
/*try from video memory handle (WIN32) if supported*/
- if ((compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_HWND_HDC)
- && compositor->rasterizer->surface_attach_to_device
+ if ((compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_HWND_HDC)
+ && compositor->rasterizer->surface_attach_to_device
&& compositor->video_out->LockOSContext
) {
compositor->hw_context = compositor->video_out->LockOSContext(compositor->video_out, 1);
}
GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor2D] Failed to attach video surface callbacks to raster\n"));
}
-
+
e = GF_NOT_SUPPORTED;
if (compositor->video_out->LockBackBuffer(compositor->video_out, &compositor->hw_surface, 1)==GF_OK) {
compositor->hw_locked = 1;
- e = compositor->rasterizer->surface_attach_to_buffer(visual->raster_surface, compositor->hw_surface.video_buffer,
- compositor->hw_surface.width,
+ e = compositor->rasterizer->surface_attach_to_buffer(visual->raster_surface, compositor->hw_surface.video_buffer,
+ compositor->hw_surface.width,
compositor->hw_surface.height,
compositor->hw_surface.pitch_x,
compositor->hw_surface.pitch_y,
}
GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor2D] Cannot attach video surface memory to raster: %s\n", gf_error_to_string(e) ));
compositor->video_out->LockBackBuffer(compositor->video_out, &compositor->hw_surface, 0);
- } else {
- e = GF_OK;
}
compositor->hw_locked = 0;
visual->is_attached = 0;
- return e;
+ return e;
}
void compositor_2d_release_video_access(GF_VisualManager *visual)
}
}
-
-static Bool compositor_2d_draw_bitmap_ex(GF_VisualManager *visual, GF_TextureHandler *txh, DrawableContext *ctx, GF_IRect *clip, GF_Rect *unclip, u8 alpha, GF_ColorKey *col_key, GF_TraverseState *tr_state, Bool force_soft_blt)
+Bool compositor_texture_rectangles(GF_VisualManager *visual, GF_TextureHandler *txh, GF_IRect *clip, GF_Rect *unclip, GF_Window *src, GF_Window *dst, Bool *disable_blit, Bool *has_scale)
{
- GF_VideoSurface video_src;
Fixed w_scale, h_scale, tmp;
- GF_Err e;
- Bool use_soft_stretch, use_blit, flush_video, is_attached;
- u32 overlay_type;
- GF_Window src_wnd, dst_wnd;
- u32 output_width, output_height, hw_caps;
+ u32 output_width, output_height;
GF_IRect clipped_final = *clip;
GF_Rect final = *unclip;
+ Bool use_blit;
- if (!txh->data) return 1;
+ src->w = src->h = 0;
+ dst->w = dst->h = 0;
+ if (disable_blit) *disable_blit = 0;
+ if (has_scale) *has_scale = 0;
- if (!visual->compositor->has_size_info && !(visual->compositor->msg_type & GF_SR_CFG_OVERRIDE_SIZE)
- && (visual->compositor->override_size_flags & 1)
- && !(visual->compositor->override_size_flags & 2)
- ) {
- if ( (visual->compositor->scene_width < txh->width)
- || (visual->compositor->scene_height < txh->height)) {
- visual->compositor->scene_width = txh->width;
- visual->compositor->scene_height = txh->height;
- visual->compositor->msg_type |= GF_SR_CFG_OVERRIDE_SIZE;
- return 1;
- }
- }
-
/*this should never happen but we check for float rounding safety*/
- if (final.width<=0 || final.height <=0) return 1;
+ if (final.width<=0 || final.height <=0) return 0;
+
w_scale = final.width / txh->width;
h_scale = final.height / txh->height;
- /*use entire video surface for un-centering coord system*/
- output_width = visual->compositor->vp_width;
- output_height = visual->compositor->vp_height;
+ if ((w_scale != FIX_ONE) || (h_scale!=FIX_ONE)) {
+ if (has_scale) *has_scale = 1;
+ }
+ if (visual->offscreen) {
+ output_width = visual->width;
+ output_height = visual->height;
+ } else {
+ /*use entire video surface for un-centering coord system*/
+ output_width = visual->compositor->vp_width;
+ output_height = visual->compositor->vp_height;
+ }
/*take care of pixel rounding for odd width/height and make sure we strictly draw in the clipped bounds*/
if (visual->center_coords) {
clipped_final.x += output_width / 2;
clipped_final.y = output_height - clipped_final.height;
}
/*needed in direct drawing since clipping is not performed*/
- if (clipped_final.width<=0 || clipped_final.height <=0)
+ if (clipped_final.width<=0 || clipped_final.height <=0)
return 0;
+ if (clipped_final.width-1>= FIX2INT(final.width) ) clipped_final.width = FIX2INT(final.width);
+ if (clipped_final.height-1>= FIX2INT(final.height) ) clipped_final.height = FIX2INT(final.height);
+
/*set dest window*/
- dst_wnd.x = (u32) clipped_final.x;
- dst_wnd.y = (u32) clipped_final.y;
- dst_wnd.w = (u32) clipped_final.width;
- dst_wnd.h = (u32) clipped_final.height;
+ dst->x = (u32) clipped_final.x;
+ dst->y = (u32) clipped_final.y;
+ dst->w = (u32) clipped_final.width;
+ dst->h = (u32) clipped_final.height;
+ if (!dst->w || !dst->h) return 0;
#ifdef GPAC_FIXED_POINT
#define ROUND_FIX(_v) \
use_blit = 1;
/*compute SRC window*/
- src_wnd.x = src_wnd.y = 0;
tmp = gf_divfix(INT2FIX(clipped_final.x) - final.x, w_scale);
if (tmp<0) tmp=0;
- CEILING(src_wnd.x);
+ CEILING(src->x);
tmp = gf_divfix(INT2FIX(clipped_final.y) - final.y, h_scale);
if (tmp<0) tmp=0;
- CEILING(src_wnd.y);
+ CEILING(src->y);
tmp = gf_divfix(INT2FIX(clip->width), w_scale);
- ROUND_FIX(src_wnd.w);
+ ROUND_FIX(src->w);
tmp = gf_divfix(INT2FIX(clip->height), h_scale);
- ROUND_FIX(src_wnd.h);
-
+ ROUND_FIX(src->h);
+
#undef ROUND_FIX
- if (src_wnd.w>txh->width) src_wnd.w=txh->width;
- if (src_wnd.h>txh->height) src_wnd.h=txh->height;
+ if (src->w>txh->width) src->w=txh->width;
+ if (src->h>txh->height) src->h=txh->height;
+
+ if (!src->w || !src->h) return 0;
- if (!src_wnd.w || !src_wnd.h) return 1;
/*make sure we lie in src bounds*/
- if (src_wnd.x + src_wnd.w>txh->width) src_wnd.w = txh->width - src_wnd.x;
- if (src_wnd.y + src_wnd.h>txh->height) src_wnd.h = txh->height - src_wnd.y;
+ if (src->x + src->w>txh->width) src->w = txh->width - src->x;
+ if (src->y + src->h>txh->height) src->h = txh->height - src->y;
- if (!src_wnd.w || !src_wnd.h) return 0;
+ if (disable_blit) *disable_blit = use_blit ? 0 : 1;
+ return 1;
+}
+
+static Bool compositor_2d_draw_bitmap_ex(GF_VisualManager *visual, GF_TextureHandler *txh, DrawableContext *ctx, GF_IRect *clip, GF_Rect *unclip, u8 alpha, GF_ColorKey *col_key, GF_TraverseState *tr_state, Bool force_soft_blt)
+{
+ GF_VideoSurface video_src;
+ GF_Err e;
+ Bool use_soft_stretch, use_blit, flush_video, is_attached, has_scale;
+ u32 overlay_type;
+ GF_Window src_wnd, dst_wnd;
+ u32 output_width, output_height, hw_caps;
+
+
+ if (!txh->data) return 1;
+
+ if (!visual->compositor->has_size_info && !(visual->compositor->msg_type & GF_SR_CFG_OVERRIDE_SIZE)
+ && (visual->compositor->override_size_flags & 1)
+ && !(visual->compositor->override_size_flags & 2)
+ ) {
+ if ( (visual->compositor->scene_width < txh->width)
+ || (visual->compositor->scene_height < txh->height)) {
+ visual->compositor->scene_width = txh->width;
+ visual->compositor->scene_height = txh->height;
+ visual->compositor->msg_type |= GF_SR_CFG_OVERRIDE_SIZE;
+ return 1;
+ }
+ }
+
+ if (!compositor_texture_rectangles(visual, txh, clip, unclip, &src_wnd, &dst_wnd, &use_blit, &has_scale)) return 1;
/*can we use hardware blitter ?*/
hw_caps = visual->compositor->video_out->hw_caps;
overlay_type = 0;
flush_video = 0;
use_soft_stretch = 1;
+
+ output_width = visual->compositor->vp_width;
+ output_height = visual->compositor->vp_height;
+
+ if (!(hw_caps & GF_VIDEO_HW_HAS_STRETCH)) {
+ if (has_scale) force_soft_blt = 1;
+ }
+ if (visual->compositor->disable_hardware_blit) force_soft_blt = 1;
+
if (!force_soft_blt) {
- /*avoid partial redraw that don't come close to src pixels with the bliter, this leads to ugly artefacts -
+ /*avoid partial redraw that don't come close to src pixels with the bliter, this leads to ugly artefacts -
fall back to rasterizer*/
// if (!(ctx->flags & CTX_TEXTURE_DIRTY) && !use_blit && (src_wnd.x || src_wnd.y) )
// return 0;
switch (txh->pixelformat) {
case GF_PIXEL_RGB_24:
case GF_PIXEL_BGR_24:
+ case GF_PIXEL_RGBS:
+ case GF_PIXEL_RGBD:
case GF_PIXEL_RGB_555:
case GF_PIXEL_RGB_565:
if (hw_caps & GF_VIDEO_HW_HAS_RGB)
break;
case GF_PIXEL_ARGB:
case GF_PIXEL_RGBA:
+ case GF_PIXEL_RGBAS:
case GF_PIXEL_RGBDS:
if (hw_caps & GF_VIDEO_HW_HAS_RGBA)
use_soft_stretch = 0;
}
/*disable based on settings*/
if (!visual->compositor->enable_yuv_hw
- || (ctx->col_mat || (alpha!=0xFF) || !visual->compositor->video_out->Blit)
+ || (ctx->col_mat || (alpha!=0xFF) || !visual->compositor->video_out->Blit)
) {
use_soft_stretch = 1;
overlay_type = 0;
/*prevents this context from being removed in direct draw mode by requesting a new one
but not allocating it*/
- if (tr_state->immediate_draw)
+ if (tr_state->immediate_draw)
visual_2d_get_drawable_context(visual);
return 1;
}
/*top level overlay*/
if (flush_video) {
GF_Window rc;
- rc.x = rc.y = 0;
- rc.w = visual->compositor->display_width;
+ rc.x = rc.y = 0;
+ rc.w = visual->compositor->display_width;
rc.h = visual->compositor->display_height;
visual_2d_release_raster(visual);
/*HW pb, try soft*/
if (e) {
use_soft_stretch = 1;
- if (visual->compositor->video_memory) {
- GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor2D] Error during hardware blit - trying with soft one\n"));
+ if (visual->compositor->video_memory==1) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor2D] Error during hardware blit - will use soft one\n"));
visual->compositor->video_memory = 2;
}
/*force a reconfigure of video output*/
else {
- visual->compositor->video_memory = 1;
+ GF_LOG(GF_LOG_INFO, GF_LOG_COMPOSE, ("[Compositor2D] Reconfiguring video output to use video memory\n"));
+ visual->compositor->request_video_memory = 1;
visual->compositor->root_visual_setup = 0;
gf_sc_next_frame_state(visual->compositor, GF_SC_DRAW_FRAME);
}
e = visual->compositor->video_out->LockBackBuffer(visual->compositor->video_out, &backbuffer, 0);
} else {
GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor2D] Cannot lock back buffer - Error %s\n", gf_error_to_string(e) ));
+ if (is_attached) visual_2d_init_raster(visual);
+ return 0;
}
if (!visual->compositor->video_memory) {
GF_LOG(GF_LOG_INFO, GF_LOG_COMPOSE, ("[Compositor2D] Reconfiguring video output to use video memory\n"));
/*check if texture is ready*/
if (!ctx->aspect.fill_texture->data) return 0;
if (ctx->transform.m[0]<0) return 0;
- /*check if the <0 value is due to a flip in he scene description or
+ /*check if the <0 value is due to a flip in he scene description or
due to bifs<->svg... context switching*/
if (ctx->transform.m[4]<0) {
if (!(ctx->flags & CTX_FLIPED_COORDS)) return 0;
alpha = GF_COL_A(ctx->aspect.fill_color);
/*THIS IS A HACK, will not work when setting filled=0, transparency and XLineProps*/
if (!alpha) alpha = GF_COL_A(ctx->aspect.line_color);
-
+
if (!alpha) return 1;
switch (ctx->aspect.fill_texture->pixelformat) {
case GF_PIXEL_IYUV:
case GF_PIXEL_I420:
case GF_PIXEL_YUVA:
+ case GF_PIXEL_RGBS:
+ case GF_PIXEL_RGBAS:
+ break;
case GF_PIXEL_YUVD:
case GF_PIXEL_RGBD:
case GF_PIXEL_RGBDS:
+#ifndef GPAC_DISABLE_3D
+ /*using OpenGL to render depth images*/
+ if (visual->compositor->depth_gl_type) {
+ gf_sc_set_option(visual->compositor, GF_OPT_USE_OPENGL, 2);
+ return 1;
+ }
+#endif
break;
/*the rest has to be displayed through brush for now, we only use YUV and RGB pool*/
default:
evt.setup.width = compositor->vp_width;
evt.setup.height = compositor->vp_height;
evt.setup.opengl_mode = 0;
- evt.setup.system_memory = (compositor->video_memory==1) ? 0 : 1;
+ /*copy over settings*/
+ evt.setup.system_memory = compositor->video_memory ? 0 : 1;
+ if (compositor->request_video_memory) evt.setup.system_memory = 0;
+ compositor->request_video_memory = 0;
#ifdef OPENGL_RASTER
if (compositor->opengl_raster) {
evt.setup.back_buffer = 1;
}
#endif
+
+
+ GF_LOG(GF_LOG_INFO, GF_LOG_COMPOSE, ("[Compositor2D] Reconfiguring display size %d x %d - opengl %s - use %s memory\n", evt.setup.width, evt.setup.height,
+ (evt.setup.opengl_mode==2) ? "Offscreen" : (evt.setup.opengl_mode==1) ? "yes" : "no", evt.setup.system_memory ? "systems" : "video"
+ ));
+
e = compositor->video_out->ProcessEvent(compositor->video_out, &evt);
if (e) return e;
GF_Node *root = gf_sg_get_root_node(scene);
/*if root node is not DOM, sent a resize event (for VRML/BIFS). Otherwise this must be handled
by the composition code of the node*/
- if (!root || (gf_node_get_tag(root) > GF_NODE_RANGE_LAST_VRML) )
+ if (!root || (gf_node_get_tag(root) > GF_NODE_RANGE_LAST_VRML) )
return;
memset(&evt, 0, sizeof(GF_DOM_Event));
#endif
}
-void compositor_2d_set_user_transform(GF_Compositor *compositor, Fixed zoom, Fixed tx, Fixed ty, Bool is_resize)
+void compositor_2d_set_user_transform(GF_Compositor *compositor, Fixed zoom, Fixed tx, Fixed ty, Bool is_resize)
{
Fixed ratio;
Fixed old_tx, old_ty, old_z;
-
+
gf_sc_lock(compositor, 1);
old_tx = tx;
old_ty = ty;
gf_mx_copy(mx, tr_state->model_matrix);
gf_mx_inverse(&mx);
gf_mx_apply_rect(&mx, &orig);
- } else
+ } else
#endif
{
GF_Matrix2D mx2d;
/*if 2D, also update with user zoom and translation*/
if (!tr_state->camera->is_3D)
gf_mx_apply_rect(&tr_state->camera->modelview, &tr_state->clipper);
- } else
+ } else
#endif
-
+
gf_mx2d_apply_rect(&tr_state->transform, &tr_state->clipper);
-
+
tr_state->has_clip = 1;
}
return clip;
the_clip = ol->ra.list[i];
/*draw all objects above this overlay*/
- ctx = ol->ctx->next;
+ ctx = ol->ctx->next;
while (ctx && ctx->drawable) {
if (gf_irect_overlaps(&ctx->bi->clip, &the_clip)) {
GF_IRect prev_clip = ctx->bi->clip;
GF_OverlayStack *ol = visual->overlays;
if (!ol) return;
visual->overlays = ol->next;
-
+
txh = ol->ctx->aspect.fill_texture;
video_src.height = txh->height;
video_src.width = txh->width;
}
#endif
- compositor->reset_graphics=0;
return GF_OK;
}
void compositor_3d_reset_camera(GF_Compositor *compositor)
{
GF_Camera *cam = compositor_3d_get_camera(compositor);
- camera_reset_viewpoint(cam, 1);
- gf_sc_invalidate(compositor, NULL);
+ if (cam) {
+ camera_reset_viewpoint(cam, 1);
+ gf_sc_invalidate(compositor, NULL);
+ }
if (compositor->active_layer) gf_node_dirty_set(compositor->active_layer, 0, 1);
}
if (!asp->fill_texture) return;
txh = asp->fill_texture;
if (!txh || !txh->tx_io || !txh->width || !txh->height) return;
+
+ if ((txh->pixelformat==GF_PIXEL_RGBD) || (txh->pixelformat==GF_PIXEL_YUVD)) {
+ if (txh->data && gf_sc_texture_convert(txh) )
+ visual_3d_point_sprite(tr_state->visual, stack, txh, tr_state);
+ return;
+ }
alpha = GF_COL_A(asp->fill_color);
/*THIS IS A HACK, will not work when setting filled=0, transparency and XLineProps*/
#include <gpac/nodes_mpeg4.h>
#include <gpac/nodes_x3d.h>
+
+void compositor_init_afx_node(GF_Compositor *compositor, GF_Node *node, MFURL *url)
+{
+ GF_MediaObject *mo = gf_mo_register(node, url, 0, 0);
+ if (!mo) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_COMPOSE, ("[Compositor] AFX Decoder not found for node %s - node will not be rendered\n", gf_node_get_class_name(node)));
+ }
+}
+
+
void gf_sc_on_node_init(GF_Compositor *compositor, GF_Node *node)
{
switch (gf_node_get_tag(node)) {
case TAG_SVG_foreignObject: compositor_init_svg_foreign_object(compositor, node); break;
case TAG_SVG_filter: compositor_init_svg_filter(compositor, node); break;
+
+ case TAG_LSR_updates: compositor_init_svg_updates(compositor, node); break;
#endif
+
+ case TAG_MPEG4_SBVCAnimation:
+ compositor_init_afx_node(compositor, node, & ((M_SBVCAnimation *)node)->url);
+ break;
+
default:
GF_LOG(GF_LOG_DEBUG, GF_LOG_COMPOSE, ("[Compositor] node %s will not be rendered\n", gf_node_get_class_name(node)));
break;
DRInfo *dri, *cur;
BoundInfo *bi, *_cur;
+
/*remove node from all visuals it's on*/
dri = dr->dri;
while (dri) {
dri = dri->next;
gf_free(cur);
}
- if (compositor) gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
+ if (compositor) {
+ gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
+
+ /*check node isn't being tracked*/
+ if (compositor->grab_node==dr->node)
+ compositor->grab_node = NULL;
+
+ if (compositor->focus_node==dr->node) {
+ compositor->focus_node = NULL;
+ compositor->focus_text_type = 0;
+ }
+ if (compositor->hit_node==dr->node) compositor->hit_node = NULL;
+ if (compositor->hit_text==dr->node) compositor->hit_text = NULL;
+ }
/*remove path object*/
if (dr->path) gf_path_del(dr->path);
hl_ctx->aspect.fill_color = compositor->highlight_fill;
hl_ctx->aspect.line_color = compositor->highlight_stroke;
hl_ctx->aspect.line_scale = 0;
- hl_ctx->aspect.pen_props.width = FIX_ONE;
+ hl_ctx->aspect.pen_props.width = compositor->highlight_stroke_width;
hl_ctx->aspect.pen_props.join = GF_LINE_JOIN_BEVEL;
hl_ctx->aspect.pen_props.dash = GF_DASH_STYLE_DOT;
void compositor_init_lineprops(GF_Compositor *compositor, GF_Node *node)
{
- LinePropStack *st = (LinePropStack *)gf_malloc(sizeof(LinePropStack));
+ LinePropStack *st;
+ GF_SAFEALLOC(st, LinePropStack);
st->compositor = compositor;
st->last_mod_time = 0;
gf_node_set_private(node, st);
/*
* GPAC - Multimedia Framework C SDK
*
- * Copyright (c) Jean Le Feuvre 2000-2005
+ * Copyright (c) Jean Le Feuvre 2000-2005
* All rights reserved
*
* This file is part of GPAC / Scene Compositor sub-project
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/utf.h>
static GF_Node *browse_parent_for_focus(GF_Compositor *compositor, GF_Node *elt, Bool prev_focus);
-u32 gf_sc_focus_switch_ring_ex(GF_Compositor *compositor, Bool move_prev, GF_Node *focus, Bool force_focus);
static void gf_sc_reset_collide_cursor(GF_Compositor *compositor)
{
static void flush_text_node_edit(GF_Compositor *compositor, Bool final_flush)
{
+ Bool signal;
u8 *txt;
u32 len;
if (!compositor->edited_text) return;
*compositor->edited_text = gf_strdup(txt);
gf_free(txt);
}
- gf_node_dirty_set(compositor->focus_node, 0, (compositor->focus_text_type==2));
- gf_node_set_private(compositor->focus_highlight->node, NULL);
+
+ signal = final_flush;
+ if ((compositor->focus_text_type==4) && (final_flush==1)) signal = 0;
+
+ gf_node_dirty_set(compositor->focus_node, 0, 1);
+ //(compositor->focus_text_type==2));
gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
+ /*notify compositor that text has been edited, in order to update composite textures*/
+ //compositor->text_edit_changed = 1;
+ gf_node_set_private(compositor->focus_highlight->node, NULL);
if (final_flush) {
GF_FieldInfo info;
compositor->sel_buffer_len = compositor->sel_buffer_alloc = 0;
compositor->edited_text = NULL;
- memset(&info, 0, sizeof(GF_FieldInfo));
- info.fieldIndex = (u32) -1;
- gf_node_changed(compositor->focus_node, &info);
-
+ if (signal) {
+ memset(&info, 0, sizeof(GF_FieldInfo));
+ info.fieldIndex = (u32) -1;
+ if (compositor->focus_text_type>=3) {
+ gf_node_get_field(compositor->focus_node, 0, &info);
+ gf_node_event_out(compositor->focus_node, 0);
+ }
+ gf_node_changed(compositor->focus_node, &info);
+ }
}
}
s32 caret_pos;
Bool append;
Bool delete_cr = 0;
-
+
caret_pos = -1;
append = 0;
break;
}
prev_pos = compositor->dom_text_pos;
-
compositor->dom_text_pos = 0;
+
#ifndef GPAC_DISABLE_VRML
- if (compositor->focus_text_type==3) {
+ if (compositor->focus_text_type>=3) {
MFString *mf = &((M_Text*)compositor->focus_node)->string;
if (append) {
compositor->dom_text_pos = prev_pos;
return 0;
}
+
+ if (compositor->picked_span_idx >=0) {
+ compositor->dom_text_pos = 1+compositor->picked_span_idx;
+ compositor->picked_span_idx = -1;
+ }
+ /*take care of loading empty text nodes*/
+ if (!mf->count) {
+ mf->count = 1;
+ mf->vals = gf_malloc(sizeof(char*));
+ mf->vals[0] = gf_strdup("");
+ }
+ if (!mf->vals[0]) mf->vals[0] = gf_strdup("");
+
+ if (!compositor->dom_text_pos || (compositor->dom_text_pos>mf->count)) {
+ compositor->dom_text_pos = prev_pos;
+ return 0;
+ }
res = &mf->vals[compositor->dom_text_pos-1];
- } else
+ if (compositor->picked_glyph_idx>=0) {
+ caret_pos = compositor->picked_glyph_idx;
+ compositor->picked_glyph_idx = -1;
+
+ if (caret_pos > (s32) strlen(*res))
+ caret_pos = -1;
+ }
+
+ } else
#endif /*GPAC_DISABLE_VRML*/
{
if (compositor->edited_text) {
flush_text_node_edit(compositor, 1);
}
+ if (!n1->textContent) n1->textContent = gf_strdup("");
caret_pos = strlen(n1->textContent);
if (n2->textContent) {
n1->textContent = gf_realloc(n1->textContent, sizeof(char)*(strlen(n1->textContent)+strlen(n2->textContent)+1));
if (caret_pos>=0) {
compositor->sel_buffer_len = gf_utf8_mbstowcs(compositor->sel_buffer, compositor->sel_buffer_alloc, &src);
memmove(&compositor->sel_buffer[caret_pos+1], &compositor->sel_buffer[caret_pos], sizeof(u16)*(compositor->sel_buffer_len-caret_pos));
- compositor->sel_buffer[caret_pos]='|';
+ compositor->sel_buffer[caret_pos] = GF_CARET_CHAR;
compositor->caret_pos = caret_pos;
-
+
} else {
compositor->sel_buffer_len = gf_utf8_mbstowcs(compositor->sel_buffer, compositor->sel_buffer_alloc, &src);
- compositor->sel_buffer[compositor->sel_buffer_len]='|';
+ compositor->sel_buffer[compositor->sel_buffer_len] = GF_CARET_CHAR;
compositor->caret_pos = compositor->sel_buffer_len;
}
compositor->sel_buffer_len++;
} else {
compositor->sel_buffer_alloc = 2;
compositor->sel_buffer = gf_malloc(sizeof(u16)*2);
- compositor->sel_buffer[0] = '|';
+ compositor->sel_buffer[0] = GF_CARET_CHAR;
compositor->sel_buffer[1] = 0;
compositor->caret_pos = 0;
compositor->sel_buffer_len = 1;
}
compositor->edited_text = res;
+ compositor->text_edit_changed = 1;
flush_text_node_edit(compositor, 0);
return 1;
}
}
break;
case GF_KEY_ENTER:
+ if (compositor->focus_text_type==4) {
+ flush_text_node_edit(compositor, 2);
+ break;
+ }
load_text_node(compositor, 3);
return;
default:
if (compositor->caret_pos==prev_caret) return;
memmove(&compositor->sel_buffer[prev_caret], &compositor->sel_buffer[prev_caret+1], sizeof(u16)*(compositor->sel_buffer_len-prev_caret));
memmove(&compositor->sel_buffer[compositor->caret_pos+1], &compositor->sel_buffer[compositor->caret_pos], sizeof(u16)*(compositor->sel_buffer_len-compositor->caret_pos));
- compositor->sel_buffer[compositor->caret_pos]='|';
+ compositor->sel_buffer[compositor->caret_pos]=GF_CARET_CHAR;
}
} else {
return;
flush_text_node_edit(compositor, is_end);
}
-static Bool hit_node_editable(GF_Compositor *compositor, Bool check_focus_node)
+static void fireTermEvent(GF_Compositor * compositor, u32 eventType){
+ if (compositor->term){
+ GF_Event evt;
+ memset(&evt, 0, sizeof(GF_Event));
+ evt.type = eventType;
+ gf_term_user_event(compositor->term, &evt);
+ }
+}
+
+static Bool hit_node_editable(GF_Compositor *compositor, Bool check_focus_node)
{
#ifndef GPAC_DISABLE_SVG
SVGAllAttributes atts;
#endif
u32 tag;
GF_Node *text = check_focus_node ? compositor->focus_node : compositor->hit_node;
- if (!text) return 0;
+ if (!text){
+ fireTermEvent(compositor, GF_EVENT_TEXT_EDITING_END);
+ return 0;
+ }
if (compositor->hit_node==compositor->focus_node) return compositor->focus_text_type ? 1 : 0;
tag = gf_node_get_tag(text);
#ifndef GPAC_DISABLE_VRML
- if ( (tag==TAG_MPEG4_Text)
+ if ( (tag==TAG_MPEG4_Text)
#ifndef GPAC_DISABLE_X3D
|| (tag==TAG_X3D_Text)
#endif
) {
M_FontStyle *fs = (M_FontStyle *) ((M_Text *)text)->fontStyle;
if (!fs || !fs->style.buffer) return 0;
- if (!strstr(fs->style.buffer, "editable") && !strstr(fs->style.buffer, "EDITABLE")) return 0;
- compositor->focus_text_type = 3;
+ if (strstr(fs->style.buffer, "editable") || strstr(fs->style.buffer, "EDITABLE")) {
+ compositor->focus_text_type = 3;
+ } else if (strstr(fs->style.buffer, "simple_edit") || strstr(fs->style.buffer, "SIMPLE_EDIT")) {
+ compositor->focus_text_type = 4;
+ } else {
+ fireTermEvent(compositor, GF_EVENT_TEXT_EDITING_END);
+ return 0;
+ }
compositor->focus_node = text;
+ fireTermEvent(compositor, compositor->focus_text_type > 2 ? GF_EVENT_TEXT_EDITING_START : GF_EVENT_TEXT_EDITING_END);
return 1;
}
#endif /*GPAC_DISABLE_VRML*/
-
if (tag <= GF_NODE_FIRST_DOM_NODE_TAG) return 0;
#ifndef GPAC_DISABLE_SVG
gf_svg_flatten_attributes((SVG_Element *)text, &atts);
compositor->focus_uses_dom_events = 1;
}
compositor->hit_node = NULL;
+ fireTermEvent(compositor, compositor->focus_text_type > 0 ? GF_EVENT_TEXT_EDITING_START : GF_EVENT_TEXT_EDITING_END);
#endif
return 1;
}
cursor_type = GF_CURSOR_NORMAL;
/*all mouse events*/
- if ((event->type<=GF_EVENT_MOUSEWHEEL)
+ if ((event->type<=GF_EVENT_MOUSEWHEEL)
// && (gf_node_get_dom_event_filter(gf_sg_get_root_node(compositor->scene)) & GF_DOM_EVENT_MOUSE)
) {
Fixed X = compositor->hit_world_point.x;
/*change focus*/
focus = get_parent_focus(compositor->grab_node, compositor->hit_use_stack, gf_list_count(compositor->hit_use_stack));
- if (focus) gf_sc_focus_switch_ring_ex(compositor, 0, focus, 1);
- else if (compositor->focus_node) gf_sc_focus_switch_ring_ex(compositor, 0, NULL, 1);
+ if (focus) gf_sc_focus_switch_ring(compositor, 0, focus, 1);
+ else if (compositor->focus_node) gf_sc_focus_switch_ring(compositor, 0, NULL, 1);
break;
case GF_EVENT_MOUSEUP:
ret += gf_dom_event_fire_ex(compositor->grab_node, &evt, compositor->hit_use_stack);
#if !defined(_WIN32_WCE)
- if ((compositor->grab_x == X) && (compositor->grab_y == Y))
+ if ((compositor->grab_x == X) && (compositor->grab_y == Y))
#endif
{
evt.type = GF_EVENT_CLICK;
evt.type = GF_EVENT_MOUSEOUT;
ret += gf_dom_event_fire_ex(compositor->grab_node, &evt, compositor->prev_hit_use_stack);
}
-
+
/*reset focus*/
- if (compositor->focus_node && (event->type==GF_EVENT_MOUSEDOWN))
- gf_sc_focus_switch_ring_ex(compositor, 0, NULL, 1);
+ if (compositor->focus_node && (event->type==GF_EVENT_MOUSEDOWN))
+ gf_sc_focus_switch_ring(compositor, 0, NULL, 1);
compositor->grab_node = NULL;
compositor->grab_use = NULL;
ret += gf_dom_event_fire_ex(gf_sg_get_root_node(compositor->scene), &evt, compositor->hit_use_stack);
}
if (compositor->sensor_type != cursor_type) {
- GF_Event c_evt;
- c_evt.type = GF_EVENT_SET_CURSOR;
+ GF_Event c_evt;
+ c_evt.type = GF_EVENT_SET_CURSOR;
c_evt.cursor.cursor_type = cursor_type;
compositor->video_out->ProcessEvent(compositor->video_out, &c_evt);
compositor->sensor_type = cursor_type;
ret += gf_dom_event_fire(target, &evt);
break;
}
- }
+ }
} else if (event->type == GF_EVENT_TEXTINPUT) {
GF_Node *target;
switch (event->character.unicode_char) {
#ifndef GPAC_DISABLE_VRML
+
Bool gf_sc_exec_event_vrml(GF_Compositor *compositor, GF_Event *ev)
{
+ u32 res = 0;
GF_SensorHandler *hs, *hs_grabbed;
GF_List *tmp;
u32 i, count, stype;
if (compositor->prev_hit_appear != compositor->hit_appear) {
if (compositor->prev_hit_appear) {
compositor_compositetexture_handle_event(compositor, compositor->prev_hit_appear, ev, 1);
- compositor->prev_hit_appear = NULL;
+ if (!compositor->grabbed_sensor) compositor->prev_hit_appear = NULL;
}
}
if (compositor->hit_appear) {
GF_Node *appear = compositor->hit_appear;
if (compositor_compositetexture_handle_event(compositor, compositor->hit_appear, ev, 0)) {
- compositor->prev_hit_appear = appear;
+ if (compositor->hit_appear) compositor->prev_hit_appear = appear;
+
+
+ compositor->grabbed_sensor = 0;
+ /*check if we have grabbed sensors*/
+ count = gf_list_count(compositor->previous_sensors);
+ for (i=0; i<count; i++) {
+ hs = (GF_SensorHandler*)gf_list_get(compositor->previous_sensors, i);
+ /*if sensor is grabbed, add it to the list of active sensor for next pick*/
+ if (hs->grabbed) {
+ hs->OnUserEvent(hs, 0, 1, ev, compositor);
+ gf_list_add(compositor->sensors, hs);
+ compositor->grabbed_sensor = 1;
+ stype = gf_node_get_tag(hs->sensor);
+ }
+ }
+
return 1;
}
- compositor->prev_hit_appear = NULL;
+// compositor->prev_hit_appear = compositor->grabbed_sensor ? compositor->hit_appear : NULL;
+ compositor->prev_hit_appear = compositor->hit_appear;
}
resetting the cursor when the picked node is a DOM node in a composite texture*/
stype = (compositor->hit_node!=NULL) ? GF_CURSOR_TOUCH : GF_CURSOR_NORMAL;
+ count = gf_list_count(compositor->sensors);
+ stype = GF_CURSOR_NORMAL;
+ for (i=0; i<count; i++) {
+ GF_Node *keynav;
+ hs = (GF_SensorHandler*)gf_list_get(compositor->sensors, i);
+ res += hs->OnUserEvent(hs, 1, 0, ev, compositor);
+
+ /*try to remove this sensor from the previous sensor list*/
+ gf_list_del_item(compositor->previous_sensors, hs);
+
+ stype = gf_node_get_tag(hs->sensor);
+
+ keynav = gf_scene_get_keynav(gf_node_get_graph(hs->sensor), hs->sensor);
+ if (keynav) gf_sc_change_key_navigator(compositor, keynav);
+ }
+ compositor->grabbed_sensor = 0;
+ /*check if we have grabbed sensors*/
count = gf_list_count(compositor->previous_sensors);
for (i=0; i<count; i++) {
hs = (GF_SensorHandler*)gf_list_get(compositor->previous_sensors, i);
- if (gf_list_find(compositor->sensors, hs) < 0) {
- /*that's a bit ugly but we need coords if pointer out of the shape when sensor grabbed...*/
- if (compositor->grabbed_sensor) {
- hs_grabbed = hs;
- } else {
- hs->OnUserEvent(hs, 0, ev, compositor);
- }
+ res += hs->OnUserEvent(hs, 0, 0, ev, compositor);
+ /*if sensor is grabbed, add it to the list of active sensor for next pick*/
+ if (hs->grabbed) {
+ gf_list_add(compositor->sensors, hs);
+ compositor->grabbed_sensor = 1;
}
+ stype = gf_node_get_tag(hs->sensor);
}
+ gf_list_reset(compositor->previous_sensors);
- count = gf_list_count(compositor->sensors);
- if (!count) stype = GF_CURSOR_NORMAL;
- else {
- for (i=0; i<count; i++) {
- GF_Node *keynav;
- hs = (GF_SensorHandler*)gf_list_get(compositor->sensors, i);
- hs->OnUserEvent(hs, ((hs==hs_grabbed) || !hs_grabbed) ? 1 : 0, ev, compositor);
- stype = gf_node_get_tag(hs->sensor);
- if (hs==hs_grabbed) hs_grabbed = NULL;
-
- keynav = gf_scene_get_keynav(gf_node_get_graph(hs->sensor), hs->sensor);
- if (keynav) gf_sc_change_key_navigator(compositor, keynav);
- }
- }
/*switch sensors*/
tmp = compositor->sensors;
compositor->sensors = compositor->previous_sensors;
compositor->previous_sensors = tmp;
- /*check if we have a grabbed sensor*/
- if (hs_grabbed) {
- hs_grabbed->OnUserEvent(hs_grabbed, 0, ev, compositor);
- gf_list_reset(compositor->previous_sensors);
- gf_list_add(compositor->previous_sensors, hs_grabbed);
- stype = gf_node_get_tag(hs_grabbed->sensor);
- }
-
/*and set cursor*/
if (compositor->sensor_type != GF_CURSOR_COLLIDE) {
switch (stype) {
- case TAG_MPEG4_Anchor:
- stype = GF_CURSOR_ANCHOR;
+ case TAG_MPEG4_Anchor:
+ stype = GF_CURSOR_ANCHOR;
break;
case TAG_MPEG4_PlaneSensor2D:
- case TAG_MPEG4_PlaneSensor:
+ case TAG_MPEG4_PlaneSensor:
stype = GF_CURSOR_PLANE;
break;
- case TAG_MPEG4_CylinderSensor:
+ case TAG_MPEG4_CylinderSensor:
case TAG_MPEG4_DiscSensor:
case TAG_MPEG4_SphereSensor:
- stype = GF_CURSOR_ROTATE;
+ stype = GF_CURSOR_ROTATE;
break;
case TAG_MPEG4_ProximitySensor2D:
case TAG_MPEG4_ProximitySensor:
- stype = GF_CURSOR_PROXIMITY;
+ stype = GF_CURSOR_PROXIMITY;
break;
- case TAG_MPEG4_TouchSensor:
- stype = GF_CURSOR_TOUCH;
+ case TAG_MPEG4_TouchSensor:
+ stype = GF_CURSOR_TOUCH;
break;
#ifndef GPAC_DISABLE_X3D
- case TAG_X3D_Anchor:
- stype = GF_CURSOR_ANCHOR;
+ case TAG_X3D_Anchor:
+ stype = GF_CURSOR_ANCHOR;
break;
- case TAG_X3D_PlaneSensor:
+ case TAG_X3D_PlaneSensor:
stype = GF_CURSOR_PLANE;
break;
- case TAG_X3D_CylinderSensor:
+ case TAG_X3D_CylinderSensor:
case TAG_X3D_SphereSensor:
- stype = GF_CURSOR_ROTATE;
+ stype = GF_CURSOR_ROTATE;
break;
case TAG_X3D_ProximitySensor:
- stype = GF_CURSOR_PROXIMITY;
+ stype = GF_CURSOR_PROXIMITY;
break;
- case TAG_X3D_TouchSensor:
- stype = GF_CURSOR_TOUCH;
+ case TAG_X3D_TouchSensor:
+ stype = GF_CURSOR_TOUCH;
break;
#endif
} else {
gf_sc_reset_collide_cursor(compositor);
}
- if (count) {
+ if (res) {
#if 1
GF_SceneGraph *sg;
- /*apply event cascade - this is needed for cases where several events are processed inbetween
+ /*apply event cascade - this is needed for cases where several events are processed inbetween
2 simultaion tick. If we don't flush the routes stack, the result will likely be wrong
*/
gf_sg_activate_routes(compositor->scene);
}
child = ((GF_ParentNode*)node)->children;
if (hdl) {
- ret++;
- hdl->OnUserEvent(hdl, is_focus_out ? 0 : 1, ev, compositor);
+ ret += hdl->OnUserEvent(hdl, is_focus_out ? 0 : 1, 0, ev, compositor);
} else {
while (child) {
hdl = compositor_mpeg4_get_sensor_handler(child->node);
if (hdl) {
- ret++;
- hdl->OnUserEvent(hdl, is_focus_out ? 0 : 1, ev, compositor);
+ ret += hdl->OnUserEvent(hdl, is_focus_out ? 0 : 1, 0, ev, compositor);
}
child = child->next;
}
#ifndef GPAC_DISABLE_3D
tr_state->layer3d = NULL;
#endif
-
+
/*preprocess text selection and edition*/
if ((ev->type<GF_EVENT_MOUSEWHEEL) && (ev->mouse.button==GF_MOUSE_LEFT)) {
if (compositor->text_selection) {
reset_sel = 1;
}
} else if (compositor->edited_text) {
- if (ev->type==GF_EVENT_MOUSEDOWN)
+ if (ev->type==GF_EVENT_MOUSEDOWN)
reset_sel = 1;
}
if (ev->type==GF_EVENT_MOUSEUP) {
}
#if 0
else if (!compositor->focus_node) {
- gf_sc_focus_switch_ring_ex(compositor, 0, gf_sg_get_root_node(compositor->scene), 1);
+ gf_sc_focus_switch_ring(compositor, 0, gf_sg_get_root_node(compositor->scene), 1);
}
#endif
}
compositor->sel_buffer_len = 0;
gf_sc_next_frame_state(compositor, GF_SC_DRAW_FRAME);
+ compositor->text_edit_changed = 1;
} else if (compositor->store_text_state == GF_SC_TSEL_RELEASED) {
compositor->store_text_state = GF_SC_TSEL_NONE;
}
temp_stack = compositor->prev_hit_use_stack;
compositor->prev_hit_use_stack = compositor->hit_use_stack;
compositor->hit_use_stack = temp_stack;
-
+
tr_state->pick_x = ev->mouse.x;
tr_state->pick_y = ev->mouse.y;
#ifndef GPAC_DISABLE_3D
if (visual->type_3d)
visual_3d_pick_node(visual, tr_state, ev, children);
- else
+ else
#endif
visual_2d_pick_node(visual, tr_state, ev, children);
-
+
gf_list_reset(tr_state->vrml_sensors);
if (exec_text_selection(compositor, ev))
if (tag<=GF_NODE_FIRST_DOM_NODE_TAG) return 0;
#ifndef GPAC_DISABLE_SVG
- count = gf_dom_listener_count(elt);
+ count = gf_dom_listener_count(elt);
for (i=0; i<count; i++) {
GF_FieldInfo info;
GF_Node *l = gf_dom_listener_get(elt, i);
} \
-static void rebuild_focus_ancestor(GF_Compositor *compositor, GF_Node *elt)
+static void rebuild_focus_ancestor(GF_Compositor *compositor, GF_Node *elt)
{
gf_list_reset(compositor->focus_ancestors);
while (elt) {
GF_Node *n;
if (!elt) return NULL;
-
+
/*all return in this function shall be preceeded with gf_node_set_cyclic_traverse_flag(elt, 0)
this ensures that we don't go into cyclic references when moving focus, hence stack overflow*/
- if (! gf_node_set_cyclic_traverse_flag(elt, 1)) return NULL;
+ if (! gf_node_set_cyclic_traverse_flag(elt, 1)) return NULL;
tag = gf_node_get_tag(elt);
if (tag <= GF_NODE_FIRST_DOM_NODE_TAG) {
switch (tag) {
#ifndef GPAC_DISABLE_VRML
-
- case TAG_MPEG4_Group:
- case TAG_MPEG4_Transform:
+ case TAG_MPEG4_Transform:
+ {
+ M_Transform *tr=(M_Transform *)elt;
+ if (!tr->scale.x || !tr->scale.y || !tr->scale.z) {
+ gf_node_set_cyclic_traverse_flag(elt, 0);
+ return NULL;
+ }
+ goto test_grouping;
+ }
+ case TAG_MPEG4_Transform2D:
+ {
+ M_Transform2D *tr=(M_Transform2D *)elt;
+ if (!tr->scale.x || !tr->scale.y) {
+ gf_node_set_cyclic_traverse_flag(elt, 0);
+ return NULL;
+ }
+ goto test_grouping;
+ }
+ case TAG_MPEG4_Layer3D:
+ case TAG_MPEG4_Layer2D:
+ {
+ M_Layer2D *l=(M_Layer2D *)elt;
+ if (!l->size.x || !l->size.y) {
+ gf_node_set_cyclic_traverse_flag(elt, 0);
+ return NULL;
+ }
+ goto test_grouping;
+ }
+ case TAG_MPEG4_Form:
+ case TAG_MPEG4_TransformMatrix2D:
+ case TAG_MPEG4_Group:
case TAG_MPEG4_Billboard:
case TAG_MPEG4_Collision:
- case TAG_MPEG4_LOD:
+ case TAG_MPEG4_LOD:
case TAG_MPEG4_OrderedGroup:
- case TAG_MPEG4_Transform2D:
- case TAG_MPEG4_TransformMatrix2D:
case TAG_MPEG4_ColorTransform:
- case TAG_MPEG4_Layer3D:
- case TAG_MPEG4_Layer2D:
case TAG_MPEG4_PathLayout:
- case TAG_MPEG4_Form:
- case TAG_MPEG4_Anchor:
+ case TAG_MPEG4_Anchor:
#ifndef GPAC_DISABLE_X3D
case TAG_X3D_Group:
case TAG_X3D_Transform:
case TAG_X3D_Billboard:
- case TAG_X3D_Collision:
- case TAG_X3D_LOD:
+ case TAG_X3D_Collision:
+ case TAG_X3D_LOD:
case TAG_X3D_Anchor:
#endif
+
+test_grouping:
if (!current_focus) {
/*get the base grouping stack (*/
BaseGroupingStack *grp = (BaseGroupingStack*)gf_node_get_private(elt);
}
}
break;
- case TAG_MPEG4_Switch:
+ case TAG_MPEG4_Switch:
#ifndef GPAC_DISABLE_X3D
case TAG_X3D_Switch:
#endif
if (tag==TAG_X3D_Switch) {
child = ((X_Switch*)elt)->children;
wc = ((X_Switch*)elt)->whichChoice;
- } else
+ } else
#endif
{
child = ((M_Switch*)elt)->choice;
return NULL;
}
- case TAG_MPEG4_Text:
+ case TAG_MPEG4_Text:
#ifndef GPAC_DISABLE_X3D
case TAG_X3D_Text:
#endif
if (!current_focus) {
M_FontStyle *fs = (M_FontStyle *) ((M_Text *)elt)->fontStyle;
-
+
if (!fs || !fs->style.buffer) return NULL;
- if (!strstr(fs->style.buffer, "editable") && !strstr(fs->style.buffer, "EDITABLE")) return NULL;
- compositor->focus_text_type = 3;
+
+ if (strstr(fs->style.buffer, "editable") || strstr(fs->style.buffer, "EDITABLE")) {
+ compositor->focus_text_type = 3;
+ } else if (strstr(fs->style.buffer, "simple_edit") || strstr(fs->style.buffer, "SIMPLE_EDIT")) {
+ compositor->focus_text_type = 4;
+ } else {
+ return NULL;
+ }
return elt;
}
return NULL;
case TAG_MPEG4_Layout:
+ {
+ M_Layout *l=(M_Layout*)elt;
+ if (!l->size.x || !l->size.y) {
+ gf_node_set_cyclic_traverse_flag(elt, 0);
+ return NULL;
+ }
if (!current_focus && (compositor_mpeg4_layout_get_sensor_handler(elt)!=NULL)) {
gf_node_set_cyclic_traverse_flag(elt, 0);
return elt;
}
+ }
break;
case TAG_ProtoNode:
if (!current_focus) {
/*get the base grouping stack (*/
BaseGroupingStack *grp = (BaseGroupingStack*)gf_node_get_private(elt);
- if (grp && (grp->flags & (GROUP_HAS_SENSORS | GROUP_IS_ANCHOR) ))
+ if (grp && (grp->flags & (GROUP_HAS_SENSORS | GROUP_IS_ANCHOR) )) {
gf_node_set_cyclic_traverse_flag(elt, 0);
return elt;
+ }
}
if ( (gf_node_get_field_by_name(elt, "children", &info) != GF_OK) || (info.fieldType != GF_SG_VRML_MFNODE)) {
gf_node_set_cyclic_traverse_flag(elt, 0);
CALL_SET_FOCUS(gf_node_get_proto_root(elt));
}
break;
-
- case TAG_MPEG4_Inline:
+
+ case TAG_MPEG4_Inline:
#ifndef GPAC_DISABLE_X3D
- case TAG_X3D_Inline:
+ case TAG_X3D_Inline:
#endif
CALL_SET_FOCUS(gf_scene_get_subscene_root(elt));
gf_node_set_cyclic_traverse_flag(elt, 0);
return NULL;
- case TAG_MPEG4_Appearance:
+ case TAG_MPEG4_Appearance:
#ifndef GPAC_DISABLE_X3D
- case TAG_X3D_Appearance:
+ case TAG_X3D_Appearance:
#endif
CALL_SET_FOCUS(((M_Appearance*)elt)->texture);
- case TAG_MPEG4_CompositeTexture2D:
+ case TAG_MPEG4_CompositeTexture2D:
case TAG_MPEG4_CompositeTexture3D:
/*CompositeTextures are not grouping nodes per say*/
child = ((GF_ParentNode*)elt)->children;
count = gf_node_list_get_count(child);
for (i=count; i>0; i--) {
/*get in the subtree*/
- n = gf_node_list_get_child( ((GF_ParentNode *)elt)->children, i-1);
+ n = gf_node_list_get_child( child, i-1);
n = set_focus(compositor, n, 0, 1);
if (n) {
gf_node_set_cyclic_traverse_flag(elt, 0);
if (tag <= GF_NODE_FIRST_DOM_NODE_TAG) {
switch (tag) {
#ifndef GPAC_DISABLE_VRML
- case TAG_MPEG4_Group:
- case TAG_MPEG4_Transform:
- case TAG_MPEG4_Billboard:
- case TAG_MPEG4_Collision:
- case TAG_MPEG4_LOD:
+ case TAG_MPEG4_Group:
+ case TAG_MPEG4_Transform:
+ case TAG_MPEG4_Billboard:
+ case TAG_MPEG4_Collision:
+ case TAG_MPEG4_LOD:
case TAG_MPEG4_OrderedGroup:
case TAG_MPEG4_Transform2D:
case TAG_MPEG4_TransformMatrix2D:
case TAG_MPEG4_Layout:
case TAG_MPEG4_PathLayout:
case TAG_MPEG4_Form:
- case TAG_MPEG4_Anchor:
+ case TAG_MPEG4_Anchor:
#ifndef GPAC_DISABLE_X3D
case TAG_X3D_Anchor:
case TAG_X3D_Group:
case TAG_X3D_Transform:
case TAG_X3D_Billboard:
- case TAG_X3D_Collision:
- case TAG_X3D_LOD:
+ case TAG_X3D_Collision:
+ case TAG_X3D_LOD:
#endif
case TAG_MPEG4_CompositeTexture2D: case TAG_MPEG4_CompositeTexture3D:
child = ((GF_ParentNode*)par)->children;
/*hardcoded proto acting as a grouping node*/
if (gf_node_proto_is_grouping(par)) {
GF_FieldInfo info;
- if ((gf_node_get_field_by_name(par, "children", &info) == GF_OK)
- && (info.fieldType == GF_SG_VRML_MFNODE)
+ if ((gf_node_get_field_by_name(par, "children", &info) == GF_OK)
+ && (info.fieldType == GF_SG_VRML_MFNODE)
) {
child = *(GF_ChildNodeItem **) info.far_ptr;
break;
return browse_parent_for_focus(compositor, (GF_Node*)par, prev_focus);
}
-u32 gf_sc_focus_switch_ring_ex(GF_Compositor *compositor, Bool move_prev, GF_Node *focus, Bool force_focus)
+u32 gf_sc_focus_switch_ring(GF_Compositor *compositor, Bool move_prev, GF_Node *focus, u32 force_focus)
{
Bool current_focus = 1;
Bool prev_uses_dom_events;
compositor->focus_uses_dom_events = 0;
if (!compositor->focus_node) {
- compositor->focus_node = gf_sg_get_root_node(compositor->scene);
+ compositor->focus_node = (force_focus==2) ? focus : gf_sg_get_root_node(compositor->scene);
gf_list_reset(compositor->focus_ancestors);
if (!compositor->focus_node) return 0;
current_focus = 0;
if (force_focus) {
gf_list_reset(compositor->focus_ancestors);
n = focus;
+ if (force_focus==2) {
+ current_focus=0;
+ n = set_focus(compositor, focus, current_focus, move_prev);
+ if (!n) n = browse_parent_for_focus(compositor, focus, move_prev);
+ }
} else {
n = set_focus(compositor, compositor->focus_node, current_focus, move_prev);
if (!n) n = browse_parent_for_focus(compositor, compositor->focus_node, move_prev);
gf_list_reset(compositor->focus_ancestors);
}
}
-
+
if (n && gf_node_get_tag(n)>=GF_NODE_FIRST_DOM_NODE_TAG) {
compositor->focus_uses_dom_events = 1;
}
evt.bubbles = 1;
evt.type = GF_EVENT_FOCUSOUT;
gf_dom_event_fire_ex(prev, &evt, cloned_use);
- }
+ }
#ifndef GPAC_DISABLE_VRML
else {
exec_vrml_key_event(compositor, prev, &ev, 1);
evt.bubbles = 1;
evt.type = GF_EVENT_FOCUSIN;
gf_dom_event_fire_ex(compositor->focus_node, &evt, compositor->focus_use_stack);
- }
+ }
#ifndef GPAC_DISABLE_VRML
else {
exec_vrml_key_event(compositor, NULL, &ev, 0);
}
#endif
}
+ /*because of offscreen caches and composite texture, we must invalidate subtrees of previous and new focus to force a redraw*/
+ if (prev) gf_node_dirty_set(prev, GF_SG_NODE_DIRTY, 1);
+ if (compositor->focus_node) gf_node_dirty_set(compositor->focus_node, GF_SG_NODE_DIRTY, 1);
/*invalidate in case we draw focus rect*/
gf_sc_invalidate(compositor, NULL);
}
if (hit_node_editable(compositor, 1)) {
compositor->text_selection = NULL;
exec_text_input(compositor, NULL);
+ /*invalidate parent graphs*/
+ gf_node_dirty_set(compositor->focus_node, GF_SG_NODE_DIRTY, 1);
}
return ret;
}
-u32 gf_sc_focus_switch_ring(GF_Compositor *compositor, Bool move_prev)
-{
- return gf_sc_focus_switch_ring_ex(compositor, move_prev, NULL, 0);
-}
-
Bool gf_sc_execute_event(GF_Compositor *compositor, GF_TraverseState *tr_state, GF_Event *ev, GF_ChildNodeItem *children)
{
/*filter mouse events and other events (key...)*/
/*if text is no longer edited, this is focus change so process as usual*/
}
/*FIXME - this is not working for mixed docs*/
- if (compositor->focus_uses_dom_events)
+ if (compositor->focus_uses_dom_events)
ret = exec_event_dom(compositor, ev);
#ifndef GPAC_DISABLE_VRML
- else
+ else
ret = exec_vrml_key_event(compositor, compositor->focus_node, ev, 0);
#endif
-
+
if (ev->type==GF_EVENT_KEYDOWN) {
switch (ev->key.key_code) {
case GF_KEY_ENTER:
}
break;
case GF_KEY_TAB:
- ret += gf_sc_focus_switch_ring(compositor, (ev->key.flags & GF_KEY_MOD_SHIFT) ? 1 : 0);
+ ret += gf_sc_focus_switch_ring(compositor, (ev->key.flags & GF_KEY_MOD_SHIFT) ? 1 : 0, NULL, 0);
break;
case GF_KEY_UP:
case GF_KEY_DOWN:
}
break;
}
- }
+ }
return ret;
- }
+ }
/*pick even, call visual handler*/
return visual_execute_event(compositor->visual, tr_state, ev, children);
}
+static Bool forward_event(GF_Compositor *compositor, GF_Event *ev, Bool consumed)
+{
+ Bool ret = gf_term_forward_event(compositor->term, ev, consumed, 0);
+ if (consumed) return 0;
+
+ if ((ev->type==GF_EVENT_MOUSEUP) && (ev->mouse.button==GF_MOUSE_LEFT)) {
+ u32 now;
+ GF_Event event;
+ /*emulate doubleclick*/
+ now = gf_sys_clock();
+ if (now - compositor->last_click_time < DOUBLECLICK_TIME_MS) {
+ event.type = GF_EVENT_DBLCLICK;
+ event.mouse.key_states = compositor->key_states;
+ event.mouse.x = ev->mouse.x;
+ event.mouse.y = ev->mouse.y;
+ ret += gf_term_send_event(compositor->term, &event);
+ }
+ compositor->last_click_time = now;
+ }
+ return ret ? 1 : 0;
+}
+
+
Bool gf_sc_exec_event(GF_Compositor *compositor, GF_Event *evt)
{
+ s32 x, y;
Bool switch_coords=0;
Bool ret=0;
if (evt->type<=GF_EVENT_MOUSEWHEEL) {
if (compositor->visual->center_coords) {
+ x = evt->mouse.x;
+ y = evt->mouse.y;
evt->mouse.x = evt->mouse.x - compositor->display_width/2;
evt->mouse.y = compositor->display_height/2 - evt->mouse.y;
switch_coords=1;
compositor->navigation_state = 0;
ret = 1;
}
+ if (switch_coords) {
+ evt->mouse.x = x;
+ evt->mouse.y = y;
+ }
+ ret += forward_event(compositor, evt, ret);
if (!ret) {
#ifndef GPAC_DISABLE_3D
if ((evt->type==GF_EVENT_MOUSEDOWN) && (evt->mouse.button==GF_MOUSE_LEFT)) compositor->active_layer = compositor->traverse_state->layer3d;
#endif
/*process navigation events*/
- if (compositor->interaction_level & GF_INTERACT_NAVIGATION)
+ if (compositor->interaction_level & GF_INTERACT_NAVIGATION)
ret = compositor_handle_navigation(compositor, evt);
}
- if (switch_coords) {
- evt->mouse.x += compositor->display_width/2;
- evt->mouse.y = compositor->display_height/2 - evt->mouse.y;
- }
return ret;
}
par = n ? kn->sensor : NULL;
if (par) par = gf_node_get_parent(par, 0);
- gf_sc_focus_switch_ring_ex(sr, 0, par, 1);
+ gf_sc_focus_switch_ring(sr, 0, par, 1);
}
#endif
#include <gpac/options.h>
#include "visual_manager.h"
#include "nodes_stacks.h"
-
#include "texturing.h"
struct _gf_ft_mgr
u32 *id_buffer;
u32 id_buffer_size;
+
+ Bool wait_font_load;
};
gf_path_add_line_to(font_mgr->line_path, FIX_ONE/2, -FIX_ONE/2);
gf_path_add_line_to(font_mgr->line_path, -FIX_ONE/2, -FIX_ONE/2);
gf_path_close(font_mgr->line_path);
+
+ opt = gf_cfg_get_key(user->config, "FontEngine", "WaitForFontLoad");
+ if (!opt) gf_cfg_set_key(user->config, "FontEngine", "WaitForFontLoad", "no");
+ if (opt && !strcmp(opt, "yes")) font_mgr->wait_font_load = 1;
+
return font_mgr;
}
}
while (font) {
+ if (fm->wait_font_load && font->not_loaded && !check_only && !stricmp(font->name, font_name)) {
+ GF_Font *a_font = NULL;
+ if (font->get_alias) a_font = font->get_alias(font->udta);
+ if (!a_font || a_font->not_loaded)
+ return font;
+ }
if ((check_only || !font->not_loaded) && font->name && !stricmp(font->name, font_name)) {
s32 fw;
s32 w;
if (glyph->ID==name) return glyph;
glyph = glyph->next;
}
- /*load glyph*/
- if (font->load_glyph) {
- glyph = font->load_glyph(font->udta, name);
+ if (name==GF_CARET_CHAR) {
+ GF_SAFEALLOC(glyph, GF_Glyph);
+ glyph->height = font->ascent;
+ glyph->horiz_advance = 0;
+ glyph->width = 0;
+ glyph->ID = GF_CARET_CHAR;
+ glyph->path = gf_path_new();
+ gf_path_add_move_to(glyph->path, 0, INT2FIX(font->descent));
+ gf_path_add_line_to(glyph->path, 0, INT2FIX(font->ascent));
+ gf_path_add_line_to(glyph->path, 1, INT2FIX(font->ascent));
+ gf_path_add_line_to(glyph->path, 1, INT2FIX(font->descent));
+ gf_path_close(glyph->path);
+ glyph->utf_name=0;
+ } else if (name==(u32) '\n') {
+ GF_SAFEALLOC(glyph, GF_Glyph);
+ glyph->height = font->ascent;
+ glyph->horiz_advance = 0;
+ glyph->width = 0;
+ glyph->ID = name;
+ glyph->utf_name=name;
} else {
- if (!fm->reader) return NULL;
-// fm->reader->set_font(fm->reader, font->name, font->styles);
- glyph = fm->reader->load_glyph(fm->reader, name);
+ /*load glyph*/
+ if (font->load_glyph) {
+ glyph = font->load_glyph(font->udta, name);
+ } else {
+ if (!fm->reader) return NULL;
+ // fm->reader->set_font(fm->reader, font->name, font->styles);
+ glyph = fm->reader->load_glyph(fm->reader, name);
+ }
}
if (!glyph) return NULL;
a_glyph->next = glyph;
}
/*space character - this may need adjustment for other empty glyphs*/
- if (!glyph->path->n_points) {
+ if (glyph->path && !glyph->path->n_points) {
glyph->path->bbox.x = 0;
glyph->path->bbox.width = INT2FIX(font->max_advance_h);
glyph->path->bbox.y = INT2FIX(font->ascent);
if (span->rot) {
gf_mx2d_add_rotation(&mx, 0, 0, -span->rot[i]);
}
+ if (span->glyphs[i]->ID==GF_CARET_CHAR) {
+ gf_mx2d_add_scale(&mx, mat.m[0], FIX_ONE);
+ }
gf_mx2d_add_translation(&mx, dx, dy);
gf_path_add_subpath(path, span->glyphs[i]->path, &mx);
}
#endif
-
-
static void gf_font_span_draw_2d(GF_TraverseState *tr_state, GF_TextSpan *span, DrawableContext *ctx, GF_Rect *bounds)
{
u32 flags, i;
}
continue;
}
- ctx->transform.m[0] = sx;
+ if (span->glyphs[i]->ID==GF_CARET_CHAR) {
+ if (tr_state->visual->compositor->show_caret) {
+ ctx->transform.m[0] = FIX_ONE;
+ } else {
+ continue;
+ }
+ } else {
+ ctx->transform.m[0] = sx;
+ }
ctx->transform.m[4] = flip_text ? -sy : sy;
ctx->transform.m[1] = ctx->transform.m[3] = 0;
ctx->transform.m[2] = span->dx ? span->dx[i] : dx;
void gf_font_spans_pick(GF_Node *node, GF_List *spans, GF_TraverseState *tr_state, GF_Rect *node_bounds, Bool use_dom_events, Drawable *drawable)
{
- u32 i, count, j;
+ u32 i, count, j, glyph_idx;
Fixed dx, dy;
#ifndef GPAC_DISABLE_3D
GF_Matrix inv_mx;
continue;
}
+ glyph_idx = 0;
dx = span->off_x;
dy = span->off_y;
for (j=0; j<span->nb_glyphs; j++) {
}
continue;
}
+ else if (span->glyphs[j]->ID==GF_CARET_CHAR) {
+ continue;
+ }
+ glyph_idx++;
loc_x = x - (span->dx ? span->dx[j] : dx);
loc_y = y - (span->dy ? span->dy[j] : dy);
gf_mx2d_apply_coords(&r, &loc_x, &loc_y);
}
- if (use_dom_events) {
+ if (use_dom_events && !compositor->sel_buffer) {
if (svg_drawable_is_over(drawable, loc_x, loc_y, &asp, tr_state, &rc))
goto picked;
} else {
} else {
compositor->start_sel = compositor->end_sel;
}
+ compositor->picked_span_idx = i;
+ compositor->picked_glyph_idx = glyph_idx;
compositor->hit_text = tr_state->text_parent;
compositor->hit_use_dom_events = use_dom_events;
#error "OpenGL ES defined without fixed-point support - unsupported."
#endif
-#ifdef ANDROID
+#ifdef GPAC_ANDROID
#include "GLES/gl.h"
#else
#include "GLES/egl.h"
#include <GLES/glu.h>
#endif
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
+#endif
+
+#ifndef EGL_VERSION_1_1
+#ifdef GL_OES_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#endif
+#endif
+
#elif defined (CONFIG_DARWIN_GL)
#include <OpenGL/gl.h>
#else
+#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#ifdef GPAC_HAS_GLU
#endif
+#define GL_CHECK_ERR {s32 res = glGetError(); if (res) fprintf(stdout, "GL Error %d file %s line %d\n", res, __FILE__, __LINE__); }
+
+/*macros for GL proto and fun declaration*/
+#ifdef _WIN32_WCE
+#define GLAPICAST *
+#elif defined(WIN32)
+#include <windows.h>
+#define GLAPICAST APIENTRY *
+#else
+#define GLAPICAST *
+#endif
+
+#define GLDECL(ret, funname, args) \
+typedef ret (GLAPICAST proc_ ## funname)args; \
+extern proc_ ## funname funname; \
+
+#define GLDECL_STATIC(funname) proc_ ## funname funname = NULL
+
+#if defined GPAC_USE_TINYGL
+//no extensions with TinyGL
+#elif defined (GPAC_USE_OGL_ES)
+//no extensions with OpenGL ES
+#elif defined (GPAC_CONFIG_WIN32)
+#define LOAD_GL_FUNCS
+#define GET_GLFUN(funname) funname = (proc_ ## funname) wglGetProcAddress(#funname)
+#elif defined(CONFIG_DARWIN_GL)
+extern void (*glutGetProcAddress(const GLubyte *procname))( void );
+#define GET_GLFUN(funname) funname = (proc_ ## funname) glutGetProcAddress(#funname)
+#else
+#define LOAD_GL_FUNCS
+extern void (*glXGetProcAddress(const GLubyte *procname))( void );
+#define GET_GLFUN(funname) funname = (proc_ ## funname) glXGetProcAddress(#funname)
+#endif
+
+
+#if !defined(GPAC_USE_OGL_ES)
+
/*redefine all ext needed*/
/*BGRA pixel format*/
#define GL_RGBDS 0x1910
#endif
-#ifndef GL_TEXTURE0_ARB
-
-#define GL_TEXTURE0_ARB 0x84C0
-#define GL_TEXTURE1_ARB 0x84C1
-#define GL_TEXTURE2_ARB 0x84C2
-#define GL_TEXTURE3_ARB 0x84C3
-#define GL_TEXTURE4_ARB 0x84C4
-#define GL_TEXTURE5_ARB 0x84C5
-#define GL_TEXTURE6_ARB 0x84C6
-#define GL_TEXTURE7_ARB 0x84C7
-#define GL_TEXTURE8_ARB 0x84C8
-#define GL_TEXTURE9_ARB 0x84C9
-#define GL_TEXTURE10_ARB 0x84CA
-#define GL_TEXTURE11_ARB 0x84CB
-#define GL_TEXTURE12_ARB 0x84CC
-#define GL_TEXTURE13_ARB 0x84CD
-#define GL_TEXTURE14_ARB 0x84CE
-#define GL_TEXTURE15_ARB 0x84CF
-#define GL_TEXTURE16_ARB 0x84D0
-#define GL_TEXTURE17_ARB 0x84D1
-#define GL_TEXTURE18_ARB 0x84D2
-#define GL_TEXTURE19_ARB 0x84D3
-#define GL_TEXTURE20_ARB 0x84D4
-#define GL_TEXTURE21_ARB 0x84D5
-#define GL_TEXTURE22_ARB 0x84D6
-#define GL_TEXTURE23_ARB 0x84D7
-#define GL_TEXTURE24_ARB 0x84D8
-#define GL_TEXTURE25_ARB 0x84D9
-#define GL_TEXTURE26_ARB 0x84DA
-#define GL_TEXTURE27_ARB 0x84DB
-#define GL_TEXTURE28_ARB 0x84DC
-#define GL_TEXTURE29_ARB 0x84DD
-#define GL_TEXTURE30_ARB 0x84DE
-#define GL_TEXTURE31_ARB 0x84DF
-#define GL_ACTIVE_TEXTURE_ARB 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
-#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
+#ifndef GL_TEXTURE_RECTANGLE_NV
+#define GL_TEXTURE_RECTANGLE_NV 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
+#endif
+
+#ifndef GL_POINT_SIZE_MIN_EXT
+#define GL_POINT_SIZE_MIN_EXT 0x8126
+#define GL_POINT_SIZE_MAX_EXT 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
+#define GL_DISTANCE_ATTENUATION_EXT 0x8129
+#endif
+
+
+#ifndef GL_VERSION_1_3
+
+#ifdef LOAD_GL_FUNCS
+#define LOAD_GL_1_3
+#endif
+
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
#define GL_EXT_abgr 1
#define GL_EXT_blend_color 1
#define GL_EXT_blend_minmax 1
#define GL_OPERAND1_ALPHA_EXT 0x8599
#define GL_OPERAND2_ALPHA_EXT 0x859A
-#endif
-
#ifndef GL_LOGIC_OP
#define GL_LOGIC_OP GL_INDEX_LOGIC_OP
#endif
#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT
#endif
-#ifndef COMBINE_RGB_ARB
-#define COMBINE_RGB_ARB 0x8571
-#define COMBINE_ALPHA_ARB 0x8572
-#define INTERPOLATE_ARB 0x8575
-#define COMBINE_ARB 0x8570
-#define SOURCE0_RGB_ARB 0x8580
-#define SOURCE1_RGB_ARB 0x8581
-#define SOURCE2_RGB_ARB 0x8582
-#define GL_INTERPOLATE_ARB 0x8575
-#define GL_OPERAND0_RGB_ARB 0x8590
-#define GL_OPERAND1_RGB_ARB 0x8591
-#define GL_OPERAND2_RGB_ARB 0x8592
-#define GL_OPERAND0_ALPHA_ARB 0x8598
-#define GL_OPERAND1_ALPHA_ARB 0x8599
-#define GL_ADD_SIGNED_ARB 0x8574
-#define GL_SUBTRACT_ARB 0x84E7
-#define GL_SOURCE0_ALPHA_ARB 0x8588
-#define GL_SOURCE1_ALPHA_ARB 0x8589
-#define GL_SOURCE2_ALPHA_ARB 0x858A
-#endif
-
-#ifndef GL_NV_texture_rectangle
-#define GL_TEXTURE_RECTANGLE_NV 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
+
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_INTERPOLATE 0x8575
+#define GL_COMBINE 0x8570
+#define GL_SOURCE0_RGB 0x8580
+#define GL_SOURCE1_RGB 0x8581
+#define GL_SOURCE2_RGB 0x8582
+#define GL_INTERPOLATE 0x8575
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_ADD_SIGNED 0x8574
+#define GL_SUBTRACT 0x84E7
+#define GL_SOURCE0_ALPHA 0x8588
+#define GL_SOURCE1_ALPHA 0x8589
+#define GL_SOURCE2_ALPHA 0x858A
+
+
+GLDECL(void, glActiveTexture, (GLenum texture) )
+GLDECL(void, glClientActiveTexture, (GLenum texture) )
+
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_STATIC_DRAW 0x88E4
+
+GLDECL(void, glGenBuffers, (GLsizei , GLuint *) )
+GLDECL(void, glDeleteBuffers, (GLsizei , GLuint *) )
+GLDECL(void, glBindBuffer, (GLenum, GLuint ) )
+GLDECL(void, glBufferData, (GLenum, int, void *, GLenum) )
+
+#endif //GL_VERSION_1_3
+
+
+
+#ifndef GL_VERSION_1_4
+
+#ifdef LOAD_GL_FUNCS
+#define LOAD_GL_1_4
+#endif
+
+#define FUNC_ADD_EXT 0x8006
+#define MIN_EXT 0x8007
+#define MAX_EXT 0x8008
+#define BLEND_EQUATION_EXT 0x8009
+#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
+
+
+GLDECL(void, glBlendEquation, (GLint mode) )
+GLDECL(void, glPointParameterf, (GLenum , GLfloat) )
+GLDECL(void, glPointParameterfv, (GLenum, const GLfloat *) )
+
+#endif
+
+
+#ifndef GL_VERSION_2_0
+
+#ifdef LOAD_GL_FUNCS
+#define LOAD_GL_2_0
#endif
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
+#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_POINT_SPRITE 0x8861
+#define GL_COORD_REPLACE 0x8862
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_MAX_TEXTURE_COORDS 0x8871
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_MAX_VARYING_FLOATS 0x8B4B
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_1D 0x8B5D
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_SAMPLER_1D_SHADOW 0x8B61
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_DELETE_STATUS 0x8B80
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
+#define GL_LOWER_LEFT 0x8CA1
+#define GL_UPPER_LEFT 0x8CA2
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+
+
+GLDECL(GLuint, glCreateProgram, (void) )
+GLDECL(void, glDeleteProgram, (GLuint ) )
+GLDECL(void, glLinkProgram, (GLuint program) )
+GLDECL(void, glUseProgram, (GLuint program) )
+GLDECL(GLuint, glCreateShader, (GLenum shaderType) )
+GLDECL(void, glDeleteShader, (GLuint shader) )
+GLDECL(void, glShaderSource, (GLuint shader, GLsizei count, const char **string, const GLint *length) )
+GLDECL(void, glCompileShader, (GLuint shader) )
+GLDECL(void, glAttachShader, (GLuint program, GLuint shader) )
+GLDECL(void, glDetachShader, (GLuint program, GLuint shader) )
+GLDECL(void, glGetShaderiv, (GLuint shader, GLenum type, GLint *res) )
+GLDECL(void, glGetInfoLogARB, (GLuint shader, GLint size, GLsizei *rsize, const char *logs) )
+GLDECL(GLint, glGetUniformLocation, (GLuint prog, const char *name) )
+GLDECL(void, glUniform1f, (GLint location, GLfloat v0) )
+GLDECL(void, glUniform2f, (GLint location, GLfloat v0, GLfloat v1) )
+GLDECL(void, glUniform3f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) )
+GLDECL(void, glUniform4f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) )
+GLDECL(void, glUniform1i, (GLint location, GLint v0) )
+GLDECL(void, glUniform2i, (GLint location, GLint v0, GLint v1) )
+GLDECL(void, glUniform3i, (GLint location, GLint v0, GLint v1, GLint v2) )
+GLDECL(void, glUniform4i, (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) )
+GLDECL(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat *value) )
+GLDECL(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat *value) )
+GLDECL(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat *value) )
+GLDECL(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat *value) )
+GLDECL(void, glUniform1iv, (GLint location, GLsizei count, const GLint *value) )
+GLDECL(void, glUniform2iv, (GLint location, GLsizei count, const GLint *value) )
+GLDECL(void, glUniform3iv, (GLint location, GLsizei count, const GLint *value) )
+GLDECL(void, glUniform4iv, (GLint location, GLsizei count, const GLint *value) )
+GLDECL(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix2x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) )
+GLDECL(void, glUniformMatrix3x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix2x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix4x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix3x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+GLDECL(void, glUniformMatrix4x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) )
+
+
+
+#endif //GL_VERSION_2_0
+
+#endif //GPAC_USE_OGL_ES
#endif /*GPAC_DISABLE_3D*/
BASE_NODE
CHILDREN
- Bool offscreen;
+ s32 offscreen;
Fixed opacity;
} OffscreenGroup;
#endif
OffscreenGroup og;
+ Bool detached;
} OffscreenGroupStack;
static Bool OffscreenGroup_GetNode(GF_Node *node, OffscreenGroup *og)
og->children = *(GF_ChildNodeItem **) field.far_ptr;
if (gf_node_get_field(node, 1, &field) != GF_OK) return 0;
- if (field.fieldType != GF_SG_VRML_SFBOOL) return 0;
- og->offscreen = * (SFBool *) field.far_ptr;
+ if (field.fieldType != GF_SG_VRML_SFINT32) return 0;
+ og->offscreen = * (SFInt32 *) field.far_ptr;
if (gf_node_get_field(node, 2, &field) != GF_OK) return 0;
if (field.fieldType != GF_SG_VRML_SFFLOAT) return 0;
}
if (tr_state->traversing_mode==TRAVERSE_SORT) {
- if (gf_node_dirty_get(node) & GF_SG_NODE_DIRTY) {
+ if (!stack->detached && (gf_node_dirty_get(node) & GF_SG_NODE_DIRTY)) {
OffscreenGroup_GetNode(node, &stack->og);
if (stack->og.offscreen) {
gf_node_dirty_set(node, GF_SG_CHILD_DIRTY, 0);
}
if (stack->cache) {
- group_cache_traverse((GF_Node *)&stack->og, stack->cache, tr_state, stack->cache->force_recompute, 1);
- gf_node_dirty_clear(node, GF_SG_CHILD_DIRTY);
+ if (stack->detached)
+ gf_node_dirty_clear(node, GF_SG_CHILD_DIRTY);
+
+ tr_state->subscene_not_over = 0;
+ group_cache_traverse((GF_Node *)&stack->og, stack->cache, tr_state, stack->cache->force_recompute, 1, stack->detached ? 1 : 0);
+
+ if (gf_node_dirty_get(node)) {
+ gf_node_dirty_clear(node, GF_SG_CHILD_DIRTY);
+ } else if ((stack->og.offscreen==2) && !stack->detached && !tr_state->subscene_not_over && stack->cache->txh.width && stack->cache->txh.height) {
+ GF_FieldInfo field;
+ if (gf_node_get_field(node, 0, &field) == GF_OK) {
+ gf_node_unregister_children(node, *(GF_ChildNodeItem **) field.far_ptr);
+ *(GF_ChildNodeItem **) field.far_ptr = NULL;
+ stack->detached = 1;
+ }
+ if (gf_node_get_field(node, 3, &field) == GF_OK) {
+ *(SFBool *) field.far_ptr = 1;
+ //gf_node_event_out(node, 3);
+ }
+ }
} else {
group_2d_traverse((GF_Node *)&stack->og, (GroupingNode2D*)stack, tr_state);
}
/*draw it*/
group_cache_draw(stack->cache, tr_state);
gf_node_dirty_clear(node, GF_SG_CHILD_DIRTY);
- } else {
+ } else if (!stack->detached) {
group_2d_traverse((GF_Node *)&stack->og, (GroupingNode2D*)stack, tr_state);
+ } else {
+ if (tr_state->traversing_mode == TRAVERSE_GET_BOUNDS) {
+ tr_state->bounds = stack->bounds;
+ }
+ else if (tr_state->traversing_mode == TRAVERSE_PICK) {
+ vrml_drawable_pick(stack->cache->drawable, tr_state);
+ }
}
}
camera_invalidate(tr_state->camera);
tr_state->camera->is_3D=0;
- camera_update(tr_state->camera, NULL, 1);
+ camera_update(tr_state->camera, NULL, 1, 0, 0, 0, GF_3D_CAMERA_STRAIGHT);
if (tr_state->traversing_mode == TRAVERSE_SORT) {
#ifndef GPAC_DISABLE_3D
-/*for GPAC_HAS_GLU*/
+/*for GPAC_HAS_GLU and glDeleteBuffersARB */
#include "gl_inc.h"
/*when highspeeds, amount of subdivisions for bezier and ellipse will be devided by this factor*/
mesh->aabb_root = NULL;
if (mesh->aabb_indices) gf_free(mesh->aabb_indices);
mesh->aabb_indices = NULL;
+
+
+ if (mesh->vbo) {
+ glDeleteBuffers(1, &mesh->vbo);
+ mesh->vbo = 0;
+ }
}
void mesh_free(GF_Mesh *mesh)
if (!st) return;
/*MPEG4 spec is not clear about that , so this is not forbidden*/
- if (st->input.is_open&& st->input.is_open) {
- if (gf_sc_audio_check_url(&st->input, &as->url)) {
- gf_sc_audio_stop(&st->input);
- gf_sc_audio_open(&st->input, &as->url, 0, -1);
- /*force unregister to resetup audio cfg*/
- gf_sc_audio_unregister(&st->input);
- gf_sc_invalidate(st->input.compositor, NULL);
- }
+ if (gf_sc_audio_check_url(&st->input, &as->url)) {
+ if (st->input.is_open) gf_sc_audio_stop(&st->input);
+ /*force unregister to resetup audio cfg*/
+ gf_sc_audio_unregister(&st->input);
+ gf_sc_invalidate(st->input.compositor, NULL);
+
+ if (st->is_active) gf_sc_audio_open(&st->input, &as->url, 0, -1);
}
//update state if we're active
st = (BackgroundStack *) gf_node_get_private(node);
compositor = (GF_Compositor*)st->compositor;
-
- assert(tr_state->backgrounds);
+
+ /*may happen in get_bounds*/
+ if (!tr_state->backgrounds) return;
/*first traverse, bound if needed*/
if (gf_list_find(tr_state->backgrounds, node) < 0) {
static void DrawBackground2D_2D(DrawableContext *ctx, GF_TraverseState *tr_state)
{
-
- Background2DStack *stack = (Background2DStack *) gf_node_get_private(ctx->drawable->node);
+ Background2DStack *stack;
+ if (!ctx || !ctx->drawable || !ctx->drawable->node) return;
+ stack = (Background2DStack *) gf_node_get_private(ctx->drawable->node);
if (!ctx->bi->clip.width || !ctx->bi->clip.height) return;
visual_3d_matrix_push(tr_state->visual);
/* visual_3d_set_matrix_mode(tr_state->visual, V3D_MATRIX_TEXTURE);
- gf_sc_texture_get_transform(&st->txh, NULL, &mx);
+ gf_sc_texture_get_transform(&st->txh, NULL, &mx, 0);
visual_3d_matrix_load(tr_state->visual, mx.m);
*/
visual_3d_set_matrix_mode(tr_state->visual, V3D_MATRIX_MODELVIEW);
/*first traverse, bound if needed*/
if (gf_list_find(tr_state->backgrounds, node) < 0) {
+ M_Background2D *top_bck = (M_Background2D *)node;
gf_list_add(tr_state->backgrounds, node);
assert(gf_list_find(stack->reg_stacks, tr_state->backgrounds)==-1);
gf_list_add(stack->reg_stacks, tr_state->backgrounds);
b2D_new_status(stack, bck);
/*only bound if we're on top*/
- if (gf_list_get(tr_state->backgrounds, 0) == bck) {
- if (!bck->isBound) {
+ top_bck = gf_list_get(tr_state->backgrounds, 0);
+ if (!bck->isBound) {
+ if (top_bck== bck) {
Bindable_SetIsBound(node, 1);
+ } else if (!top_bck->isBound) {
+ bck->set_bind = 1;
+ bck->on_set_bind(node, NULL);
}
}
/*open the stream if any*/
gf_node_set_callback_function(node, TraverseBitmap);
}
-#endif
\ No newline at end of file
+#endif
+
+#include <gpac/internal/scenegraph_dev.h>
+
#include "nodes_stacks.h"
#include "visual_manager.h"
#include "texturing.h"
/*the visual object handling the texture*/
GF_VisualManager *visual;
Bool first, unsupported;
- GF_List *sensors, *previous_sensors;
+ GF_List *sensors, *previous_sensors, *temp_sensors, *temp_previous_sensors;
GF_Node *prev_hit_appear;
#ifdef GPAC_USE_TINYGL
#endif
} CompositeTextureStack;
+
+static Bool composite2d_draw_bitmap(GF_VisualManager *visual, GF_TraverseState *tr_state, struct _drawable_context *ctx, GF_ColorKey *col_key)
+{
+ u8 alpha = 0xFF;
+ GF_VideoSurface offscreen_dst, video_src;
+ GF_Window src_wnd, dst_wnd;
+ Bool use_blit, has_scale;
+ CompositeTextureStack *st;
+
+ if (visual->compositor->disable_composite_blit) return 0;
+
+ if (!ctx->aspect.fill_texture) return 1;
+ if (ctx->transform.m[0]<0) return 0;
+ if (ctx->transform.m[4]<0) {
+ if (!(ctx->flags & CTX_FLIPED_COORDS)) return 0;
+ } else {
+ if (ctx->flags & CTX_FLIPED_COORDS) return 0;
+ }
+ if (ctx->transform.m[1] || ctx->transform.m[3]) return 0;
+#ifndef GPAC_DISABLE_VRML
+ if ((ctx->flags & CTX_HAS_APPEARANCE) && ctx->appear && ((M_Appearance*)ctx->appear)->textureTransform)
+ return 0;
+#endif
+
+ alpha = GF_COL_A(ctx->aspect.fill_color);
+ /*THIS IS A HACK, will not work when setting filled=0, transparency and XLineProps*/
+ if (!alpha) alpha = GF_COL_A(ctx->aspect.line_color);
+ if (!alpha) return 1;
+
+ st = (CompositeTextureStack *) gf_node_get_private(visual->offscreen);
+
+ if (!compositor_texture_rectangles(visual, ctx->aspect.fill_texture, &ctx->bi->clip, &ctx->bi->unclip, &src_wnd, &dst_wnd, &use_blit, &has_scale)) return 1;
+
+ video_src.height = ctx->aspect.fill_texture->height;
+ video_src.width = ctx->aspect.fill_texture->width;
+ video_src.pitch_x = 0;
+ video_src.pitch_y = ctx->aspect.fill_texture->stride;
+ video_src.pixel_format = ctx->aspect.fill_texture->pixelformat;
+#ifdef GF_SR_USE_DEPTH
+ if (ctx->aspect.fill_texture->pixelformat==GF_PIXEL_YUVD) video_src.pixel_format = GF_PIXEL_YV12;
+#endif
+ video_src.video_buffer = ctx->aspect.fill_texture->data;
+
+ memset(&offscreen_dst, 0, sizeof(GF_VideoSurface));
+ offscreen_dst.width = st->txh.width;
+ offscreen_dst.height = st->txh.height;
+ offscreen_dst.pitch_y = st->txh.stride;
+ offscreen_dst.pixel_format = st->txh.pixelformat;
+ offscreen_dst.video_buffer = st->txh.data;
+
+ gf_stretch_bits(&offscreen_dst, &video_src, &dst_wnd, &src_wnd, alpha, 0, col_key, ctx->col_mat);
+ return 1;
+}
+
static void composite_traverse(GF_Node *node, void *rs, Bool is_destroy)
{
if (is_destroy) {
return;
}
*/
- if (!gf_node_dirty_get(txh->owner)) {
+ if (!compositor->rebuild_offscreen_textures && (!compositor->text_edit_changed || !st->visual->has_text_edit ) && !gf_node_dirty_get(txh->owner)) {
txh->needs_refresh = 0;
return;
}
#endif
-
/*FIXME - we assume RGB+Depth+bitshape, we should check with the video out module*/
#if defined(GF_SR_USE_DEPTH) && !defined(GPAC_DISABLE_3D)
- if (st->visual->type_3d) new_pixel_format = GF_PIXEL_RGBDS;
+ if (st->visual->type_3d && (compositor->video_out->hw_caps & GF_VIDEO_HW_HAS_DEPTH) ) new_pixel_format = GF_PIXEL_RGBDS;
#endif
w = ((M_CompositeTexture2D*)txh->owner)->pixelWidth;
h = ((M_CompositeTexture2D*)txh->owner)->pixelHeight;
}
+
+ /*internal GPAC hacks for testing color spaces*/
+ if (w<-1) {
+ w = -w;
+ if (h<0) {
+ h = -h;
+ if (new_pixel_format==GF_PIXEL_RGBA) {
+ new_pixel_format=GF_PIXEL_ARGB;
+ } else {
+ new_pixel_format=GF_PIXEL_BGR_24;
+ }
+ } else {
+ if (new_pixel_format==GF_PIXEL_RGB_24) {
+ new_pixel_format=GF_PIXEL_RGB_32;
+ }
+ }
+ }
+ else if (h<-1) {
+ h = -h;
+ if (new_pixel_format==GF_PIXEL_RGB_24) {
+ new_pixel_format=GF_PIXEL_RGB_32;
+ }
+ }
+
if (w<0) w = 0;
if (h<0) h = 0;
+
if (!w || !h) {
if (txh->tx_io) {
#ifdef GPAC_USE_TINYGL
}
return;
}
- invalidate_all = 0;
+ invalidate_all = compositor->rebuild_offscreen_textures;
/*rebuild stencil*/
if (!txh->tx_io
gf_sc_texture_allocate(txh);
txh->pixelformat = new_pixel_format;
- if (new_pixel_format==GF_PIXEL_RGBA) {
+ switch (new_pixel_format) {
+ case GF_PIXEL_RGBA:
+ case GF_PIXEL_ARGB:
txh->stride = txh->width * 4;
txh->transparent = 1;
- } else if (new_pixel_format==GF_PIXEL_RGB_565) {
+ break;
+ case GF_PIXEL_RGB_565:
txh->stride = txh->width * 2;
txh->transparent = 0;
- } else if (new_pixel_format==GF_PIXEL_RGBDS) {
- txh->stride = txh->width * 4;
- txh->transparent = 1;
- }
- /*RGB24*/
- else {
+ break;
+ case GF_PIXEL_RGBDS:
+ txh->stride = txh->width * 4;
+ txh->transparent = 1;
+ break;
+ case GF_PIXEL_RGB_24:
txh->stride = txh->width * 3;
txh->transparent = 0;
+ break;
}
st->visual->width = txh->width;
txh->needs_refresh = visual_draw_frame(st->visual, st->txh.owner, tr_state, 0);
txh->transparent = (st->visual->last_had_back==2) ? 0 : 1;
- /*remove any GL_FLIP flag*/
- txh->flags &= ~GF_SR_TEXTURE_NO_GL_FLIP;
+
+
+ if (!compositor->edited_text && st->visual->has_text_edit)
+ st->visual->has_text_edit = 0;
+
/*set active viewport in image coordinates top-left=(0, 0), not in BIFS*/
if (0 && gf_list_count(st->visual->view_stack)) {
st->visual->GetSurfaceAccess = composite_get_video_access;
st->visual->ReleaseSurfaceAccess = composite_release_video_access;
st->visual->raster_surface = compositor->rasterizer->surface_new(compositor->rasterizer, 1);
+ st->visual->DrawBitmap = composite2d_draw_bitmap;
st->first = 1;
st->visual->compositor = compositor;
Bool compositor_compositetexture_handle_event(GF_Compositor *compositor, GF_Node *composite_appear, GF_Event *ev, Bool is_flush)
{
- SFVec3f point;
GF_Ray ray;
Fixed dist;
+ Bool had_text_sel=0;
GF_Matrix mx;
GF_TraverseState *tr_state;
GF_ChildNodeItem *children, *l;
Bool res;
- u32 flags;
- SFVec3f txcoord;
+ SFVec3f txcoord, loc_pt, world_pt;
+ GF_Matrix l2w_mx, w2l_mx;
CompositeTextureStack *stack;
- GF_List *tmp1, *tmp2;
GF_Node *appear, *prev_appear;
M_Appearance *ap = (M_Appearance *)composite_appear;
assert(ap && ap->texture);
tr_state = NULL;
children = NULL;
+
if (!is_flush) {
txcoord.x = compositor->hit_texcoords.x;
txcoord.y = compositor->hit_texcoords.y;
txcoord.z = 0;
- flags = stack->txh.flags;
- stack->txh.flags |= GF_SR_TEXTURE_NO_GL_FLIP;
- if (gf_sc_texture_get_transform(&stack->txh, ap->textureTransform, &mx)) {
+ if (gf_sc_texture_get_transform(&stack->txh, ap->textureTransform, &mx, 1)) {
/*tx coords are inverted when mapping, thus applying directly the matrix will give us the
untransformed coords*/
gf_mx_apply_vec(&mx, &txcoord);
while (txcoord.x<0) txcoord.x += FIX_ONE; while (txcoord.x>FIX_ONE) txcoord.x -= FIX_ONE;
while (txcoord.y<0) txcoord.y += FIX_ONE; while (txcoord.y>FIX_ONE) txcoord.y -= FIX_ONE;
}
- stack->txh.flags = flags;
+
/*convert to tx space*/
ev->mouse.x = FIX2INT( (txcoord.x - FIX_ONE/2) * stack->visual->width + FIX_ONE/2);
ev->mouse.y = FIX2INT( (txcoord.y - FIX_ONE/2) * stack->visual->height + FIX_ONE/2);
}
}
- tmp1 = compositor->sensors;
- tmp2 = compositor->previous_sensors;
+ stack->temp_sensors = compositor->sensors;
+ stack->temp_previous_sensors = compositor->previous_sensors;
compositor->sensors = stack->sensors;
compositor->previous_sensors = stack->previous_sensors;
- point = compositor->hit_world_point;
ray = compositor->hit_world_ray;
dist = compositor->hit_square_dist;
prev_appear = compositor->prev_hit_appear;
+
+ /*protect against destrucion in case of self-destroy*/
+ if (prev_appear) {
+ gf_node_register(prev_appear, NULL);
+ }
compositor->prev_hit_appear = stack->prev_hit_appear;
appear = compositor->hit_appear;
compositor->hit_appear = NULL;
+ /*also backup current hit state in case we hit a node in the texture but don't consume the event*/
+ loc_pt = compositor->hit_local_point;
+ world_pt = compositor->hit_world_point;
+ gf_mx_copy(l2w_mx, compositor->hit_local_to_world);
+ gf_mx_copy(w2l_mx, compositor->hit_world_to_local);
+
+ if (compositor->text_selection) had_text_sel=1;
+
if (is_flush) {
res = 0;
gf_list_reset(stack->sensors);
res = visual_execute_event(stack->visual, tr_state, ev, children);
}
+ if (!had_text_sel && compositor->edited_text) {
+ stack->visual->has_text_edit = 1;
+ } else if (!compositor->text_selection) {
+ stack->visual->has_text_edit = 0;
+ }
+
+ if (!res) {
+ compositor->hit_local_point = loc_pt;
+ gf_mx_copy(compositor->hit_local_to_world, l2w_mx);
+ gf_mx_copy(compositor->hit_world_to_local, w2l_mx);
+ }
+
stack->prev_hit_appear = compositor->prev_hit_appear;
- compositor->prev_hit_appear = prev_appear;
- compositor->hit_appear = appear;
- compositor->hit_world_point = point;
+ if (prev_appear) {
+ if (prev_appear->sgprivate->num_instances>1) {
+ compositor->prev_hit_appear = prev_appear;
+ compositor->hit_appear = appear;
+ } else {
+ compositor->prev_hit_appear = NULL;
+ compositor->hit_appear = NULL;
+ }
+ gf_node_unregister(prev_appear, NULL);
+ } else {
+ compositor->prev_hit_appear = prev_appear;
+ compositor->hit_appear = appear;
+ }
+
+ compositor->hit_world_point = world_pt;
compositor->hit_world_ray = ray;
compositor->hit_square_dist = dist;
stack->sensors = compositor->sensors;
stack->previous_sensors = compositor->previous_sensors;
- compositor->sensors = tmp1;
- compositor->previous_sensors = tmp2;
+ compositor->sensors = stack->temp_sensors;
+ stack->temp_sensors = NULL;
+ compositor->previous_sensors = stack->temp_previous_sensors;
+ stack->temp_previous_sensors = NULL;
if (!is_flush) {
CompositeTextureStack *stack = gf_node_get_private(composite_appear);
gf_list_del_item(stack->previous_sensors, hdl);
gf_list_del_item(stack->sensors, hdl);
+ if (stack->temp_sensors)
+ gf_list_del_item(stack->temp_sensors, hdl);
+ if (stack->temp_previous_sensors)
+ gf_list_del_item(stack->temp_previous_sensors, hdl);
}
}
GF_SAFEALLOC(cg, ChildGroup);
cg->child = n;
- cg->discardable = discardable;
+ cg->text_type = discardable;
gf_list_add(group->groups, cg);
}
/*if text node, ascent and descent of the text is stored for baseline alignment*/
Fixed ascent, descent;
u32 text_split_idx;
- Bool discardable;
+ /*discard_type 0: not discardable, 1 disardable, 2 line break at the end of the group*/
+ u8 text_type;
} ChildGroup;
SwitchStack *st = (SwitchStack *)gf_node_get_private(node);
GF_TraverseState *tr_state;
tr_state = (GF_TraverseState *)rs;
-
+ children = NULL;
+ /* souchay : be sure to be initialized, -1 seems reasonable since we check if (whichChoice>=0) */
+ whichChoice = -1;
if (is_destroy) {
gf_sc_check_focus_upon_destroy(node);
gf_free(st);
}
if (tr_state->traversing_mode!=TRAVERSE_GET_BOUNDS) {
-
count = gf_node_list_get_count(children);
prev_switch = tr_state->switched_off;
tr_state->switched_off = prev_switch;
}
- if (whichChoice>=0) {
+ if (children && (whichChoice>=0)) {
child = (GF_Node*)gf_node_list_get_child(children, whichChoice);
gf_node_traverse(child, tr_state);
}
else
ptr->is_identity = 0;
- ptr->is_null = (!ptr->mat.m[0] || !ptr->mat.m[4]) ? 1 : 0;
+ ptr->is_null = ( (!ptr->mat.m[0] && !ptr->mat.m[1]) || (!ptr->mat.m[3] && !ptr->mat.m[4]) ) ? 1 : 0;
gf_node_dirty_clear(node, GF_SG_NODE_DIRTY);
}
traverse_transform(node, ptr, tr_state);
if (l->size.y>=0) st->clip.height = l->size.y;
st->clip = gf_rect_center(st->clip.width, st->clip.height);
st->bounds = st->clip;
- //gf_node_dirty_clear(node, GF_SG_NODE_DIRTY);
}
prev_vp = tr_state->vp_size;
#endif /*GPAC_DISABLE_3D*/
-#endif /*GPAC_DISABLE_VRML*/
\ No newline at end of file
+#endif /*GPAC_DISABLE_VRML*/
+
{
Fixed width, height, ascent, descent;
u32 first_child, nb_children;
+ Bool line_break;
} LineInfo;
static void layout_reset_lines(LayoutStack *st)
li->height += cg->final.height;
li->nb_children ++;
} else {
- if (i && (cg->final.width + li->width> max_w)) {
+ if ((cg->text_type==2) || (i && (cg->final.width + li->width> max_w))) {
+ if (cg->text_type==2) li->line_break = 1;
if (l->wrap) {
if (!li->ascent) {
li->ascent = li->height;
li->width -= prev_discard_width;
li->nb_children--;
}
- if (cg->discardable && (i+1==count)) break;
+ if ((cg->text_type==1) && (i+1==count)) break;
li = new_line_info(st);
li->first_child = i;
- if (cg->discardable) {
+ if (cg->text_type) {
li->first_child++;
continue;
}
li->width += cg->final.width;
li->nb_children ++;
- prev_discard_width = cg->discardable ? cg->final.width : 0;
+ prev_discard_width = (cg->text_type==1) ? cg->final.width : 0;
}
}
cg = (ChildGroup *)gf_list_get(st->groups, li->nb_children-1);
spacing = (st->clip.width - li->width) / (li->nb_children-1) ;
if (spacing<0) spacing = 0;
- /*disable spacing for last text line*/
- else if (cg->ascent && (k+1==nbLines) )
- spacing = 0;
-
+ else if (cg->ascent) {
+ /*disable spacing for last text line and line breaks*/
+ if ( (k+1==nbLines) || li->line_break) {
+ spacing = 0;
+ }
+ }
}
break;
}
i = first;
while (1) {
cg = (ChildGroup *)gf_list_get(st->groups, i);
+ if (!cg) break;
h = MAX(li->ascent, li->height);
switch (minor) {
case L_FIRST:
} else {
st->scroll_len += li->width;
}
- }
+ }
}
static void layout_setup_scroll_bounds(LayoutStack *st, M_Layout *l)
// layout_setup_scroll_bounds(st, l);
}
+
+ if (tr_state->traversing_mode==TRAVERSE_GET_BOUNDS) {
+ tr_state->bounds = st->bounds;
+ if (l->scrollVertical) {
+ tr_state->bounds.height = st->scroll_len;
+ } else {
+ tr_state->bounds.width = st->scroll_len;
+ }
+#ifndef GPAC_DISABLE_3D
+ gf_bbox_from_rect(&tr_state->bbox, &tr_state->bounds);
+#endif
+ goto layout_exit;
+ }
+
+
/*scroll*/
layout_scroll(tr_state, st, l);
tr_state->text_split_mode = 0;
}
-static void OnLayout(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnLayout(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool vertical = ((M_Layout *)sh->sensor)->scrollVertical;
LayoutStack *st = (LayoutStack *) gf_node_get_private(sh->sensor);
if (!is_over) {
st->is_scrolling = 0;
st->key_scroll = 0;
- return;
+ return 0;
}
if (ev->type!=GF_EVENT_KEYDOWN) {
st->is_scrolling = 0;
st->key_scroll = 0;
- return;
+ return 0;
}
switch (ev->key.key_code) {
case GF_KEY_LEFT:
- if (vertical) return;
+ if (vertical) return 0;
st->key_scroll = -1;
break;
case GF_KEY_RIGHT:
- if (vertical) return;
+ if (vertical) return 0;
st->key_scroll = +1;
break;
case GF_KEY_UP:
- if (!vertical) return;
+ if (!vertical) return 0;
st->key_scroll = +1;
break;
case GF_KEY_DOWN:
- if (!vertical) return;
+ if (!vertical) return 0;
st->key_scroll = -1;
break;
default:
st->key_scroll = 0;
- return;
+ return 0;
}
gf_sc_invalidate(compositor, NULL);
+ return 1;
}
static Bool layout_is_enabled(GF_Node *node)
M_SpotLight *sl = (M_SpotLight *)n;
GF_TraverseState *tr_state = (GF_TraverseState *) rs;
- if (is_destroy || !sl->on) return;
+ if (is_destroy) {
+ Bool *vis = gf_node_get_private(n);
+ gf_free(vis);
+ return;
+ }
+ if (!sl->on) return;
/*store local bounds for culling*/
if (tr_state->traversing_mode==TRAVERSE_GET_BOUNDS) {
- /*how crude - refine to only have the light cone :)*/
+ GF_BBox b;
SFVec3f size;
+ Bool *visible = gf_node_get_private(n);
size.x = size.y = size.z = sl->radius;
- gf_vec_add(tr_state->bbox.max_edge, sl->location, size);
- gf_vec_diff(tr_state->bbox.min_edge, sl->location, size);
- gf_bbox_refresh(&tr_state->bbox);
+ gf_vec_add(b.max_edge, sl->location, size);
+ gf_vec_diff(b.min_edge, sl->location, size);
+ gf_bbox_refresh(&b);
+ *visible = visual_3d_node_cull(tr_state, &b, 0);
+ /*if visible, disable culling on our parent branch - this is not very efficient but
+ we only store one bound per grouping node, and we don't want the lights to interfere with it*/
+ if (*visible) tr_state->disable_cull = 1;
return;
}
else if (tr_state->traversing_mode == TRAVERSE_LIGHTING) {
- visual_3d_matrix_push(tr_state->visual);
- visual_3d_matrix_add(tr_state->visual, tr_state->model_matrix.m);
-
- visual_3d_add_spot_light(tr_state->visual, sl->ambientIntensity, sl->attenuation, sl->beamWidth,
- sl->color, sl->cutOffAngle, sl->direction, sl->intensity, sl->location);
-
- visual_3d_matrix_pop(tr_state->visual);
+ Bool *visible = gf_node_get_private(n);
+ if (*visible) {
+
+ visual_3d_matrix_push(tr_state->visual);
+ visual_3d_matrix_add(tr_state->visual, tr_state->model_matrix.m);
+
+ visual_3d_add_spot_light(tr_state->visual, sl->ambientIntensity, sl->attenuation, sl->beamWidth,
+ sl->color, sl->cutOffAngle, sl->direction, sl->intensity, sl->location);
+
+ visual_3d_matrix_pop(tr_state->visual);
+ }
}
}
void compositor_init_spot_light(GF_Compositor *compositor, GF_Node *node)
{
+ Bool *vis = gf_malloc(sizeof(Bool));
+ *vis = 0;
+ gf_node_set_private(node, vis);
/*no need for a stck*/
gf_node_set_callback_function(node, TraverseSpotLight);
}
M_PointLight *pl = (M_PointLight *)n;
GF_TraverseState *tr_state = (GF_TraverseState *) rs;
- if (is_destroy || !pl->on) return;
+ if (is_destroy) {
+ Bool *vis = gf_node_get_private(n);
+ gf_free(vis);
+ return;
+ }
+ if (!pl->on) return;
/*store local bounds for culling*/
if (tr_state->traversing_mode==TRAVERSE_GET_BOUNDS) {
SFVec3f size;
+ GF_BBox b;
+ Bool *visible = gf_node_get_private(n);
size.x = size.y = size.z = pl->radius;
- gf_vec_add(tr_state->bbox.max_edge, pl->location, size);
- gf_vec_diff(tr_state->bbox.min_edge, pl->location, size);
- gf_bbox_refresh(&tr_state->bbox);
+ gf_vec_add(b.max_edge, pl->location, size);
+ gf_vec_diff(b.min_edge, pl->location, size);
+ gf_bbox_refresh(&b);
+ *visible = visual_3d_node_cull(tr_state, &b, 0);
+ /*if visible, disable culling on our parent branch*/
+ if (*visible) tr_state->disable_cull = 1;
return;
}
else if (tr_state->traversing_mode == TRAVERSE_LIGHTING) {
- visual_3d_matrix_push(tr_state->visual);
- visual_3d_matrix_add(tr_state->visual, tr_state->model_matrix.m);
+ Bool *visible = gf_node_get_private(n);
+ if (*visible) {
+ visual_3d_matrix_push(tr_state->visual);
+ visual_3d_matrix_add(tr_state->visual, tr_state->model_matrix.m);
- visual_3d_add_point_light(tr_state->visual, pl->ambientIntensity, pl->attenuation, pl->color,
- pl->intensity, pl->location);
+ visual_3d_add_point_light(tr_state->visual, pl->ambientIntensity, pl->attenuation, pl->color,
+ pl->intensity, pl->location);
- visual_3d_matrix_pop(tr_state->visual);
+ visual_3d_matrix_pop(tr_state->visual);
+ }
}
}
void compositor_init_point_light(GF_Compositor *compositor, GF_Node *node)
{
+ Bool *vis = gf_malloc(sizeof(Bool));
+ *vis = 0;
+ gf_node_set_private(node, vis);
/*no need for a stck*/
gf_node_set_callback_function(node, TraversePointLight);
}
void compositor_init_directional_light(GF_Compositor *compositor, GF_Node *node)
{
- /*our stack is just a boolean used to store whether the light was turned on successfully*/
- Bool *stack = (Bool*)gf_malloc(sizeof(Bool));
+ Bool *stack = gf_malloc(sizeof(Bool));
*stack = 0;
gf_node_set_private(node, stack);
gf_node_set_callback_function(node, TraverseDirectionalLight);
if (compositor) {
GF_VisualManager *visual;
u32 i=0;
+ gf_list_del_item(compositor->sensors, hdl);
gf_list_del_item(compositor->previous_sensors, hdl);
if (compositor->interaction_sensors) compositor->interaction_sensors--;
while ( (visual=gf_list_enum(compositor->visuals, &i)) ) {
}
if (gf_node_dirty_get(node) & GF_SG_NODE_DIRTY) {
- MFURL *url;
+ MFURL *url = NULL;
switch (gf_node_get_tag(node)) {
case TAG_MPEG4_Anchor:
url = & ((M_Anchor *)node)->url;
#endif
}
st->enabled = 0;
- if (url->count && url->vals[0].url && strlen(url->vals[0].url) )
+ if (url && url->count && url->vals[0].url && strlen(url->vals[0].url) )
st->enabled = 1;
if (!tr_state->visual->compositor->user->EventProc) {
static void anchor_activation(GF_Node *node, AnchorStack *st, GF_Compositor *compositor)
{
GF_Event evt;
- MFURL *url;
u32 i;
+ MFURL *url = NULL;
switch (gf_node_get_tag(node)) {
case TAG_MPEG4_Anchor:
url = & ((M_Anchor *)node)->url;
}
evt.type = GF_EVENT_NAVIGATE;
i=0;
- while (i<url->count) {
+ while (url && i<url->count) {
evt.navigate.to_url = url->vals[i].url;
if (!evt.navigate.to_url) break;
/*current scene navigation*/
}
}
-static void OnAnchor(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnAnchor(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
GF_Event evt;
- MFURL *url;
+ MFURL *url = NULL;
AnchorStack *st = (AnchorStack *) gf_node_get_private(sh->sensor);
if ((ev->type==GF_EVENT_MOUSEDOWN) && (ev->mouse.button==GF_MOUSE_LEFT)) st->active = 1;
/*mouse*/ ((ev->type==GF_EVENT_MOUSEUP) && (ev->mouse.button==GF_MOUSE_LEFT))
|| /*mouse*/((ev->type==GF_EVENT_KEYUP) && (ev->key.key_code==GF_KEY_ENTER))
) ) {
- anchor_activation(sh->sensor, st, compositor);
+ if (!is_cancel) anchor_activation(sh->sensor, st, compositor);
} else if (is_over && !st->over) {
st->over = 1;
if (compositor->user->EventProc) {
break;
#endif
}
- if (!evt.navigate.to_url || !strlen(evt.navigate.to_url)) evt.navigate.to_url = url->vals[0].url;
+ if (url && (!evt.navigate.to_url || !strlen(evt.navigate.to_url))) evt.navigate.to_url = url->vals[0].url;
gf_term_send_event(compositor->term, &evt);
}
} else if (!is_over) {
st->over = 0;
}
+ return 0;
}
static Bool anchor_is_enabled(GF_Node *node)
}
-static void OnDiscSensor(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnDiscSensor(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool is_mouse = (ev->type<=GF_EVENT_MOUSEWHEEL) ? 1 : 0;
M_DiscSensor *ds = (M_DiscSensor *)sh->sensor;
if (ds->autoOffset) {
ds->offset = ds->rotation_changed;
/*that's an exposedField*/
- gf_node_event_out_str(sh->sensor, "offset");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "offset");
}
ds->isActive = 0;
- gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 0;
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isActive");
+ sh->grabbed = 0;
+ return is_cancel ? 0 : 1;
} else if (is_mouse) {
if (!ds->isActive && (ev->type==GF_EVENT_MOUSEDOWN) && (ev->mouse.button==GF_MOUSE_LEFT)) {
/*store inverse matrix*/
stack->start_angle = gf_atan2(compositor->hit_local_point.y, compositor->hit_local_point.x);
ds->isActive = 1;
gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 1;
+ sh->grabbed = 1;
+ return 1;
}
else if (ds->isActive) {
GF_Ray loc_ray;
ds->trackPoint_changed.x = res.x;
ds->trackPoint_changed.y = res.y;
gf_node_event_out_str(sh->sensor, "trackPoint_changed");
+ return 1;
}
} else {
if (!ds->isActive && is_over && (ev->type==GF_EVENT_KEYDOWN) && (ev->key.key_code==GF_KEY_ENTER)) {
ds->isActive = 1;
stack->start_angle = ds->offset;
gf_node_event_out_str(sh->sensor, "isActive");
+ return 1;
}
else if (ds->isActive && (ev->type==GF_EVENT_KEYDOWN)) {
Fixed res;
case GF_KEY_HOME:
res = ds->offset;
break;
- default: return;
+ default:
+ return 0;
}
if (ds->minAngle < ds->maxAngle) {
/*FIXME this doesn't work properly*/
stack->start_angle = res;
ds->rotation_changed = res;
gf_node_event_out_str(sh->sensor, "rotation_changed");
+ return 1;
}
}
+ return 0;
}
static GF_SensorHandler *disc_sensor_get_handler(GF_Node *n)
return (ps2d->enabled || ps2d->isActive);
}
-static void OnPlaneSensor2D(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnPlaneSensor2D(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool is_mouse = (ev->type<=GF_EVENT_MOUSEWHEEL) ? 1 : 0;
M_PlaneSensor2D *ps = (M_PlaneSensor2D *)sh->sensor;
) ) {
if (ps->autoOffset) {
ps->offset = ps->translation_changed;
- gf_node_event_out_str(sh->sensor, "offset");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "offset");
}
ps->isActive = 0;
- gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 0;
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isActive");
+ sh->grabbed = 0;
+ return is_cancel ? 0 : 1;
} else if (is_mouse) {
if (!ps->isActive && (ev->type==GF_EVENT_MOUSEDOWN) && (ev->mouse.button==GF_MOUSE_LEFT)) {
gf_mx_copy(stack->initial_matrix, compositor->hit_local_to_world);
stack->start_drag.y = compositor->hit_local_point.y - ps->offset.y;
ps->isActive = 1;
gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 1;
- } else if (ps->isActive) {
- GF_Ray loc_ray;
+ sh->grabbed = 1;
+ /*fallthrough to fire mouse coords*/
+ //return 1;
+ }
+ if (ps->isActive) {
SFVec3f res;
+ GF_Ray loc_ray;
loc_ray = compositor->hit_world_ray;
gf_mx_apply_ray(&stack->initial_matrix, &loc_ray);
compositor_get_2d_plane_intersection(&loc_ray, &res);
+
ps->trackPoint_changed.x = res.x;
ps->trackPoint_changed.y = res.y;
gf_node_event_out_str(sh->sensor, "trackPoint_changed");
ps->translation_changed.x = res.x;
ps->translation_changed.y = res.y;
gf_node_event_out_str(sh->sensor, "translation_changed");
-
- compositor->grabbed_sensor = 1;
+ return 1;
}
} else {
if (!ps->isActive && is_over && (ev->type==GF_EVENT_KEYDOWN) && (ev->key.key_code==GF_KEY_ENTER)) {
ps->isActive = 1;
stack->start_drag = ps->offset;
gf_node_event_out_str(sh->sensor, "isActive");
+ return 1;
}
else if (ps->isActive && (ev->type==GF_EVENT_KEYDOWN)) {
SFVec2f res;
case GF_KEY_UP: res.y += diff; break;
case GF_KEY_DOWN: res.y += -diff; break;
case GF_KEY_HOME: res = ps->offset; break;
- default: return;
+ default:
+ return 0;
}
/*clip*/
if (ps->minPosition.x <= ps->maxPosition.x) {
if (res.y < ps->minPosition.y) res.y = ps->minPosition.y;
if (res.y > ps->maxPosition.y) res.y = ps->maxPosition.y;
}
- stack->start_drag = res;
ps->translation_changed = res;
gf_node_event_out_str(sh->sensor, "translation_changed");
+ ps->trackPoint_changed.x = res.x + stack->start_drag.x;
+ ps->trackPoint_changed.y = res.y + stack->start_drag.y;
+ gf_node_event_out_str(sh->sensor, "trackPoint_changed");
+ stack->start_drag = res;
+ return 1;
}
}
+ return 0;
}
static GF_SensorHandler *plane_sensor2d_get_handler(GF_Node *n)
return 1;
}
-static void OnProximitySensor2D(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnProximitySensor2D(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
M_ProximitySensor2D *ps = (M_ProximitySensor2D *)sh->sensor;
Prox2DStack *stack = (Prox2DStack *) gf_node_get_private(sh->sensor);
if (is_over) {
stack->last_time = gf_node_get_scene_time(sh->sensor);
+ if (is_cancel) return 0;
if (prox2D_is_in_sensor(stack, ps, compositor->hit_local_point.x, compositor->hit_local_point.y)) {
ps->position_changed.x = compositor->hit_local_point.x;
ps->position_changed.y = compositor->hit_local_point.y;
ps->enterTime = stack->last_time;
gf_node_event_out_str(sh->sensor, "enterTime");
}
- return;
+ return 1;
}
}
/*either we're not over the shape or we're not in sensor*/
gf_node_event_out_str(sh->sensor, "exitTime");
ps->isActive = 0;
gf_node_event_out_str(sh->sensor, "isActive");
+ return 1;
}
+ return 0;
}
static GF_SensorHandler *proximity_sensor2d_get_handler(GF_Node *n)
return ((M_TouchSensor *) n)->enabled;
}
-static void OnTouchSensor(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnTouchSensor(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool is_mouse = (ev->type<=GF_EVENT_MOUSEWHEEL);
M_TouchSensor *ts = (M_TouchSensor *)sh->sensor;
/*this is not specified in VRML, however we consider that a de-enabled sensor will not sent deactivation events*/
if (!ts->enabled) {
- if (ts->isActive) compositor->grabbed_sensor = 0;
- return;
+ if (ts->isActive) {
+ sh->grabbed = 0;
+ }
+ return 0;
}
/*isActive becomes false, send touch time*/
|| /*keyboard*/ ((ev->type==GF_EVENT_KEYUP) && (ev->key.key_code==GF_KEY_ENTER) )
) {
ts->touchTime = gf_node_get_scene_time(sh->sensor);
- gf_node_event_out_str(sh->sensor, "touchTime");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "touchTime");
ts->isActive = 0;
- gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 0;
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isActive");
+ sh->grabbed = 0;
+ return is_cancel ? 0 : 1;
}
}
if (is_over != ts->isOver) {
ts->isOver = is_over;
- gf_node_event_out_str(sh->sensor, "isOver");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isOver");
+ return is_cancel ? 0 : 1;
}
if (!ts->isActive && is_over) {
if (/*mouse*/ ((ev->type==GF_EVENT_MOUSEDOWN) && (ev->mouse.button==GF_MOUSE_LEFT))
) {
ts->isActive = 1;
gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 1;
+ sh->grabbed = 1;
+ return 1;
}
+ if (ev->type==GF_EVENT_MOUSEUP) return 0;
}
if (is_over && is_mouse) {
/*THIS IS NOT CONFORMANT, the hitpoint should be in the touchsensor coordinate system, eg we
gf_node_event_out_str(sh->sensor, "hitNormal_changed");
ts->hitTexCoord_changed = compositor->hit_texcoords;
gf_node_event_out_str(sh->sensor, "hitTexCoord_changed");
+ return 1;
}
+ return 0;
}
static GF_SensorHandler *touch_sensor_get_handler(GF_Node *n)
return (ps->enabled || ps->isActive);
}
-static void OnPlaneSensor(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnPlaneSensor(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool is_mouse = (ev->type<=GF_EVENT_MOUSEWHEEL) ? 1 : 0;
M_PlaneSensor *ps = (M_PlaneSensor *)sh->sensor;
) ) {
if (ps->autoOffset) {
ps->offset = ps->translation_changed;
- gf_node_event_out_str(sh->sensor, "offset");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "offset");
}
ps->isActive = 0;
- gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 0;
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isActive");
+ sh->grabbed = 0;
+ return is_cancel ? 0 : 1;
}
/*mouse*/
else if (is_mouse) {
stack->tracker.d = - gf_vec_dot(stack->start_drag, stack->tracker.normal);
ps->isActive = 1;
gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 1;
+ sh->grabbed = 1;
+ return 1;
}
else if (ps->isActive) {
GF_Ray loc_ray;
}
ps->translation_changed = res;
gf_node_event_out_str(sh->sensor, "translation_changed");
+ return 1;
}
} else {
if (!ps->isActive && is_over && (ev->type==GF_EVENT_KEYDOWN) && (ev->key.key_code==GF_KEY_ENTER)) {
ps->isActive = 1;
stack->start_drag = ps->offset;
gf_node_event_out_str(sh->sensor, "isActive");
+ return 1;
}
else if (ps->isActive && (ev->type==GF_EVENT_KEYDOWN)) {
SFVec3f res;
case GF_KEY_UP: res.y += diff; break;
case GF_KEY_DOWN: res.y -= diff; break;
case GF_KEY_HOME: res = ps->offset; break;
- default: return;
+ default:
+ return 0;
}
/*clip*/
if (ps->minPosition.x <= ps->maxPosition.x) {
stack->start_drag = res;
ps->translation_changed = res;
gf_node_event_out_str(sh->sensor, "translation_changed");
+ return 1;
}
}
+ return 0;
}
static GF_SensorHandler *plane_sensor_get_handler(GF_Node *n)
return (cs->enabled || cs->isActive);
}
-static void OnCylinderSensor(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnCylinderSensor(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool is_mouse = (ev->type<=GF_EVENT_MOUSEWHEEL) ? 1 : 0;
M_CylinderSensor *cs = (M_CylinderSensor *)sh->sensor;
) ) {
if (cs->autoOffset) {
cs->offset = cs->rotation_changed.q;
- gf_node_event_out_str(sh->sensor, "offset");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "offset");
}
cs->isActive = 0;
- gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 0;
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isActive");
+ sh->grabbed = 0;
+ return is_cancel ? 0 : 1;
}
else if (is_mouse) {
if (!cs->isActive && (ev->type==GF_EVENT_MOUSEDOWN) && (ev->mouse.button==GF_MOUSE_LEFT)) {
cs->isActive = 1;
gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 1;
+ sh->grabbed = 1;
+ return 1;
}
else if (cs->isActive) {
GF_Ray r;
if (ABS(r.dir.x) > ABS(r.dir.x)) project_to = st->xplane;
else project_to = st->zplane;
} else project_to = st->yplane;
- if (!gf_plane_intersect_line(&project_to, &r.orig, &r.dir, &compositor->hit_local_point)) return;
+ if (!gf_plane_intersect_line(&project_to, &r.orig, &r.dir, &compositor->hit_local_point)) return 0;
}
dir1.x = compositor->hit_local_point.x; dir1.y = 0; dir1.z = compositor->hit_local_point.z;
gf_vec_norm(&dir2);
cx = gf_vec_cross(dir2, dir1);
gf_vec_norm(&cx);
- if (gf_vec_len(cx)<FIX_EPSILON) return;
+ if (gf_vec_len(cx)<FIX_EPSILON) return 0;
rot = gf_mulfix(radius, gf_acos(gf_vec_dot(dir2, dir1)) );
if (fabs(cx.y + FIX_ONE) < FIX_EPSILON) rot = -rot;
if (cs->autoOffset) rot += cs->offset;
}
cs->rotation_changed.q = rot;
gf_node_event_out_str(sh->sensor, "rotation_changed");
+ return 1;
}
} else {
if (!cs->isActive && is_over && (ev->type==GF_EVENT_KEYDOWN) && (ev->key.key_code==GF_KEY_ENTER)) {
cs->rotation_changed.x = cs->rotation_changed.z = 0;
cs->rotation_changed.y = FIX_ONE;
gf_node_event_out_str(sh->sensor, "isActive");
+ return 1;
}
else if (cs->isActive && (ev->type==GF_EVENT_KEYDOWN)) {
SFFloat res;
case GF_KEY_LEFT: res -= diff; break;
case GF_KEY_RIGHT: res += diff; break;
case GF_KEY_HOME: res = cs->offset; break;
- default: return;
+ default: return 0;
}
/*clip*/
if (cs->minAngle <= cs->maxAngle) {
}
cs->rotation_changed.q = res;
gf_node_event_out_str(sh->sensor, "rotation_changed");
+ return 1;
}
}
+ return 0;
}
static GF_SensorHandler *cylinder_sensor_get_handler(GF_Node *n)
return (ss->enabled || ss->isActive);
}
-static void OnSphereSensor(GF_SensorHandler *sh, Bool is_over, GF_Event *ev, GF_Compositor *compositor)
+static Bool OnSphereSensor(GF_SensorHandler *sh, Bool is_over, Bool is_cancel, GF_Event *ev, GF_Compositor *compositor)
{
Bool is_mouse = (ev->type<=GF_EVENT_MOUSEWHEEL) ? 1 : 0;
M_SphereSensor *sphere = (M_SphereSensor *)sh->sensor;
) ) {
if (sphere->autoOffset) {
sphere->offset = sphere->rotation_changed;
- gf_node_event_out_str(sh->sensor, "offset");
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "offset");
}
sphere->isActive = 0;
- gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 0;
+ if (!is_cancel) gf_node_event_out_str(sh->sensor, "isActive");
+ sh->grabbed = 0;
+ return is_cancel ? 0 : 1;
}
else if (is_mouse) {
if (!sphere->isActive && (ev->type==GF_EVENT_MOUSEDOWN) && (ev->mouse.button==GF_MOUSE_LEFT)) {
sphere->isActive = 1;
gf_node_event_out_str(sh->sensor, "isActive");
- compositor->grabbed_sensor = 1;
+ sh->grabbed = 1;
+ return 1;
}
else if (sphere->isActive) {
SFVec3f vec, axis;
}
sphere->rotation_changed = gf_quat_to_rotation(&q1);
gf_node_event_out_str(sh->sensor, "rotation_changed");
+ return 1;
}
} else {
if (!sphere->isActive && is_over && (ev->type==GF_EVENT_KEYDOWN) && (ev->key.key_code==GF_KEY_ENTER)) {
sphere->isActive = 1;
sphere->rotation_changed = sphere->offset;
gf_node_event_out_str(sh->sensor, "isActive");
+ return 1;
}
else if (sphere->isActive && (ev->type==GF_EVENT_KEYDOWN)) {
SFVec4f res, rot;
res = gf_quat_to_rotation(&rot);
break;
case GF_KEY_HOME: res = sphere->offset; break;
- default: return;
+ default: return 0;
}
sphere->rotation_changed = res;
gf_node_event_out_str(sh->sensor, "rotation_changed");
+ return 1;
}
}
-
+ return 0;
}
static GF_SensorHandler *sphere_get_handler(GF_Node *n)
/*we currently only split sentences at spaces*/
if (tspan->glyphs[j]->utf_name == (unsigned short) ' ') is_space = 1;
+ else if (tspan->glyphs[j]->utf_name == (unsigned short) '\n')
+ is_space = 2;
if (split_words && (j+1!=len) && !is_space)
continue;
k = (j - first_char);
span->glyphs[0] = tspan->glyphs[FSLTR ? (first_char+k) : (len - first_char - k - 1)];
span->bounds.width = tspan->font_scale * (span->glyphs[0] ? span->glyphs[0]->horiz_advance : tspan->font->max_advance_h);
- parent_node_start_group(tr_state->parent, NULL, 1);
+ parent_node_start_group(tr_state->parent, NULL, is_space);
idx++;
parent_node_end_text_group(tr_state->parent, &span->bounds, st->ascent, st->descent, idx);
}
gf_node_dirty_clear(node, 0);
drawable_mark_modified(stack->graph, tr_state);
}
+
+ if (tr_state->visual->compositor->edited_text && (tr_state->visual->compositor->focus_node==node)) {
+ drawable_mark_modified(stack->graph, tr_state);
+ tr_state->visual->has_text_edit = 1;
+ if (!stack->bounds.width) stack->bounds.width = INT2FIX(1)/100;
+ if (!stack->bounds.height) stack->bounds.height = INT2FIX(1)/100;
+ }
}
void compositor_init_text(GF_Compositor *compositor, GF_Node *node)
{
- TextStack *stack = (TextStack *)gf_malloc(sizeof(TextStack));
+ TextStack *stack;
+ GF_SAFEALLOC(stack, TextStack);
stack->graph = drawable_new();
stack->graph->node = node;
stack->graph->flags = DRAWABLE_USE_TRAVERSE_DRAW;
#ifndef GPAC_DISABLE_VRML
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef struct
{
GF_TextureHandler txh;
if (!st) return;
/*if open and changed, stop and play*/
- if (st->txh.is_open && gf_sc_texture_check_url_change(&st->txh, &mt->url)) {
- gf_sc_texture_stop(&st->txh);
- gf_sc_texture_play(&st->txh, &mt->url);
+ if (gf_sc_texture_check_url_change(&st->txh, &mt->url)) {
+ if (st->txh.is_open) gf_sc_texture_stop(&st->txh);
+ if (mt->isActive) gf_sc_texture_play(&st->txh, &mt->url);
}
/*update state if we're active*/
else if (mt->isActive) {
Bool delete_file = 1;
M_CacheTexture *ct = (M_CacheTexture*)node;
- sprintf(section, "@cache=%08X", (u32) ct);
+ sprintf(section, "@cache=%08X", (u32) (PTR_TO_U_CAST ct));
file = gf_cfg_get_key(txh->compositor->user->config, section, "cacheFile");
opt = gf_cfg_get_key(txh->compositor->user->config, section, "expireAfterNTP");
}
}
- sprintf(section, "@cache=%08X", (u32) ct);
+ sprintf(section, "@cache=%08X", (u32) (PTR_TO_U_CAST ct));
gf_cfg_set_key(compositor->user->config, section, "serviceURL", url);
gf_cfg_set_key(compositor->user->config, section, "cacheFile", ct->image.buffer);
gf_node_set_private(node, txh);
gf_node_set_callback_function(node, imagetexture_destroy);
}
-
+#ifdef __cplusplus
+}
+#endif
#endif /*GPAC_DISABLE_VRML*/
DestroyViewStack(node);
return;
}
-
- assert(tr_state->viewpoints);
+ /*may happen in get_bounds*/
+ if (!tr_state->viewpoints) return;
// if (!tr_state->camera->is_3D) return;
/*first traverse, bound if needed*/
gf_node_dirty_set(node, 0, 0);
}
}
- tr_state->disable_cull = 1;
return;
}
if (compositor->active_layer) gf_node_dirty_set(compositor->active_layer, 0, 1);
}
+#endif
+
+static void nav_set_zoom_trans_2d(GF_VisualManager *visual, Fixed zoom, Fixed dx, Fixed dy)
+{
+ compositor_2d_set_user_transform(visual->compositor, zoom, visual->compositor->trans_x + dx, visual->compositor->trans_y + dy, 0);
+#ifndef GPAC_DISABLE_3D
+ if (visual->type_3d) camera_changed(visual->compositor, &visual->camera);
+#endif
+}
+
+
+#ifndef GPAC_DISABLE_3D
+
/*shortcut*/
static void gf_mx_rotation_matrix(GF_Matrix *mx, SFVec3f axis_pt, SFVec3f axis, Fixed angle)
{
camera_changed(compositor, cam);
}
-static void nav_fit_screen(GF_Compositor *compositor)
+Bool gf_sc_fit_world_to_screen(GF_Compositor *compositor)
{
GF_TraverseState tr_state;
SFVec3f pos, diff;
GF_Node *top;
#ifndef GPAC_DISABLE_VRML
- if (gf_list_count(compositor->visual->back_stack)) return;
- if (gf_list_count(compositor->visual->view_stack)) return;
+// if (gf_list_count(compositor->visual->back_stack)) return;
+ if (gf_list_count(compositor->visual->view_stack)) return 0;
#endif
gf_mx_p(compositor->mx);
top = gf_sg_get_root_node(compositor->scene);
if (!top) {
gf_mx_v(compositor->mx);
- return;
+ return 0;
}
memset(&tr_state, 0, sizeof(GF_TraverseState));
tr_state.traversing_mode = TRAVERSE_GET_BOUNDS;
tr_state.visual = compositor->visual;
gf_node_traverse(top, &tr_state);
+ if (gf_node_dirty_get(top)) {
+ tr_state.bbox.is_set = 0;
+ }
+
if (!tr_state.bbox.is_set) {
gf_mx_v(compositor->mx);
- return;
+ return 0;
}
cam = &compositor->visual->camera;
+ cam->world_bbox = tr_state.bbox;
/*fit is based on bounding sphere*/
dist = gf_divfix(tr_state.bbox.radius, gf_sin(cam->fieldOfView/2) );
gf_vec_diff(diff, cam->center, tr_state.bbox.center);
d = gf_vec_len(diff);
if (d<dist) {
gf_mx_v(compositor->mx);
- return;
+ return 1;
}
}
camera_move_to(cam, pos, cam->target, cam->up);
cam->examine_center = tr_state.bbox.center;
cam->flags |= CF_STORE_VP;
+ if (cam->z_far < dist) cam->z_far = 10*dist;
camera_changed(compositor, cam);
gf_mx_v(compositor->mx);
+ return 1;
}
static Bool compositor_handle_navigation_3d(GF_Compositor *compositor, GF_Event *ev)
u32 keys;
Bool is_pixel_metrics;
GF_Camera *cam;
+ Fixed zoom = compositor->zoom;
cam = NULL;
if (compositor->active_layer) {
}
dx = (x - compositor->grab_x);
- dy = (y - compositor->grab_y);
-
- if (!compositor->visual->center_coords) dy = -dy;
-
+ dy = (compositor->grab_y - y);
/* trans_scale = is_pixel_metrics ? cam->width/2 : INT2FIX(10);
key_trans = is_pixel_metrics ? INT2FIX(10) : cam->avatar_size.x;
*/
- trans_scale = cam->width/2;
+ trans_scale = cam->width/20;
key_trans = cam->avatar_size.x;
+ if (cam->world_bbox.is_set && (key_trans*5 > cam->world_bbox.radius)) {
+ key_trans = cam->world_bbox.radius / 10;
+ }
key_pan = FIX_ONE/25;
key_exam = FIX_ONE/10;
gf_sc_invalidate(compositor, NULL);
return 1;
}
- else if (keys & GF_KEY_MOD_CTRL) nav_fit_screen(compositor);
+ else if (keys & GF_KEY_MOD_CTRL) gf_sc_fit_world_to_screen(compositor);
}
break;
case GF_NAVIGATE_EXAMINE:
case GF_NAVIGATE_ORBIT:
case GF_NAVIGATE_PAN:
- if (is_pixel_metrics) {
+ if (cam->is_3D) {
view_translate_z(compositor, cam, gf_mulfix(trans_scale, ev->mouse.wheel_pos) * ((keys & GF_KEY_MOD_SHIFT) ? 4 : 1));
} else {
- view_translate_z(compositor, cam, ev->mouse.wheel_pos * ((keys & GF_KEY_MOD_SHIFT) ? 4 : 1));
+ nav_set_zoom_trans_2d(compositor->visual, zoom + INT2FIX(ev->mouse.wheel_pos)/10, 0, 0);
}
- break;
}
return 1;
}
break;
case GF_KEY_HOME:
- if (!compositor->navigation_state) compositor_3d_reset_camera(compositor);
+ if (!compositor->navigation_state) {
+ compositor->visual->camera.start_zoom = compositor->zoom;
+ compositor->zoom = FIX_ONE;
+ compositor->interoccular_offset = 0;
+ compositor->view_distance_offset = 0;
+ compositor->interoccular_offset = 0;
+ compositor->view_distance_offset = 0;
+ compositor_3d_reset_camera(compositor);
+ }
break;
case GF_KEY_END:
if (cam->navigate_mode==GF_NAVIGATE_GAME) {
break;
case GF_KEY_LEFT: key_inv = -1;
case GF_KEY_RIGHT:
+ if (keys & GF_KEY_MOD_ALT) {
+ if ( (keys & GF_KEY_MOD_SHIFT) && (compositor->visual->nb_views > 1) ) {
+ compositor->view_distance_offset += key_inv * INT2FIX((is_pixel_metrics ? 5 : 1));
+ cam->flags |= CAM_IS_DIRTY;
+ fprintf(stdout, "AutoStereo view distance %f\n", FIX2FLT(compositor->view_distance_offset + compositor->video_out->view_distance)/100);
+ gf_sc_invalidate(compositor, NULL);
+ return 1;
+ }
+ return 0;
+ }
+
+
switch (cam->navigate_mode) {
case GF_NAVIGATE_SLIDE:
if (keys & GF_KEY_MOD_CTRL) view_pan_x(compositor, cam, key_inv * key_pan);
return 1;
case GF_KEY_DOWN: key_inv = -1;
case GF_KEY_UP:
- if (keys & GF_KEY_MOD_ALT) return 0;
+ if (keys & GF_KEY_MOD_ALT) {
+ if ( (keys & GF_KEY_MOD_SHIFT) && (compositor->visual->nb_views > 1) ) {
+ compositor->interoccular_offset += FLT2FIX(0.5) * key_inv;
+ fprintf(stdout, "AutoStereo interoccular distance %f\n", FIX2FLT(compositor->interoccular_offset)+6.8);
+ cam->flags |= CAM_IS_DIRTY;
+ gf_sc_invalidate(compositor, NULL);
+ return 1;
+ }
+ return 0;
+ }
switch (cam->navigate_mode) {
case GF_NAVIGATE_SLIDE:
if (keys & GF_KEY_MOD_CTRL) view_translate_z(compositor, cam, key_inv * key_trans);
#endif
-static void nav_set_zoom_trans_2d(GF_VisualManager *visual, Fixed zoom, Fixed dx, Fixed dy)
-{
- compositor_2d_set_user_transform(visual->compositor, zoom, visual->compositor->trans_x + dx, visual->compositor->trans_y + dy, 0);
-#ifndef GPAC_DISABLE_3D
- if (visual->type_3d) camera_changed(visual->compositor, &visual->camera);
-#endif
-}
-
static Bool compositor_handle_navigation_2d(GF_VisualManager *visual, GF_Event *ev)
{
y = INT2FIX(ev->mouse.y);
}
dx = x - visual->compositor->grab_x;
- dy = y - visual->compositor->grab_y;
+ dy = visual->compositor->grab_y - y;
if (!is_pixel_metrics) { dx /= visual->width; dy /= visual->height; }
key_inv = 1;
visual->compositor->navigation_state = 1;
/*update zoom center*/
if (keys & GF_KEY_MOD_CTRL) {
- if (visual->center_coords) {
- visual->compositor->trans_x -= visual->compositor->grab_x;
- visual->compositor->trans_y -= visual->compositor->grab_y;
- } else {
- visual->compositor->trans_x -= visual->compositor->grab_x - INT2FIX(visual->width)/2;
- visual->compositor->trans_y += INT2FIX(visual->height)/2 - visual->compositor->grab_y;
- }
+ visual->compositor->trans_x -= visual->compositor->grab_x - INT2FIX(visual->width)/2;
+ visual->compositor->trans_y += INT2FIX(visual->height)/2 - visual->compositor->grab_y;
nav_set_zoom_trans_2d(visual, visual->compositor->zoom, 0, 0);
}
return 0;
break;
case GF_EVENT_MOUSEWHEEL:
- if (navigation_mode != GF_NAVIGATE_SLIDE) return 0;
- new_zoom = zoom + INT2FIX(ev->mouse.wheel_pos)/10;
- nav_set_zoom_trans_2d(visual, new_zoom, 0, 0);
- return 1;
+ switch (navigation_mode) {
+ case GF_NAVIGATE_SLIDE:
+ new_zoom = zoom + INT2FIX(ev->mouse.wheel_pos)/10;
+ nav_set_zoom_trans_2d(visual, new_zoom, 0, 0);
+ return 1;
+ case GF_NAVIGATE_EXAMINE:
+ if (ev->mouse.wheel_pos>0)
+ visual->compositor->rotation += gf_asin( GF_PI / 10);
+ else
+ visual->compositor->rotation -= gf_asin( GF_PI / 10);
+ nav_set_zoom_trans_2d(visual, zoom, 0, 0);
+ return 1;
+ }
+ return 0;
case GF_EVENT_MOUSEMOVE:
if (!visual->compositor->navigation_state) return 0;
{
if (!compositor->scene) return 0;
#ifndef GPAC_DISABLE_3D
- if ( (compositor->visual->type_3d>1) || compositor->active_layer)
+ if ( (compositor->visual->type_3d>0) || compositor->active_layer)
return compositor_handle_navigation_3d(compositor, ev);
#endif
return compositor_handle_navigation_2d(compositor->visual, ev);
void compositor_init_svg_glyph(GF_Compositor *compositor, GF_Node *node);
void compositor_init_svg_font_face_uri(GF_Compositor *compositor, GF_Node *node);
+void compositor_init_svg_updates(GF_Compositor *compositor, GF_Node *node);
+
void compositor_init_svg_filter(GF_Compositor *compositor, GF_Node *node);
void svg_draw_filter(GF_Node *filter, GF_Node *node, GF_TraverseState *tr_state);
cache->txh.pixelformat = for_gl ? GF_PIXEL_RGBA : GF_PIXEL_ARGB;
cache->txh.transparent = 1;
- if (cache->txh.data) gf_free(cache->txh.data);
+ if (cache->txh.data)
+ gf_free(cache->txh.data);
#ifdef CACHE_DEBUG_ALPHA
cache->txh.stride = pix_bounds->width * 3;
cache->txh.pixelformat = GF_PIXEL_RGB_24;
path_bounds->width, path_bounds->height);
}
-Bool group_cache_traverse(GF_Node *node, GroupCache *cache, GF_TraverseState *tr_state, Bool force_recompute, Bool is_mpeg4)
+Bool group_cache_traverse(GF_Node *node, GroupCache *cache, GF_TraverseState *tr_state, Bool force_recompute, Bool is_mpeg4, Bool auto_fit_vp)
{
+ GF_Matrix2D backup;
DrawableContext *group_ctx = NULL;
GF_ChildNodeItem *l;
cache->txh.flags |= GF_SR_TEXTURE_NO_GL_FLIP;
gf_sc_texture_set_data(&cache->txh);
gf_sc_texture_push_image(&cache->txh, 0, type_3d ? 0 : 1);
+
+ cache->orig_vp = tr_state->vp_size;
}
/*just setup the context*/
else {
if (gf_node_dirty_get(node)) group_ctx->flags |= CTX_TEXTURE_DIRTY;
- {
#ifdef CACHE_DEBUG_CENTER
- GF_Matrix2D mx;
- gf_mx2d_copy(mx, tr_state->transform);
+ gf_mx2d_copy(backup, tr_state->transform);
gf_mx2d_init(tr_state->transform);
+#else
+ if (auto_fit_vp) {
+ if ((tr_state->vp_size.x != cache->orig_vp.x) || (tr_state->vp_size.y != cache->orig_vp.y)) {
+ GF_Matrix2D m;
+ gf_mx2d_init(m);
+ gf_mx2d_copy(backup, tr_state->transform);
+ gf_mx2d_add_scale(&m, gf_divfix(tr_state->vp_size.x, cache->orig_vp.x), gf_divfix(tr_state->vp_size.y, cache->orig_vp.y) );
+ gf_mx2d_pre_multiply(&tr_state->transform, &m);
+ } else {
+ auto_fit_vp = 0;
+ }
+ }
#endif
#ifndef GPAC_DISABLE_3D
#endif
drawable_finalize_sort(group_ctx, tr_state, NULL);
-#ifdef CACHE_DEBUG_CENTER
- gf_mx2d_copy(tr_state->transform, mx);
+#ifndef CACHE_DEBUG_CENTER
+ if (auto_fit_vp)
#endif
+ {
+ gf_mx2d_copy(tr_state->transform, backup);
}
-
return (force_recompute==1);
}
}
/*cache has been modified due to node changes, reset stats*/
- group_cache_traverse(node, group->cache, tr_state, needs_recompute, 1);
+ group_cache_traverse(node, group->cache, tr_state, needs_recompute, 1, 0);
return 1;
}
Bool force_recompute;
/*user scale (zoom and AR) of the group*/
Fixed scale;
+ SFVec2f orig_vp;
} GroupCache;
GroupCache *group_cache_new(GF_Compositor *compositor, GF_Node *node);
void group_cache_del(GroupCache *cache);
/*returns 1 if cache is being recomputed due to dirty subtree*/
-Bool group_cache_traverse(GF_Node *node, GroupCache *cache, GF_TraverseState *tr_state, Bool force_recompute, Bool is_mpeg4);
+Bool group_cache_traverse(GF_Node *node, GroupCache *cache, GF_TraverseState *tr_state, Bool force_recompute, Bool is_mpeg4, Bool auto_fit_vp);
void group_cache_draw(GroupCache *cache, GF_TraverseState *tr_state);
Fixed group_cache_check_coverage_increase(GF_Rect *ctx, GF_Rect *grp_bounds, DrawableContext *curr, DrawableContext* first_child);
gf_mx2d_copy(tr_state->transform, *backup_matrix_2d);
}
-
+#ifdef UNUSED_FUNC
static void gf_svg_apply_inheritance_no_inheritance(SVGAllAttributes *all_atts, SVGPropertiesPointers *render_svg_props)
{
#define CHECK_PROP(a, b) if (b) a = b;
CHECK_PROP(render_svg_props->stroke_width, all_atts->stroke_width);
CHECK_PROP(render_svg_props->visibility, all_atts->visibility);
}
+#endif /* UNUSED_FUNC */
static const struct svg_11_feature { const char *name; Bool supported; } svg11_features[] =
{
Fixed amplitude = 1;\r
Fixed exponent = 1;\r
Fixed offset = 0;\r
- u8 *ptr;\r
- u32 tag = gf_node_get_tag(l->node);\r
+ u8 *ptr = NULL;\r
+ /*FIXME: unused u32 tag = gf_node_get_tag(l->node);*/\r
GF_DOMAttribute *att = ((SVG_Element *)l->node)->attributes;\r
\r
while (att) {\r
\r
if ((type==SVG_FILTER_TRANSFER_LINEAR) && (intercept || (slope!=FIX_ONE)) ) {\r
intercept *= 255;\r
+ assert( ptr );\r
for (i=0; i<source->height; i++) {\r
for (j=0; j<source->width; j++) {\r
Fixed p = (*ptr) * slope + intercept;\r
}\r
}\r
} else if (type==SVG_FILTER_TRANSFER_GAMMA) {\r
+ assert( ptr );\r
for (i=0; i<source->height; i++) {\r
for (j=0; j<source->width; j++) {\r
Fixed p = 255 * gf_mulfix(amplitude, FLT2FIX( pow( INT2FIX(*ptr)/255, FIX2FLT(exponent) ) ) ) + offset;\r
} else if ((type==SVG_FILTER_TRANSFER_TABLE) && table && (gf_list_count(table)>=2) ) {\r
u32 count = gf_list_count(table);\r
u32 N = count-1;\r
+ assert( ptr );\r
for (i=0; i<source->height; i++) {\r
for (j=0; j<source->width; j++) {\r
SVG_Number *vk, *vk1;\r
}\r
} else if ((type==SVG_FILTER_TRANSFER_DISCRETE) && table && gf_list_count(table) ) {\r
u32 count = gf_list_count(table);\r
+ assert( ptr );\r
for (i=0; i<source->height; i++) {\r
for (j=0; j<source->width; j++) {\r
SVG_Number *vk;\r
\r
if (st->txh.stride * st->txh.height > st->alloc_size) {\r
st->alloc_size = st->txh.stride * st->txh.height;\r
- st->data = realloc(st->data, sizeof(u8) * st->alloc_size);\r
+ st->data = (u8*)gf_realloc(st->data, sizeof(u8) * st->alloc_size);\r
}\r
memset(st->data, 0x0, sizeof(char) * st->txh.stride * st->txh.height);\r
st->txh.data = st->data;\r
st->txh.data = NULL;\r
gf_sc_texture_release(&st->txh);\r
gf_sc_texture_destroy(&st->txh);\r
- free(st);\r
+ gf_free(st);\r
return;\r
}\r
\r
st->glyph.utf_name = utf_name[0];
st->uni_len = 1;
} else {
- st->glyph.utf_name = (u32) st;
+ st->glyph.utf_name = (u32) (PTR_TO_U_CAST st);
st->unicode = gf_malloc(sizeof(u16)*len);
st->uni_len = len;
memcpy(st->unicode, utf_name, sizeof(u16)*len);
}
reg_common:
- st->glyph.ID = (u32) st;
+ st->glyph.ID = (u32) (PTR_TO_U_CAST st);
st->font = font;
st->glyph.horiz_advance = font->max_advance_h;
if (atts.horiz_adv_x) st->glyph.horiz_advance = FIX2INT( gf_ceil(atts.horiz_adv_x->value) );
evt.prev_translate.x = stack->vp.x;
evt.prev_translate.y = stack->vp.y;
evt.type = GF_EVENT_VP_RESIZE;
- gf_scene_notify_event(scene, 0, NULL, &evt);
+ gf_scene_notify_event(scene, 0, NULL, &evt, GF_OK);
}
}
#ifdef GF_SR_USE_VIDEO_CACHE
group_2d_cache_traverse(node, group, tr_state);
#else
- group_cache_traverse(node, group->cache, tr_state, group->cache->force_recompute, 0);
+ group_cache_traverse(node, group->cache, tr_state, group->cache->force_recompute, 0, 0);
#endif
} else {
#ifdef GF_SR_USE_VIDEO_CACHE
drawable_check_focus_highlight(node, tr_state, NULL);
if (is_fragment) {
- /*we must have exclusive access to the fragment*/
- if (gf_scene_lock(stack->inline_sg, 1)) {
- gf_node_traverse(used_node, tr_state);
- gf_scene_lock(stack->inline_sg, 0);
- }
+ gf_node_traverse(used_node, tr_state);
} else {
gf_sc_traverse_subscene(tr_state->visual->compositor, node, stack->inline_sg, tr_state);
}
return NULL;
}
+GF_SceneGraph *gf_sc_animation_get_scenegraph(GF_Node *node)
+{
+ SVGlinkStack *stack;
+ if (node->sgprivate->tag!=TAG_SVG_animation) return NULL;
+ stack = gf_node_get_private(node);
+ return stack->inline_sg;
+}
+
+
#endif
return &(st->txh);
}
+
+
+
+typedef struct
+{
+ /*media stream*/
+ GF_MediaObject *resource;
+ Bool stop_requested, is_open;
+ Double clipBegin, clipEnd;
+} SVG_updates_stack;
+
+static void svg_updates_smil_evaluate(SMIL_Timing_RTI *rti, Fixed normalized_scene_time, u32 status)
+{
+ SVG_updates_stack *stack = (SVG_updates_stack *)gf_node_get_private(gf_smil_get_element(rti));
+
+ switch (status) {
+ case SMIL_TIMING_EVAL_UPDATE:
+ if (!stack->is_open) {
+ if (stack->resource ) gf_mo_play(stack->resource, stack->clipBegin, stack->clipEnd, 0);
+ stack->is_open = 1;
+ }
+ else if (gf_mo_is_done(stack->resource) && (gf_smil_get_media_duration(rti)<0) ) {
+ Double dur = gf_mo_get_duration(stack->resource);
+ gf_smil_set_media_duration(rti, dur);
+ }
+ break;
+ case SMIL_TIMING_EVAL_FREEZE:
+ case SMIL_TIMING_EVAL_REMOVE:
+ stack->is_open = 0;
+ gf_mo_set_flag(stack->resource, GF_MO_DISPLAY_REMOVE, 1);
+ gf_mo_stop(stack->resource);
+ break;
+ case SMIL_TIMING_EVAL_REPEAT:
+ gf_mo_restart(stack->resource);
+ break;
+ }
+}
+
+static void svg_traverse_updates(GF_Node *node, void *rs, Bool is_destroy)
+{
+ /*video stack is just an extension of image stack, type-casting is OK*/
+ SVG_updates_stack *stack = (SVG_updates_stack*)gf_node_get_private(node);
+ GF_TraverseState *tr_state = (GF_TraverseState *)rs;
+ SVGAllAttributes all_atts;
+ SVGPropertiesPointers backup_props;
+ u32 backup_flags, dirty_flags;
+
+ if (is_destroy) {
+ if (stack->resource) {
+ if (stack->is_open) {
+ gf_mo_set_flag(stack->resource, GF_MO_DISPLAY_REMOVE, 1);
+ gf_mo_stop(stack->resource);
+ }
+ gf_mo_unregister(node, stack->resource);
+ }
+ gf_free(stack);
+ return;
+ }
+
+ if (tr_state->traversing_mode!=TRAVERSE_SORT) return;
+
+ /*flatten attributes and apply animations + inheritance*/
+ gf_svg_flatten_attributes((SVG_Element *)node, &all_atts);
+ if (!compositor_svg_traverse_base(node, &all_atts, (GF_TraverseState *)rs, &backup_props, &backup_flags))
+ return;
+
+ dirty_flags = gf_node_dirty_get(node);
+ if (dirty_flags) {
+ stack->clipBegin = all_atts.clipBegin ? *all_atts.clipBegin : 0;
+ stack->clipEnd = all_atts.clipEnd ? *all_atts.clipEnd : -1;
+ if (dirty_flags & GF_SG_SVG_XLINK_HREF_DIRTY) {
+ GF_MediaObject *new_res;
+ MFURL url;
+ Bool lock_timeline=0;
+ url.vals = NULL;
+ url.count = 0;
+
+ if (all_atts.syncBehavior) lock_timeline = (*all_atts.syncBehavior == SMIL_SYNCBEHAVIOR_LOCKED) ? 1 : 0;
+
+ gf_term_get_mfurl_from_xlink(node, &url);
+
+ new_res = gf_mo_register(node, &url, lock_timeline, 0);
+ gf_sg_mfurl_del(url);
+
+ if (stack->resource!=new_res) {
+ if (stack->resource) {
+ gf_mo_stop(stack->resource);
+ gf_mo_unregister(node, stack->resource);
+ }
+ stack->resource = new_res;
+ if (stack->resource && stack->is_open) gf_mo_play(stack->resource, stack->clipBegin, stack->clipEnd, 0);
+ }
+ }
+ gf_node_dirty_clear(node, 0);
+ }
+ memcpy(tr_state->svg_props, &backup_props, sizeof(SVGPropertiesPointers));
+ tr_state->svg_flags = backup_flags;
+}
+
+void compositor_init_svg_updates(GF_Compositor *compositor, GF_Node *node)
+{
+ SVG_updates_stack *stack;
+ GF_SAFEALLOC(stack, SVG_updates_stack)
+
+ /*force first processing of xlink-href*/
+ gf_node_dirty_set(node, GF_SG_SVG_XLINK_HREF_DIRTY, 0);
+
+ gf_smil_set_evaluation_callback(node, svg_updates_smil_evaluate);
+
+ gf_node_set_private(node, stack);
+ gf_node_set_callback_function(node, svg_traverse_updates);
+ stack->clipEnd = -1;
+}
+
#endif //GPAC_DISABLE_SVG
font = svg_set_font(tr_state, fm);
if (!font) return;
+ if (font->not_loaded) {
+ tr_state->visual->compositor->reset_fonts = 1;
+ tr_state->visual->compositor->skip_flush = 1;
+ gf_sc_next_frame_state(tr_state->visual->compositor, GF_SC_DRAW_FRAME);
+ return;
+ }
+
span = svg_get_text_span(fm, font, tr_state->svg_props->font_size->value, (tr_state->count_x>1), (tr_state->count_y>1), tr_state->count_rotate, atts, dom_text->textContent, atts->xml_lang ? *atts->xml_lang : NULL, tr_state);
if (!span) return;
void gf_sc_texture_destroy(GF_TextureHandler *txh)
{
GF_Compositor *compositor = txh->compositor;
- gf_mx_p(compositor->mx);
+ Bool lock = gf_mx_try_lock(compositor->mx);
gf_sc_texture_release(txh);
if (txh->is_open) gf_sc_texture_stop(txh);
gf_list_del_item(txh->compositor->textures, txh);
- gf_mx_v(compositor->mx);
+ if (lock) gf_mx_v(compositor->mx);
}
GF_EXPORT
txh->needs_release = 0;
}
gf_sc_invalidate(txh->compositor, NULL);
- gf_mo_stop(txh->stream);
+ if (gf_mo_stop(txh->stream)) {
+ txh->data = NULL;
+ }
txh->is_open = 0;
/*and deassociate object*/
gf_mo_restart(txh->stream);
}
+
+static void setup_texture_object(GF_TextureHandler *txh, Bool private_media)
+{
+ if (!txh->tx_io) {
+ gf_sc_texture_allocate(txh);
+ if (!txh->tx_io) return;
+
+ gf_mo_get_visual_info(txh->stream, &txh->width, &txh->height, &txh->stride, &txh->pixel_ar, &txh->pixelformat);
+
+ if (private_media) {
+ txh->transparent = 1;
+ txh->pixelformat = GF_PIXEL_ARGB;
+ txh->flags |= GF_SR_TEXTURE_PRIVATE_MEDIA;
+ } else {
+ txh->transparent = 0;
+ switch (txh->pixelformat) {
+ case GF_PIXEL_ALPHAGREY:
+ case GF_PIXEL_ARGB:
+ case GF_PIXEL_RGBA:
+ case GF_PIXEL_YUVA:
+ case GF_PIXEL_RGBDS:
+ txh->transparent = 1;
+ break;
+ }
+ }
+ gf_mo_set_flag(txh->stream, GF_MO_IS_INIT, 1);
+ }
+}
+
+
GF_EXPORT
void gf_sc_texture_update_frame(GF_TextureHandler *txh, Bool disable_resync)
{
gf_sc_invalidate(txh->compositor, NULL);
return;
}
+ if (gf_mo_is_private_media(txh->stream)) {
+ setup_texture_object(txh, 1);
+ }
}
txh->data = gf_mo_fetch_data(txh->stream, !disable_resync, &txh->stream_finished, &ts, &size);
/*if no frame or muted don't draw*/
- if (!txh->data || !size) return;
+ if (!txh->data || !size) {
+ /*TODO - check if this is needed */
+ if (txh->flags & GF_SR_TEXTURE_PRIVATE_MEDIA) {
+ //txh->needs_refresh = 1;
+ gf_sc_invalidate(txh->compositor, NULL);
+ }
+ return;
+ }
/*if setup and same frame return*/
if (txh->tx_io && (txh->stream_finished || (txh->last_frame_time==ts)) ) {
if (gf_mo_is_muted(txh->stream)) return;
if (!txh->tx_io) {
- gf_sc_texture_allocate(txh);
- if (!txh->tx_io) return;
-
- gf_mo_get_visual_info(txh->stream, &txh->width, &txh->height, &txh->stride, &txh->pixel_ar, &txh->pixelformat);
-
- txh->transparent = 0;
- switch (txh->pixelformat) {
- case GF_PIXEL_ALPHAGREY:
- case GF_PIXEL_ARGB:
- case GF_PIXEL_RGBA:
- case GF_PIXEL_YUVA:
- case GF_PIXEL_RGBDS:
- txh->transparent = 1;
- break;
- }
-
- gf_mo_set_flag(txh->stream, GF_MO_IS_INIT, 1);
+ setup_texture_object(txh, 0);
}
/*try to push texture on graphics but don't complain if failure*/
#define _TEXTURING_H_
#include <gpac/internal/compositor_dev.h>
-
+#ifdef __cplusplus
+extern "C" {
+#endif
/*allocates the HW specific texture handle(s) (potentially both raster and OpenGL handlers)*/
GF_Err gf_sc_texture_allocate(GF_TextureHandler *txh);
/*releases the hardware handle(s) and all associated system resources*/
/*gets texture transform matrix - returns 1 if not identity
@tx_transform: texture transform node from appearance*/
-Bool gf_sc_texture_get_transform(GF_TextureHandler *txh, GF_Node *tx_transform, GF_Matrix *mx);
+Bool gf_sc_texture_get_transform(GF_TextureHandler *txh, GF_Node *tx_transform, GF_Matrix *mx, Bool for_picking);
/*gets the associated raster2D stencil handler*/
GF_STENCIL gf_sc_texture_get_stencil(GF_TextureHandler *hdl);
void gf_sc_copy_to_texture(GF_TextureHandler *txh);
#endif
+Bool gf_sc_texture_convert(GF_TextureHandler *txh);
/*copy current GL window to the associated data buffer - the viewport used is the texture one (0,0,W,H) */
void gf_sc_copy_to_stencil(GF_TextureHandler *txh);
void gf_sc_texture_set_blend_mode(GF_TextureHandler *txh, u32 mode);
#endif /*GPAC_DISABLE_3D*/
-
-
+#ifdef __cplusplus
+}
+#endif
#endif /*_TEXTURING_H_*/
TX_IS_RECT = (1<<5),
TX_EMULE_POW2 = (1<<6),
TX_EMULE_FIRST_LOAD = (1<<7),
+
+ TX_IS_FLIPPED = (1<<8),
};
if (txh->tx_io) txh->tx_io->blend_mode = mode;
}
-
void tx_bind_with_mode(GF_TextureHandler *txh, Bool transparent, u32 blend_mode)
{
if (!txh->tx_io || !txh->tx_io->id || !txh->tx_io->gl_type) return;
txh->tx_io->gl_type = GL_TEXTURE_2D;
use_rect = tx_can_use_rect_ext(compositor, txh);
if (!is_pow2 && use_rect) {
-#ifndef GPAC_USE_TINYGL
+#if !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
txh->tx_io->gl_type = GL_TEXTURE_RECTANGLE_EXT;
#endif
txh->tx_io->flags = TX_IS_RECT;
txh->tx_io->gl_format = GL_RGBA;
txh->tx_io->nb_comp = 4;
break;
+#ifndef GPAC_USE_OGL_ES
case GF_PIXEL_ARGB:
if (!compositor->gl_caps.bgra_texture) return 0;
txh->tx_io->gl_format = GL_BGRA_EXT;
txh->tx_io->nb_comp = 4;
break;
+#endif
case GF_PIXEL_YV12:
+#ifndef GPAC_USE_OGL_ES
if (!compositor->disable_yuvgl && compositor->gl_caps.yuv_texture && !(txh->tx_io->flags & TX_MUST_SCALE) ) {
txh->tx_io->gl_format = compositor->gl_caps.yuv_texture;
txh->tx_io->nb_comp = 3;
txh->tx_io->gl_dtype = UNSIGNED_SHORT_8_8_MESA;
- } else {
+ } else
+#endif
+ {
if (!use_rect && compositor->emul_pow2) txh->tx_io->flags = TX_EMULE_POW2;
txh->tx_io->gl_format = GL_RGB;
txh->tx_io->nb_comp = 3;
#else
#ifndef GPAC_USE_TINYGL
- if (txh->tx_io->gl_type == GL_TEXTURE_2D) {
+ if (txh->tx_io->gl_type == GL_TEXTURE_2D) {
GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_WRAP_S, (txh->flags & GF_SR_TEXTURE_REPEAT_S) ? GL_REPEAT : GL_CLAMP);
GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_WRAP_T, (txh->flags & GF_SR_TEXTURE_REPEAT_T) ? GL_REPEAT : GL_CLAMP);
} else
#endif
- {
- GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_WRAP_S, GL_REPEAT);
- GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ {
+ GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
- if (txh->tx_io->gl_type == GL_TEXTURE_2D) {
+ if (txh->tx_io->gl_type == GL_TEXTURE_2D) {
GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_MAG_FILTER, txh->compositor->high_speed ? GL_NEAREST : GL_LINEAR);
GLTEXPARAM(txh->tx_io->gl_type, GL_TEXTURE_MIN_FILTER, txh->compositor->high_speed ? GL_NEAREST : GL_LINEAR);
} else {
char *gf_sc_texture_get_data(GF_TextureHandler *txh, u32 *pix_format)
{
- char *data = txh->tx_io->conv_data;
- *pix_format = txh->tx_io->conv_format;
- if (*pix_format == txh->pixelformat) return txh->data;
- return data;
+ if (txh->tx_io->conv_data) {
+ *pix_format = txh->tx_io->conv_format;
+ return txh->tx_io->conv_data;
+ }
+ *pix_format = txh->pixelformat;
+ return txh->data;
}
void txh_unpack_yuv(GF_TextureHandler *txh)
}
}
/*remove GL texture flip*/
- txh->flags |= GF_SR_TEXTURE_NO_GL_FLIP;
+ txh->tx_io->flags |= TX_IS_FLIPPED;
}
/*note about conversion: we consider that a texture without a stream attached is generated by the compositor
hence is never flipped. Otherwise all textures attached to stream are flipped in order to match uv coords*/
-Bool tx_convert(GF_TextureHandler *txh)
+Bool gf_sc_texture_convert(GF_TextureHandler *txh)
{
GF_VideoSurface src, dst;
- u32 out_stride, i, hy;
- char *tmp;
+ u32 out_stride, i, bpp;
+ Bool flip;
GF_Compositor *compositor = (GF_Compositor *)txh->compositor;
switch (txh->pixelformat) {
if (!(txh->tx_io->flags & TX_IS_RECT)) return 1;
if (txh->flags & GF_SR_TEXTURE_NO_GL_FLIP) return 1;
+ if (!txh->tx_io->conv_data) {
+ txh->tx_io->conv_data = gf_malloc(sizeof(char)*txh->stride*txh->height);
+ txh->tx_io->conv_format = txh->pixelformat;
+ }
+
/*if texture is using RECT extension, flip image manually because
texture transforms are not supported in this case ...*/
- tmp = (char*)gf_malloc(sizeof(char)*txh->stride);
- hy = txh->height/2;
- for (i=0; i<hy; i++) {
- memcpy(tmp, txh->data + i*txh->stride, txh->stride);
- memcpy(txh->data + i*txh->stride, txh->data + (txh->height - 1 - i) * txh->stride, txh->stride);
- memcpy(txh->data + (txh->height - 1 - i) * txh->stride, tmp, txh->stride);
+ for (i=0; i<txh->height; i++) {
+ memcpy(txh->tx_io->conv_data + (txh->height - 1 - i) * txh->stride, txh->data + i*txh->stride, txh->stride);
}
- gf_free(tmp);
- txh->flags |= GF_SR_TEXTURE_NO_GL_FLIP;
+
+ txh->tx_io->flags |= TX_IS_FLIPPED;
return 1;
case GF_PIXEL_YV12:
if (txh->tx_io->gl_format == compositor->gl_caps.yuv_texture) {
txh_unpack_yuv(txh);
return 1;
}
+ bpp = 3;
+ break;
+ case GF_PIXEL_YUVD:
+ bpp = 4;
break;
default:
txh->tx_io->conv_format = 0;
/*convert video to a po of 2 WITHOUT SCALING VIDEO*/
txh->tx_io->conv_w = gf_get_next_pow2(txh->width);
txh->tx_io->conv_h = gf_get_next_pow2(txh->height);
- txh->tx_io->conv_data = (char*)gf_malloc(sizeof(char) * 3 * txh->tx_io->conv_w * txh->tx_io->conv_h);
- memset(txh->tx_io->conv_data , 0, sizeof(char) * 3 * txh->tx_io->conv_w * txh->tx_io->conv_h);
+ txh->tx_io->conv_data = (char*)gf_malloc(sizeof(char) * bpp * txh->tx_io->conv_w * txh->tx_io->conv_h);
+ memset(txh->tx_io->conv_data , 0, sizeof(char) * bpp * txh->tx_io->conv_w * txh->tx_io->conv_h);
txh->tx_io->conv_wscale = INT2FIX(txh->width) / txh->tx_io->conv_w;
txh->tx_io->conv_hscale = INT2FIX(txh->height) / txh->tx_io->conv_h;
} else {
- txh->tx_io->conv_data = (char*)gf_malloc(sizeof(char) * 3 * txh->width * txh->height);
+ txh->tx_io->conv_data = (char*)gf_malloc(sizeof(char) * bpp * txh->width * txh->height);
}
}
- out_stride = 3 * ((txh->tx_io->flags & TX_EMULE_POW2) ? txh->tx_io->conv_w : txh->width);
+ out_stride = bpp * ((txh->tx_io->flags & TX_EMULE_POW2) ? txh->tx_io->conv_w : txh->width);
dst.width = src.width = txh->width;
dst.height = src.height = txh->height;
dst.pitch_x = 0;
dst.pitch_y = out_stride;
- txh->tx_io->conv_format = dst.pixel_format = GF_PIXEL_RGB_24;
+
+ flip = 1;
+ switch (txh->pixelformat) {
+ case GF_PIXEL_YV12:
+ txh->tx_io->conv_format = dst.pixel_format = GF_PIXEL_RGB_24;
+ break;
+ case GF_PIXEL_YUVD:
+ txh->tx_io->conv_format = GF_PIXEL_RGBD;
+ dst.pixel_format = GF_PIXEL_RGBD;
+ flip = 0;
+ break;
+ }
dst.video_buffer = txh->tx_io->conv_data;
/*stretch and flip*/
- gf_stretch_bits(&dst, &src, NULL, NULL, 0xFF, 1, NULL, NULL);
+ gf_stretch_bits(&dst, &src, NULL, NULL, 0xFF, flip, NULL, NULL);
txh->tx_io->flags |= TX_NEEDS_HW_LOAD;
- txh->flags |= GF_SR_TEXTURE_NO_GL_FLIP;
+ txh->tx_io->flags |= TX_IS_FLIPPED;
return 1;
}
}
/*convert image*/
- tx_convert(txh);
+ gf_sc_texture_convert(txh);
tx_bind(txh);
/*pow2 texture or hardware support*/
if (! (txh->tx_io->flags & TX_MUST_SCALE) ) {
+ first_load=1;
if (first_load) {
glTexImage2D(txh->tx_io->gl_type, 0, tx_mode, w, h, 0, txh->tx_io->gl_format, txh->tx_io->gl_dtype, (unsigned char *) data);
#endif
-Bool gf_sc_texture_get_transform(GF_TextureHandler *txh, GF_Node *tx_transform, GF_Matrix *mx)
+Bool gf_sc_texture_get_transform(GF_TextureHandler *txh, GF_Node *tx_transform, GF_Matrix *mx, Bool for_picking)
{
Bool ret = 0;
gf_mx_init(*mx);
/*flip image if requested*/
- if (! (txh->flags & GF_SR_TEXTURE_NO_GL_FLIP) ) {
+ if (! (txh->flags & GF_SR_TEXTURE_NO_GL_FLIP) && !(txh->tx_io->flags & TX_IS_FLIPPED) && !for_picking) {
/*flip it*/
gf_mx_add_scale(mx, FIX_ONE, -FIX_ONE, FIX_ONE);
/*and translate it to handle repeatS/repeatT*/
/*WATCHOUT: GL_TEXTURE_RECTANGLE coords are w, h not 1.0, 1.0*/
if (txh->tx_io->flags & TX_IS_RECT) {
-
-// gf_mx_add_translation(mx, 0, -INT2FIX(txh->height), FIX_ONE);
- gf_mx_add_scale(mx, INT2FIX(txh->width), INT2FIX(txh->height), FIX_ONE);
+ if (!for_picking) {
+ gf_mx_add_scale(mx, INT2FIX(txh->width), INT2FIX(txh->height), FIX_ONE);
+// gf_mx_add_translation(mx, 0, INT2FIX(txh->height), 0);
+ }
/*disable any texture transforms when using RECT textures (no repeat) ??*/
/*tx_transform = NULL;*/
ret = 1;
static Bool gf_sc_texture_enable_matte_texture(GF_Node *n)
{
GF_TextureHandler *b_surf;
-#ifndef GPAC_USE_TINYGL
+#if !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
GF_TextureHandler *matte_hdl;
GF_TextureHandler *a_surf;
GF_TextureHandler *alpha_surf;
glEnable(GL_BLEND);
tx_set_image(b_surf, 0);
-#ifdef GPAC_USE_TINYGL
+#if defined(GPAC_USE_TINYGL) || defined(GPAC_USE_OGL_ES)
tx_bind(b_surf);
return 1;
#else
compositor = b_surf->compositor;
- if (!compositor->gl_caps.glActiveTextureARB) {
+ if (glActiveTexture==NULL) {
tx_bind(b_surf);
return 1;
}
if (coefficients.count >= 4)
texture[3] = (u8) FIX2INT( 255 * coefficients.vals[3]);
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
if (!matte_hdl->tx_io->id) {
glGenTextures(1, &matte_hdl->tx_io->id);
}
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,1,1,0,GL_RGBA,GL_UNSIGNED_BYTE,texture);
operand = GL_MODULATE;
- if (!strcmp(action,"BIAS")) operand = GL_ADD_SIGNED_ARB;
+ if (!strcmp(action,"BIAS")) operand = GL_ADD_SIGNED;
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_bind(b_surf);
- GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_RGB_ARB, operand);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE1_ARB);
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE1_RGB_ARB, GL_TEXTURE0_ARB);
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_ALPHA_ARB, GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, operand);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB , GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE );
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE1 );
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
return 2;
}
/* end SCALE */
texture[2] = (unsigned char) tmp;
texture[3] = (unsigned char) 255; // donne l'alpha de l'image de sortie
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
if (!matte_hdl->tx_io->id) {
glGenTextures(1, &matte_hdl->tx_io->id);
}
/* fin de la génération de la texture donnée par la fraction ! */
/* mélange effectif des textures ! } */
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_bind(b_surf);
if (a_surf) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE2_ARB);
+ glActiveTexture(GL_TEXTURE2);
tx_set_image(a_surf, 0);
tx_bind(a_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_RGB_ARB,INTERPOLATE_ARB );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE1_RGB_ARB , GL_TEXTURE2_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,SOURCE2_RGB_ARB, GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND2_RGB_ARB,GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE );
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE1 );
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE2 );
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE0 );
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
}
return 3;
}
/*REVEAL */
if (!strcmp(action,"REVEAL")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
if (alpha_surf) {
tx_set_image(alpha_surf, 0);
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_bind(alpha_surf);
}
if (a_surf) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE2_ARB);
+ glActiveTexture(GL_TEXTURE2);
tx_set_image(a_surf, 0);
tx_bind(a_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_RGB_ARB,INTERPOLATE_ARB );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE1_RGB_ARB , GL_TEXTURE2_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,SOURCE2_RGB_ARB, GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND2_RGB_ARB,GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB , GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE2);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
}
return 3;
/*INVERT */
if (! strcmp(action,"INVERT")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
- GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_RGB_ARB, GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB, GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_ONE_MINUS_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR);
if (matte->parameter.count && matte->parameter.vals[0]) {
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_ALPHA_ARB, GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_ONE_MINUS_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE );
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
return 1;
}
/* opération REPLACE_ALPHA */
if (!strcmp(action,"REPLACE_ALPHA")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
if (alpha_surf) {
glEnable(GL_BLEND);
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_set_image(alpha_surf, 0);
tx_bind(alpha_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_RGB_ARB,GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_ALPHA_ARB,GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_ARB,GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
}
return 2;
}
/* MULTIPLY_ALPHA */
if (!strcmp(action,"MULTIPLY_ALPHA")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
if (alpha_surf) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_set_image(alpha_surf, 0);
tx_bind(alpha_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_RGB_ARB,GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_ALPHA_ARB,GL_MODULATE );
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB , GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND1_ALPHA_ARB,GL_SRC_ALPHA);
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_ARB,GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
}
return 2;
}
/*ADD */
if (! strcmp(action,"ADD")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
if (a_surf) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_set_image(a_surf, 0);
tx_bind(a_surf);
- GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_RGB_ARB, GL_ADD_SIGNED_ARB );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB, GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE1_RGB_ARB, GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_ALPHA_ARB, GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD_SIGNED);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
}
return 2;
}
/* ADD_SIGNED*/
if (! strcmp(action,"ADD_SIGNED")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
if (a_surf) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_set_image(a_surf, 0);
tx_bind(a_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_RGB_ARB,GL_ADD );
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,SOURCE1_RGB_ARB,GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_ALPHA_ARB,GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_ARB,GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
}
return 2;
}
/*SUBSTRACT*/
if (! strcmp(action,"SUBSTRACT")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
if (a_surf) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_set_image(a_surf, 0);
tx_bind(a_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_RGB_ARB,GL_SUBTRACT_ARB);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,SOURCE1_RGB_ARB,GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV,COMBINE_ALPHA_ARB,GL_REPLACE );
- GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB , GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_ARB,GL_SRC_ALPHA);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_SUBTRACT);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
}
return 2;
}
/*BLEND*/
if (! strcmp(action,"BLEND")) {
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE0_ARB);
+ glActiveTexture(GL_TEXTURE0);
tx_bind(b_surf);
if (a_surf) {
GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
- compositor->gl_caps.glActiveTextureARB(GL_TEXTURE1_ARB);
+ glActiveTexture(GL_TEXTURE1);
tx_set_image(a_surf, 0);
tx_bind(a_surf);
- GLTEXENV(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);
- GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, COMBINE_ARB);
- GLTEXENV(GL_TEXTURE_ENV, COMBINE_RGB_ARB, GL_MODULATE);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE0_RGB_ARB, GL_TEXTURE0_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
- GLTEXENV(GL_TEXTURE_ENV, SOURCE1_RGB_ARB, GL_TEXTURE1_ARB );
- GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+ GLTEXENV(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ GLTEXENV(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1);
+ GLTEXENV(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
}
return 2;
}
u32 ret = gf_sc_texture_enable_matte_texture(txh->matteTexture);
if (!ret) return 0;
visual_3d_set_matrix_mode(compositor->visual, V3D_MATRIX_TEXTURE);
- if (gf_sc_texture_get_transform(txh, tx_transform, &mx))
+ if (gf_sc_texture_get_transform(txh, tx_transform, &mx, 0))
visual_3d_matrix_load(compositor->visual, mx.m);
else
visual_3d_matrix_reset(compositor->visual);
gf_mx_from_mx2d(&mx, &mx2d);
visual_3d_matrix_load(compositor->visual, mx.m);
}
- else if (gf_sc_texture_get_transform(txh, tx_transform, &mx)) {
+ else if (gf_sc_texture_get_transform(txh, tx_transform, &mx, 0)) {
visual_3d_matrix_load(compositor->visual, mx.m);
} else {
visual_3d_matrix_reset(compositor->visual);
#endif /*GPAC_DISABLE_VRML*/
#ifndef GPAC_DISABLE_3D
+ visual_3d_reset_graphics(visual);
#ifndef GPAC_DISABLE_VRML
if (visual->navigation_stack) BindableStackDelete(visual->navigation_stack);
/*remove visual registration flag*/
ctx->drawable->flags &= ~DRAWABLE_REGISTERED_WITH_VISUAL;
if (is_root_visual && (ctx->flags & CTX_HAS_APPEARANCE))
- gf_node_dirty_reset(ctx->appear);
+ gf_node_dirty_reset(ctx->appear, 0);
ctx = ctx->next;
}
ctx = a_vis->context;
while (ctx && ctx->drawable) {
if (ctx->flags & CTX_HAS_APPEARANCE)
- gf_node_dirty_reset(ctx->appear);
+ gf_node_dirty_reset(ctx->appear, 0);
ctx->drawable = NULL;
ctx = ctx->next;
}
tr_state->bounds = rc;
}
+
+void visual_reset_graphics(GF_VisualManager *visual)
+{
+#ifndef GPAC_DISABLE_3D
+ if (visual->type_3d) {
+ visual_3d_reset_graphics(visual);
+ }
+#endif
+}
+
/*all 3D related functions and macro are locate there*/
#include "visual_manager_3d.h"
+
+enum
+{
+ GF_3D_STEREO_NONE = 0,
+ GF_3D_STEREO_TOP = 1,
+ GF_3D_STEREO_SIDE = 2,
+ /*all modes above GF_3D_STEREO_SIDE require shaders*/
+
+ /*each pixel correspond to a different view*/
+ GF_3D_STEREO_COLUMNS = 3,
+ GF_3D_STEREO_ROWS = 4,
+ /*special case of sub-pixel interleaving for 2 views*/
+ GF_3D_STEREO_ANAGLYPH = 5,
+ /*custom interleaving using GLSL shaders*/
+ GF_3D_STEREO_CUSTOM = 6,
+};
+
+enum
+{
+ GF_3D_CAMERA_STRAIGHT = 0,
+ GF_3D_CAMERA_OFFAXIS,
+ GF_3D_CAMERA_LINEAR,
+ GF_3D_CAMERA_CIRCULAR,
+};
+
struct _visual_manager
{
GF_Compositor *compositor;
Bool center_coords;
Bool has_modif;
Bool has_overlays;
+ Bool has_text_edit;
/*gets access to graphics handle (either OS-specific or raw memory)*/
GF_Err (*GetSurfaceAccess)(GF_VisualManager *);
GF_List *fog_stack;
#endif
-
/*the one and only camera associated with the visual*/
GF_Camera camera;
/*cliping stuff*/
u32 num_clips;
u32 max_clips;
+
+
+ u32 nb_views, current_view, autostereo_type, camera_layout;
+ Bool reverse_views;
+
+ u32 *gl_textures;
+ u32 auto_stereo_width, auto_stereo_height;
+ GF_Mesh *autostereo_mesh;
+ u32 glsl_program;
+ u32 glsl_vertex;
+ u32 glsl_fragment;
#endif
#ifdef GF_SR_USE_DEPTH
/*reset all appearance dirty state and visual registration info*/
void visual_clean_contexts(GF_VisualManager *visual);
+
+void visual_reset_graphics(GF_VisualManager *visual);
+
#endif /*_VISUAL_MANAGER_H_*/
if (drawable->flags & DRAWABLE_IS_OVERLAY) {
visual->compositor->video_out->Blit(visual->compositor->video_out, NULL, NULL, NULL, 1);
}
-
- /*check node isn't being tracked*/
- if (visual->compositor->grab_node==drawable->node)
- visual->compositor->grab_node = NULL;
-
- if (visual->compositor->focus_node==drawable->node) {
- visual->compositor->focus_node = NULL;
- visual->compositor->focus_text_type = 0;
- }
- if (visual->compositor->hit_node==drawable->node) visual->compositor->hit_node = NULL;
- if (visual->compositor->hit_text==drawable->node) visual->compositor->hit_text = NULL;
}
Bool visual_2d_node_cull(GF_TraverseState *tr_state, GF_Rect *bounds)
#endif
if (!visual->is_attached) return;
- if (!BackColor && !visual->offscreen) BackColor = visual->compositor->back_color;
+ if (!BackColor && !visual->offscreen) {
+ if (!visual->compositor->user || !(visual->compositor->user->init_flags & GF_TERM_WINDOW_TRANSPARENT)) {
+ BackColor = visual->compositor->back_color;
+ }
+ }
visual->compositor->rasterizer->surface_clear(visual->raster_surface, rc, BackColor);
}
if ((ctx->flags & CTX_IS_BACKGROUND) || tr_state->immediate_draw) {
if (ctx->bi->clip.width && ctx->bi->clip.height) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_COMPOSE, ("[Visual2D] Redrawing node %s (direct draw)\n", gf_node_get_log_name(ctx->drawable->node) ));
- raster->surface_set_clipper(visual->raster_surface, &ctx->bi->clip);
- raster->surface_fill(visual->raster_surface, stencil);
+
+ if (stencil) {
+ raster->surface_set_clipper(visual->raster_surface, &ctx->bi->clip);
+ raster->surface_fill(visual->raster_surface, stencil);
+ } else {
+ raster->surface_clear(visual->raster_surface, &ctx->bi->clip, 0);
+ }
visual->has_modif = 1;
}
gf_irect_intersect(&clip, &visual->to_redraw.list[i]);
if (clip.width && clip.height) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_COMPOSE, ("[Visual2D] Redrawing node %s (indirect draw @ dirty rect idx %d)\n", gf_node_get_log_name(ctx->drawable->node), i));
- raster->surface_set_clipper(visual->raster_surface, &clip);
- raster->surface_fill(visual->raster_surface, stencil);
-
+ if (stencil) {
+ raster->surface_set_clipper(visual->raster_surface, &clip);
+ raster->surface_fill(visual->raster_surface, stencil);
+ } else {
+ raster->surface_clear(visual->raster_surface, &clip, 0);
+ }
visual->has_modif = 1;
}
}
return;
}
+ if (txh->flags & GF_SR_TEXTURE_PRIVATE_MEDIA) {
+ GF_Window src, dst;
+
+
+ /*no aa*/
+// visual_2d_set_options(visual->compositor, visual->raster_surface, 0, 1);
+
+ /*set matrix*/
+// raster->surface_set_matrix(visual->raster_surface, &ctx->transform);
+
+ /*push path*/
+// raster->surface_set_path(visual->raster_surface, ctx->drawable->path);
+ /*using NULL will clear the clip rect with color 0x00000000*/
+ visual_2d_fill_path(visual, ctx, NULL, tr_state);
+// raster->surface_set_path(visual->raster_surface, NULL);
+
+ if (compositor_texture_rectangles(visual, txh, &ctx->bi->clip, &ctx->bi->unclip, &src, &dst, NULL, NULL))
+ gf_mo_set_position(txh->stream, &src, &dst);
+
+ return;
+ }
+
if (!gf_sc_texture_push_image(txh, 0, 1)) return;
tx_raster = gf_sc_texture_get_stencil(txh);
z_far = max(vp_size.x, vp_size.y) * max(width, height) / (2*min(1, ar)*tg(fov/2)) )
to choose a z_far so that the size is more than one pixel, then z_far' = z_far/n_pixels*/
- if (tr_state->camera->z_far<=0) {
+ //if (tr_state->camera->z_far<=0)
+ {
Fixed ar = gf_divfix(tr_state->vp_size.x, tr_state->vp_size.y);
if (ar>FIX_ONE) ar = FIX_ONE;
tr_state->camera->z_far = gf_muldiv(
if (tr_state->visual->compositor->auto_calibration && tr_state->visual->compositor->video_out->view_distance) {
Fixed view_distance, disparity;
- view_distance = INT2FIX(tr_state->visual->compositor->video_out->view_distance);
+ /*get view distance in pixels*/
+ view_distance = tr_state->visual->compositor->video_out->view_distance * tr_state->visual->compositor->video_out->dpi_x;
+ view_distance = gf_divfix(view_distance , FLT2FIX(2.54f) );
disparity = INT2FIX(tr_state->visual->compositor->video_out->disparity);
if (tr_state->visual->depth_vp_range) {
gf_sc_invalidate(tr_state->visual->compositor, NULL);
}
-
void visual_3d_setup_projection(GF_TraverseState *tr_state)
{
#ifndef GPAC_DISABLE_VRML
} else
#endif
if (tr_state->camera->had_viewpoint) {
+ Bool had_vp = tr_state->camera->had_viewpoint;
+ tr_state->camera->had_viewpoint = 0;
if (tr_state->camera->is_3D) {
SFVec3f pos, center;
SFRotation r;
#ifdef GF_SR_USE_DEPTH
/* 3D world calibration for stereoscopic screen */
if (tr_state->visual->compositor->auto_calibration && tr_state->visual->compositor->video_out->view_distance) {
- fov = 2*gf_atan2( INT2FIX(tr_state->visual->compositor->video_out->max_screen_width)/2,
- INT2FIX(tr_state->visual->compositor->video_out->view_distance));
+ /*get view distance in pixels*/
+ Fixed view_distance = tr_state->visual->compositor->video_out->view_distance * tr_state->visual->compositor->video_out->dpi_x;
+ view_distance = gf_divfix(view_distance , FLT2FIX(2.54f) );
+
+ fov = 2*gf_atan2( INT2FIX(tr_state->visual->compositor->video_out->max_screen_width)/2, view_distance);
}
#endif
/*this takes care of pixelMetrics*/
visual_3d_viewpoint_change(tr_state, NULL, 0, fov, pos, r, center);
/*initial vp compute, don't animate*/
- if (tr_state->camera->had_viewpoint == 2) {
+ if (had_vp == 2) {
camera_stop_anim(tr_state->camera);
camera_reset_viewpoint(tr_state->camera, 0);
+ /*scene not yet ready, force a recompute of world bounds at next frame*/
+ if (gf_sc_fit_world_to_screen(tr_state->visual->compositor) == 0) {
+ tr_state->camera->had_viewpoint = 2;
+ }
}
} else {
tr_state->camera->flags &= ~CAM_HAS_VIEWPORT;
tr_state->camera->flags |= CAM_IS_DIRTY;
}
- tr_state->camera->had_viewpoint = 0;
}
- camera_update(tr_state->camera, &tr_state->transform, tr_state->visual->center_coords);
+ if (tr_state->visual->nb_views>1) {
+ s32 view_idx;
+ Fixed interocular_dist_pixel;
+ Fixed delta = 0;
+
+ interocular_dist_pixel = FLT2FIX(6.8f) + tr_state->visual->compositor->interoccular_offset;
+
+ view_idx = tr_state->visual->current_view;
+ view_idx -= tr_state->visual->nb_views/2;
+ delta = interocular_dist_pixel * view_idx;
+ if (! (tr_state->visual->nb_views % 2)) {
+ delta += interocular_dist_pixel/2;
+ }
+ if (tr_state->visual->reverse_views) delta = - delta;
+
+ tr_state->camera->flags |= CAM_IS_DIRTY;
+ camera_update(tr_state->camera, &tr_state->transform, tr_state->visual->center_coords, delta, tr_state->visual->compositor->video_out->view_distance, tr_state->visual->compositor->view_distance_offset, tr_state->visual->camera_layout);
+ } else {
+ camera_update(tr_state->camera, &tr_state->transform, tr_state->visual->center_coords, 0, 0, 0, GF_3D_CAMERA_STRAIGHT);
+ }
/*setup projection/modelview*/
visual_3d_set_matrix_mode(tr_state->visual, V3D_MATRIX_PROJECTION);
#endif
}
-void visual_3d_init_draw(GF_TraverseState *tr_state, u32 layer_type)
+static void visual_3d_draw_background(GF_TraverseState *tr_state, u32 layer_type)
{
u32 mode;
#ifndef GPAC_DISABLE_VRML
GF_Node *bindable;
#endif
+ /*setup background*/
+ mode = tr_state->traversing_mode;
+ tr_state->traversing_mode = TRAVERSE_BINDABLE;
+
+ /*if in layer clear z buffer (even if background)*/
+ if (layer_type) visual_3d_clear_depth(tr_state->visual);
+
+ /*clear requested - do it before background drawing for layer3D (transparent background)*/
+ if (layer_type==2) {
+ SFColor col;
+ col.red = INT2FIX((tr_state->visual->compositor->back_color>>16)&0xFF) / 255;
+ col.green = INT2FIX((tr_state->visual->compositor->back_color>>8)&0xFF) / 255;
+ col.blue = INT2FIX((tr_state->visual->compositor->back_color)&0xFF) / 255;
+ visual_3d_clear(tr_state->visual, col, 0);
+ }
+
+#ifndef GPAC_DISABLE_VRML
+ bindable = (GF_Node*) gf_list_get(tr_state->backgrounds, 0);
+ if (Bindable_GetIsBound(bindable)) {
+ gf_node_traverse(bindable, tr_state);
+ }
+ /*clear if not in layer*/
+ else
+#endif
+ if (!layer_type) {
+ SFColor col;
+ Fixed alpha = 0;
+ col.red = INT2FIX((tr_state->visual->compositor->back_color>>16)&0xFF) / 255;
+ col.green = INT2FIX((tr_state->visual->compositor->back_color>>8)&0xFF) / 255;
+ col.blue = INT2FIX((tr_state->visual->compositor->back_color)&0xFF) / 255;
+ /*if composite visual, clear with alpha = 0*/
+ if (tr_state->visual==tr_state->visual->compositor->visual) {
+ alpha = FIX_ONE;
+ if (tr_state->visual->compositor->user && (tr_state->visual->compositor->user->init_flags & GF_TERM_WINDOW_TRANSPARENT) ) {
+ alpha = 0;
+ }
+ }
+ visual_3d_clear(tr_state->visual, col, alpha);
+ }
+ tr_state->traversing_mode = mode;
+
+}
+
+/*in off-axis, projection matrix is not aligned with view axis, however we need to draw the background
+centered !!
+In this case we draw the background before setting up the projection but after setting up scissor and Viewport*/
+static void visual_3d_draw_background_on_axis(GF_TraverseState *tr_state, u32 layer_type)
+{
+ GF_Matrix proj, model;
+ GF_Camera *cam = &tr_state->visual->camera;
+ Fixed ar = gf_divfix(cam->width, cam->height);
+
+ tr_state->visual->camera_layout = 0;
+
+ gf_mx_perspective(&proj, cam->fieldOfView, ar, cam->z_near, cam->z_far);
+ /*setup modelview*/
+ gf_mx_lookat(&model, cam->position, cam->target, cam->up);
+
+ visual_3d_set_matrix_mode(tr_state->visual, V3D_MATRIX_PROJECTION);
+ visual_3d_matrix_load(tr_state->visual, proj.m);
+ visual_3d_set_matrix_mode(tr_state->visual, V3D_MATRIX_MODELVIEW);
+ visual_3d_matrix_load(tr_state->visual, model.m);
+
+ visual_3d_draw_background(tr_state, layer_type);
+ tr_state->visual->camera_layout = GF_3D_CAMERA_OFFAXIS;
+}
+
+void visual_3d_init_draw(GF_TraverseState *tr_state, u32 layer_type)
+{
+#ifndef GPAC_DISABLE_VRML
+ GF_Node *bindable;
+#endif
+
/*if not in layer, traverse navigation node
FIXME: we should update the nav info according to the world transform at the current viewpoint (vrml)*/
tr_state->traversing_mode = TRAVERSE_BINDABLE;
} else {
tr_state->camera->navigation_flags = NAV_ANY | NAV_HEADLIGHT;
if (tr_state->camera->is_3D) {
- /*X3D is by default examine, VRML/MPEG4 is WALK*/
- tr_state->camera->navigate_mode = (tr_state->visual->type_3d==3) ? GF_NAVIGATE_EXAMINE : GF_NAVIGATE_WALK;
-
+ if (tr_state->visual->compositor->default_navigation_mode != GF_NAVIGATE_NONE) {
+ tr_state->camera->navigate_mode = tr_state->visual->compositor->default_navigation_mode;
+ } else {
+ /*X3D is by default examine, VRML/MPEG4 is WALK*/
+ tr_state->camera->navigate_mode = (tr_state->visual->type_3d==3) ? GF_NAVIGATE_EXAMINE : GF_NAVIGATE_WALK;
+ }
+
#ifdef GF_SR_USE_DEPTH
if (tr_state->visual->compositor->display_depth)
tr_state->camera->navigate_mode = GF_NAVIGATE_NONE;
gf_sc_invalidate(tr_state->visual->compositor, NULL);
}
- visual_3d_set_viewport(tr_state->visual, tr_state->camera->vp);
-
- /*setup projection*/
- visual_3d_setup_projection(tr_state);
/*turn off depth buffer in 2D*/
visual_3d_enable_depth_buffer(tr_state->visual, tr_state->camera->is_3D);
/*set headlight if any*/
visual_3d_enable_headlight(tr_state->visual, (tr_state->camera->navigation_flags & NAV_HEADLIGHT) ? 1 : 0, tr_state->camera);
- /*setup background*/
- mode = tr_state->traversing_mode;
- tr_state->traversing_mode = TRAVERSE_BINDABLE;
+ if (tr_state->visual->autostereo_type==GF_3D_STEREO_SIDE) {
+ GF_Rect orig_vp;
+ orig_vp = tr_state->camera->vp;
+
+ tr_state->camera->vp.width /= tr_state->visual->nb_views;
+ tr_state->camera->vp.x += tr_state->visual->current_view * tr_state->camera->vp.width;
- /*if in layer clear z buffer (even if background)*/
- if (layer_type) visual_3d_clear_depth(tr_state->visual);
+ visual_3d_set_viewport(tr_state->visual, tr_state->camera->vp);
+ visual_3d_set_scissor(tr_state->visual, &tr_state->camera->vp);
- /*clear requested - do it before background drawing for layer3D (transparent background)*/
- if (layer_type==2) {
- SFColor col;
- col.red = INT2FIX((tr_state->visual->compositor->back_color>>16)&0xFF) / 255;
- col.green = INT2FIX((tr_state->visual->compositor->back_color>>8)&0xFF) / 255;
- col.blue = INT2FIX((tr_state->visual->compositor->back_color)&0xFF) / 255;
- visual_3d_clear(tr_state->visual, col, 0);
- }
+ if (tr_state->visual->camera_layout==GF_3D_CAMERA_OFFAXIS) {
+ visual_3d_draw_background_on_axis(tr_state, layer_type);
+ }
-#ifndef GPAC_DISABLE_VRML
- bindable = (GF_Node*) gf_list_get(tr_state->backgrounds, 0);
- if (Bindable_GetIsBound(bindable)) {
- gf_node_traverse(bindable, tr_state);
+ /*setup projection*/
+ visual_3d_setup_projection(tr_state);
+
+ tr_state->camera->vp = orig_vp;
+ } else if (tr_state->visual->autostereo_type==GF_3D_STEREO_TOP) {
+ GF_Rect orig_vp;
+ orig_vp = tr_state->camera->vp;
+
+ tr_state->camera->vp.height /= tr_state->visual->nb_views;
+ tr_state->camera->vp.y += tr_state->visual->current_view * tr_state->camera->vp.height;
+ tr_state->camera->vp.y = orig_vp.height - tr_state->camera->vp.height - tr_state->camera->vp.y;
+
+ visual_3d_set_viewport(tr_state->visual, tr_state->camera->vp);
+ visual_3d_set_scissor(tr_state->visual, &tr_state->camera->vp);
+
+ if (tr_state->visual->camera_layout==GF_3D_CAMERA_OFFAXIS) {
+ visual_3d_draw_background_on_axis(tr_state, layer_type);
+ }
+
+ /*setup projection*/
+ visual_3d_setup_projection(tr_state);
+
+ tr_state->camera->vp = orig_vp;
+ } else {
+ visual_3d_set_viewport(tr_state->visual, tr_state->camera->vp);
+
+ if (tr_state->visual->camera_layout==GF_3D_CAMERA_OFFAXIS) {
+ visual_3d_draw_background_on_axis(tr_state, layer_type);
+ }
+
+ /*setup projection*/
+ visual_3d_setup_projection(tr_state);
+
+ if (tr_state->visual->autostereo_type) {
+ visual_3d_clear_depth(tr_state->visual);
+ }
}
- /*clear if not in layer*/
- else
-#endif
- if (!layer_type) {
- SFColor col;
- col.red = INT2FIX((tr_state->visual->compositor->back_color>>16)&0xFF) / 255;
- col.green = INT2FIX((tr_state->visual->compositor->back_color>>8)&0xFF) / 255;
- col.blue = INT2FIX((tr_state->visual->compositor->back_color)&0xFF) / 255;
- /*if composite visual, clear with alpha = 0*/
- visual_3d_clear(tr_state->visual, col, (tr_state->visual==tr_state->visual->compositor->visual) ? FIX_ONE : 0);
+ /*regular background draw*/
+ if (tr_state->visual->camera_layout != GF_3D_CAMERA_OFFAXIS) {
+ visual_3d_draw_background(tr_state, layer_type);
}
- tr_state->traversing_mode = mode;
+
+ visual_3d_set_scissor(tr_state->visual, NULL);
}
#ifndef GPAC_DISABLE_LOG
u32 time = gf_sys_clock();
#endif
- visual_3d_setup(visual);
+ visual_3d_setup(visual);
+
/*setup our traversing state*/
visual_3d_setup_traversing_state(visual, tr_state);
if (is_root_visual) {
- GF_SceneGraph *sg;
- u32 i;
- visual_3d_draw_node(tr_state, root);
+ Bool auto_stereo = 0;
- /*extra scene graphs*/
- i=0;
- while ((sg = (GF_SceneGraph*)gf_list_enum(visual->compositor->extra_scenes, &i))) {
- tr_state->traversing_mode = TRAVERSE_SORT;
- gf_sc_traverse_subscene(visual->compositor, root, sg, tr_state);
+ if (tr_state->visual->autostereo_type>GF_3D_STEREO_SIDE) {
+ visual_3d_init_autostereo(visual);
+ auto_stereo = 1;
}
+
+ for (visual->current_view=0; visual->current_view < visual->nb_views; visual->current_view++) {
+ GF_SceneGraph *sg;
+ u32 i;
+ visual_3d_draw_node(tr_state, root);
+
+ /*extra scene graphs*/
+ i=0;
+ while ((sg = (GF_SceneGraph*)gf_list_enum(visual->compositor->extra_scenes, &i))) {
+ tr_state->traversing_mode = TRAVERSE_SORT;
+ gf_sc_traverse_subscene(visual->compositor, root, sg, tr_state);
+ }
+
+ if (auto_stereo) {
+ visual_3d_end_auto_stereo_pass(visual);
+ }
+
+ if (is_root_visual) visual->compositor->reset_graphics = 0;
+ }
+
} else {
visual_3d_draw_node(tr_state, root);
}
tr_state->mesh_num_textures = 0;
if (!tr_state->appear) return 0;
- gf_node_dirty_reset(tr_state->appear);
+ gf_node_dirty_reset(tr_state->appear, 0);
txh = gf_sc_texture_get_handler(((M_Appearance *)tr_state->appear)->texture);
if (txh) {
/*setup viewport (vp: top-left, width, height)*/
void visual_3d_set_viewport(GF_VisualManager *visual, GF_Rect vp);
+/*setup scissors region (vp: top-left, width, height) - if vp is NULL, disables scissors*/
+void visual_3d_set_scissor(GF_VisualManager *visual, GF_Rect *vp);
+
/*setup rectangular cliper (clip: top-left, width, height)
NOTE: 2D clippers can only be set from a 2D context, hence will always take the 4 first GL clip planes.
In order to allow multiple Layer2D in Layer2D, THERE IS ALWAYS AT MOST ONE 2D CLIPPER USED AT ANY TIME,
/*fill given rect with given color (used for text hilighting only) - context shall not be altered*/
void visual_3d_fill_rect(GF_VisualManager *visual, GF_Rect rc, SFColorRGBA color);
+void visual_3d_point_sprite(GF_VisualManager *visual, Drawable *stack, GF_TextureHandler *txh, GF_TraverseState *tr_state);
+
/*non-oglES functions*/
#ifndef GPAC_USE_OGL_ES
void visual_3d_draw_bbox(GF_TraverseState *tr_state, GF_BBox *box);
+
+GF_Err visual_3d_init_autostereo(GF_VisualManager *visual);
+void visual_3d_end_auto_stereo_pass(GF_VisualManager *visual);
+void visual_3d_reset_graphics(GF_VisualManager *visual);
+
#endif /*GPAC_DISABLE_3D*/
*/
#include "visual_manager.h"
+#include "texturing.h"
#ifndef GPAC_DISABLE_3D
#undef GL_MAX_CLIP_PLANES
#endif
+#ifdef GPAC_ANDROID
+#define GPAC_USE_TINYGL
+#endif
+
+#ifdef GPAC_USE_OGL_ES
+#define GL_CLAMP GL_CLAMP_TO_EDGE
+#endif
+
+
#define CHECK_GL_EXT(name) ((strstr(ext, name) != NULL) ? 1 : 0)
+
+#ifdef LOAD_GL_1_3
+
+GLDECL_STATIC(glActiveTexture);
+GLDECL_STATIC(glClientActiveTexture);
+GLDECL_STATIC(glGenBuffers);
+GLDECL_STATIC(glDeleteBuffers);
+GLDECL_STATIC(glBindBuffer);
+GLDECL_STATIC(glBufferData);
+
+#endif //LOAD_GL_1_3
+
+#ifdef LOAD_GL_1_4
+
+GLDECL_STATIC(glPointParameterf);
+GLDECL_STATIC(glPointParameterfv);
+
+#endif //LOAD_GL_1_4
+
+#ifdef LOAD_GL_2_0
+
+GLDECL_STATIC(glCreateProgram);
+GLDECL_STATIC(glDeleteProgram);
+GLDECL_STATIC(glLinkProgram);
+GLDECL_STATIC(glUseProgram);
+GLDECL_STATIC(glCreateShader);
+GLDECL_STATIC(glDeleteShader);
+GLDECL_STATIC(glShaderSource);
+GLDECL_STATIC(glCompileShader);
+GLDECL_STATIC(glAttachShader);
+GLDECL_STATIC(glDetachShader);
+GLDECL_STATIC(glGetShaderiv);
+GLDECL_STATIC(glGetInfoLogARB);
+GLDECL_STATIC(glGetUniformLocation);
+GLDECL_STATIC(glUniform1f);
+GLDECL_STATIC(glUniform2f);
+GLDECL_STATIC(glUniform3f);
+GLDECL_STATIC(glUniform4f);
+GLDECL_STATIC(glUniform1i);
+GLDECL_STATIC(glUniform2i);
+GLDECL_STATIC(glUniform3i);
+GLDECL_STATIC(glUniform4i);
+GLDECL_STATIC(glUniform1fv);
+GLDECL_STATIC(glUniform2fv);
+GLDECL_STATIC(glUniform3fv);
+GLDECL_STATIC(glUniform4fv);
+GLDECL_STATIC(glUniform1iv);
+GLDECL_STATIC(glUniform2iv);
+GLDECL_STATIC(glUniform3iv);
+GLDECL_STATIC(glUniform4iv);
+GLDECL_STATIC(glUniformMatrix2fv);
+GLDECL_STATIC(glUniformMatrix3fv);
+GLDECL_STATIC(glUniformMatrix4fv);
+GLDECL_STATIC(glUniformMatrix2x3fv);
+GLDECL_STATIC(glUniformMatrix3x2fv);
+GLDECL_STATIC(glUniformMatrix2x4fv);
+GLDECL_STATIC(glUniformMatrix4x2fv);
+GLDECL_STATIC(glUniformMatrix3x4fv);
+GLDECL_STATIC(glUniformMatrix4x3fv);
+GLDECL_STATIC(glBlendEquation);
+
+
+#endif //LOAD_GL_2_0
+
void gf_sc_load_opengl_extensions(GF_Compositor *compositor)
{
+ Bool has_shaders = 0;
#ifdef GPAC_USE_TINYGL
/*let TGL handle texturing*/
compositor->gl_caps.rect_texture = 1;
compositor->gl_caps.npot_texture = 1;
#else
-#if defined (GPAC_USE_OGL_ES)
-#define GET_GLFUN(__name) (PFNGLARBMULTITEXTUREPROC) eglGetProcAddress(__name)
-#elif defined (WIN32)
-#define GET_GLFUN(__name) (PFNGLARBMULTITEXTUREPROC) wglGetProcAddress(__name)
-#elif defined(CONFIG_DARWIN_GL)
-#define GET_GLFUN(__name) (PFNGLARBMULTITEXTUREPROC) glutGetProcAddress(__name)
-#else
-#define GET_GLFUN(__name) (PFNGLARBMULTITEXTUREPROC) glXGetProcAddress(__name)
-#endif
+ const char *ext = NULL;
- const char *ext;
- if (!compositor->visual->type_3d) return;
+ if (compositor->visual->type_3d)
+ ext = (const char *) glGetString(GL_EXTENSIONS);
- ext = (const char *) glGetString(GL_EXTENSIONS);
+ if (!ext) ext = gf_cfg_get_key(compositor->user->config, "Compositor", "OpenGLExtensions");
/*store OGL extension to config for app usage*/
- if (gf_cfg_get_key(compositor->user->config, "Compositor", "OpenGLExtensions")==NULL)
+ else if (gf_cfg_get_key(compositor->user->config, "Compositor", "OpenGLExtensions")==NULL)
gf_cfg_set_key(compositor->user->config, "Compositor", "OpenGLExtensions", ext ? ext : "None");
+
if (!ext) return;
+
memset(&compositor->gl_caps, 0, sizeof(GLCaps));
if (CHECK_GL_EXT("GL_ARB_multisample") || CHECK_GL_EXT("GLX_ARB_multisample") || CHECK_GL_EXT("WGL_ARB_multisample"))
if (CHECK_GL_EXT("GL_EXT_bgra"))
compositor->gl_caps.bgra_texture = 1;
+ if (CHECK_GL_EXT("GL_ARB_point_parameters")) {
+ compositor->gl_caps.point_sprite = 1;
+ if (CHECK_GL_EXT("GL_ARB_point_sprite") || CHECK_GL_EXT("GL_NV_point_sprite")) {
+ compositor->gl_caps.point_sprite = 2;
+ }
+ }
+ if (CHECK_GL_EXT("GL_ARB_vertex_buffer_object")) {
+ compositor->gl_caps.vbo = 1;
+ }
+
+#ifndef GPAC_USE_OGL_ES
if (CHECK_GL_EXT("GL_EXT_texture_rectangle") || CHECK_GL_EXT("GL_NV_texture_rectangle")) {
compositor->gl_caps.rect_texture = 1;
-
if (CHECK_GL_EXT("GL_MESA_ycbcr_texture")) compositor->gl_caps.yuv_texture = YCBCR_MESA;
else if (CHECK_GL_EXT("GL_APPLE_ycbcr_422")) compositor->gl_caps.yuv_texture = YCBCR_422_APPLE;
}
+#endif
+
+ if (!compositor->visual->type_3d) return;
+ /*we have a GL context, get proc addresses*/
+
+#ifdef LOAD_GL_1_3
if (CHECK_GL_EXT("GL_ARB_multitexture")) {
- compositor->gl_caps.glActiveTextureARB = GET_GLFUN("glActiveTextureARB");
- compositor->gl_caps.glClientActiveTextureARB = GET_GLFUN("glClientActiveTextureARB");
+ GET_GLFUN(glActiveTexture);
+ GET_GLFUN(glClientActiveTexture);
+ }
+ if (compositor->gl_caps.vbo) {
+ GET_GLFUN(glGenBuffers);
+ GET_GLFUN(glDeleteBuffers);
+ GET_GLFUN(glBindBuffer);
+ GET_GLFUN(glBufferData);
}
+#endif
+#ifdef LOAD_GL_1_4
+ if (compositor->gl_caps.point_sprite) {
+ GET_GLFUN(glPointParameterf);
+ GET_GLFUN(glPointParameterfv);
+ }
+ GET_GLFUN(glBlendEquation);
#endif
+
+
+
+#ifdef LOAD_GL_2_0
+ GET_GLFUN(glCreateProgram);
+
+ if (glCreateProgram != NULL) {
+ GET_GLFUN(glDeleteProgram);
+ GET_GLFUN(glLinkProgram);
+ GET_GLFUN(glUseProgram);
+ GET_GLFUN(glCreateShader);
+ GET_GLFUN(glDeleteShader);
+ GET_GLFUN(glShaderSource);
+ GET_GLFUN(glCompileShader);
+ GET_GLFUN(glAttachShader);
+ GET_GLFUN(glDetachShader);
+ GET_GLFUN(glGetShaderiv);
+ GET_GLFUN(glGetInfoLogARB);
+ GET_GLFUN(glGetUniformLocation);
+ GET_GLFUN(glUniform1f);
+ GET_GLFUN(glUniform2f);
+ GET_GLFUN(glUniform3f);
+ GET_GLFUN(glUniform4f);
+ GET_GLFUN(glUniform1i);
+ GET_GLFUN(glUniform2i);
+ GET_GLFUN(glUniform3i);
+ GET_GLFUN(glUniform4i);
+ GET_GLFUN(glUniform1fv);
+ GET_GLFUN(glUniform2fv);
+ GET_GLFUN(glUniform3fv);
+ GET_GLFUN(glUniform4fv);
+ GET_GLFUN(glUniform1iv);
+ GET_GLFUN(glUniform2iv);
+ GET_GLFUN(glUniform3iv);
+ GET_GLFUN(glUniform4iv);
+ GET_GLFUN(glUniformMatrix2fv);
+ GET_GLFUN(glUniformMatrix3fv);
+ GET_GLFUN(glUniformMatrix4fv);
+ GET_GLFUN(glUniformMatrix2x3fv);
+ GET_GLFUN(glUniformMatrix3x2fv);
+ GET_GLFUN(glUniformMatrix2x4fv);
+ GET_GLFUN(glUniformMatrix4x2fv);
+ GET_GLFUN(glUniformMatrix3x4fv);
+ GET_GLFUN(glUniformMatrix4x3fv);
+
+ has_shaders = 1;
+ } else {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_COMPOSE, ("[Compositor] OpenGL shaders not supported\n"));
+ }
+#endif //LOAD_GL_FUNCS
+
+#endif //GPAC_USE_TINYGL
+
+#ifdef GL_VERSION_2_0
+ has_shaders = 1;
+#endif
+
+ if (!has_shaders && (compositor->visual->autostereo_type > GF_3D_STEREO_SIDE)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor] OpenGL shaders not supported - disabling auto-stereo output\n"));
+ compositor->visual->nb_views=1;
+ compositor->visual->autostereo_type = GF_3D_STEREO_NONE;
+ compositor->visual->camera_layout = GF_3D_CAMERA_STRAIGHT;
+ }
+}
+
+
+#if !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+
+
+static char *default_glsl_vertex = "\
+ varying vec3 gfNormal;\
+ varying vec3 gfView;\
+ void main(void)\
+ {\
+ gfView = vec3(gl_ModelViewMatrix * gl_Vertex);\
+ gfNormal = normalize(gl_NormalMatrix * gl_Normal);\
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\
+ gl_TexCoord[0] = gl_MultiTexCoord0;\
+ }";
+
+static char *default_glsl_lighting = "\
+ varying vec3 gfNormal;\
+ varying vec3 gfView;\
+ void gpac_lighting (void) \
+ { \
+ vec3 L = normalize(gl_LightSource[0].position.xyz - gfView);\
+ vec3 E = normalize(-gfView); \
+ vec3 R = normalize(-reflect(L,gfNormal));\
+ vec4 Iamb = gl_FrontLightProduct[0].ambient;\
+ vec4 Idiff = gl_FrontLightProduct[0].diffuse * max(dot(gfNormal,L), 0.0);\
+ Idiff = clamp(Idiff, 0.0, 1.0);\
+ vec4 Ispec = gl_FrontLightProduct[0].specular * pow(max(dot(R,E),0.0),0.3*gl_FrontMaterial.shininess);\
+ Ispec = clamp(Ispec, 0.0, 1.0);\
+ gl_FragColor = gl_FrontLightModelProduct.sceneColor + Iamb + Idiff + Ispec;\
+ }";
+
+static char *glsl_view_anaglyph = "\
+ uniform sampler2D gfView1;\
+ uniform sampler2D gfView2;\
+ void main(void) \
+ {\
+ vec4 col1 = texture2D(gfView1, gl_TexCoord[0].st); \
+ vec4 col2 = texture2D(gfView2, gl_TexCoord[0].st); \
+ gl_FragColor.r = col1.r;\
+ gl_FragColor.g = col2.g;\
+ gl_FragColor.b = col2.b;\
+ }";
+
+static char *glsl_view_anaglyph_optimize = "\
+ uniform sampler2D gfView1;\
+ uniform sampler2D gfView2;\
+ void main(void) \
+ {\
+ vec4 col1 = texture2D(gfView1, gl_TexCoord[0].st); \
+ vec4 col2 = texture2D(gfView2, gl_TexCoord[0].st); \
+ gl_FragColor.r = 0.7*col1.g + 0.3*col1.b;\
+ gl_FragColor.r = pow(gl_FragColor.r, 1.5);\
+ gl_FragColor.g = col2.g;\
+ gl_FragColor.b = col2.b;\
+ }";
+
+static char *glsl_view_columns = "\
+ uniform sampler2D gfView1;\
+ uniform sampler2D gfView2;\
+ void main(void) \
+ {\
+ if ( int( mod(gl_FragCoord.x, 2.0) ) == 0) \
+ gl_FragColor = texture2D(gfView1, gl_TexCoord[0].st); \
+ else \
+ gl_FragColor = texture2D(gfView2, gl_TexCoord[0].st); \
+ }";
+
+static char *glsl_view_rows = "\
+ uniform sampler2D gfView1;\
+ uniform sampler2D gfView2;\
+ void main(void) \
+ {\
+ if ( int( mod(gl_FragCoord.y, 2.0) ) == 0) \
+ gl_FragColor = texture2D(gfView1, gl_TexCoord[0].st); \
+ else \
+ gl_FragColor = texture2D(gfView2, gl_TexCoord[0].st); \
+ }";
+
+
+Bool visual_3d_compile_shader(u32 shader_id, const char *name, const char *source)
+{
+ GLint blen = 0;
+ GLsizei slen = 0;
+ u32 len;
+ if (!source || !shader_id) return 0;
+ len = strlen(source);
+ glShaderSource(shader_id, 1, &source, &len);
+ glCompileShader(shader_id);
+
+ glGetShaderiv(shader_id, GL_INFO_LOG_LENGTH , &blen);
+ if (blen > 1) {
+ char* compiler_log = (char*) gf_malloc(blen);
+#ifdef CONFIG_DARWIN_GL
+ glGetInfoLogARB((GLhandleARB) shader_id, blen, &slen, compiler_log);
+#else
+ glGetInfoLogARB(shader_id, blen, &slen, compiler_log);
+#endif
+ GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[GLSL] Failed to compile shader %s: %s\n", name, compiler_log));
+ gf_free (compiler_log);
+ return 0;
+ }
+ return 1;
+}
+
+void visual_3d_init_shaders(GF_VisualManager *visual)
+{
+ if (!glCreateProgram) return;
+
+ if (visual->glsl_program) return;
+
+ visual->glsl_program = glCreateProgram();
+
+ visual->glsl_vertex = glCreateShader(GL_VERTEX_SHADER);
+ visual_3d_compile_shader(visual->glsl_vertex, "vertex", default_glsl_vertex);
+
+ switch (visual->autostereo_type) {
+ case GF_3D_STEREO_COLUMNS:
+ visual->glsl_fragment = glCreateShader(GL_FRAGMENT_SHADER);
+ visual_3d_compile_shader(visual->glsl_fragment, "fragment", glsl_view_columns);
+ break;
+ case GF_3D_STEREO_ROWS:
+ visual->glsl_fragment = glCreateShader(GL_FRAGMENT_SHADER);
+ visual_3d_compile_shader(visual->glsl_fragment, "fragment", glsl_view_rows);
+ break;
+ case GF_3D_STEREO_ANAGLYPH:
+ visual->glsl_fragment = glCreateShader(GL_FRAGMENT_SHADER);
+ visual_3d_compile_shader(visual->glsl_fragment, "fragment", glsl_view_anaglyph);
+ break;
+ case GF_3D_STEREO_CUSTOM:
+ {
+ const char *sOpt = gf_cfg_get_key(visual->compositor->user->config, "Compositor", "InterleaverShader");
+ if (sOpt) {
+ FILE *src = gf_f64_open(sOpt, "rt");
+ if (src) {
+ u32 size;
+ char *shader_src;
+ gf_f64_seek(src, 0, SEEK_END);
+ size = (u32) gf_f64_tell(src);
+ gf_f64_seek(src, 0, SEEK_SET);
+ shader_src = gf_malloc(sizeof(char)*(size+1));
+ size = fread(shader_src, 1, size, src);
+ fclose(src);
+ shader_src[size]=0;
+ visual->glsl_fragment = glCreateShader(GL_FRAGMENT_SHADER);
+ visual_3d_compile_shader(visual->glsl_fragment, "fragment", shader_src);
+ gf_free(shader_src);
+ }
+ }
+ }
+ break;
+ }
+
+ glAttachShader(visual->glsl_program, visual->glsl_vertex);
+ glAttachShader(visual->glsl_program, visual->glsl_fragment);
+ glLinkProgram(visual->glsl_program);
+}
+
+#endif // !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+
+
+void visual_3d_reset_graphics(GF_VisualManager *visual)
+{
+#if !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+
+#define DEL_SHADER(_a) if (_a) { glDeleteShader(_a); _a = 0; }
+
+ DEL_SHADER(visual->glsl_vertex);
+ DEL_SHADER(visual->glsl_fragment);
+
+ if (visual->glsl_program ) {
+ glDeleteProgram(visual->glsl_program);
+ visual->glsl_program = 0;
+ }
+
+ if (visual->gl_textures) {
+ glDeleteTextures(visual->nb_views, visual->gl_textures);
+ gf_free(visual->gl_textures);
+ visual->gl_textures = NULL;
+ }
+ if (visual->autostereo_mesh) {
+ mesh_free(visual->autostereo_mesh);
+ visual->autostereo_mesh = NULL;
+ }
+#endif // !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+
+}
+
+
+GF_Err visual_3d_init_autostereo(GF_VisualManager *visual)
+{
+#if !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+ u32 bw, bh;
+ SFVec2f s;
+ if (visual->gl_textures) return GF_OK;
+
+ visual->gl_textures = gf_malloc(sizeof(GLuint) * visual->nb_views);
+ glGenTextures(visual->nb_views, visual->gl_textures);
+
+ bw = visual->width;
+ bh = visual->height;
+ /*main (not offscreen) visual*/
+ if (visual->compositor->visual==visual) {
+ bw = visual->compositor->output_width;
+ bh = visual->compositor->output_height;
+ }
+
+ if (visual->compositor->gl_caps.npot_texture) {
+ visual->auto_stereo_width = bw;
+ visual->auto_stereo_height = bh;
+ } else {
+ visual->auto_stereo_width = 2;
+ while (visual->auto_stereo_width*2 < visual->width) visual->auto_stereo_width *= 2;
+ visual->auto_stereo_height = 2;
+ while (visual->auto_stereo_height < visual->height) visual->auto_stereo_height *= 2;
+ }
+
+ visual->autostereo_mesh = new_mesh();
+ s.x = INT2FIX(bw);
+ s.y = INT2FIX(bh);
+ mesh_new_rectangle(visual->autostereo_mesh, s, NULL, 0);
+// mesh_new_ellipse(visual->autostereo_mesh, s.x, s.y, 0);
+
+ fprintf(stdout, "AutoStereo initialized - width %d height %d\n",visual->auto_stereo_width, visual->auto_stereo_height);
+
+ visual_3d_init_shaders(visual);
+#endif // !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+
+ return GF_OK;
+}
+
+void visual_3d_end_auto_stereo_pass(GF_VisualManager *visual)
+{
+#if !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+ u32 i;
+ GLint loc;
+ char szTex[100];
+ Double hw, hh;
+#ifdef GPAC_USE_OGL_ES
+ GF_Matrix mx;
+#endif
+
+
+ glFlush();
+
+ glEnable(GL_TEXTURE_2D);
+
+ glBindTexture(GL_TEXTURE_2D, visual->gl_textures[visual->current_view]);
+
+ glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
+ glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
+
+ glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, visual->auto_stereo_width, visual->auto_stereo_height, 0);
+ glDisable(GL_TEXTURE_2D);
+
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ if (visual->current_view+1<visual->nb_views) return;
+
+ hw = visual->width;
+ hh = visual->height;
+ /*main (not offscreen) visual*/
+ if (visual->compositor->visual==visual) {
+ hw = visual->compositor->output_width;
+ hh = visual->compositor->output_height;
+ }
+
+ glViewport(0, 0, (GLsizei) hw, (GLsizei) hh );
+
+ hw /= 2;
+ hh /= 2;
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-hw, hw, -hh, hh, -10, 100);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+
+ /*use our program*/
+ glUseProgram(visual->glsl_program);
+
+ /*push number of views if shader uses it*/
+ loc = glGetUniformLocation(visual->glsl_program, "gfViewCount");
+ if (loc != -1) glUniform1i(loc, visual->nb_views);
+
+ glClientActiveTexture(GL_TEXTURE0);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(2, GL_FLOAT, sizeof(GF_Vertex), &visual->autostereo_mesh->vertices[0].texcoords);
+
+ /*bind all our textures*/
+ for (i=0; i<visual->nb_views; i++) {
+ sprintf(szTex, "gfView%d", i+1);
+ loc = glGetUniformLocation(visual->glsl_program, szTex);
+ if (loc == -1) continue;
+
+ glActiveTexture(GL_TEXTURE0 + i);
+
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+
+ glBindTexture(GL_TEXTURE_2D, visual->gl_textures[i]);
+
+ glUniform1i(loc, i);
+ }
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, sizeof(GF_Vertex), &visual->autostereo_mesh->vertices[0].pos);
+
+ glDrawElements(GL_TRIANGLES, visual->autostereo_mesh->i_count, GL_UNSIGNED_INT, visual->autostereo_mesh->indices);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+
+ glClientActiveTexture(GL_TEXTURE0);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY );
+
+ glUseProgram(0);
+
+ /*not sure why this is needed but it prevents a texturing bug on XP on parallels*/
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glDisable(GL_TEXTURE_2D);
+#endif // !defined(GPAC_USE_TINYGL) && !defined(GPAC_USE_OGL_ES)
+
}
+
static void visual_3d_setup_quality(GF_VisualManager *visual)
{
if (visual->compositor->high_speed) {
glViewport(FIX2INT(vp.x), FIX2INT(vp.y), FIX2INT(vp.width), FIX2INT(vp.height));
}
+void visual_3d_set_scissor(GF_VisualManager *visual, GF_Rect *vp)
+{
+#ifndef GPAC_USE_TINYGL
+ if (vp) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(FIX2INT(vp->x), FIX2INT(vp->y), FIX2INT(vp->width), FIX2INT(vp->height));
+ } else {
+ glDisable(GL_SCISSOR_TEST);
+ }
+#endif
+}
+
void visual_3d_clear_depth(GF_VisualManager *visual)
{
glClear(GL_DEPTH_BUFFER_BIT);
Bool has_col, has_tx, has_norm;
u32 prim_type;
GF_Compositor *compositor = tr_state->visual->compositor;
+ void *base_address = NULL;
#if defined(GPAC_FIXED_POINT) && !defined(GPAC_USE_OGL_ES)
Float *color_array = NULL;
Float fix_scale = 1.0f;
fix_scale /= FIX_ONE;
#endif
-
+
has_col = has_tx = has_norm = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_COMPOSE, ("[V3D] Drawing mesh 0x%08x\n", mesh));
+
+ if ((compositor->reset_graphics==2) && mesh->vbo) {
+ /*we lost OpenGL context at previous frame, recreate VBO*/
+ mesh->vbo = 0;
+ }
+ if (!mesh->vbo && compositor->gl_caps.vbo) {
+ glGenBuffers(1, &mesh->vbo);
+ if (mesh->vbo) {
+ glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo);
+ glBufferData(GL_ARRAY_BUFFER, mesh->v_count * sizeof(GF_Vertex) , mesh->vertices, GL_STATIC_DRAW);
+ }
+ }
+ if (mesh->vbo) {
+ base_address = NULL;
+ glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo);
+ } else {
+ base_address = & mesh->vertices[0].pos;
+ }
+
glEnableClientState(GL_VERTEX_ARRAY);
#if defined(GPAC_USE_OGL_ES)
- glVertexPointer(3, GL_FIXED, sizeof(GF_Vertex), &mesh->vertices[0].pos);
+ glVertexPointer(3, GL_FIXED, sizeof(GF_Vertex), base_address);
#elif defined(GPAC_FIXED_POINT)
/*scale modelview matrix*/
glPushMatrix();
glScalef(fix_scale, fix_scale, fix_scale);
- glVertexPointer(3, GL_INT, sizeof(GF_Vertex), &mesh->vertices[0].pos);
+ glVertexPointer(3, GL_INT, sizeof(GF_Vertex), base_address);
#else
- glVertexPointer(3, GL_FLOAT, sizeof(GF_Vertex), &mesh->vertices[0].pos);
+ glVertexPointer(3, GL_FLOAT, sizeof(GF_Vertex), base_address);
#endif
- if (!tr_state->mesh_num_textures && (mesh->flags & MESH_HAS_COLOR)) {
+ if (!tr_state->mesh_num_textures && (mesh->flags & MESH_HAS_COLOR)) {
glEnable(GL_COLOR_MATERIAL);
#if !defined (GPAC_USE_OGL_ES)
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
}
#ifdef MESH_USE_SFCOLOR
/*glES only accepts full RGBA colors*/
- glColorPointer(4, GL_FIXED, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(4, GL_FIXED, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
#else
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
#endif /*MESH_USE_SFCOLOR*/
#elif defined (GPAC_FIXED_POINT)
glColorPointer(3, GL_FLOAT, 3*sizeof(Float), color_array);
}
#else
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
#endif /*MESH_USE_SFCOLOR*/
#else
#ifdef MESH_USE_SFCOLOR
if (mesh->flags & MESH_HAS_ALPHA) {
glEnable(GL_BLEND);
- glColorPointer(4, GL_FLOAT, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(4, GL_FLOAT, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
tr_state->mesh_is_transparent = 1;
} else {
- glColorPointer(3, GL_FLOAT, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(3, GL_FLOAT, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
}
#else
if (mesh->flags & MESH_HAS_ALPHA) {
glEnable(GL_BLEND);
tr_state->mesh_is_transparent = 1;
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
} else {
- glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), &mesh->vertices[0].color);
+ glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(GF_Vertex), ((char *)base_address + MESH_COLOR_OFFSET));
}
#endif /*MESH_USE_SFCOLOR*/
if (tr_state->mesh_num_textures && !mesh->mesh_type && !(mesh->flags & MESH_NO_TEXTURE)) {
has_tx = 1;
#if defined(GPAC_USE_OGL_ES)
- glTexCoordPointer(2, GL_FIXED, sizeof(GF_Vertex), &mesh->vertices[0].texcoords);
+ glTexCoordPointer(2, GL_FIXED, sizeof(GF_Vertex), ((char *)base_address + MESH_TEX_OFFSET));
glEnableClientState(GL_TEXTURE_COORD_ARRAY );
#elif defined(GPAC_FIXED_POINT)
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glScalef(fix_scale, fix_scale, fix_scale);
glMatrixMode(GL_MODELVIEW);
- glTexCoordPointer(2, GL_INT, sizeof(GF_Vertex), &mesh->vertices[0].texcoords);
+ glTexCoordPointer(2, GL_INT, sizeof(GF_Vertex), ((char *)base_address + MESH_TEX_OFFSET));
glEnableClientState(GL_TEXTURE_COORD_ARRAY );
#else
+
+#ifndef GPAC_USE_TINYGL
if (tr_state->mesh_num_textures>1) {
u32 i;
for (i=0; i<tr_state->mesh_num_textures; i++) {
- compositor->gl_caps.glClientActiveTextureARB(GL_TEXTURE0_ARB + i);
- glTexCoordPointer(2, GL_FLOAT, sizeof(GF_Vertex), &mesh->vertices[0].texcoords);
+ glClientActiveTexture(GL_TEXTURE0 + i);
+ glTexCoordPointer(2, GL_FLOAT, sizeof(GF_Vertex), ((char *)base_address + MESH_TEX_OFFSET));
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
- } else {
- glTexCoordPointer(2, GL_FLOAT, sizeof(GF_Vertex), &mesh->vertices[0].texcoords);
+ } else
+#endif //GPAC_USE_TINYGL
+ {
+ glTexCoordPointer(2, GL_FLOAT, sizeof(GF_Vertex), ((char *)base_address + MESH_TEX_OFFSET));
glEnableClientState(GL_TEXTURE_COORD_ARRAY );
}
#endif
/*normals are stored on signed bytes*/
normal_type = GL_BYTE;
#endif
- glNormalPointer(normal_type, sizeof(GF_Vertex), &mesh->vertices[0].normal);
+ glNormalPointer(normal_type, sizeof(GF_Vertex), ((char *)base_address + MESH_NORMAL_OFFSET));
if (!mesh->mesh_type) {
if (compositor->backcull
if (has_tx) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
if (has_norm) glDisableClientState(GL_NORMAL_ARRAY);
+ if (mesh->vbo)
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
#if defined(GPAC_FIXED_POINT) && !defined(GPAC_USE_OGL_ES)
if (color_array) gf_free(color_array);
if (!mesh->mesh_type && !(mesh->flags & MESH_NO_TEXTURE)) {
glClear(GL_COLOR_BUFFER_BIT);
}
+
#if !defined(GPAC_USE_OGL_ES) && !defined(GPAC_USE_TINYGL)
void visual_3d_draw_image(GF_VisualManager *visual, Fixed pos_x, Fixed pos_y, u32 width, u32 height, u32 pixelformat, char *data, Fixed scale_x, Fixed scale_y)
#endif /*GPAC_USE_OGL_ES*/
+ } else if (compositor->user && (compositor->user->init_flags & GF_TERM_WINDOW_TRANSPARENT)) {
+ fb->pitch_x = 4;
+ fb->pitch_y = 4*compositor->vp_width;
+ fb->video_buffer = (char*)gf_malloc(sizeof(char) * fb->pitch_y * fb->height);
+ fb->pixel_format = GF_PIXEL_RGBA;
+
+ glReadPixels(compositor->vp_x, compositor->vp_y, fb->width, fb->height, GL_RGBA, GL_UNSIGNED_BYTE, fb->video_buffer);
} else {
fb->pitch_x = 3;
fb->pitch_y = 3*compositor->vp_width;
return GF_OK;
}
+void visual_3d_point_sprite(GF_VisualManager *visual, Drawable *stack, GF_TextureHandler *txh, GF_TraverseState *tr_state)
+{
+#if !defined(GPAC_USE_OGL_ES) && !defined(GPAC_USE_TINYGL)
+ u32 w, h;
+ u32 pixel_format, stride;
+ u8 *data;
+ Float r, g, b, x, y;
+ Float inc, scale;
+ Bool in_strip;
+ Float delta = 0;
+ Bool first_pass = 2;
+
+ if ((visual->compositor->depth_gl_type==1) && visual->compositor->gl_caps.point_sprite) {
+ Float z;
+ static GLfloat none[3] = { 1.0f, 0, 0 };
+
+ data = gf_sc_texture_get_data(txh, &pixel_format);
+ if (!data) return;
+ stride = txh->stride;
+ if (txh->pixelformat==GF_PIXEL_YUVD) stride *= 4;
+
+ glPointSize(1.0f * visual->compositor->zoom);
+ glDepthMask(GL_FALSE);
+
+ glPointParameterfv(GL_DISTANCE_ATTENUATION_EXT, none);
+ glPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 0.0);
+ glEnable(GL_POINT_SMOOTH);
+ glDisable(GL_LIGHTING);
+
+ scale = visual->compositor->depth_gl_scale;
+ inc = 1;
+ if (!tr_state->pixel_metrics) inc /= tr_state->min_hsize;
+ x = 0;
+ y = 1; y*=txh->height/2;
+ if (!tr_state->pixel_metrics) y /= tr_state->min_hsize;
+
+ glBegin(GL_POINTS);
+ for (h=0; h<txh->height; h++) {
+ x = -1; x *= txh->width/2;
+ if (!tr_state->pixel_metrics) x /= tr_state->min_hsize;
+ for (w=0; w<txh->width; w++) {
+ u8 *p = data + h*stride + w*4;
+ r = p[0]; r /= 255;
+ g = p[1]; g /= 255;
+ b = p[2]; b /= 255;
+ z = p[3]; z = z / 255;
+
+ glColor4f(r, g, b, 1.0);
+ glVertex3f(x, y, -z*60);
+ x += inc;
+ }
+ y -= inc;
+ }
+ glEnd();
+
+ glDepthMask(GL_TRUE);
+ return;
+ }
+
+ delta = visual->compositor->depth_gl_strips_filter;
+ if (!delta) first_pass = 2;
+ else first_pass = 1;
+
+ data = gf_sc_texture_get_data(txh, &pixel_format);
+ if (!data) return;
+ stride = txh->stride;
+ if (txh->pixelformat==GF_PIXEL_YUVD) stride *= 4;
+
+ glDepthMask(GL_FALSE);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_BLEND);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_POINT_SMOOTH);
+ glDisable(GL_FOG);
+
+restart:
+ scale = 50;
+ inc = 1;
+ if (!tr_state->pixel_metrics) inc /= tr_state->min_hsize;
+ x = 0;
+ y = 1; y*=txh->height/2;
+ if (!tr_state->pixel_metrics) y /= tr_state->min_hsize;
+
+ in_strip = 0;
+ for (h=0; h<txh->height - 1; h++) {
+ char *src = data + h*stride;
+ x = -1; x *= txh->width/2;
+ if (!tr_state->pixel_metrics) x /= tr_state->min_hsize;
+
+ for (w=0; w<txh->width; w++) {
+ u8 *p1 = src + w*4;
+ u8 *p2 = src + w*4 + stride;
+ Float z1 = p1[3];
+ Float z2 = p2[3];
+ if (first_pass==1) {
+ if ((z1>delta) || (z2>delta))
+ {
+ if (0 && in_strip) {
+ glEnd();
+ in_strip = 0;
+ }
+ x += inc;
+ continue;
+ }
+ } else if (first_pass==0) {
+ if ((z1<=delta) || (z2<=delta))
+ {
+ if (in_strip) {
+ glEnd();
+ in_strip = 0;
+ }
+ x += inc;
+ continue;
+ }
+ }
+ z1 = z1 / 255;
+ z2 = z2 / 255;
+
+ r = p1[0];
+ r /= 255;
+ g = p1[1];
+ g /= 255;
+ b = p1[2];
+ b /= 255;
+
+ if (!in_strip) {
+ glBegin(GL_TRIANGLE_STRIP);
+ in_strip = 1;
+ }
+
+ glColor3f(r, g, b);
+ glVertex3f(x, y, z1*scale);
+
+ r = p2[0];
+ r /= 255;
+ g = p2[1];
+ g /= 255;
+ b = p2[2];
+ b /= 255;
+
+ glColor3f(r, g, b);
+ glVertex3f(x, y-inc, z2*scale);
+
+ x += inc;
+ }
+ if (in_strip) {
+ glEnd();
+ in_strip = 0;
+ }
+ y -= inc;
+ }
+
+ if (first_pass==1) {
+ first_pass = 0;
+ goto restart;
+ }
+
+#endif //GPAC_USE_OGL_ES
+
+}
+
#endif /*GPAC_DISABLE_3D*/
#pragma comment (linker, EXPORT_SYMBOL(gf_sys_clock) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sys_get_rti) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sys_get_battery_state) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_get_default_cache_directory) )
#pragma comment (linker, EXPORT_SYMBOL(gf_4cc_to_str) )
#pragma comment (linker, EXPORT_SYMBOL(gf_error_to_string) )
#pragma comment (linker, EXPORT_SYMBOL(gf_rand_init) )
#pragma comment (linker, EXPORT_SYMBOL(gf_prompt_get_char) )
#pragma comment (linker, EXPORT_SYMBOL(gf_prompt_set_echo_off) )
#pragma comment (linker, EXPORT_SYMBOL(gf_crc_32) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_gz_compress_payload) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_gz_decompress_payload) )
/* Font */
#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_new) )
+/* Memory */
#ifdef GPAC_MEMORY_TRACKING
#pragma comment (linker, EXPORT_SYMBOL(gf_mem_malloc) )
#pragma comment (linker, EXPORT_SYMBOL(gf_mem_calloc) )
#pragma comment (linker, EXPORT_SYMBOL(gf_strdup) )
#endif /*GPAC_MEMORY_TRACKING*/
+/* Print */
+#pragma comment (linker, EXPORT_SYMBOL(gf_asprintf) )
+
+/* Ring Buffer */
+#pragma comment (linker, EXPORT_SYMBOL(gf_ringbuffer_new) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_ringbuffer_read) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_ringbuffer_write) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_global_resource_lock) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_ringbuffer_available_for_read ) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_ringbuffer_del) )
+
+/* List */
#pragma comment (linker, EXPORT_SYMBOL(gf_list_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_list_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_list_count) )
#pragma comment (linker, EXPORT_SYMBOL(gf_list_last) )
#pragma comment (linker, EXPORT_SYMBOL(gf_list_rem_last) )
+/* Bitstream */
#pragma comment (linker, EXPORT_SYMBOL(gf_bs_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_bs_from_file) )
#pragma comment (linker, EXPORT_SYMBOL(gf_bs_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_bs_get_position) )
#pragma comment (linker, EXPORT_SYMBOL(gf_bs_get_size) )
#pragma comment (linker, EXPORT_SYMBOL(gf_bs_get_refreshed_size) )
-
+
+/* Thread */
#pragma comment (linker, EXPORT_SYMBOL(gf_th_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_th_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_th_run) )
#pragma comment (linker, EXPORT_SYMBOL(gf_th_status) )
#pragma comment (linker, EXPORT_SYMBOL(gf_th_set_priority) )
#pragma comment (linker, EXPORT_SYMBOL(gf_th_id) )
+
+/* Lock */
#pragma comment (linker, EXPORT_SYMBOL(gf_mx_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_mx_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_mx_v) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sema_notify) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sema_wait) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sema_wait_for) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_global_resource_lock) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_global_resource_unlock) )
+/* Socket */
#pragma comment (linker, EXPORT_SYMBOL(gf_sk_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sk_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sk_reset) )
#pragma comment (linker, EXPORT_SYMBOL(gf_cfg_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_cfg_del) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cfg_remove) )
#pragma comment (linker, EXPORT_SYMBOL(gf_cfg_save) )
#pragma comment (linker, EXPORT_SYMBOL(gf_cfg_get_key) )
#pragma comment (linker, EXPORT_SYMBOL(gf_cfg_get_sub_key) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_new) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_new_simple) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_process) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_get_cache_name) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_get_stats) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_fetch_data) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_last_error) )
-#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_dash_reset) )
-#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_set_range) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_setup_from_url) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_get_resource_name) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_reset) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_mime_type) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_dm_del) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_get_url) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_get_cache_filename) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_create_entry) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_get_mime_type) )
+#pragma comment (linker, EXPORT_SYMBOL(appendHttpCacheHeaders) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_open_write_cache) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_set_last_modified_on_server) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_set_etag_on_server) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_set_content_length) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_set_mime_type) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_cache_get_cache_filename_range) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_delete_cached_file_entry_session) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_url_info_del) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_get_url_info) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_url_info_init) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_is_thread_dead) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_abort) )
+
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_sess_can_be_cached_on_disk) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_dm_wget) )
#pragma comment (linker, EXPORT_SYMBOL(gf_xml_sax_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_xml_sax_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_odf_com_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_odf_com_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_odf_avc_cfg_del) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_afx_get_type_description) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_esd_get_textual_description) )
#pragma comment (linker, EXPORT_SYMBOL(gf_odf_slc_set_pref) )
#pragma comment (linker, EXPORT_SYMBOL(gf_odf_get_bifs_config) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_close) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_delete) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_get_mode) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_isom_get_file_size) )
+
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_open_progressive) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_get_missing_bytes) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_is_fragmented) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_remove_meta_item) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_set_meta_primary_item) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_set_meta_xml) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_isom_set_meta_xml_memory) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_remove_meta_xml) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_extract_meta_xml) )
#pragma comment (linker, EXPORT_SYMBOL(gf_isom_extract_meta_item) )
#pragma comment (linker, EXPORT_SYMBOL(gf_term_process_shortcut) )
#pragma comment (linker, EXPORT_SYMBOL(gf_term_set_speed) )
#pragma comment (linker, EXPORT_SYMBOL(gf_term_relocate_url) )
-#pragma comment (linker, EXPORT_SYMBOL(gf_term_register_event_filter) )
-#pragma comment (linker, EXPORT_SYMBOL(gf_term_unregister_event_filter) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_term_add_event_filter) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_term_remove_event_filter) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_term_lock_media_queue) )
/*ietf.h exports*/
#ifndef GPAC_DISABLE_STREAMING
#pragma comment (linker, EXPORT_SYMBOL(gf_crypt_set_state) )
#endif GPAC_DISABLE_MCRYPT
#pragma comment (linker, EXPORT_SYMBOL(gf_sha1_csum) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_sha1_file) )
#ifndef GPAC_DISABLE_AV_PARSERS
#pragma comment (linker, EXPORT_SYMBOL(gf_m4v_parser_new) )
#pragma comment (linker, EXPORT_SYMBOL(gf_js_add_root) )
#pragma comment (linker, EXPORT_SYMBOL(gf_js_add_named_root) )
#pragma comment (linker, EXPORT_SYMBOL(gf_js_remove_root) )
+
+#pragma comment (linker, EXPORT_SYMBOL(gf_sg_js_has_instance) )
+
#ifndef GPAC_DISABLE_SVG
#pragma comment (linker, EXPORT_SYMBOL(gf_sg_js_event_add_listener) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sg_js_event_remove_listener) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sc_remove_video_listener) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sc_add_audio_listener) )
#pragma comment (linker, EXPORT_SYMBOL(gf_sc_remove_audio_listener) )
-
+#pragma comment (linker, EXPORT_SYMBOL(gf_sc_focus_switch_ring) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_sc_animation_get_scenegraph) )
#ifndef GPAC_DISABLE_SVG
#pragma comment (linker, EXPORT_SYMBOL(gf_sc_svg_convert_length_to_display) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_mux_del) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_mux_program_add) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_program_stream_add) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_program_stream_update_ts_scale) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_program_stream_update_sl_config) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_mux_update_config) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_mux_process) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_get_sys_clock) )
#pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_get_ts_clock) )
#endif /*GPAC_DISABLE_MPEG2TS_MUX*/
+
+/* M3U8 & MPD related functions */
+#pragma comment (linker, EXPORT_SYMBOL(gf_mpd_new) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_mpd_init_from_dom) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_mpd_del) )
+#pragma comment (linker, EXPORT_SYMBOL(gf_m3u8_to_mpd) )
+
#endif /*GPAC_DISABLE_MPEG2TS*/
/*laser.h exports*/
{
GF_RTPChannel *tmp;
GF_SAFEALLOC(tmp, GF_RTPChannel);
+ if (!tmp)
+ return NULL;
tmp->first_SR = 1;
tmp->SSRC = gf_rand();
-
return tmp;
}
if (ch->s_tool) gf_free(ch->s_tool);
if (ch->s_note) gf_free(ch->s_note);
if (ch->s_priv) gf_free(ch->s_priv);
+ memset(ch, 0, sizeof(GF_RTPChannel));
gf_free(ch);
}
if (!trans_info->source && !remote_address) return GF_BAD_PARAM;
if (ch->net_info.destination) gf_free(ch->net_info.destination);
+ ch->net_info.destination = NULL;
if (ch->net_info.Profile) gf_free(ch->net_info.Profile);
+ ch->net_info.Profile = NULL;
if (ch->net_info.source) gf_free(ch->net_info.source);
+ ch->net_info.source = NULL;
memcpy(&ch->net_info, trans_info, sizeof(GF_RTSPTransport));
if (trans_info->destination)
ch->net_info.Profile = gf_strdup(trans_info->Profile);
if (!ch->net_info.IsUnicast && trans_info->destination) {
+ assert( trans_info->destination );
ch->net_info.source = gf_strdup(trans_info->destination);
if (ch->net_info.client_port_first) {
ch->net_info.port_first = ch->net_info.client_port_first;
ch->net_info.port_last = ch->net_info.client_port_last;
}
- ch->net_info.source = gf_strdup(trans_info->destination);
} else if (trans_info->source) {
ch->net_info.source = gf_strdup(trans_info->source);
} else {
if (IsSource && !PathMTU) return GF_BAD_PARAM;
if (ch->rtp) gf_sk_del(ch->rtp);
+ ch->rtp = NULL;
if (ch->rtcp) gf_sk_del(ch->rtcp);
+ ch->rtcp = NULL;
if (ch->po) gf_rtp_reorderer_del(ch->po);
+ ch->po = NULL;
ch->CurrentTime = 0;
ch->rtp_time = 0;
while ((att = (GF_X_Attribute *)gf_list_enum(media->Attributes, &j))) {
if (stricmp(att->Name, "cliprect")) continue;
/*only get the display area*/
- sscanf(att->Value, "%d,%d,%d,%d", &y, &x, &h, &w);
+ sscanf(att->Value, "%ud,%ud,%ud,%ud", &y, &x, &h, &w);
}
rtp->sl_map.StreamType = GF_STREAM_VISUAL;
//Range, only NPT
if (com->Range && !com->Range->UseSMPTE) {
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "Range: npt=");
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, com->Range->start);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, com->Range->start);
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "-");
if (com->Range->end > com->Range->start) {
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, com->Range->end);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, com->Range->end);
}
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "\r\n");
}
RTSP_WRITE_HEADER(buffer, size, cur_pos, "Referer", com->Referer);
if (com->Scale != 0.0) {
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "Scale: ");
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, com->Scale);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, com->Scale);
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "\r\n");
}
RTSP_WRITE_HEADER(buffer, size, cur_pos, "Session", com->Session);
if (com->Speed != 0.0) {
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "Speed: ");
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, com->Speed);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, com->Speed);
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "\r\n");
}
else if (!stricmp(Header, "Accept-Encoding")) com->Accept_Encoding = gf_strdup(Value);
else if (!stricmp(Header, "Accept-Language")) com->Accept_Language = gf_strdup(Value);
else if (!stricmp(Header, "Authorization")) com->Authorization = gf_strdup(Value);
- else if (!stricmp(Header, "Bandwidth")) sscanf(Value, "%d", &com->Bandwidth);
- else if (!stricmp(Header, "Blocksize")) sscanf(Value, "%d", &com->Blocksize);
+ else if (!stricmp(Header, "Bandwidth")) sscanf(Value, "%ud", &com->Bandwidth);
+ else if (!stricmp(Header, "Blocksize")) sscanf(Value, "%ud", &com->Blocksize);
else if (!stricmp(Header, "Cache-Control")) com->Cache_Control = gf_strdup(Value);
else if (!stricmp(Header, "Conference")) com->Conference = gf_strdup(Value);
else if (!stricmp(Header, "Connection")) com->Connection = gf_strdup(Value);
- else if (!stricmp(Header, "Content-Length")) sscanf(Value, "%d", &com->Content_Length);
- else if (!stricmp(Header, "CSeq")) sscanf(Value, "%d", &com->CSeq);
+ else if (!stricmp(Header, "Content-Length")) sscanf(Value, "%ud", &com->Content_Length);
+ else if (!stricmp(Header, "CSeq")) sscanf(Value, "%ud", &com->CSeq);
else if (!stricmp(Header, "From")) com->From = gf_strdup(Value);
else if (!stricmp(Header, "Proxy_Authorization")) com->Proxy_Authorization = gf_strdup(Value);
else if (!stricmp(Header, "Proxy_Require")) com->Proxy_Require = gf_strdup(Value);
Bool IsFirst;
char buf[100], param_name[100], param_val[100];
s32 pos, nPos;
+ u32 v1, v2;
GF_RTSPTransport *tmp;
pos = 0;
if (!buffer) return NULL;
else if (!stricmp(param_name, "interleaved")) {
u32 rID, rcID;
tmp->IsInterleaved = 1;
+ /*do not use %ud here, broken on Win32 (sscanf returns 1)*/
if (sscanf(param_val, "%d-%d", &rID, &rcID) == 1) {
- sscanf(param_val, "%d", &rID);
+ sscanf(param_val, "%ud", &rID);
tmp->rtcpID = tmp->rtpID = (u8) rID;
} else {
tmp->rtpID = (u8) rID;
tmp->rtcpID = (u8) rcID;
}
}
- else if (!stricmp(param_name, "layers")) sscanf(param_val, "%d", &tmp->MulticastLayers);
+ else if (!stricmp(param_name, "layers")) sscanf(param_val, "%ud", &tmp->MulticastLayers);
else if (!stricmp(param_name, "ttl")) sscanf(param_val, "%c ", &tmp->TTL);
- else if (!stricmp(param_name, "port")) sscanf(param_val, "%hd-%hd", &tmp->port_first, &tmp->port_last);
- else if (!stricmp(param_name, "server_port")) sscanf(param_val, "%hd-%hd", &tmp->port_first, &tmp->port_last);
- else if (!stricmp(param_name, "client_port")) sscanf(param_val, "%hd-%hd", &tmp->client_port_first, &tmp->client_port_last);
+ /*do not use %hud here, broken on Win32 (sscanf returns 1)*/
+ else if (!stricmp(param_name, "port")) {
+ sscanf(param_val, "%d-%d", &v1, &v2);
+ tmp->port_first = (u16) v1;
+ tmp->port_last = (u16) v2;
+ }
+ /*do not use %hud here, broken on Win32 (sscanf returns 1)*/
+ else if (!stricmp(param_name, "server_port")) {
+ sscanf(param_val, "%d-%d", &v1, &v2);
+ tmp->port_first = (u16) v1;
+ tmp->port_last = (u16) v2;
+ }
+ /*do not use %hud here, broken on Win32 (sscanf returns 1)*/
+ else if (!stricmp(param_name, "client_port")) {
+ sscanf(param_val, "%d-%d", &v1, &v2);
+ tmp->client_port_first = (u16) v1;
+ tmp->client_port_last = (u16) v2;
+ }
else if (!stricmp(param_name, "ssrc")) sscanf(param_val, "%X", &tmp->SSRC);
}
return tmp;
else if (!stricmp(Header, "Accept-Language")) rsp->Accept_Language = gf_strdup(Value);
else if (!stricmp(Header, "Allow")) rsp->Allow = gf_strdup(Value);
else if (!stricmp(Header, "Authorization")) rsp->Authorization = gf_strdup(Value);
- else if (!stricmp(Header, "Bandwidth")) sscanf(Value, "%d", &rsp->Bandwidth);
- else if (!stricmp(Header, "Blocksize")) sscanf(Value, "%d", &rsp->Blocksize);
+ else if (!stricmp(Header, "Bandwidth")) sscanf(Value, "%ud", &rsp->Bandwidth);
+ else if (!stricmp(Header, "Blocksize")) sscanf(Value, "%ud", &rsp->Blocksize);
else if (!stricmp(Header, "Cache-Control")) rsp->Cache_Control = gf_strdup(Value);
else if (!stricmp(Header, "Conference")) rsp->Conference = gf_strdup(Value);
else if (!stricmp(Header, "Connection")) rsp->Connection = gf_strdup(Value);
else if (!stricmp(Header, "Content-Base")) rsp->Content_Base = gf_strdup(Value);
else if (!stricmp(Header, "Content-Encoding")) rsp->Content_Encoding = gf_strdup(Value);
- else if (!stricmp(Header, "Content-Length")) sscanf(Value, "%d", &rsp->Content_Length);
+ else if (!stricmp(Header, "Content-Length")) sscanf(Value, "%ud", &rsp->Content_Length);
else if (!stricmp(Header, "Content-Language")) rsp->Content_Language = gf_strdup(Value);
else if (!stricmp(Header, "Content-Location")) rsp->Content_Location = gf_strdup(Value);
else if (!stricmp(Header, "Content-Type")) rsp->Content_Type = gf_strdup(Value);
- else if (!stricmp(Header, "CSeq")) sscanf(Value, "%d", &rsp->CSeq);
+ else if (!stricmp(Header, "CSeq")) sscanf(Value, "%ud", &rsp->CSeq);
else if (!stricmp(Header, "Date")) rsp->Date = gf_strdup(Value);
else if (!stricmp(Header, "Expires")) rsp->Expires = gf_strdup(Value);
else if (!stricmp(Header, "From")) rsp->From = gf_strdup(Value);
LinePos = gf_token_get(Value, LinePos, ";\r\n", LineBuffer, 400);
//default
rsp->SessionTimeOut = 60;
- sscanf(LineBuffer, "timeout=%d", &rsp->SessionTimeOut);
+ sscanf(LineBuffer, "timeout=%ud", &rsp->SessionTimeOut);
}
}
strcpy(param_name, buf);
}
if (!stricmp(param_name, "url")) info->url = gf_strdup(param_val);
- else if (!stricmp(param_name, "seq")) sscanf(param_val, "%d", &info->seq);
+ else if (!stricmp(param_name, "seq")) sscanf(param_val, "%ud", &info->seq);
else if (!stricmp(param_name, "rtptime")) {
sscanf(param_val, "%i", &s_val);
info->rtp_time = (s_val>0) ? s_val : 0;
//Range, only NPT
if (rsp->Range && !rsp->Range->UseSMPTE) {
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "Range: npt:");
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, rsp->Range->start);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, rsp->Range->start);
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "-");
if (rsp->Range->end > rsp->Range->start) {
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, rsp->Range->end);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, rsp->Range->end);
}
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "\r\n");
}
if (rsp->Scale != 0.0) {
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "Scale: ");
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, rsp->Scale);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, rsp->Scale);
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "\r\n");
}
RTSP_WRITE_HEADER(buffer, size, cur_pos, "Server", rsp->Server);
RTSP_WRITE_HEADER(buffer, size, cur_pos, "Session", rsp->Session);
if (rsp->Speed != 0.0) {
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "Scale: ");
- RTSP_WRITE_FLOAT(buffer, size, cur_pos, rsp->Speed);
+ RTSP_WRITE_FLOAT_WITHOUT_CHECK(buffer, size, cur_pos, rsp->Speed);
RTSP_WRITE_ALLOC_STR(buffer, size, cur_pos, "\r\n");
}
RTSP_WRITE_HEADER(buffer, size, cur_pos, "Timestamp", rsp->Timestamp);
one = gf_rand();
res = one;
res <<= 32;
- res += (u64) sess + sess->CurrentPos + sess->CurrentSize;
+ res+= (PTR_TO_U_CAST sess) + sess->CurrentPos + sess->CurrentSize;
sprintf(buffer, LLU, res);
return gf_strdup(buffer);
}
}
-
+#define SDP_WRITE_ALLOC_STR_WITHOUT_CHECK(str, space) \
+ if (strlen(str)+pos + (space ? 1 : 0) >= buf_size) { \
+ buf_size += SDP_WRITE_STEPALLOC; \
+ buf = (char*)gf_realloc(buf, sizeof(char)*buf_size); \
+ } \
+ strcpy(buf+pos, str); \
+ pos += strlen(str); \
+ if (space) { \
+ strcat(buf+pos, " "); \
+ pos += 1; \
+ }
#define SDP_WRITE_ALLOC_STR(str, space) \
if (str) { \
- if (strlen(str)+pos + (space ? 1 : 0) >= buf_size) { \
- buf_size += SDP_WRITE_STEPALLOC; \
- buf = (char*)gf_realloc(buf, sizeof(char)*buf_size); \
- } \
- strcpy(buf+pos, str); \
- pos += strlen(str); \
- if (space) { \
- strcat(buf+pos, " "); \
- pos += 1; \
- } \
+ SDP_WRITE_ALLOC_STR_WITHOUT_CHECK(str, space); \
} \
#define SDP_WRITE_ALLOC_INT(d, spa, sig) \
- if (sig) { \
+ if (sig < 0) { \
sprintf(temp, "%d", d); \
} else { \
- sprintf(temp, "%u", d); \
+ sprintf(temp, "%ud", d); \
} \
- SDP_WRITE_ALLOC_STR(temp, spa);
+ SDP_WRITE_ALLOC_STR_WITHOUT_CHECK(temp, spa);
#define SDP_WRITE_ALLOC_FLOAT(d, spa) \
sprintf(temp, "%.2f", d); \
- SDP_WRITE_ALLOC_STR(temp, spa);
+ SDP_WRITE_ALLOC_STR_WITHOUT_CHECK(temp, spa);
#define TEST_SDP_WRITE_SINGLE(type, str, sep) \
if (str) { \
if (ptr->SampleDep) gf_isom_box_del((GF_Box *) ptr->SampleDep);
if (ptr->PaddingBits) gf_isom_box_del((GF_Box *) ptr->PaddingBits);
if (ptr->Fragments) gf_isom_box_del((GF_Box *) ptr->Fragments);
+ if (ptr->SubSamples) gf_isom_box_del((GF_Box *) ptr->SubSamples);
gf_free(ptr);
}
if (ptr->Fragments) return GF_ISOM_INVALID_FILE;
ptr->Fragments = (GF_SampleFragmentBox *)a;
break;
+
+ case GF_ISOM_BOX_TYPE_SUBS:
+ if (ptr->SubSamples) return GF_ISOM_INVALID_FILE;
+ ptr->SubSamples = (GF_SubSampleInformationBox *)a;
+ break;
//what's this box ??? delete it
default:
e = gf_isom_box_write((GF_Box *) ptr->PaddingBits, bs);
if (e) return e;
}
+ if (ptr->SubSamples) {
+ e = gf_isom_box_write((GF_Box *) ptr->SubSamples, bs);
+ if (e) return e;
+ }
#if WRITE_SAMPLE_FRAGMENTS
//sampleFragments
ptr->size += ptr->Fragments->size;
}
#endif
+
+ if (ptr->SubSamples) {
+ e = gf_isom_box_size((GF_Box *) ptr->SubSamples);
+ if (e) return e;
+ ptr->size += ptr->SubSamples->size;
+ }
return GF_OK;
}
if (ptr == NULL) return;
if (ptr->tfhd) gf_isom_box_del((GF_Box *) ptr->tfhd);
if (ptr->sdtp) gf_isom_box_del((GF_Box *) ptr->sdtp);
+ if (ptr->subs) gf_isom_box_del((GF_Box *) ptr->subs);
gf_isom_box_array_del(ptr->TrackRuns);
gf_free(ptr);
}
if (ptr->tfad) return GF_ISOM_INVALID_FILE;
ptr->tfad = a;
return GF_OK;
+ case GF_ISOM_BOX_TYPE_SUBS:
+ if (ptr->subs) return GF_ISOM_INVALID_FILE;
+ ptr->subs = (GF_SubSampleInformationBox *)a;
+ return GF_OK;
default:
return GF_ISOM_INVALID_FILE;
}
GF_Box *traf_New()
{
- GF_TrackFragmentBox *tmp = (GF_TrackFragmentBox *) gf_malloc(sizeof(GF_TrackFragmentBox));
+ GF_TrackFragmentBox *tmp;
+ GF_SAFEALLOC(tmp, GF_TrackFragmentBox);
if (tmp == NULL) return NULL;
- memset(tmp, 0, sizeof(GF_TrackFragmentBox));
tmp->type = GF_ISOM_BOX_TYPE_TRAF;
tmp->TrackRuns = gf_list_new();
return (GF_Box *)tmp;
e = gf_isom_box_write((GF_Box *) ptr->tfhd, bs);
if (e) return e;
}
+ if (ptr->subs) {
+ e = gf_isom_box_write((GF_Box *) ptr->subs, bs);
+ if (e) return e;
+ }
e = gf_isom_box_array_write(s, ptr->TrackRuns, bs);
if (e) return e;
if (ptr->sdtp) {
if (e) return e;
ptr->size += ptr->tfhd->size;
}
+ if (ptr->subs) {
+ e = gf_isom_box_size((GF_Box *) ptr->subs);
+ if (e) return e;
+ ptr->size += ptr->subs->size;
+ }
if (ptr->sdtp) {
e = gf_isom_box_size((GF_Box *) ptr->sdtp);
if (e) return e;
for (i=0; i<ptr->sample_count; i++) {
u32 trun_size = 0;
p = (GF_TrunEntry *) gf_malloc(sizeof(GF_TrunEntry));
+ if (!p) return GF_OUT_OF_MEM;
memset(p, 0, sizeof(GF_TrunEntry));
if (ptr->flags & GF_ISOM_TRUN_DURATION) {
{
GF_SegmentIndexBox *ptr = (GF_SegmentIndexBox *) s;
if (ptr == NULL) return;
- if (ptr->tracks_times) gf_free(ptr->tracks_times);
if (ptr->refs) gf_free(ptr->refs);
gf_free(ptr);
}
GF_SegmentIndexBox *ptr = (GF_SegmentIndexBox*) s;
e = gf_isom_full_box_read(s, bs);
if (e) return e;
- ptr->reference_track_ID = gf_bs_read_u32(bs);
- ptr->nb_track_times = gf_bs_read_u16(bs);
- ptr->nb_refs = gf_bs_read_u16(bs);
+ ptr->reference_ID = gf_bs_read_u32(bs);
+ ptr->timescale = gf_bs_read_u32(bs);
ptr->size -= 8;
- ptr->tracks_times = gf_malloc(sizeof(GF_SIDXTrackTimes)*ptr->nb_track_times);
- ptr->refs = gf_malloc(sizeof(GF_SIDXReference)*ptr->nb_refs);
- for (i=0; i<ptr->nb_track_times; i++) {
- ptr->tracks_times[i].track_ID = gf_bs_read_u32(bs);
+ if (ptr->version==0) {
+ ptr->earliest_presentation_time = gf_bs_read_u32(bs);
+ ptr->first_offset = gf_bs_read_u32(bs);
ptr->size -= 8;
- if (ptr->version==0) {
- ptr->tracks_times[i].decoding_time = gf_bs_read_u32(bs);
- } else {
- ptr->tracks_times[i].decoding_time = gf_bs_read_u64(bs);
- ptr->size -= 4;
- }
+ } else {
+ ptr->earliest_presentation_time = gf_bs_read_u64(bs);
+ ptr->first_offset = gf_bs_read_u64(bs);
+ ptr->size -= 16;
}
-
+ gf_bs_read_u16(bs); /* reserved */
+ ptr->nb_refs = gf_bs_read_u16(bs);
+ ptr->size -= 4;
+ ptr->refs = gf_malloc(sizeof(GF_SIDXReference)*ptr->nb_refs);
for (i=0; i<ptr->nb_refs; i++) {
ptr->refs[i].reference_type = gf_bs_read_int(bs, 1);
ptr->refs[i].reference_offset = gf_bs_read_int(bs, 31);
e = gf_isom_full_box_write(s, bs);
if (e) return e;
- gf_bs_write_u32(bs, ptr->reference_track_ID);
- gf_bs_write_u16(bs, ptr->nb_track_times);
- gf_bs_write_u16(bs, ptr->nb_refs);
-
- for (i=0; i<ptr->nb_track_times; i++ ) {
- gf_bs_write_u32(bs, ptr->tracks_times[i].track_ID);
- if (ptr->version==0) {
- gf_bs_write_u32(bs, (u32) ptr->tracks_times[i].decoding_time);
- } else {
- gf_bs_write_u64(bs, ptr->tracks_times[i].decoding_time);
- }
+ gf_bs_write_u32(bs, ptr->reference_ID);
+ gf_bs_write_u32(bs, ptr->timescale);
+ if (ptr->version==0) {
+ gf_bs_write_u32(bs, (u32) ptr->earliest_presentation_time);
+ gf_bs_write_u32(bs, (u32) ptr->first_offset);
+ } else {
+ gf_bs_write_u64(bs, ptr->earliest_presentation_time);
+ gf_bs_write_u64(bs, ptr->first_offset);
}
+ gf_bs_write_u16(bs, 0);
+ gf_bs_write_u16(bs, ptr->nb_refs);
for (i=0; i<ptr->nb_refs; i++ ) {
gf_bs_write_int(bs, ptr->refs[i].reference_type, 1);
gf_bs_write_int(bs, ptr->refs[i].reference_offset, 31);
e = gf_isom_full_box_get_size(s);
if (e) return e;
- ptr->size += 8;
+ ptr->size += 12;
if (ptr->version==0) {
- ptr->size += ptr->nb_track_times * 8;
+ ptr->size += 8;
} else {
- ptr->size += ptr->nb_track_times * 12;
+ ptr->size += 16;
}
ptr->size += ptr->nb_refs * 12;
return GF_OK;
#endif /*GPAC_DISABLE_ISOM_FRAGMENTS*/
+
+GF_Box *subs_New()
+{
+ GF_SubSampleInformationBox *tmp = (GF_SubSampleInformationBox *) gf_malloc(sizeof(GF_SubSampleInformationBox));
+ if (tmp == NULL) return NULL;
+ memset(tmp, 0, sizeof(GF_SubSampleInformationBox));
+ tmp->type = GF_ISOM_BOX_TYPE_SUBS;
+ tmp->Samples = gf_list_new();
+ return (GF_Box *)tmp;
+}
+
+void subs_del(GF_Box *s)
+{
+ GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *)s;
+ if (ptr == NULL) return;
+
+ while (gf_list_count(ptr->Samples)) {
+ GF_SampleEntry *pSamp;
+ pSamp = (GF_SampleEntry*)gf_list_get(ptr->Samples, 0);
+ while (gf_list_count(pSamp->SubSamples)) {
+ GF_SubSampleEntry *pSubSamp;
+ pSubSamp = (GF_SubSampleEntry*) gf_list_get(pSamp->SubSamples, 0);
+ gf_free(pSubSamp);
+ gf_list_rem(pSamp->SubSamples, 0);
+ }
+ gf_list_del(pSamp->SubSamples);
+ gf_free(pSamp);
+ gf_list_rem(ptr->Samples, 0);
+ }
+ gf_list_del(ptr->Samples);
+ gf_free(ptr);
+}
+
+GF_Err subs_Write(GF_Box *s, GF_BitStream *bs)
+{
+ GF_Err e;
+ u32 i, j, entry_count;
+ u16 subsample_count;
+ GF_SampleEntry *pSamp;
+ GF_SubSampleEntry *pSubSamp;
+ GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *) s;
+
+ if (!s) return GF_BAD_PARAM;
+ e = gf_isom_full_box_write(s, bs);
+ if (e) return e;
+ entry_count = gf_list_count(ptr->Samples);
+ gf_bs_write_u32(bs, entry_count);
+
+ for (i=0; i<entry_count; i++) {
+ pSamp = (GF_SampleEntry*) gf_list_get(ptr->Samples, i);
+ subsample_count = gf_list_count(pSamp->SubSamples);
+ gf_bs_write_u32(bs, pSamp->sample_delta);
+ gf_bs_write_u16(bs, subsample_count);
+
+ for (j=0; j<subsample_count; j++) {
+ pSubSamp = (GF_SubSampleEntry*) gf_list_get(pSamp->SubSamples, j);
+ if (ptr->version == 1) {
+ gf_bs_write_u32(bs, pSubSamp->subsample_size);
+ } else {
+ gf_bs_write_u16(bs, pSubSamp->subsample_size);
+ }
+ gf_bs_write_u8(bs, pSubSamp->subsample_priority);
+ gf_bs_write_u8(bs, pSubSamp->discardable);
+ gf_bs_write_u32(bs, pSubSamp->reserved);
+ }
+ }
+ return e;
+}
+
+GF_Err subs_Size(GF_Box *s)
+{
+ GF_Err e;
+ GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *) s;
+ GF_SampleEntry *pSamp;
+ u32 entry_count, i;
+ u16 subsample_count;
+
+ // determine the size of the full box
+ e = gf_isom_full_box_get_size(s);
+ if (e) return e;
+
+ // add 4 byte for entry_count
+ ptr->size += 4;
+ entry_count = gf_list_count(ptr->Samples);
+ for (i=0; i<entry_count; i++) {
+ pSamp = (GF_SampleEntry*) gf_list_get(ptr->Samples, i);
+ subsample_count = gf_list_count(pSamp->SubSamples);
+ // 4 byte for sample_delta, 2 byte for subsample_count
+ // and 6 + (4 or 2) bytes for each subsample
+ ptr->size += 4 + 2 + subsample_count * (6 + (ptr->version==1 ? 4 : 2));
+ }
+ return GF_OK;
+}
+
+
+GF_Err subs_Read(GF_Box *s, GF_BitStream *bs)
+{
+ GF_Err e;
+ GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *)s;
+ u32 entry_count, i, j;
+ u16 subsample_count;
+
+ e = gf_isom_full_box_read(s, bs);
+ if (e) return e;
+
+ entry_count = gf_bs_read_u32(bs);
+ ptr->size -= 4;
+
+ for (i=0; i<entry_count; i++) {
+ GF_SampleEntry *pSamp = (GF_SampleEntry*) gf_malloc(sizeof(GF_SampleEntry));
+ if (!pSamp) return GF_OUT_OF_MEM;
+
+ memset(pSamp, 0, sizeof(GF_SampleEntry));
+ pSamp->SubSamples = gf_list_new();
+ pSamp->sample_delta = gf_bs_read_u32(bs);
+ subsample_count = gf_bs_read_u16(bs);
+
+ for (j=0; j<subsample_count; j++) {
+ GF_SubSampleEntry *pSubSamp = (GF_SubSampleEntry*) gf_malloc(sizeof(GF_SubSampleEntry));
+ if (!pSubSamp) return GF_OUT_OF_MEM;
+
+ memset(pSubSamp, 0, sizeof(GF_SubSampleEntry));
+ if (ptr->version==1) {
+ pSubSamp->subsample_size = gf_bs_read_u32(bs);
+ } else {
+ pSubSamp->subsample_size = gf_bs_read_u16(bs);
+ }
+ pSubSamp->subsample_priority = gf_bs_read_u8(bs);
+ pSubSamp->discardable = gf_bs_read_u8(bs);
+ pSubSamp->reserved = gf_bs_read_u32(bs);
+
+ gf_list_add(pSamp->SubSamples, pSubSamp);
+ }
+ gf_list_add(ptr->Samples, pSamp);
+ }
+ return GF_OK;
+}
+
#endif /*GPAC_DISABLE_ISOM*/
case GF_ISOM_BOX_TYPE_TRUN:
return trun_dump(a, trace);
#endif
+
+ case GF_ISOM_BOX_TYPE_SUBS:
+ return subs_dump(a, trace);
case GF_ISOM_BOX_TYPE_VOID:
return void_dump(a, trace);
if (p->DegradationPriority) gf_box_dump(p->DegradationPriority, trace);
if (p->SampleDep) gf_box_dump(p->SampleDep, trace);
if (p->PaddingBits) gf_box_dump(p->PaddingBits, trace);
+ if (p->SubSamples) gf_box_dump(p->SubSamples, trace);
if (p->Fragments) gf_box_dump(p->Fragments, trace);
fprintf(trace, "</SampleTableBox>\n");
fprintf(trace, "<TrackFragmentBox>\n");
DumpBox(a, trace);
if (p->tfhd) gf_box_dump(p->tfhd, trace);
+ if (p->subs) gf_box_dump(p->subs, trace);
gf_box_array_dump(p->TrackRuns, trace);
if (p->sdtp) gf_box_dump(p->sdtp, trace);
fprintf(trace, "</TrackFragmentBox>\n");
{
u32 i;
GF_SegmentIndexBox *p = (GF_SegmentIndexBox *)a;
- fprintf(trace, "<SegmentIndexBox reference_track_ID=\"%d\">\n", p->reference_track_ID);
+ fprintf(trace, "<SegmentIndexBox reference_ID=\"%d\" timescale=\"%d\" earliest_presentation_time=\""LLD"\" first_offset=\""LLD"\">\n", p->reference_ID, p->timescale, p->earliest_presentation_time, p->first_offset);
DumpBox(a, trace);
gf_full_box_dump(a, trace);
- for (i=0; i<p->nb_track_times; i++) {
- fprintf(trace, "<TrackTiming trackID=\"%d\" duration=\""LLD"\" />\n", p->tracks_times[i].track_ID, p->tracks_times[i].decoding_time);
- }
for (i=0; i<p->nb_refs; i++) {
- fprintf(trace, "<Reference type=\"%d\" offset=\"%d\" SubSegmentDuration=\"%d\" hasRAP=\"%d\" RAPDeltaTime=\"%d\"/>\n", p->refs[i].reference_type, p->refs[i].reference_offset, p->refs[i].subsegment_duration, p->refs[i].contains_RAP, p->refs[i].RAP_delta_time);
+ fprintf(trace, "<Reference type=\"%d\" size=\"%d\" duration=\"%d\" hasRAP=\"%d\" RAPDeltaTime=\"%d\"/>\n", p->refs[i].reference_type, p->refs[i].reference_offset, p->refs[i].subsegment_duration, p->refs[i].contains_RAP, p->refs[i].RAP_delta_time);
}
fprintf(trace, "</SegmentIndexBox>\n");
return GF_OK;
}
+
+GF_Err subs_dump(GF_Box *a, FILE * trace)
+{
+ u32 entry_count, i, j;
+ u16 subsample_count;
+ GF_SampleEntry *pSamp;
+ GF_SubSampleEntry *pSubSamp;
+ GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *) a;
+
+ if (!a) return GF_BAD_PARAM;
+
+ entry_count = gf_list_count(ptr->Samples);
+ fprintf(trace, "<SubSampleInformationBox EntryCount=\"%d\">\n", entry_count);
+ DumpBox(a, trace);
+
+ for (i=0; i<entry_count; i++) {
+ pSamp = (GF_SampleEntry*) gf_list_get(ptr->Samples, i);
+
+ subsample_count = gf_list_count(pSamp->SubSamples);
+
+ fprintf(trace, "<SampleEntry SampleDelta=\"%d\" SubSampleCount=\"%d\">\n", pSamp->sample_delta, subsample_count);
+
+ for (j=0; j<subsample_count; j++) {
+ pSubSamp = (GF_SubSampleEntry*) gf_list_get(pSamp->SubSamples, j);
+ fprintf(trace, "<SubSample Size=\"%u\" Priority=\"%u\" Discardable=\"%d\" Reserved=\"%08X\"/>\n", pSubSamp->subsample_size, pSubSamp->subsample_priority, pSubSamp->discardable, pSubSamp->reserved);
+ }
+ fprintf(trace, "</SampleEntry>\n");
+ }
+
+ fprintf(trace, "</SubSampleInformationBox>\n");
+ return GF_OK;
+}
+
#endif /*GPAC_DISABLE_ISOM_DUMP*/
case GF_ISOM_BOX_TYPE_LSR1: return lsr1_New();
case GF_ISOM_BOX_TYPE_SIDX: return sidx_New();
+ case GF_ISOM_BOX_TYPE_SUBS: return subs_New();
default:
a = defa_New();
case GF_ISOM_BOX_TYPE_LSR1: lsr1_del(a); return;
case GF_ISOM_BOX_TYPE_SIDX: sidx_del(a); return;
+ case GF_ISOM_BOX_TYPE_SUBS: subs_del(a); return;
default:
defa_del(a);
case GF_ISOM_BOX_TYPE_LSR1: return lsr1_Read(a, bs);
case GF_ISOM_BOX_TYPE_SIDX: return sidx_Read(a, bs);
+ case GF_ISOM_BOX_TYPE_SUBS: return subs_Read(a, bs);
default:
return defa_Read(a, bs);
case GF_ISOM_BOX_TYPE_LSR1: return lsr1_Write(a, bs);
case GF_ISOM_BOX_TYPE_SIDX: return sidx_Write(a, bs);
+ case GF_ISOM_BOX_TYPE_SUBS: return subs_Write(a, bs);
default:
return defa_Write(a, bs);
case GF_ISOM_BOX_TYPE_LSR1: return lsr1_Size(a);
case GF_ISOM_BOX_TYPE_SIDX: return sidx_Size(a);
+ case GF_ISOM_BOX_TYPE_SUBS: return subs_Size(a);
default: return defa_Size(a);
}
} else {
char szPath[GF_MAX_PATH];
if ((sPath[strlen(sPath)-1] != '\\') && (sPath[strlen(sPath)-1] != '/')) {
- sprintf(szPath, "%s%c%d_isotmp", sPath, GF_PATH_SEPARATOR, (u32) (u64) tmp);
+ sprintf(szPath, "%s%c%p_isotmp", sPath, GF_PATH_SEPARATOR, (void*) tmp);
} else {
- sprintf(szPath, "%s%d_isotmp", sPath, (u32) (u64) tmp);
+ sprintf(szPath, "%s%p_isotmp", sPath, (void*) tmp);
}
tmp->stream = gf_f64_open(szPath, "w+b");
tmp->temp_file = gf_strdup(szPath);
GF_TrackFragmentBox *traf;
GF_TrackBox *trak;
- GF_Err MergeTrack(GF_TrackBox *trak, GF_TrackFragmentBox *traf, u64 *moof_offset);
+ GF_Err MergeTrack(GF_TrackBox *trak, GF_TrackFragmentBox *traf, u64 moof_offset);
MaxDur = 0;
}
if (!trak || !traf->trex) return GF_ISOM_INVALID_FILE;
- //NB we can modify the movie data-offset info since we are in the middle of
- //parsing an box, so next box readin will reset it...
- MergeTrack(trak, traf, &mov->current_top_box_start);
+ MergeTrack(trak, traf, mov->current_top_box_start);
//update trak duration
SetTrackDuration(trak);
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
case GF_ISOM_BOX_TYPE_STYP:
+ if (((GF_SegmentTypeBox *)a)->majorBrand == GF_4CC('i', 's', 's', 's') ||
+ ((GF_SegmentTypeBox *)a)->majorBrand == GF_4CC('i', 'm', 's', 's')) mov->is_index_segment = 1;
+
case GF_ISOM_BOX_TYPE_SIDX:
totSize += a->size;
if (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) {
}
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
- mov->current_top_box_start = gf_bs_get_position(mov->movieFileMap->bs);
+// mov->current_top_box_start = gf_bs_get_position(mov->movieFileMap->bs);
#endif
}
/*we need at least moov or meta*/
if (!mov->moov && !mov->meta
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
- && !mov->moof
+ && !mov->moof && !mov->is_index_segment
#endif
) return GF_ISOM_INVALID_FILE;
/*we MUST have movie header*/
return ent;
}
+GF_Err gf_isom_add_subsample_info(GF_SubSampleInformationBox *sub_samples, u32 sampleNumber, u32 subSampleSize, u32 priority, Bool discardable)
+{
+ u32 i, count, last_sample;
+ GF_SampleEntry *pSamp;
+ GF_SubSampleEntry *pSubSamp;
+
+ pSamp = NULL;
+ last_sample = 0;
+ count = gf_list_count(sub_samples->Samples);
+ for (i=0; i<count; i++) {
+ pSamp = (GF_SampleEntry*) gf_list_get(sub_samples->Samples, i);
+ /*TODO - do we need to support insertion of subsample info ?*/
+ if (last_sample + pSamp->sample_delta > sampleNumber) return GF_NOT_SUPPORTED;
+ if (last_sample + pSamp->sample_delta == sampleNumber) break;
+ last_sample += pSamp->sample_delta;
+ pSamp = NULL;
+ }
+
+ if (!pSamp) {
+ GF_SAFEALLOC(pSamp, GF_SampleEntry);
+ if (!pSamp) return GF_OUT_OF_MEM;
+ pSamp->SubSamples = gf_list_new();
+ if (!pSamp->SubSamples ) {
+ gf_free(pSamp);
+ return GF_OUT_OF_MEM;
+ }
+ pSamp->sample_delta = sampleNumber - last_sample;
+ gf_list_add(sub_samples->Samples, pSamp);
+ }
+
+ if ((subSampleSize>0xFFFF) && !sub_samples->version) {
+ sub_samples->version = 1;
+ }
+ /*remove last subsample info*/
+ if (!subSampleSize) {
+ pSubSamp = gf_list_last(pSamp->SubSamples);
+ gf_list_rem_last(pSamp->SubSamples);
+ gf_free(pSubSamp);
+ if (!gf_list_count(pSamp->SubSamples)) {
+ gf_list_del_item(sub_samples->Samples, pSamp);
+ gf_list_del(pSamp->SubSamples);
+ gf_free(pSamp);
+ }
+ return GF_OK;
+ }
+ /*add subsample*/
+ GF_SAFEALLOC(pSubSamp, GF_SubSampleEntry);
+ if (!pSubSamp) return GF_OUT_OF_MEM;
+ pSubSamp->subsample_size = subSampleSize;
+ pSubSamp->subsample_priority = priority;
+ pSubSamp->discardable = discardable;
+ return gf_list_add(pSamp->SubSamples, pSubSamp);
+}
+
#endif /*GPAC_DISABLE_ISOM_WRITE*/
+u32 gf_isom_sample_get_subsample_entry(GF_ISOFile *movie, u32 track, u32 sampleNumber, GF_SampleEntry **sub_sample)
+{
+ u32 i, count, last_sample;
+ GF_SubSampleInformationBox *sub_samples;
+ GF_TrackBox *trak = gf_isom_get_track_from_file(movie, track);
+ if (sub_sample) *sub_sample = NULL;
+ if (!track) return 0;
+ if (!trak->Media || !trak->Media->information->sampleTable) return 0;
+ sub_samples = trak->Media->information->sampleTable->SubSamples;
+ if (!sub_samples) return 0;
+ last_sample = 0;
+ count = gf_list_count(sub_samples->Samples);
+ for (i=0; i<count; i++) {
+ GF_SampleEntry*pSamp = (GF_SampleEntry*) gf_list_get(sub_samples->Samples, i);
+ if (last_sample + pSamp->sample_delta == sampleNumber) {
+ if (sub_sample) *sub_sample = pSamp;
+ return gf_list_count(pSamp->SubSamples);
+ }
+ last_sample += pSamp->sample_delta;
+ }
+ return 0;
+}
#endif /*GPAC_DISABLE_ISOM*/
return the_file->openMode;
}
+u64 gf_isom_get_file_size(GF_ISOFile *the_file)
+{
+ if (!the_file) return 0;
+ if (the_file->movieFileMap) return gf_bs_get_size(the_file->movieFileMap->bs);
+ if (the_file->editFileMap) return gf_bs_get_size(the_file->editFileMap->bs);
+ return 0;
+}
/**************************************************************
Sample Manip
case GF_ISOM_BOX_TYPE_MOOV:
case GF_ISOM_BOX_TYPE_MDAT:
case GF_ISOM_BOX_TYPE_FTYP:
+#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
+ case GF_ISOM_BOX_TYPE_STYP:
+#endif
case GF_ISOM_BOX_TYPE_FREE:
case GF_ISOM_BOX_TYPE_SKIP:
case GF_ISOM_BOX_TYPE_UDTA:
u32 i;
GF_Box *a;
i = 0;
- while (a = gf_list_enum(file->TopBoxes, &i)) {
+ while (NULL != (a = gf_list_enum(file->TopBoxes, &i))) {
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
if (a->type == GF_ISOM_BOX_TYPE_STYP) {
GF_SegmentTypeBox *styp = (GF_SegmentTypeBox *)a;
GF_EXPORT
GF_ESD *gf_isom_get_esd(GF_ISOFile *movie, u32 trackNumber, u32 StreamDescriptionIndex)
{
- GF_ESD *outESD;
+ GF_ESD *esd;
GF_Err e;
- e = GetESD(movie->moov, gf_isom_get_track_id(movie, trackNumber), StreamDescriptionIndex, &outESD);
+ e = GetESD(movie->moov, gf_isom_get_track_id(movie, trackNumber), StreamDescriptionIndex, &esd);
if (e && (e!= GF_ISOM_INVALID_MEDIA)) {
movie->LastError = e;
return NULL;
}
- return outESD;
+ if (esd) {
+ GF_TrackBox *trak = gf_isom_get_track_from_file(movie, trackNumber);
+ if (trak->meta) {
+ u32 brand = gf_isom_get_meta_type(movie, 0, trackNumber);
+ if (brand==GF_4CC('r','v','c','z')) {
+ Bool compressed=0;
+ GF_XMLBox *xml = gf_isom_get_meta_xml(movie, 0, trackNumber, &compressed);
+ if (xml) {
+ esd->decoderConfig->rvc_config = (GF_DefaultDescriptor *) gf_odf_desc_new(GF_ODF_DSI_TAG);
+ if (compressed) {
+ gf_gz_decompress_payload(xml->xml, xml->xml_length, &esd->decoderConfig->rvc_config->data, &esd->decoderConfig->rvc_config->dataLength);
+ } else {
+ esd->decoderConfig->rvc_config->data = gf_malloc(sizeof(char)*(xml->xml_length+1));
+ memcpy(esd->decoderConfig->rvc_config->data, xml->xml, sizeof(char)*xml->xml_length);
+ esd->decoderConfig->rvc_config->data[xml->xml_length] = 0;
+ esd->decoderConfig->rvc_config->dataLength = xml->xml_length;
+ }
+ }
+ }
+ }
+ }
+ return esd;
}
//Get the decoderConfigDescriptor given the SampleDescriptionIndex
}
+u32 gf_isom_sample_has_subsamples(GF_ISOFile *movie, u32 track, u32 sampleNumber)
+{
+ return gf_isom_sample_get_subsample_entry(movie, track, sampleNumber, NULL);
+}
+
+GF_Err gf_isom_sample_get_subsample(GF_ISOFile *movie, u32 track, u32 sampleNumber, u32 subSampleNumber, u32 *size, u8 *priority, Bool *discardable)
+{
+ GF_SubSampleEntry *entry;
+ GF_SampleEntry *sub_sample;
+ u32 count = gf_isom_sample_get_subsample_entry(movie, track, sampleNumber, &sub_sample);
+ if (!size || !priority || !discardable) return GF_BAD_PARAM;
+
+ if (!subSampleNumber || (subSampleNumber>count)) return GF_BAD_PARAM;
+ entry = gf_list_get(sub_sample->SubSamples, subSampleNumber-1);
+ *size = entry->subsample_size;
+ *priority = entry->subsample_priority;
+ *discardable = entry->discardable ? 1 : 0;
+ return GF_OK;
+}
+
+
#endif /*GPAC_DISABLE_ISOM*/
return e;
}
+
+GF_Err gf_isom_add_subsample(GF_ISOFile *movie, u32 track, u32 sampleNumber, u32 subSampleSize, u32 priority, Bool discardable)
+{
+ GF_SubSampleInformationBox *sub_samples;
+ GF_TrackBox *trak;
+ GF_Err e;
+
+ e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE);
+ if (e) return e;
+
+ trak = gf_isom_get_track_from_file(movie, track);
+ if (!trak || !trak->Media || !trak->Media->information->sampleTable)
+ return GF_BAD_PARAM;
+
+ if (!trak->Media->information->sampleTable->SubSamples) {
+ trak->Media->information->sampleTable->SubSamples = (GF_SubSampleInformationBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_SUBS);
+ sub_samples = trak->Media->information->sampleTable->SubSamples;
+ sub_samples->version = (subSampleSize>0xFFFF) ? 1 : 0;
+ } else {
+ sub_samples = trak->Media->information->sampleTable->SubSamples;
+ }
+ return gf_isom_add_subsample_info(sub_samples, sampleNumber, subSampleSize, priority, discardable);
+}
+
#endif /*!defined(GPAC_DISABLE_ISOM) && !defined(GPAC_DISABLE_ISOM_WRITE)*/
return GF_OK;
}
+GF_XMLBox *gf_isom_get_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, Bool *is_binary)
+{
+ u32 i, count;
+ GF_XMLBox *xml = NULL;
+ GF_MetaBox *meta = gf_isom_get_meta(file, root_meta, track_num);
+ if (!meta) return NULL;
+
+ /*Find XMLBox*/
+ count = gf_list_count(meta->other_boxes);
+ for (i = 0; i <count; i++) {
+ GF_Box *a = (GF_Box *)gf_list_get(meta->other_boxes, i);
+ if (a->type == GF_ISOM_BOX_TYPE_XML) {
+ *is_binary = 0;
+ return (GF_XMLBox *)a;
+ } else if (a->type == GF_ISOM_BOX_TYPE_BXML) {
+ *is_binary = 1;
+ return (GF_XMLBox *)a;
+ }
+ }
+ return NULL;
+}
+
GF_EXPORT
return GF_OK;
}
+GF_Err gf_isom_set_meta_xml_memory(GF_ISOFile *file, Bool root_meta, u32 track_num, unsigned char *data, u32 data_size, Bool IsBinaryXML)
+{
+ GF_Err e;
+ GF_XMLBox *xml;
+ GF_MetaBox *meta;
+
+ e = CanAccessMovie(file, GF_ISOM_OPEN_WRITE);
+ if (e) return e;
+
+ meta = gf_isom_get_meta(file, root_meta, track_num);
+ if (!meta) return GF_BAD_PARAM;
+
+ e = gf_isom_remove_meta_xml(file, root_meta, track_num);
+ if (e) return e;
+
+ xml = (GF_XMLBox *)xml_New();
+ if (!xml) return GF_OUT_OF_MEM;
+ gf_list_add(meta->other_boxes, xml);
+ if (IsBinaryXML) xml->type = GF_ISOM_BOX_TYPE_BXML;
+
+
+ /*assume 32bit max size = 4Go should be sufficient for a DID!!*/
+ xml->xml_length = data_size;
+ xml->xml = (char*)gf_malloc(sizeof(unsigned char)*xml->xml_length);
+ memcpy(xml->xml, data, sizeof(unsigned char)*xml->xml_length);
+ return GF_OK;
+}
GF_Err gf_isom_add_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, Bool self_reference, char *resource_path, const char *item_name, const char *mime_type, const char *content_encoding, const char *URL, const char *URN)
{
e = CanAccessMovie(file, GF_ISOM_OPEN_WRITE);
if (e) return e;
meta = gf_isom_get_meta(file, root_meta, track_num);
- if (!meta) return GF_BAD_PARAM;
+ if (!meta) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("Trying to add item, but missing meta box"));
+ return GF_BAD_PARAM;
+ }
e = FlushCaptureMode(file);
if (e) return e;
bs = movie->editFileMap->bs;
if (!movie->moof_first) load_mdat_only = 0;
-
+ mdat_size = 0;
//1 - flush all caches
i=0;
while ((traf = (GF_TrackFragmentBox*)gf_list_enum(movie->moof->TrackList, &i))) {
u64 sidx_start, sidx_end;
u32 count, nb_subsegs, idx;
GF_Err e;
+ sidx_start = sidx_end = 0;
//and only at setup
if (!movie || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) ) return GF_BAD_PARAM;
if (movie->openMode != GF_ISOM_OPEN_WRITE) return GF_ISOM_INVALID_MODE;
e = gf_isom_box_write((GF_Box *) movie->brand, movie->editFileMap->bs);
if (e) return e;
+ /* TODO: change code for SIDX new version */
/*prepare SIDX*/
if (referenceTrackID) {
sidx = (GF_SegmentIndexBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_SIDX);
- sidx->reference_track_ID = referenceTrackID;
- sidx->nb_track_times = nb_times;
- sidx->tracks_times = tracks_times;
+ sidx->reference_ID = referenceTrackID;
+ //sidx->nb_track_times = nb_times;
+ //sidx->tracks_times = tracks_times;
if (!frags_per_sidx) nb_subsegs = 1;
- else nb_subsegs = count/frags_per_sidx;
- if (!nb_subsegs) nb_subsegs=1;
+ else {
+ nb_subsegs = count/frags_per_sidx;
+ if (nb_subsegs*frags_per_sidx<count) nb_subsegs++;
+ }
sidx->nb_refs = nb_subsegs;
sidx->refs = gf_malloc(sizeof(GF_SIDXReference)*nb_subsegs);
memset(sidx->refs, 0, sizeof(GF_SIDXReference)*nb_subsegs);
e = gf_isom_box_write((GF_Box *) sidx, movie->editFileMap->bs);
gf_bs_seek(movie->editFileMap->bs, pos);
- sidx->tracks_times=NULL;
- sidx->nb_track_times=0;
+ //sidx->tracks_times=NULL;
+ //sidx->nb_track_times=0;
gf_isom_box_del((GF_Box*)sidx);
}
return e;
if (!movie || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) ) return GF_BAD_PARAM;
if (movie->openMode != GF_ISOM_OPEN_WRITE) return GF_ISOM_INVALID_MODE;
- if (gf_list_count(movie->moof_list)) return GF_BAD_PARAM;
+ if (gf_list_count(movie->moof_list))
+ return GF_BAD_PARAM;
/*update segment file*/
if (SegName) {
GF_TrackFragmentBox *traf;
GF_Err e;
//and only at setup
- if (!movie || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) ) return GF_BAD_PARAM;
+ if (!movie || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) )
+ return GF_BAD_PARAM;
if (movie->openMode != GF_ISOM_OPEN_WRITE) return GF_ISOM_INVALID_MODE;
count = gf_list_count(movie->moov->mvex->TrackExList);
- if (!count) return GF_BAD_PARAM;
+ if (!count)
+ return GF_BAD_PARAM;
/*always force cached mode when writing movie segments*/
if (movie->use_segments) moof_first = 1;
GF_TrunEntry *ent;
GF_TrackFragmentBox *traf, *traf_2;
GF_TrackFragmentRunBox *trun;
- if (!movie->moof || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) || !sample) return GF_BAD_PARAM;
+ if (!movie->moof || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) || !sample)
+ return GF_BAD_PARAM;
traf = GetTraf(movie, TrackID);
- if (!traf) return GF_BAD_PARAM;
+ if (!traf)
+ return GF_BAD_PARAM;
if (!traf->tfhd->sample_desc_index) traf->tfhd->sample_desc_index = DescIndex ? DescIndex : traf->trex->def_sample_desc_index;
return GF_OK;
}
+GF_Err gf_isom_fragment_add_subsample(GF_ISOFile *movie, u32 TrackID, u32 subSampleSize, u32 priority, Bool discardable)
+{
+ u32 i, count, last_sample;
+ GF_TrackFragmentBox *traf;
+ if (!movie->moof || !(movie->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) ) return GF_BAD_PARAM;
+
+ traf = GetTraf(movie, TrackID);
+ if (!traf || !traf->tfhd->sample_desc_index) return GF_BAD_PARAM;
+
+ /*compute last sample number in traf*/
+ last_sample = 0;
+ count = gf_list_count(traf->TrackRuns);
+ for (i=0; i<count; i++) {
+ GF_TrackFragmentRunBox *trun = gf_list_get(traf->TrackRuns, i);
+ last_sample += trun->sample_count;
+ }
+
+ if (!traf->subs) {
+ traf->subs = (GF_SubSampleInformationBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_SUBS);
+ traf->subs->version = (subSampleSize>0xFFFF) ? 1 : 0;
+ }
+ return gf_isom_add_subsample_info(traf->subs, last_sample, subSampleSize, priority, discardable);
+}
+
+GF_Err gf_isom_fragment_copy_subsample(GF_ISOFile *dest, u32 TrackID, GF_ISOFile *orig, u32 track, u32 sampleNumber)
+{
+ u32 i, count, last_sample;
+ GF_SampleEntry *sub_sample;
+ GF_Err e;
+ GF_TrackFragmentBox *traf;
+ if (!dest->moof || !(dest->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) ) return GF_BAD_PARAM;
+
+ if (! gf_isom_sample_get_subsample_entry(orig, track, sampleNumber, &sub_sample)) return GF_OK;
+
+ traf = GetTraf(dest, TrackID);
+ if (!traf || !traf->tfhd->sample_desc_index) return GF_BAD_PARAM;
+
+ /*compute last sample number in traf*/
+ last_sample = 0;
+ count = gf_list_count(traf->TrackRuns);
+ for (i=0; i<count; i++) {
+ GF_TrackFragmentRunBox *trun = gf_list_get(traf->TrackRuns, i);
+ last_sample += trun->sample_count;
+ }
+
+ /*create subsample if needed*/
+ if (!traf->subs) {
+ traf->subs = (GF_SubSampleInformationBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_SUBS);
+ traf->subs->version = 0;
+ }
+
+
+ count = gf_list_count(sub_sample->SubSamples);
+ for (i=0; i<count; i++) {
+ GF_SubSampleEntry *entry = gf_list_get(sub_sample->SubSamples, i);
+ e = gf_isom_add_subsample_info(traf->subs, last_sample, entry->subsample_size, entry->subsample_priority, entry->discardable);
+ if (e) return e;
+ }
+ return GF_OK;
+}
+
#endif /*GPAC_DISABLE_ISOM_WRITE*/
return 0;
}
+GF_Err gf_isom_fragment_add_subsample(GF_ISOFile *movie, u32 TrackID, u32 subSampleSize, u32 priority, Bool discardable)
+{
+ return GF_NOT_SUPPORTED;
+}
+
+GF_Err gf_isom_fragment_copy_subsample(GF_ISOFile *dest, u32 TrackID, GF_ISOFile *orig, u32 track, u32 sampleNumber)
+{
+ return GF_NOT_SUPPORTED;
+}
+
+
#endif /*GPAC_DISABLE_ISOM_FRAGMENTS)*/
#endif /*GPAC_DISABLE_ISOM*/
if (!stbl->SampleSize->sizes || (stbl->SampleSize->sampleCount==stbl->SampleSize->alloc_size)) {
Bool init_table = (stbl->SampleSize->sizes==NULL) ? 1 : 0;
ALLOC_INC(stbl->SampleSize->alloc_size);
+ if (stbl->SampleSize->sampleCount>stbl->SampleSize->alloc_size)
+ stbl->SampleSize->alloc_size = stbl->SampleSize->sampleCount+1;
+
stbl->SampleSize->sizes = (u32 *)gf_realloc(stbl->SampleSize->sizes, sizeof(u32)*stbl->SampleSize->alloc_size);
if (!stbl->SampleSize->sizes) return;
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
-GF_Err MergeTrack(GF_TrackBox *trak, GF_TrackFragmentBox *traf, u64 *moof_offset)
+GF_Err MergeTrack(GF_TrackBox *trak, GF_TrackFragmentBox *traf, u64 moof_offset)
{
u32 i, j, chunk_size;
u64 base_offset, data_offset;
def_flags = (traf->tfhd->flags & GF_ISOM_TRAF_SAMPLE_FLAGS) ? traf->tfhd->def_sample_flags : traf->trex->def_sample_flags;
//locate base offset
- base_offset = (traf->tfhd->flags & GF_ISOM_TRAF_BASE_OFFSET) ? traf->tfhd->base_data_offset : *moof_offset;
+ base_offset = (traf->tfhd->flags & GF_ISOM_TRAF_BASE_OFFSET) ? traf->tfhd->base_data_offset : moof_offset;
chunk_size = 0;
prev_trun_data_offset = 0;
if (degr) stbl_AppendDegradation(trak->Media->information->sampleTable, degr);
}
}
- //end of the fragment, update offset
- *moof_offset += chunk_size;
return GF_OK;
}
}
GF_EXPORT
-GF_Err gf_laser_decode_au(GF_LASeRCodec *codec, u16 ESID, char *data, u32 data_len)
+GF_Err gf_laser_decode_au(GF_LASeRCodec *codec, u16 ESID, const char *data, u32 data_len)
{
GF_Err e;
if (!codec || !data || !data_len) return GF_BAD_PARAM;
gf_bs_write_data(lsr->bs, data, len);
}
-static void lsr_write_extend_class(GF_LASeRCodec *lsr, char *data, u32 len, const char *name)
-{
- u32 i=0;
- GF_LSR_WRITE_INT(lsr, 0, lsr->info->cfg.extensionIDBits, "reserved");
- lsr_write_vluimsbf5(lsr, len, "len");
- while (i<len) {
- gf_bs_write_int(lsr->bs, data[i], 8);
- i++;
- }
-}
-
static void lsr_write_codec_IDREF(GF_LASeRCodec *lsr, XMLRI *href, const char *name)
{
u32 nID = 0;
}
}
+#ifdef UNUSED_FUNC
+
static void lsr_write_private_element_container(GF_LASeRCodec *lsr)
{
/*NO PRIVATE DATA ON ENCODING YET*/
assert(0);
}
+static void lsr_write_extend_class(GF_LASeRCodec *lsr, char *data, u32 len, const char *name)
+{
+ u32 i=0;
+ GF_LSR_WRITE_INT(lsr, 0, lsr->info->cfg.extensionIDBits, "reserved");
+ lsr_write_vluimsbf5(lsr, len, "len");
+ while (i<len) {
+ gf_bs_write_int(lsr->bs, data[i], 8);
+ i++;
+ }
+}
+
static void lsr_write_private_attr_container(GF_LASeRCodec *lsr, u32 index, const char *name)
{
assert(0);
}
+static Bool lsr_float_list_equal(GF_List *l1, GF_List *l2)
+{
+ u32 i, count = gf_list_count(l1);
+ if (count != gf_list_count(l2)) return 0;
+ for (i=0;i<count;i++) {
+ Fixed *v1 = (Fixed *)gf_list_get(l1, i);
+ Fixed *v2 = (Fixed *)gf_list_get(l2, i);
+ if (*v1 != *v2) return 0;
+ }
+ return 1;
+}
+#endif /* UNUSED_FUNC */
+
+
+
static void lsr_write_any_attribute(GF_LASeRCodec *lsr, SVG_Element *node, Bool skippable)
{
if (1) {
GF_LSR_WRITE_INT(lsr, 0, 1, "has_private_attr");
} else {
GF_LSR_WRITE_INT(lsr, 1, 1, "has_private_attr");
+#ifdef UNUSED_FUNC
lsr_write_private_att_class(lsr);
+#endif /* UNUSED_FUNC */
}
}
static void lsr_write_string_attribute(GF_LASeRCodec *lsr, char *class_attr, char *name)
return gf_lsr_same_rare(atts, &base_atts);
}
-static Bool lsr_float_list_equal(GF_List *l1, GF_List *l2)
-{
- u32 i, count = gf_list_count(l1);
- if (count != gf_list_count(l2)) return 0;
- for (i=0;i<count;i++) {
- Fixed *v1 = (Fixed *)gf_list_get(l1, i);
- Fixed *v2 = (Fixed *)gf_list_get(l2, i);
- if (*v1 != *v2) return 0;
- }
- return 1;
-}
-
static void lsr_write_rare(GF_LASeRCodec *lsr, GF_Node *n)
{
u32 i, nb_rare;
/*
* Output = SHA-1( file contents )
*/
-s32 gf_sha1_file( char *path, u8 output[20] )
+s32 gf_sha1_file( const char *path, u8 output[20] )
{
FILE *f;
size_t n;
td->mode_version = 20010801;
}
-#endif /* !defined(GPAC_CRYPT_ISMA_ONLY) && !defined(GPAC_DISABLE_MCRYPT)*//
+#endif /* !defined(GPAC_CRYPT_ISMA_ONLY) && !defined(GPAC_DISABLE_MCRYPT)*/
+
const char *gf_m4a_object_type_name(u32 objectType)
{
switch (objectType) {
- case 0: return "Reserved";
- case 1: return "AAC Main";
- case 2: return "AAC LC";
- case 3: return "AAC SSR";
- case 4: return "AAC LTP";
- case 5: return "SBR";
- case 6: return "AAC Scalable";
- case 7: return "TwinVQ";
- case 8: return "CELP";
- case 9: return "HVXC";
- case 10: return "Reserved";
- case 11: return "Reserved";
- case 12: return "TTSI";
- case 13: return "Main synthetic";
- case 14: return "Wavetable synthesis";
- case 15: return "General MIDI";
- case 16: return "Algorithmic Synthesis and Audio FX";
- case 17: return "ER AAC LC";
- case 18: return "Reserved";
- case 19: return "ER AAC LTP";
- case 20: return "ER AAC scalable";
- case 21: return "ER TwinVQ";
- case 22: return "ER BSAC";
- case 23: return "ER AAC LD";
- case 24: return "ER CELP";
- case 25: return "ER HVXC";
- case 26: return "ER HILN";
- case 27: return "ER Parametric";
- case 28: return "SSC";
- case 29: return "ParametricStereo";
- case 30: return "(Reserved)";
- case 31: return "(Reserved)";
- case 32: return "Layer-1";
- case 33: return "Layer-2";
- case 34: return "Layer-3";
- case 35: return "DST";
- case 36: return "ALS";
- default: return "Unknown";
+ case 0: return "MPEG-4 Audio Reserved";
+ case 1: return "MPEG-4 Audio AAC Main";
+ case 2: return "MPEG-4 Audio AAC LC";
+ case 3: return "MPEG-4 Audio AAC SSR";
+ case 4: return "MPEG-4 Audio AAC LTP";
+ case 5: return "MPEG-4 Audio SBR";
+ case 6: return "MPEG-4 Audio AAC Scalable";
+ case 7: return "MPEG-4 Audio TwinVQ";
+ case 8: return "MPEG-4 Audio CELP";
+ case 9: return "MPEG-4 Audio HVXC";
+ case 10: return "MPEG-4 Audio Reserved";
+ case 11: return "MPEG-4 Audio Reserved";
+ case 12: return "MPEG-4 Audio TTSI";
+ case 13: return "MPEG-4 Audio Main synthetic";
+ case 14: return "MPEG-4 Audio Wavetable synthesis";
+ case 15: return "MPEG-4 Audio General MIDI";
+ case 16: return "MPEG-4 Audio Algorithmic Synthesis and Audio FX";
+ case 17: return "MPEG-4 Audio ER AAC LC";
+ case 18: return "MPEG-4 Audio Reserved";
+ case 19: return "MPEG-4 Audio ER AAC LTP";
+ case 20: return "MPEG-4 Audio ER AAC scalable";
+ case 21: return "MPEG-4 Audio ER TwinVQ";
+ case 22: return "MPEG-4 Audio ER BSAC";
+ case 23: return "MPEG-4 Audio ER AAC LD";
+ case 24: return "MPEG-4 Audio ER CELP";
+ case 25: return "MPEG-4 Audio ER HVXC";
+ case 26: return "MPEG-4 Audio ER HILN";
+ case 27: return "MPEG-4 Audio ER Parametric";
+ case 28: return "MPEG-4 Audio SSC";
+ case 29: return "MPEG-4 Audio ParametricStereo";
+ case 30: return "MPEG-4 Audio Reserved";
+ case 31: return "MPEG-4 Audio Reserved";
+ case 32: return "MPEG-1 Audio Layer-1";
+ case 33: return "MPEG-1 Audio Layer-2";
+ case 34: return "MPEG-1 Audio Layer-3";
+ case 35: return "MPEG-4 Audio DST";
+ case 36: return "MPEG-4 Audio ALS";
+ default: return "MPEG-4 Audio Unknown";
}
}
default:
return 0;
}
+ return 0;
}
}
GF_EXPORT
-u32 gf_mp3_get_next_header_mem(char *buffer, u32 size, u32 *pos)
+u32 gf_mp3_get_next_header_mem(const char *buffer, u32 size, u32 *pos)
{
u32 cur;
u8 b, state = 0;
gf_bs_read_int(bs, 5); /*initial_cpb_removal_delay_length_minus1*/
hrd->cpb_removal_delay_length_minus1 = gf_bs_read_int(bs, 5); /*cpb_removal_delay_length_minus1*/
hrd->dpb_output_delay_length_minus1 = gf_bs_read_int(bs, 5); /*dpb_output_delay_length_minus1*/
- gf_bs_read_int(bs, 5); /*time_offset_length*/
+ hrd->time_offset_length = gf_bs_read_int(bs, 5); /*time_offset_length*/
return;
}
}
return nal_size+emulation_bytes_count;
}
-
+#ifdef UNUSED_FUNC
/*returns the nal_size without emulation prevention bytes*/
static u32 avc_emulation_bytes_remove_count(unsigned char *buffer, u32 nal_size)
{
return emulation_bytes_count;
}
-
+#endif /* UNUSED_FUNC */
/*nal_size is updated to allow better error detection*/
static u32 avc_remove_emulation_bytes(const unsigned char *buffer_src, unsigned char *buffer_dst, u32 nal_size)
s32 AVC_ReadSeqInfo(char *sps_data, u32 sps_size, AVCState *avc, u32 subseq_sps, u32 *vui_flag_pos)
{
AVC_SPS *sps;
+ u32 ChromaArrayType = 0;
s32 mb_width, mb_height;
u32 sps_id, profile_idc, level_idc, pcomp, i, chroma_format_idc, cl, cr, ct, cb;
GF_BitStream *bs;
/*SubsetSps is used to be sure that AVC SPS are not going to be scratched
by subset SPS. According to the SVC standard, subset SPS can have the same sps_id
than its base layer, but it does not refer to the same SPS. */
- sps_id = avc_get_ue(bs) + 16 * subseq_sps;
+ sps_id = avc_get_ue(bs) + GF_SVC_SSPS_ID_SHIFT * subseq_sps;
sps = &avc->sps[sps_id];
sps->state |= subseq_sps ? AVC_SUBSPS_PARSED : AVC_SPS_PARSED;
case 83:
case 86:
chroma_format_idc = avc_get_ue(bs);
- if (chroma_format_idc == 3) /*residual_colour_transform_flag = */ gf_bs_read_int(bs, 1);
+ ChromaArrayType = chroma_format_idc;
+ if (chroma_format_idc == 3) {
+ u8 separate_colour_plane_flag = gf_bs_read_int(bs, 1);
+ /*
+ Depending on the value of separate_colour_plane_flag, the value of the variable ChromaArrayType is assigned as follows.
+ \96 If separate_colour_plane_flag is equal to 0, ChromaArrayType is set equal to chroma_format_idc.
+ \96 Otherwise (separate_colour_plane_flag is equal to 1), ChromaArrayType is set equal to 0.
+ */
+ if (separate_colour_plane_flag) ChromaArrayType = 0;
+ }
/*bit_depth_luma_minus8 = */ avc_get_ue(bs);
/*bit_depth_chroma_minus8 = */ avc_get_ue(bs);
/*qpprime_y_zero_transform_bypass_flag = */ gf_bs_read_int(bs, 1);
if (vui_flag_pos) {
*vui_flag_pos = (u32) gf_bs_get_bit_offset(bs);
}
-
/*vui_parameters_present_flag*/
if (gf_bs_read_int(bs, 1)) {
/*aspect_ratio_info_present_flag*/
sps->vui.pic_struct_present_flag = gf_bs_read_int(bs, 1);
}
+ /*end of seq_parameter_set_data*/
+
+ if (subseq_sps) {
+ if ((profile_idc==83) || (profile_idc==86)) {
+ u8 extended_spatial_scalability_idc;
+ /*parsing seq_parameter_set_svc_extension*/
+ /*inter_layer_deblocking_filter_control_present_flag=*/ gf_bs_read_int(bs, 1);
+ extended_spatial_scalability_idc = gf_bs_read_int(bs, 2);
+ if (ChromaArrayType == 1 || ChromaArrayType == 2) {
+ /*chroma_phase_x_plus1_flag*/ gf_bs_read_int(bs, 1);
+ }
+ if( ChromaArrayType == 1 ) {
+ /*chroma_phase_y_plus1*/ gf_bs_read_int(bs, 2);
+ }
+ if (extended_spatial_scalability_idc == 1) {
+ if( ChromaArrayType > 0 ) {
+ /*seq_ref_layer_chroma_phase_x_plus1_flag*/gf_bs_read_int(bs, 1);
+ /*seq_ref_layer_chroma_phase_y_plus1*/gf_bs_read_int(bs, 2);
+ }
+ /*seq_scaled_ref_layer_left_offset*/ avc_get_se(bs);
+ /*seq_scaled_ref_layer_top_offset*/avc_get_se(bs);
+ /*seq_scaled_ref_layer_right_offset*/avc_get_se(bs);
+ /*seq_scaled_ref_layer_bottom_offset*/avc_get_se(bs);
+ }
+ if (/*seq_tcoeff_level_prediction_flag*/gf_bs_read_int(bs, 1)) {
+ /*adaptive_tcoeff_level_prediction_flag*/ gf_bs_read_int(bs, 1);
+ }
+ /*slice_header_restriction_flag*/gf_bs_read_int(bs, 1);
+
+ /*svc_vui_parameters_present*/
+ if (gf_bs_read_int(bs, 1)) {
+ u32 i, vui_ext_num_entries_minus1;
+ vui_ext_num_entries_minus1 = avc_get_ue(bs);
+
+ for (i=0; i <= vui_ext_num_entries_minus1; i++) {
+ u8 vui_ext_nal_hrd_parameters_present_flag, vui_ext_vcl_hrd_parameters_present_flag;
+ u8 vui_ext_dependency_id = gf_bs_read_int(bs, 3);
+ u8 vui_ext_quality_id = gf_bs_read_int(bs, 4);
+ u8 vui_ext_temporal_id = gf_bs_read_int(bs, 3);
+ u8 vui_ext_timing_info_present_flag = gf_bs_read_int(bs, 1);
+ if (vui_ext_timing_info_present_flag) {
+ u32 vui_ext_num_units_in_tick = gf_bs_read_int(bs, 32);
+ u32 vui_ext_time_scale = gf_bs_read_int(bs, 32);
+ u8 vui_ext_fixed_frame_rate_flag = gf_bs_read_int(bs, 1);
+ }
+ vui_ext_nal_hrd_parameters_present_flag = gf_bs_read_int(bs, 1);
+ if (vui_ext_nal_hrd_parameters_present_flag) {
+ //hrd_parameters( )
+ }
+ vui_ext_vcl_hrd_parameters_present_flag = gf_bs_read_int(bs, 1);
+ if (vui_ext_vcl_hrd_parameters_present_flag) {
+ //hrd_parameters( )
+ }
+ if ( vui_ext_nal_hrd_parameters_present_flag || vui_ext_vcl_hrd_parameters_present_flag) {
+ /*vui_ext_low_delay_hrd_flag*/gf_bs_read_int(bs, 1);
+ }
+ /*vui_ext_pic_struct_present_flag*/gf_bs_read_int(bs, 1);
+ }
+ }
+ }
+ else if ((profile_idc==118) || (profile_idc==128)) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CODING, ("[avc-h264] MVC not spported - skipping parsing end of Subset SPS\n"));
+ goto exit;
+ }
+
+ if (gf_bs_read_int(bs, 1)) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CODING, ("[avc-h264] skipping parsing end of Subset SPS (additional_extension2)\n"));
+ goto exit;
+ }
+ }
+
+exit:
+ gf_bs_del(bs);
gf_free(sps_data_without_emulation_bytes);
return sps_id;
}
if (!pps->status) pps->status = 1;
pps->sps_id = avc_get_ue(bs);
- if (!avc->sps[pps->sps_id].state) {
+ /*sps_id may be refer to regular SPS or subseq sps, depending on the coded slice refering to the pps*/
+ if (!avc->sps[pps->sps_id].state && !avc->sps[pps->sps_id + GF_SVC_SSPS_ID_SHIFT].state) {
pps_id = -1;
goto exit;
}
/*pps->ref_count[0]= */avc_get_ue(bs) /*+ 1*/;
/*pps->ref_count[1]= */avc_get_ue(bs) /*+ 1*/;
/*
- if ((pps->ref_count[0] > 32) || (pps->ref_count[1] > 32)) return -1;
+ if ((pps->ref_count[0] > 32) || (pps->ref_count[1] > 32)) goto exit;
*/
/*pps->weighted_pred = */gf_bs_read_int(bs, 1);
pps->redundant_pic_cnt_present = gf_bs_read_int(bs, 1);
exit:
+ gf_bs_del(bs);
gf_free(pps_data_without_emulation_bytes);
return pps_id;
}
{
gf_bs_read_int(bs, 1); //reserved_one_bits
NalHeader->idr_pic_flag = gf_bs_read_int(bs, 1); //idr_flag
- gf_bs_read_int(bs, 6); //priority_id
+ NalHeader->priority_id = gf_bs_read_int(bs, 6); //priority_id
gf_bs_read_int(bs, 1); //no_inter_layer_pred_flag
- gf_bs_read_int(bs, 3); //DependencyId
- gf_bs_read_int(bs, 4); //quality_id
+ NalHeader->dependency_id = gf_bs_read_int(bs, 3); //DependencyId
+ NalHeader->quality_id = gf_bs_read_int(bs, 4); //quality_id
NalHeader->temporal_id = gf_bs_read_int(bs, 3); //temporal_id
gf_bs_read_int(bs, 1); //use_ref_base_pic_flag
gf_bs_read_int(bs, 1); //discardable_flag
si->pps->id = pps_id;
if (!si->pps->slice_group_count)
return -2;
- si->sps = &avc->sps[si->pps->sps_id + 16];
+ si->sps = &avc->sps[si->pps->sps_id + GF_SVC_SSPS_ID_SHIFT];
if (!si->sps->log2_max_frame_num)
return -2;
for (i=0; i<NumClockTS[pt->pic_struct]; i++) {
if (gf_bs_read_int(bs, 1)) {/*clock_timestamp_flag[i]*/
- GF_LOG(GF_LOG_WARNING, GF_LOG_CODING, ("[avc-h264] not implemented pic_timing part\n", pt->pic_struct));
- assert(0);
+ Bool full_timestamp_flag;
+ gf_bs_read_int(bs, 2); /*ct_type*/
+ gf_bs_read_int(bs, 1); /*nuit_field_based_flag*/
+ gf_bs_read_int(bs, 5); /*counting_type*/
+ full_timestamp_flag = gf_bs_read_int(bs, 1);/*full_timestamp_flag*/
+ gf_bs_read_int(bs, 1); /*discontinuity_flag*/
+ gf_bs_read_int(bs, 1); /*cnt_dropped_flag*/
+ gf_bs_read_int(bs, 8); /*n_frames*/
+ if (full_timestamp_flag) {
+ gf_bs_read_int(bs, 6); /*seconds_value*/
+ gf_bs_read_int(bs, 6); /*minutes_value*/
+ gf_bs_read_int(bs, 5); /*hours_value*/
+ } else {
+ if (gf_bs_read_int(bs, 1)) { /*seconds_flag*/
+ gf_bs_read_int(bs, 6); /*seconds_value*/
+ if (gf_bs_read_int(bs, 1)) { /*minutes_flag*/
+ gf_bs_read_int(bs, 6); /*minutes_value*/
+ if (gf_bs_read_int(bs, 1)) { /*hours_flag*/
+ gf_bs_read_int(bs, 5); /*hours_value*/
+ }
+ }
+ }
+ if (avc->sps[sps_id].vui.hrd.time_offset_length > 0)
+ gf_bs_read_int(bs, avc->sps[sps_id].vui.hrd.time_offset_length); /*time_offset*/
+ }
}
}
}
case GF_AVC_NALU_SVC_PREFIX_NALU:
SVC_ReadNal_header_extension(bs, &n_state.NalHeader);
-
- if (avc->s_info.nal_unit_type == GF_AVC_NALU_SVC_SLICE) {
- return 1;
- }
return 0;
case GF_AVC_NALU_NON_IDR_SLICE:
u32 i, bit_offset, flag;
s32 idx;
GF_AVCConfigSlot *slc;
+ orig = NULL;
memset(&avc, 0, sizeof(AVCState));
avc.sps_active_idx = -1;
i=0;
while ((slc = (GF_AVCConfigSlot *)gf_list_enum(avcc->sequenceParameterSets, &i))) {
- orig = gf_bs_new(slc->data, slc->size, GF_BITSTREAM_READ);
+ char *no_emulation_buf = NULL;
+ u32 no_emulation_buf_size = 0, emulation_bytes = 0;
idx = AVC_ReadSeqInfo(slc->data+1/*skip NALU type*/, slc->size-1, &avc, 0, &bit_offset);
if (idx<0) {
- gf_bs_del(orig);
+ if ( orig )
+ gf_bs_del(orig);
continue;
}
- gf_bs_read_data(orig, slc->data, slc->size);
+
+ /*SPS still contains emulation bytes*/
+ no_emulation_buf = gf_malloc((slc->size-1)*sizeof(char));
+ no_emulation_buf_size = avc_remove_emulation_bytes(slc->data+1, no_emulation_buf, slc->size-1);
+
+ orig = gf_bs_new(no_emulation_buf, no_emulation_buf_size, GF_BITSTREAM_READ);
+ gf_bs_read_data(orig, no_emulation_buf, no_emulation_buf_size);
gf_bs_seek(orig, 0);
mod = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
gf_bs_write_int(mod, flag, 1);
}
gf_bs_del(orig);
- gf_free(slc->data);
- slc->data = NULL;
- gf_bs_get_content(mod, (char **) &slc->data, &flag);
- slc->size = flag;
+ orig = NULL;
+ gf_free(no_emulation_buf);
+
+ /*set anti-emulation*/
+ gf_bs_get_content(mod, (char **) &no_emulation_buf, &flag);
+ emulation_bytes = avc_emulation_bytes_add_count(no_emulation_buf, flag);
+ if (flag+emulation_bytes+1>slc->size)
+ slc->data = (char*)gf_realloc(slc->data, flag+emulation_bytes);
+ slc->size = avc_add_emulation_bytes(no_emulation_buf, slc->data+1, flag)+1;
+
gf_bs_del(mod);
+ gf_free(no_emulation_buf);
}
return GF_OK;
}
#endif
GF_EXPORT
-GF_Err gf_avc_get_sps_info(char *sps_data, u32 sps_size, u32 *width, u32 *height, s32 *par_n, s32 *par_d)
+GF_Err gf_avc_get_sps_info(char *sps_data, u32 sps_size, u32 *sps_id, u32 *width, u32 *height, s32 *par_n, s32 *par_d)
{
AVCState avc;
s32 idx;
if (idx<0) {
return GF_NON_COMPLIANT_BITSTREAM;
}
+ if (sps_id) *sps_id = idx;
if (width) *width = avc.sps[idx].width;
if (height) *height = avc.sps[idx].height;
u32 i_streams, i_targets;
GF_M2TS_IP_Stream *ip_stream_buff;
- GF_M2TS_IP_PLATFORM * ip_platform = ts->ip_platform;
+ GF_M2TS_IP_PLATFORM * ip_platform;
+ if (!ts)
+ return;
+ ip_platform = ts->ip_platform;
if (!ip_platform) return;
i_streams = 0;
i_targets = 0;
- while(gf_list_count(ip_platform->ip_streams)){
- ip_stream_buff=gf_list_get(ip_platform->ip_streams, 0);
+ if (ip_platform->ip_streams){
+ while(gf_list_count(ip_platform->ip_streams)){
+ ip_stream_buff=gf_list_get(ip_platform->ip_streams, 0);
- while (gf_list_count(ip_stream_buff->targets)){
- GF_M2TS_IP_Target *ip_targets = gf_list_get(ip_stream_buff->targets, 0);
- gf_free(ip_targets);
- gf_list_rem(ip_stream_buff->targets,0);
- }
- gf_free(ip_stream_buff);
- gf_list_rem(ip_platform->ip_streams,0);
+ while (gf_list_count(ip_stream_buff->targets)){
+ GF_M2TS_IP_Target *ip_targets = gf_list_get(ip_stream_buff->targets, 0);
+ gf_free(ip_targets);
+ gf_list_rem(ip_stream_buff->targets,0);
+ }
+ gf_free(ip_stream_buff);
+ gf_list_rem(ip_platform->ip_streams,0);
+ }
+ gf_list_del(ip_platform->ip_streams);
}
- gf_list_del(ip_platform->ip_streams);
- while(gf_list_count(ip_platform->socket_struct)){
- GF_SOCK_ENTRY *socket_struct = gf_list_get(ip_platform->socket_struct, 0);
- gf_free(socket_struct);
- gf_list_rem(ip_platform->socket_struct,0);
+ ip_platform->ip_streams = NULL;
+ if (ip_platform->socket_struct){
+ while(gf_list_count(ip_platform->socket_struct)){
+ GF_SOCK_ENTRY *socket_struct = gf_list_get(ip_platform->socket_struct, 0);
+ gf_free(socket_struct);
+ gf_list_rem(ip_platform->socket_struct,0);
+ }
+ gf_list_del(ip_platform->socket_struct);
}
- gf_list_del(ip_platform->socket_struct);
+ ip_platform->socket_struct = NULL;
gf_free(ip_platform);
+ ts->ip_platform = NULL;
}
GF_M2TS_ES *gf_dvb_mpe_section_new()
/*TODO - cleanup MPE FEC frame state & co*/
if (ses->mff) {
- gf_list_del(ses->mff->mpe_holes);
+ if (ses->mff->mpe_holes)
+ gf_list_del(ses->mff->mpe_holes);
+ ses->mff->mpe_holes = NULL;
gf_free(ses->mff);
ses->mff=NULL;
}
u32 i_streams,j;
u32 id,section_length, section_number, last_section_number;
s32 len_left = data_size;
+ assert( ts );
- u32 i = 0;
i_streams = 0;
// printf("Processing MPE/MPE-FEC data PID %d (%d/%d)\n",mpe->pid, data[6],data[7]);
last_section_number = data[7];
//printf( "table_id: %x section_length: %d section_number: %d last : %d \n",id, section_length, section_number, last_section_number);
+ if (ts->direct_mpe) {
+ if (table_id != GF_M2TS_TABLE_ID_DSM_CC_PRIVATE) return;
+ if (section_number != last_section_number) {
+ fprintf(stdout, "MPE IP datagram on several section not supported\n");
+ return;
+ }
+ /* send the IP data :
+ Remove the first 12 bytes of header (from table id to end of real time parameters
+ Remove also the last four 4 bytes of the section (CRC 32)
+ */
+ gf_m2ts_mpe_send_datagram(ts, mpe->pid, data +12, data_size - (12+4));
+ return;
+ }
+
+
/*get number of rows of mpe_fec_frame from descriptor*/
/* Real-Time Parameters */
delta_t = (data[8]<<4)|(data[9]>>4);
}else{
GF_SAFEALLOC(mpe->mff,MPE_FEC_FRAME);
+ assert( ip_platform );
+ assert(ip_platform->ip_streams);
i_streams = gf_list_count(ip_platform->ip_streams);
for(j=0;j<i_streams;j++){
ip_stream_buff=gf_list_get(ip_platform->ip_streams, j);
ip_adress_bootstrap[1]=0;
ip_adress_bootstrap[2]=23;
ip_adress_bootstrap[3]=14;
- socket_simu(ip_packet,ts);
+ socket_simu(ip_packet,ts, 1);
if(ip_packet->u8_rx_adr[3] == 8){
printf("\n");
gf_m2ts_Delete_IpPacket(ip_packet);
}
+
+void gf_m2ts_mpe_send_datagram(GF_M2TS_Demuxer *ts, u32 mpe_pid, unsigned char *data, u32 data_size)
+{
+ GF_M2TS_IP_Packet ip_pck;
+ u8 *udp_data;
+ u32 hdr_len;
+
+ ip_pck.u32_version = data[0] >>4;
+ ip_pck.u32_hdr_length =data[0] & 0xF;
+ ip_pck.u32_total_length = data[2]<<8 | data[3];
+ ip_pck.u32_id_nb = data[4]<<8 | data[5];
+ ip_pck.u32_flag = data[6] >>5;
+ ip_pck.u32_frag_offset = (data[6] & 0x1F)<<8 | data[7];
+ ip_pck.u32_TTL = data[8];
+ ip_pck.u32_protocol = data[9];
+ ip_pck.u32_crc = data[10]<<8 | data[11];
+ memcpy(ip_pck.u8_tx_adr,data+12,sizeof(ip_pck.u8_tx_adr));
+ memcpy(ip_pck.u8_rx_adr,data+16,sizeof(ip_pck.u8_rx_adr));
+
+ hdr_len = ip_pck.u32_hdr_length;
+ udp_data = data+(hdr_len*4);
+
+ ip_pck.u32_tx_udp_port = udp_data[0]<<8 | udp_data[1];
+ if(!ip_pck.u32_tx_udp_port){
+ return;
+ }
+ ip_pck.u32_rx_udp_port = udp_data[2]<<8 | udp_data[3];
+ if(!ip_pck.u32_rx_udp_port){
+ return;
+ }
+ ip_pck.u32_udp_data_size = udp_data[4]<<8 | udp_data[5];
+ if(ip_pck.u32_udp_data_size == 0){
+ return;
+ }
+ ip_pck.u32_udp_chksm = udp_data[6]<<8 | udp_data[7];
+
+ /*excluding UDP header*/
+ ip_pck.data = udp_data + 8;
+
+ socket_simu(&ip_pck, ts, 0);
+
+ fprintf(stdout, "MPE PID %d - send datagram %d bytes to %d.%d.%d.%d port:%d\n", mpe_pid, ip_pck.u32_udp_data_size-8, ip_pck.u8_rx_adr[0], ip_pck.u8_rx_adr[1], ip_pck.u8_rx_adr[2], ip_pck.u8_rx_adr[3], ip_pck.u32_rx_udp_port);
+
+}
+
+
Bool gf_m2ts_compare_ip(u8 rx_ip_adress[4], u8 ip_adress_bootstrap[4])
{
Bool Boostrap_ip;
{
GF_M2TS_IP_PLATFORM * ip_platform = ts->ip_platform ;
+ assert( ts );
// fprintf(stdout, "Processing IP/MAC Notification table (PID %d) %s\n", ip_table->pid, (status==GF_M2TS_TABLE_REPEAT)?"repeated":"");
//if ( status == GF_M2TS_TABLE_REPEAT ) return ;
if ( ip_platform == NULL )
data += 12 ;
+ assert( ip_platform);
i = dsmcc_pto_platform_descriptor_loop(ip_platform,data);
data += i;
length -= i;
i = dsmcc_pto_descriptor_loop(ip_str,data);
data += i;
length -= i;
-
-
+ assert( ip_platform->ip_streams );
gf_list_add(ip_platform->ip_streams, ip_str);
}
length = loop_length;
data += 2;
while (length > 0) {
+ assert( ip_platform);
i = platform_descriptorDSMCC_INT_UNT(ip_platform,data);
data += i;
length -= i;
{
u32 length;
length = data[1];
+ assert( ip_platform );
/* allocation ofr the name of the platform */
ip_platform->name = gf_malloc(sizeof(char)*(length-3+1));
memcpy(ip_platform->name, data+5, length-3);
u32 length;
length = data[1];
/* allocation of the name of the platform */
+ assert( ip_platform );
ip_platform->provider_name = gf_malloc(sizeof(char)*(length-3+1));
memcpy(ip_platform->provider_name, data+5, length-3);
ip_platform->provider_name[length-3] = 0;
GF_M2TS_IP_Target *ip_targets;
GF_M2TS_IP_PLATFORM * ip_platform = ts->ip_platform;
-
+ assert( ts );
offset =0;
ip_datagram = mff->p_adt;
GF_SAFEALLOC(ip_packet,GF_M2TS_IP_Packet);
GF_SAFEALLOC(mff_holes,MPE_Error_Holes);
-
+ assert( ip_platform );
while(offset<mff->current_offset_adt)
{
/* Find the parts of the ADT which contain errors and skip them */
i_targets = 0;
-
+ assert( ip_platform->ip_streams );
i_streams = gf_list_count(ip_platform->ip_streams);
for(k=0;k<i_streams;k++)
{
GF_M2TS_IP_Target *ip_targets;
u8 *ip_adress;
GF_M2TS_IP_PLATFORM * ip_platform = ts->ip_platform;
+ assert( ts );
if (!ts->ip_platform) return;
/* provider and ip platform name */
i_targets = 0;
+ assert(ip_platform->ip_streams);
i_streams = gf_list_count(ip_platform->ip_streams);
for(i=0;i<i_streams;i++)
{
}
-void socket_simu(GF_M2TS_IP_Packet *ip_packet, GF_M2TS_Demuxer *ts)
+void socket_simu(GF_M2TS_IP_Packet *ip_packet, GF_M2TS_Demuxer *ts, Bool yield)
{
- int j = 1;
char name[100];
u32 ipv4_addr;
GF_Err e;
u8 nb_socket_struct, i;
- GF_SOCK_ENTRY *Sock_Struct;
-
+ GF_SOCK_ENTRY *Sock_Struct = NULL;
+ assert( ts );
+ if(!ts->ip_platform) {
+ GF_SAFEALLOC(ts->ip_platform,GF_M2TS_IP_PLATFORM );
+ }
if(ts->ip_platform->socket_struct == NULL) ts->ip_platform->socket_struct= gf_list_new();
-
- ip_packet->sock = NULL;
ipv4_addr = GF_4CC(ip_packet->u8_rx_adr[0], ip_packet->u8_rx_adr[1], ip_packet->u8_rx_adr[2], ip_packet->u8_rx_adr[3]);
nb_socket_struct = gf_list_count(ts->ip_platform->socket_struct);
for(i=0;i<nb_socket_struct;i++) {
Sock_Struct = gf_list_get(ts->ip_platform->socket_struct,i);
-
- if ((Sock_Struct->ipv4_addr==ipv4_addr)&& (Sock_Struct->port == (u16) ip_packet->u32_rx_udp_port))
- {
+ if ((Sock_Struct->ipv4_addr==ipv4_addr)&& (Sock_Struct->port == (u16) ip_packet->u32_rx_udp_port)) {
if (Sock_Struct->bind_failure) return;
- ip_packet->sock = Sock_Struct->sock;
break;
}
+ Sock_Struct = NULL;
}
- if (ip_packet->sock == NULL) {
+ if (Sock_Struct == NULL) {
GF_SAFEALLOC(Sock_Struct, GF_SOCK_ENTRY);
Sock_Struct->ipv4_addr = ipv4_addr;
sprintf(name, "%d.%d.%d.%d", ip_packet->u8_rx_adr[0],ip_packet->u8_rx_adr[1], ip_packet->u8_rx_adr[2],ip_packet->u8_rx_adr[3]);
-
if (gf_sk_is_multicast_address(name) ) {
e = gf_sk_setup_multicast(Sock_Struct->sock, name, ip_packet->u32_rx_udp_port, 1/*TTL - FIXME this should be in a cfg file*/, 0, NULL/*FIXME this should be in a cfg file*/);
} else {
fprintf(stderr, "Server Bind Error: %s\n", gf_error_to_string(e));
Sock_Struct->bind_failure = 1;
}
-
- ip_packet->sock = Sock_Struct->sock;
gf_list_add(ts->ip_platform->socket_struct, Sock_Struct);
}
// Envoi des données
// ********************************************************
- e = gf_sk_send(ip_packet->sock, ip_packet->data, ip_packet->u32_udp_data_size - 8);
+ e = gf_sk_send(Sock_Struct->sock, ip_packet->data, ip_packet->u32_udp_data_size - 8);
if (e != GF_OK){
fprintf(stdout, "Error sending to \n");
}
- gf_sleep(10);
+ if (yield) gf_sleep(10);
}
for ( i = offset ; i <mff->capacity_total; i ++ )
mff -> p_adt [i] = 0xff ;
}
-
+#ifdef UNUSED_FUNC
static void print_bytes2(u8 * data, u32 length ) /*print_bytes2 */
{
u32 i = 0;
}
}
}
+#endif /* UNUSED_FUNC */
/*add a ip datagram into mpe fec frame, and indicate error positions*/
void setIpDatagram(MPE_FEC_FRAME * mff, u32 offset, u8* dgram, u32 length )
GF_Err e = GF_OK;
const char *opt = NULL;
const char *dest_ip;
- GF_Config *configFile = NULL;
+ /*GF_Config *configFile = NULL; */
u32 i, max_ptime, au_sn_len;
u8 payt;
GF_ISOFile *file;
#ifdef GPAC_HAS_JPEG
-void _nonfatal_error(j_common_ptr cinfo) { }
void _nonfatal_error2(j_common_ptr cinfo, int lev) {}
/*JPG context while decoding*/
struct jpeg_decompress_struct cinfo;
} JPGCtx;
+void _output_message (j_common_ptr cinfo){
+ char buffer[JMSG_LENGTH_MAX];
+ /* Create the message */
+ (*cinfo->err->format_message) (cinfo, buffer);
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MEDIA, ("[JPEG OUTPUT MESSAGE]: %s\n", buffer));
+}
+
void _fatal_error(j_common_ptr cinfo)
{
JPGErr *err = (JPGErr *) cinfo->err;
+ _output_message(cinfo);
longjmp(err->jmpbuf, 1);
}
jpx.cinfo.err = jpeg_std_error(&(jper.pub));
jper.pub.error_exit = _fatal_error;
- jper.pub.output_message = _nonfatal_error;
+ jper.pub.output_message = _output_message;
jper.pub.emit_message = _nonfatal_error2;
if (setjmp(jper.jmpbuf)) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MEDIA, ("[gf_img_jpeg_dec] : Failed to call cannot setjmp(jper.jmpbuf)\n"));
jpeg_destroy_decompress(&jpx.cinfo);
return GF_IO_ERR;
}
jpx.src.resync_to_restart = jpeg_resync_to_restart;
jpx.src.term_source = stub;
jpx.skip = 0;
- jpx.src.next_input_byte = jpg;
- jpx.src.bytes_in_buffer = jpg_size;
+ jpx.src.next_input_byte = jpg;
+ jpx.src.bytes_in_buffer = jpg_size;
jpx.cinfo.src = (void *) &jpx.src;
/*read header*/
if (jpx.cinfo.rec_outbuf_height>JPEG_MAX_SCAN_BLOCK_HEIGHT) {
if (scan_line) gf_free(scan_line);
jpeg_destroy_decompress(&jpx.cinfo);
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MEDIA, ("[gf_img_jpeg_dec] : jpx.cinfo.rec_outbuf_height>JPEG_MAX_SCAN_BLOCK_HEIGHT\n"));
return GF_IO_ERR;
}
static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
- GFpng *ctx = (GFpng*)png_ptr->io_ptr;
+ GFpng *ctx = (GFpng*)png_get_io_ptr(png_ptr);
if (ctx->pos + length > ctx->size) {
png_error(png_ptr, "Read Error");
}
static void user_error_fn(png_structp png_ptr,png_const_charp error_msg)
{
- longjmp(png_ptr->jmpbuf, 1);
+ longjmp(png_jmpbuf(png_ptr), 1);
}
GF_Err gf_img_png_file_dec(char *png_filename, u32 *width, u32 *height, u32 *pixel_format, char **dst, u32 *dst_size)
{
- u32 fsize;
+ u32 fsize, readen;
FILE *f;
char *data;
GF_Err e;
- f = fopen(png_filename, "rb");
+ f = gf_f64_open(png_filename, "rb");
if (!f) return GF_URL_ERROR;
- fseek(f, 0, SEEK_END);
- fsize = (u32)ftell(f);
- fseek(f, 0, SEEK_SET);
+ gf_f64_seek(f, 0, SEEK_END);
+ fsize = (u32)gf_f64_tell(f);
+ gf_f64_seek(f, 0, SEEK_SET);
data = gf_malloc(fsize);
- fread(data, fsize, 1, f);
-
+ readen = fread(data, sizeof(char), fsize, f);
+ if (readen != fsize){
+ fclose( f );
+ return GF_IO_ERR;
+ }
*dst_size = 0;
e = gf_img_png_dec(data, fsize, width, height, pixel_format, NULL, dst_size);
if (*dst_size) {
*dst = gf_malloc(*dst_size);
+ fclose( f );
return gf_img_png_dec(data, fsize, width, height, pixel_format, *dst, dst_size);
} else {
+ fclose( f );
return e;
}
}
png_struct *png_ptr;
png_info *info_ptr;
png_byte **rows;
- u32 i, stride, bpp;
-
+ u32 i, stride, out_size;
+ png_bytep trans_alpha;
+ int num_trans;
+ png_color_16p trans_color;
+
if ((png_size<8) || png_sig_cmp(png, 0, 8) ) return GF_NON_COMPLIANT_BITSTREAM;
udta.buffer = png;
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
return GF_IO_ERR;
}
- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_info_struct(png_ptr,(png_infopp) & info_ptr);
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
return GF_IO_ERR;
png_read_info(png_ptr, info_ptr);
/*unpaletize*/
- if (info_ptr->color_type==PNG_COLOR_TYPE_PALETTE) {
+ if (png_get_color_type(png_ptr, info_ptr)==PNG_COLOR_TYPE_PALETTE) {
png_set_expand(png_ptr);
png_read_update_info(png_ptr, info_ptr);
}
- if (info_ptr->num_trans) {
+ num_trans = 0;
+ png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
+ if (num_trans) {
png_set_tRNS_to_alpha(png_ptr);
png_read_update_info(png_ptr, info_ptr);
}
-
- bpp = info_ptr->pixel_depth / 8;
- *width = info_ptr->width;
- *height = info_ptr->height;
-
- switch (info_ptr->pixel_depth) {
- case 8:
- *pixel_format = GF_PIXEL_GREYSCALE;
- break;
- case 16:
+ *width = png_get_image_width(png_ptr, info_ptr);
+ *height = png_get_image_height(png_ptr, info_ptr);
+
+ switch (png_get_color_type(png_ptr, info_ptr)) {
+ case PNG_COLOR_TYPE_GRAY:
+ *pixel_format = GF_PIXEL_GREYSCALE;
+ break;
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
*pixel_format = GF_PIXEL_ALPHAGREY;
break;
- case 24:
+ case PNG_COLOR_TYPE_RGB:
*pixel_format = GF_PIXEL_RGB_24;
break;
- case 32:
+ case PNG_COLOR_TYPE_RGB_ALPHA:
*pixel_format = GF_PIXEL_RGBA;
break;
default:
}
+ out_size = png_get_rowbytes(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr);
/*new cfg, reset*/
- if (*dst_size != info_ptr->width * info_ptr->height * bpp) {
- *dst_size = info_ptr->width * info_ptr->height * bpp;
+ if (*dst_size != out_size) {
+ *dst_size = out_size;
png_destroy_info_struct(png_ptr,(png_infopp) & info_ptr);
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
return GF_BUFFER_TOO_SMALL;
}
- *dst_size = info_ptr->width * info_ptr->height * bpp;
+ *dst_size = out_size;
/*read*/
stride = png_get_rowbytes(png_ptr, info_ptr);
- rows = (png_bytepp) gf_malloc(sizeof(png_bytep) * info_ptr->height);
- for (i=0; i<info_ptr->height; i++) {
+ rows = (png_bytepp) gf_malloc(sizeof(png_bytep) * png_get_image_height(png_ptr, info_ptr));
+ for (i=0; i<png_get_image_height(png_ptr, info_ptr); i++) {
rows[i] = dst + i*stride;
}
png_read_image(png_ptr, rows);
void my_png_write(png_structp png, png_bytep data, png_size_t size)
{
- GFpng *p = (GFpng *)png->io_ptr;
+ GFpng *p = (GFpng *)png_get_io_ptr(png);
memcpy(p->buffer+p->pos, data, sizeof(char)*size);
p->pos += size;
}
/* pack pixels into bytes */
png_set_packing(png_ptr);
- if (pixel_format==GF_PIXEL_ARGB)
- png_set_swap_alpha(png_ptr);
-
+ if (pixel_format==GF_PIXEL_ARGB) {
+// png_set_swap_alpha(png_ptr);
+ png_set_bgr(png_ptr);
+ }
switch (pixel_format) {
case GF_PIXEL_RGB_32:
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
tkc->sel_enc_type = GF_ISMACRYP_SELENC_RAND_RANGE;
tkc->sel_enc_range = atoi(&att->value[4]);
}
- else if (sscanf(att->value, "%d", &tkc->sel_enc_range)==1) {
+ else if (sscanf(att->value, "%u", &tkc->sel_enc_range)==1) {
if (tkc->sel_enc_range==1) tkc->sel_enc_range = 0;
else tkc->sel_enc_type = GF_ISMACRYP_SELENC_RANGE;
}
}
else if (!stricmp(att->name, "Preview")) {
tkc->sel_enc_type = GF_ISMACRYP_SELENC_PREVIEW;
- sscanf(att->value, "%d", &tkc->sel_enc_range);
+ sscanf(att->value, "%u", &tkc->sel_enc_range);
}
else if (!stricmp(att->name, "ipmpType")) {
if (!stricmp(att->value, "None")) tkc->ipmp_type = 0;
u32 FragmentLength;
u32 OriginalTrack;
u32 TimeScale, MediaType, DefaultDuration;
+ u64 last_sample_cts;
} TrackFragmenter;
GF_EXPORT
-GF_Err gf_media_fragment_file(GF_ISOFile *input, char *output_file, Double max_duration_sec, u32 dash_mode, Double dash_duration_sec, char *seg_rad_name, u32 fragments_per_sidx, Bool daisy_chain_sidx)
+GF_Err gf_media_fragment_file(GF_ISOFile *input, char *output_file, Double max_duration_sec, u32 dash_mode, Double dash_duration_sec, char *seg_rad_name, char *seg_ext, u32 fragments_per_sidx, Bool daisy_chain_sidx, Bool use_url_template)
{
u8 NbBits;
u32 i, TrackNum, descIndex, j, count, nb_sync, ref_track_id;
GF_ISOFile *output;
GF_ISOSample *sample, *next;
GF_List *fragmenters;
- u32 MaxFragmentDuration;
- u32 MaxSegmentDuration;
- u32 SegmentDuration, maxFragDurationOverSegment;
+ u32 MaxFragmentDuration, MaxSegmentDuration, SegmentDuration, maxFragDurationOverSegment;
+ Double average_duration, file_duration;
+ u32 nb_segments, width, height, sample_rate, nb_channels;
+ char langCode[5];
Bool switch_segment = 0;
Bool split_seg_at_rap = (dash_mode==2) ? 1 : 0;
Bool split_at_rap = 0;
+ Bool has_rap = 0;
Bool next_sample_rap = 0;
+ Bool flush_all_samples = 0;
+ u64 last_ref_cts = 0;
+ u64 start_range, end_range, file_size, init_seg_size;
+ u32 tfref_timescale = 0;
+ u32 bandwidth = 0;
TrackFragmenter *tf, *tfref;
FILE *mpd = NULL;
+ FILE *mpd_segs = NULL;
char *SegName = NULL;
-
+ SegmentDuration = 0;
+ nb_samp = 0;
+ fragmenters = NULL;
+ if (!seg_ext) seg_ext = "m4s";
+
//create output file
if (dash_mode) {
u32 len = strlen(output_file);
}
strcpy(SegName, output_file);
strcat(SegName, ".mpd");
- mpd = fopen(SegName, "wt");
+ mpd = gf_f64_open(SegName, "wt");
+ mpd_segs = gf_temp_file_new();
} else {
output = gf_isom_open(output_file, GF_ISOM_OPEN_WRITE, NULL);
if (!output) return gf_isom_last_error(NULL);
MaxFragmentDuration = (u32) (max_duration_sec * 1000);
MaxSegmentDuration = (u32) (dash_duration_sec * 1000);
tfref = NULL;
+ file_duration = 0;
+ width = height = sample_rate = nb_channels = 0;
+ langCode[0]=0;
+ langCode[4]=0;
//duplicates all tracks
for (i=0; i<gf_isom_get_track_count(input); i++) {
- if (gf_isom_get_media_type(input, i+1) == GF_ISOM_MEDIA_HINT) continue;
+ u32 mtype = gf_isom_get_media_type(input, i+1);
+ if (mtype == GF_ISOM_MEDIA_HINT) continue;
e = gf_isom_clone_track(input, i+1, output, 0, &TrackNum);
if (e) goto err_exit;
}
//otherwise setup fragmented
else {
+ u32 _w, _h, _sr, _nb_ch;
+
gf_isom_get_fragment_defaults(input, i+1,
&defaultDuration, &defaultSize, &defaultDescriptionIndex, &defaultRandomAccess, &defaultPadding, &defaultDegradationPriority);
//otherwise setup fragmentation
if (gf_isom_get_sync_point_count(input, i+1)>nb_sync) {
tfref = tf;
+ tfref_timescale = tf->TimeScale;
nb_sync = gf_isom_get_sync_point_count(input, i+1);
}
+ switch (mtype) {
+ case GF_ISOM_MEDIA_TEXT:
+ gf_isom_get_media_language(input, i+1, langCode);
+ case GF_ISOM_MEDIA_VISUAL:
+ case GF_ISOM_MEDIA_SCENE:
+ case GF_ISOM_MEDIA_DIMS:
+ gf_isom_get_track_layout_info(input, i+1, &_w, &_h, NULL, NULL, NULL);
+ if (_w>width) width = _w;
+ if (_h>height) height = _h;
+ break;
+ case GF_ISOM_MEDIA_AUDIO:
+ gf_isom_get_audio_info(input, i+1, 1, &_sr, &_nb_ch, NULL);
+ if (_sr>sample_rate) sample_rate=_sr;
+ if (_nb_ch>nb_channels) nb_channels = _nb_ch;
+ gf_isom_get_media_language(input, i+1, langCode);
+ break;
+ }
+
+ if (file_duration < ((Double) gf_isom_get_media_duration(input, i+1)) / tf->TimeScale ) {
+ file_duration = ((Double) gf_isom_get_media_duration(input, i+1)) / tf->TimeScale;
+ }
gf_list_add(fragmenters, tf);
nb_samp += count;
}
e = gf_isom_finalize_for_fragment(output, dash_mode ? 1 : 0);
if (e) goto err_exit;
- if (dash_mode) {
- fprintf(mpd, "<MPD type=\"OnDemand\" xmlns=\"urn:3GPP:ns:PSS:AdaptiveHTTPStreamingMPD:2009\">\n");
- fprintf(mpd, " <ProgramInformation moreInformationURL=\"http://gpac.sourceforge.net\">\n");
- fprintf(mpd, " <Title>Media Presentation Description for file %s generated with GPAC </Title>\n", gf_isom_get_filename(input));
- fprintf(mpd, " </ProgramInformation>\n");
- fprintf(mpd, " <Period start=\"PT0S\">\n");
- fprintf(mpd, " <Representation mimeType=\"video/mp4\">\n");
- fprintf(mpd, " <SegmentInfo duration=\"PT%.3fS\">\n", dash_duration_sec);
- fprintf(mpd, " <InitialisationSegmentURL sourceURL=\"%s.mp4\"/>\n", output_file);
- }
+ start_range = 0;
+ end_range = gf_isom_get_file_size(output);
+ file_size = end_range;
+ init_seg_size = end_range;
+
+ average_duration = 0;
+ nb_segments = 0;
nb_done = 0;
cur_seg=1;
maxFragDurationOverSegment=0;
if (dash_mode) switch_segment=1;
+ if (!seg_rad_name) use_url_template = 0;
+
+
+
while ( (count = gf_list_count(fragmenters)) ) {
if (switch_segment) {
SegmentDuration = 0;
switch_segment = 0;
+ start_range = gf_isom_get_file_size(output);
if (seg_rad_name) {
- sprintf(SegName, "%s_seg%d.mp4", seg_rad_name, cur_seg);
+ sprintf(SegName, "%s_seg%d.%s", seg_rad_name, cur_seg, seg_ext);
e = gf_isom_start_segment(output, SegName);
- if (dash_mode) fprintf(mpd, " <Url sourceURL=\"%s\"/>\n", SegName);
+ if (!use_url_template) {
+ fprintf(mpd_segs, " <Url sourceURL=\"%s\"/>\n", SegName);
+ }
} else {
e = gf_isom_start_segment(output, NULL);
}
if (tfref && split_seg_at_rap ) {
if (i==0) {
tf = tfref;
+ has_rap=0;
} else {
tf = (TrackFragmenter *)gf_list_get(fragmenters, i-1);
if (tf == tfref) {
}
} else {
tf = (TrackFragmenter *)gf_list_get(fragmenters, i);
- }
+ if (tf == tfref)
+ has_rap=0;
+ }
//ok write samples
while (1) {
e = gf_isom_fragment_add_sample(output, tf->TrackID, sample, descIndex,
defaultDuration, NbBits, 0);
- if (e) goto err_exit;
+ if (e)
+ goto err_exit;
+
+ /*copy subsample information*/
+ e = gf_isom_fragment_copy_subsample(output, tf->TrackID, input, tf->OriginalTrack, tf->SampleNum + 1);
+ if (e)
+ goto err_exit;
gf_set_progress("ISO File Fragmenting", nb_done, nb_samp);
nb_done++;
+ tf->last_sample_cts = sample->DTS + sample->CTS_Offset;
+
gf_isom_sample_del(&sample);
sample = next;
tf->FragmentLength += defaultDuration;
tf->SampleNum += 1;
- if (split_seg_at_rap && (tf==tfref) && next && next->IsRAP) {
- next_sample_rap = 1;
- if ((tf->FragmentLength+2*defaultDuration)*1000 >= MaxFragmentDuration*tf->TimeScale)
- split_at_rap = 1;
+ if (next && next->IsRAP) {
+ if (tf==tfref) {
+ if (split_seg_at_rap) {
+ u32 frag_dur = tf->FragmentLength*1000/tf->TimeScale;
+ next_sample_rap = 1;
+ /*if media segment about to be produced is longer than max segment length, force split*/
+ if (SegmentDuration + frag_dur > MaxSegmentDuration) {
+ split_at_rap = 1;
+ }
+
+ if (split_at_rap) {
+ stop_frag = 1;
+ /*override fragment duration for the rest of this fragment*/
+ MaxFragmentDuration = frag_dur;
+ }
+ } else if (!has_rap) {
+ if (tf->FragmentLength == defaultDuration) has_rap = 2;
+ else has_rap = 1;
+ }
+ }
+ } else {
+ next_sample_rap = 0;
+ }
- if (split_at_rap) {
+ if (tf->SampleNum==tf->SampleCount) {
+ stop_frag = 1;
+ } else if (tf==tfref) {
+ /*fragmenting on "clock" track: no drift control*/
+ if (tf->FragmentLength*1000 >= MaxFragmentDuration*tf->TimeScale)
+ stop_frag = 1;
+ }
+ /*do not abort fragment if ref track is done, put everything in the last fragment*/
+ else if (!flush_all_samples) {
+ /*fragmenting on "non-clock" track: drift control*/
+ if (tf->last_sample_cts * tfref_timescale >= last_ref_cts * tf->TimeScale)
stop_frag = 1;
- /*override fragment duration for the rest of this fragment*/
- MaxFragmentDuration = tf->FragmentLength*1000/tf->TimeScale;
- }
}
- else next_sample_rap = 0;
- //end of track fragment or track
- if (stop_frag ||
- (tf->SampleNum==tf->SampleCount) ||
- /* TODO: should probably test the time position (not only duration) to avoid drift */
- (tf->FragmentLength*1000 >= MaxFragmentDuration*tf->TimeScale)) {
+ if (stop_frag) {
gf_isom_sample_del(&next);
sample = next = NULL;
if (maxFragDurationOverSegment<=tf->FragmentLength*1000/tf->TimeScale) {
maxFragDurationOverSegment = tf->FragmentLength*1000/tf->TimeScale;
}
tf->FragmentLength = 0;
+
+ if (tf==tfref) last_ref_cts = tf->last_sample_cts;
+
break;
}
}
- if (dash_mode) {
- SegmentDuration += maxFragDurationOverSegment;
-
- if ((SegmentDuration >= MaxSegmentDuration) && (!split_seg_at_rap || next_sample_rap)) {
- switch_segment=1;
- maxFragDurationOverSegment=0;
- SegmentDuration=0;
- split_at_rap = 0;
- /*restore fragment duration*/
- MaxFragmentDuration = (u32) (max_duration_sec * 1000);
-
- gf_isom_close_segment(output, fragments_per_sidx, ref_track_id, NULL, 0, daisy_chain_sidx);
- }
- /*next fragment will exceed segment length, abort fragment at next rap*/
- if (split_seg_at_rap && (SegmentDuration + MaxFragmentDuration >= MaxSegmentDuration)) {
- split_at_rap = 1;
- }
- }
if (tf->SampleNum==tf->SampleCount) {
gf_free(tf);
gf_list_rem(fragmenters, i);
i--;
count --;
+ if (tf == tfref) {
+ tfref = NULL;
+ flush_all_samples = 1;
+ }
+ }
+ }
+
+ if (dash_mode) {
+
+ SegmentDuration += maxFragDurationOverSegment;
+ maxFragDurationOverSegment=0;
+
+ if ((SegmentDuration >= MaxSegmentDuration) && (!split_seg_at_rap || next_sample_rap)) {
+ average_duration += SegmentDuration;
+ nb_segments++;
+
+#if 0
+ if (split_seg_at_rap) has_rap = 0;
+ fprintf(stdout, "Seg#%d: Duration %d%s - Track times (ms): ", nb_segments, SegmentDuration, (has_rap == 2) ? " - Starts with RAP" : ((has_rap == 1) ? " - Contains RAP" : "") );
+ for (i=0; i<count; i++) {
+ tf = (TrackFragmenter *)gf_list_get(fragmenters, i);
+ fprintf(stdout, "%d ", (u32) ( (tf->last_sample_cts*1000.0)/tf->TimeScale) );
+ }
+ fprintf(stdout, "\n ");
+#endif
+ switch_segment=1;
+ SegmentDuration=0;
+ split_at_rap = 0;
+ has_rap = 0;
+ /*restore fragment duration*/
+ MaxFragmentDuration = (u32) (max_duration_sec * 1000);
+
+ gf_isom_close_segment(output, fragments_per_sidx, ref_track_id, NULL, 0, daisy_chain_sidx);
+
+
+ if (!seg_rad_name) {
+ file_size = end_range = gf_isom_get_file_size(output);
+ fprintf(mpd_segs, " <Url range=\""LLD"-"LLD"\"/>\n", start_range, end_range);
+ } else {
+ file_size += gf_isom_get_file_size(output);
+ }
+
+ }
+ /*next fragment will exceed segment length, abort fragment at next rap*/
+ if (split_seg_at_rap && (SegmentDuration + MaxFragmentDuration >= MaxSegmentDuration)) {
+ split_at_rap = 1;
}
}
}
+
if (dash_mode) {
- gf_isom_close_segment(output, fragments_per_sidx, ref_track_id, NULL, 0, daisy_chain_sidx);
- fprintf(mpd, " </SegmentInfo>\n");
+ char buffer[1000];
+ u32 size;
+ u32 h, m;
+ Double s;
+
+ /*flush last segment*/
+ if (!switch_segment) {
+ gf_isom_close_segment(output, fragments_per_sidx, ref_track_id, NULL, 0, daisy_chain_sidx);
+ nb_segments++;
+ if (!seg_rad_name) {
+ file_size = end_range = gf_isom_get_file_size(output);
+ fprintf(mpd_segs, " <Url range=\""LLD"-"LLD"\"/>\n", start_range, end_range);
+ } else {
+ if (use_url_template) {
+ sprintf(SegName, "%s_seg$Index$.%s", seg_rad_name, seg_ext);
+ fprintf(mpd_segs, " <UrlTemplate sourceURL=\"%s\" startIndex=\"1\" endIndex=\"%d\" />\n", SegName, nb_segments);
+ }
+ file_size += gf_isom_get_file_size(output);
+ }
+ }
+ h = (u32) (file_duration/3600);
+ m = (u32) (file_duration-h*60)/60;
+ s = file_duration - h*3600 - m*60;
+ bandwidth = (u32) (file_size * 8 / file_duration);
+
+ fprintf(mpd, "<MPD type=\"OnDemand\" xmlns=\"urn:3GPP:ns:PSS:AdaptiveHTTPStreamingMPD:2009\">\n");
+ fprintf(mpd, " <ProgramInformation moreInformationURL=\"http://gpac.sourceforge.net\">\n");
+ fprintf(mpd, " <Title>Media Presentation Description for file %s generated with GPAC </Title>\n", gf_isom_get_filename(input));
+ fprintf(mpd, " </ProgramInformation>\n");
+ fprintf(mpd, " <Period start=\"PT0S\" duration=\"PT%dH%dM%.2fS\">\n", h, m, s);
+ fprintf(mpd, " <Representation mimeType=\"video/mp4\"");
+ if (width && height) fprintf(mpd, " width=\"%d\" height=\"%d\"", width, height);
+ if (sample_rate && nb_channels) fprintf(mpd, " sampleRate=\"%d\" numChannels=\"%d\"", sample_rate, nb_channels);
+ if (langCode[0]) fprintf(mpd, " lang=\"%s\"", langCode);
+ fprintf(mpd, " startWithRAP=\"%s\"", split_seg_at_rap ? "true" : "false");
+ fprintf(mpd, " bandwidth=\"%d\"", bandwidth);
+
+ fprintf(mpd, ">\n");
+
+ h = (u32) (dash_duration_sec/3600);
+ m = (u32) (dash_duration_sec-h*60)/60;
+ s = dash_duration_sec - h*3600 - m*60;
+ if (m) {
+ fprintf(mpd, " <SegmentInfo duration=\"PT%dM%.2fS\"", m, s);
+ } else {
+ fprintf(mpd, " <SegmentInfo duration=\"PT%.2fS\"", s);
+ }
+ fprintf(mpd, ">\n");
+
+ fprintf(mpd, " <InitialisationSegmentURL sourceURL=\"%s.mp4\"", output_file);
+ if (!seg_rad_name) {
+ fprintf(mpd, " range=\"0-"LLD"\"", init_seg_size);
+ }
+ fprintf(mpd, "/>\n");
+
+ gf_f64_seek(mpd_segs, 0, SEEK_END);
+ size = (u32) gf_f64_tell(mpd_segs);
+ gf_f64_seek(mpd_segs, 0, SEEK_SET);
+ while (!feof(mpd_segs)) {
+ u32 r = fread(buffer, 1, 100, mpd_segs);
+ fwrite(buffer, 1, r, mpd);
+ }
+
+ fprintf(mpd, " </SegmentInfo>\n");
fprintf(mpd, " </Representation>\n");
fprintf(mpd, " </Period>\n");
fprintf(mpd, "</MPD>");
}
err_exit:
- while (gf_list_count(fragmenters)) {
- tf = (TrackFragmenter *)gf_list_get(fragmenters, 0);
- gf_free(tf);
- gf_list_rem(fragmenters, 0);
+ if (fragmenters){
+ while (gf_list_count(fragmenters)) {
+ tf = (TrackFragmenter *)gf_list_get(fragmenters, 0);
+ gf_free(tf);
+ gf_list_rem(fragmenters, 0);
+ }
+ gf_list_del(fragmenters);
}
- gf_list_del(fragmenters);
if (e) gf_isom_delete(output);
else gf_isom_close(output);
gf_set_progress("ISO File Fragmenting", nb_samp, nb_samp);
if (SegName) gf_free(SegName);
- if (mpd)fclose(mpd);
+ if (mpd) fclose(mpd);
+ if (mpd_segs) fclose(mpd_segs);
return e;
}
import_fps = ts;
import_fps /= inc;
gf_isom_sample_del(&samp);
- GF_LOG(GF_LOG_INFO, GF_LOG_AUTHOR, ("[Chapter import] Guessed video frame rate %g (%d:%d)\n", import_fps, ts, inc));
+ GF_LOG(GF_LOG_INFO, GF_LOG_AUTHOR, ("[Chapter import] Guessed video frame rate %g (%u:%u)\n", import_fps, ts, inc));
break;
}
/*ZoomPlayer chapters*/
if (!strnicmp(sL, "AddChapter(", 11)) {
u32 nb_fr;
- sscanf(sL, "AddChapter(%d,%s)", &nb_fr, szTitle);
+ sscanf(sL, "AddChapter(%u,%s)", &nb_fr, szTitle);
ts = nb_fr;
ts *= 1000;
if (import_fps) ts = (u64) (((s64) ts ) / import_fps);
sL = strchr(sL, ','); strcpy(szTitle, sL+1); sL = strrchr(szTitle, ')'); if (sL) sL[0] = 0;
} else if (!strnicmp(sL, "AddChapterBySecond(", 19)) {
u32 nb_s;
- sscanf(sL, "AddChapterBySecond(%d,%s)", &nb_s, szTitle);
+ sscanf(sL, "AddChapterBySecond(%u,%s)", &nb_s, szTitle);
ts = nb_s;
ts *= 1000;
sL = strchr(sL, ','); strcpy(szTitle, sL+1); sL = strrchr(szTitle, ')'); if (sL) sL[0] = 0;
} else if (!strnicmp(sL, "AddChapterByTime(", 17)) {
u32 h, m, s;
- sscanf(sL, "AddChapterByTime(%d,%d,%d,%s)", &h, &m, &s, szTitle);
+ sscanf(sL, "AddChapterByTime(%u,%u,%u,%s)", &h, &m, &s, szTitle);
ts = 3600*h + 60*m + s;
ts *= 1000;
sL = strchr(sL, ',');
else if ((strlen(sL)>=8) && (sL[2]==':') && (sL[5]==':')) {
title = NULL;
if (strlen(sL)==8) {
- sscanf(sL, "%02d:%02d:%02d", &h, &m, &s);
+ sscanf(sL, "%02u:%02u:%02u", &h, &m, &s);
ts = (h*3600 + m*60+s)*1000;
}
else {
ts = 0;
h = m = s = ms = 0;
- if (sscanf(szTS, "%d:%d:%d;%d/%d", &h, &m, &s, &fr, &fps)==5) {
+ if (sscanf(szTS, "%u:%u:%u;%u/%u", &h, &m, &s, &fr, &fps)==5) {
ts = (h*3600 + m*60+s)*1000 + 1000*fr/fps;
- } else if (sscanf(szTS, "%d:%d:%d;%d", &h, &m, &s, &fr)==4) {
+ } else if (sscanf(szTS, "%u:%u:%u;%u", &h, &m, &s, &fr)==4) {
ts = (h*3600 + m*60+s);
if (import_fps)
ts = (s64) (((import_fps*((s64)ts) + fr) * 1000 ) / import_fps);
else
ts = ((ts*25 + fr) * 1000 ) / 25;
- } else if (sscanf(szTS, "%d:%d:%d.%d", &h, &m, &s, &ms) == 4) {
+ } else if (sscanf(szTS, "%u:%u:%u.%u", &h, &m, &s, &ms) == 4) {
ts = (h*3600 + m*60+s)*1000+ms;
- } else if (sscanf(szTS, "%d:%d:%d.%d", &h, &m, &s, &ms) == 4) {
+ } else if (sscanf(szTS, "%u:%u:%u.%u", &h, &m, &s, &ms) == 4) {
ts = (h*3600 + m*60+s)*1000+ms;
- } else if (sscanf(szTS, "%d:%d:%d:%d", &h, &m, &s, &ms) == 4) {
+ } else if (sscanf(szTS, "%u:%u:%u:%u", &h, &m, &s, &ms) == 4) {
ts = (h*3600 + m*60+s)*1000+ms;
- } else if (sscanf(szTS, "%d:%d:%d", &h, &m, &s) == 3) {
+ } else if (sscanf(szTS, "%u:%u:%u", &h, &m, &s) == 3) {
ts = (h*3600 + m*60+s) * 1000;
}
}
str = strchr(sL, '=');
str++;
if (strstr(szTemp, "name")) {
- sscanf(szTemp, "chapter%dname", &idx);
+ sscanf(szTemp, "chapter%uname", &idx);
strcpy(szTitle, str);
if (idx!=cur_chap) {
cur_chap=idx;
}
state++;
} else {
- sscanf(szTemp, "chapter%d", &idx);
+ sscanf(szTemp, "chapter%u", &idx);
if (idx!=cur_chap) {
cur_chap=idx;
state = 0;
ts = 0;
h = m = s = ms = 0;
- if (sscanf(str, "%d:%d:%d.%d", &h, &m, &s, &ms) == 4) {
+ if (sscanf(str, "%u:%u:%u.%u", &h, &m, &s, &ms) == 4) {
ts = (h*3600 + m*60+s)*1000+ms;
- } else if (sscanf(str, "%d:%d:%d:%d", &h, &m, &s, &ms) == 4) {
+ } else if (sscanf(str, "%u:%u:%u:%u", &h, &m, &s, &ms) == 4) {
ts = (h*3600 + m*60+s)*1000+ms;
- } else if (sscanf(str, "%d:%d:%d", &h, &m, &s) == 3) {
+ } else if (sscanf(str, "%u:%u:%u", &h, &m, &s) == 3) {
ts = (h*3600 + m*60+s) * 1000;
}
}
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS Muxer] PID %d: Generating %d sections for MPEG-4 SL packet - version number %d - extension ID %d\n", stream->pid, nb_sections, table->version_number, table_id_extension));
- {
- /*discard first packet*/
- GF_M2TS_Packet *pck;
- gf_mx_p(stream->mx);
- assert(stream->pck_first);
- pck = stream->pck_first;
- stream->pck_first = pck->next;
- gf_mx_v(stream->mx);
- gf_free(pck->data);
- gf_free(pck);
- }
-
if (stream->ifce->repeat_rate) {
stream->refresh_rate_ms = stream->ifce->repeat_rate;
gf_m2ts_mux_table_update_bitrate(stream->program->mux, stream);
/*rewrite SL config in IOD streams*/
i=0;
- while (esd = gf_list_enum(((GF_ObjectDescriptor*)stream->program->iod)->ESDescriptors, &i)) {
+ while (NULL != (esd = gf_list_enum(((GF_ObjectDescriptor*)stream->program->iod)->ESDescriptors, &i))) {
GF_M2TS_Mux_Stream *es_stream = stream->program->streams;
while (es_stream) {
if (es_stream->ifce && (es_stream->ifce->stream_id==esd->ESID)) {
{
u32 hdr_len;
/*not the AU start*/
- if (stream->pck_offset || !(stream->pck.flags & GF_ESI_DATA_AU_START) ) return 0;
+ if (stream->pck_offset || !(stream->curr_pck.flags & GF_ESI_DATA_AU_START) ) return 0;
hdr_len = 9;
- if (stream->pck.flags & GF_ESI_DATA_HAS_CTS) hdr_len += 5;
- if (stream->pck.flags & GF_ESI_DATA_HAS_DTS) hdr_len += 5;
+ if (stream->curr_pck.flags & GF_ESI_DATA_HAS_CTS) hdr_len += 5;
+ if (stream->curr_pck.flags & GF_ESI_DATA_HAS_DTS) hdr_len += 5;
return hdr_len;
}
if (stream->ifce->repeat_rate && stream->tables)
ret = 1;
}
- else if (stream->pck_offset < stream->pck.data_len) {
+ else if (stream->curr_pck.data_len && stream->pck_offset < stream->curr_pck.data_len) {
/*PES packet not completely sent yet*/
return 1;
}
/*PULL mode*/
if (stream->ifce->caps & GF_ESI_AU_PULL_CAP) {
- if (stream->pck.data_len) {
+ if (stream->curr_pck.data_len) {
/*discard packet data if we use SL over PES*/
- if (stream->mpeg2_stream_type==GF_M2TS_SYSTEMS_MPEG4_PES) gf_free(stream->pck.data);
+ if (stream->discard_data) gf_free(stream->curr_pck.data);
/*release data*/
stream->ifce->input_ctrl(stream->ifce, GF_ESI_INPUT_DATA_RELEASE, NULL);
}
stream->pck_offset = 0;
- stream->pck.data_len = 0;
+ stream->curr_pck.data_len = 0;
+ stream->discard_data = 0;
/*EOS*/
if (stream->ifce->caps & GF_ESI_STREAM_IS_OVER) return 0;
- stream->ifce->input_ctrl(stream->ifce, GF_ESI_INPUT_DATA_PULL, &stream->pck);
+ assert( stream->ifce->input_ctrl);
+ stream->ifce->input_ctrl(stream->ifce, GF_ESI_INPUT_DATA_PULL, &stream->curr_pck);
} else {
- GF_M2TS_Packet *pck;
+ GF_M2TS_Packet *curr_pck;
+
/*flush input pipe*/
- stream->ifce->input_ctrl(stream->ifce, GF_ESI_INPUT_DATA_FLUSH, NULL);
+ if (stream->ifce->input_ctrl) stream->ifce->input_ctrl(stream->ifce, GF_ESI_INPUT_DATA_FLUSH, NULL);
+
gf_mx_p(stream->mx);
stream->pck_offset = 0;
- stream->pck.data_len = 0;
+ stream->curr_pck.data_len = 0;
- /*fill pck*/
- pck = stream->pck_first;
- if (!pck) {
+ /*fill curr_pck*/
+ curr_pck = stream->pck_first;
+ if (!curr_pck) {
gf_mx_v(stream->mx);
return ret;
}
- stream->pck.cts = pck->cts;
- stream->pck.data = pck->data;
- stream->pck.data_len = pck->data_len;
- stream->pck.dts = pck->dts;
- stream->pck.flags = pck->flags;
+ stream->curr_pck.cts = curr_pck->cts;
+ stream->curr_pck.data = curr_pck->data;
+ stream->curr_pck.data_len = curr_pck->data_len;
+ stream->curr_pck.dts = curr_pck->dts;
+ stream->curr_pck.flags = curr_pck->flags;
+
+ /*discard first packet*/
+ stream->pck_first = curr_pck->next;
+ gf_free(curr_pck);
+ stream->discard_data = 1;
+
gf_mx_v(stream->mx);
}
- if (!(stream->pck.flags & GF_ESI_DATA_HAS_DTS))
- stream->pck.dts = stream->pck.cts;
+ if (!(stream->curr_pck.flags & GF_ESI_DATA_HAS_DTS))
+ stream->curr_pck.dts = stream->curr_pck.cts;
/*Rescale our timestamps and express them in PCR*/
if (stream->ts_scale) {
- stream->pck.cts = (u64) (stream->ts_scale * (s64) stream->pck.cts);
- stream->pck.dts = (u64) (stream->ts_scale * (s64) stream->pck.dts);
+ stream->curr_pck.cts = (u64) (stream->ts_scale * (s64) stream->curr_pck.cts);
+ stream->curr_pck.dts = (u64) (stream->ts_scale * (s64) stream->curr_pck.dts);
}
/*initializing the PCR*/
while (!stream->program->pcr_init_time)
stream->program->pcr_init_time = gf_rand();
- stream->program->pcr_init_time=1;
+ stream->program->pcr_init_time = 1;
stream->program->ts_time_at_pcr_init = muxer->time;
stream->program->num_pck_at_pcr_init = muxer->tot_pck_sent;
if (!stream->initial_ts) {
u32 nb_bits = (u32) (muxer->tot_pck_sent - stream->program->num_pck_at_pcr_init) * 1504;
u32 nb_ticks = 90000*nb_bits / muxer->bit_rate;
- stream->initial_ts = stream->pck.dts;
+ stream->initial_ts = stream->curr_pck.dts;
if (stream->initial_ts > nb_ticks)
stream->initial_ts -= nb_ticks;
else
switch (stream->mpeg2_stream_type) {
case GF_M2TS_SYSTEMS_MPEG4_SECTIONS:
/*update SL config*/
- stream->sl_header.accessUnitStartFlag = (stream->pck.flags & GF_ESI_DATA_AU_START) ? 1 : 0;
- stream->sl_header.accessUnitEndFlag = (stream->pck.flags & GF_ESI_DATA_AU_END) ? 1 : 0;
- stream->sl_header.accessUnitLength += stream->pck.data_len;
- stream->sl_header.randomAccessPointFlag = (stream->pck.flags & GF_ESI_DATA_AU_RAP) ? 1: 0;
- stream->sl_header.compositionTimeStampFlag = (stream->pck.flags & GF_ESI_DATA_HAS_CTS) ? 1 : 0;
- stream->sl_header.compositionTimeStamp = stream->pck.cts;
- stream->sl_header.decodingTimeStampFlag = (stream->pck.flags & GF_ESI_DATA_HAS_DTS) ? 1: 0;
- stream->sl_header.decodingTimeStamp = stream->pck.dts;
-
- gf_m2ts_mux_table_update_mpeg4(stream, stream->table_id, muxer->ts_id, stream->pck.data, stream->pck.data_len, 1, 0, (stream->pck.flags & GF_ESI_DATA_REPEAT) ? 0 : 1, 0);
+ stream->sl_header.accessUnitStartFlag = (stream->curr_pck.flags & GF_ESI_DATA_AU_START) ? 1 : 0;
+ stream->sl_header.accessUnitEndFlag = (stream->curr_pck.flags & GF_ESI_DATA_AU_END) ? 1 : 0;
+#if 0
+ assert(stream->sl_header.accessUnitLength + stream->curr_pck.data_len < 65536); /*stream->sl_header.accessUnitLength type is u16*/
+ stream->sl_header.accessUnitLength += stream->curr_pck.data_len;
+#endif
+ stream->sl_header.randomAccessPointFlag = (stream->curr_pck.flags & GF_ESI_DATA_AU_RAP) ? 1: 0;
+ stream->sl_header.compositionTimeStampFlag = (stream->curr_pck.flags & GF_ESI_DATA_HAS_CTS) ? 1 : 0;
+ stream->sl_header.compositionTimeStamp = stream->curr_pck.cts;
+ stream->sl_header.decodingTimeStampFlag = (stream->curr_pck.flags & GF_ESI_DATA_HAS_DTS) ? 1: 0;
+ stream->sl_header.decodingTimeStamp = stream->curr_pck.dts;
+
+ gf_m2ts_mux_table_update_mpeg4(stream, stream->table_id, muxer->ts_id, stream->curr_pck.data, stream->curr_pck.data_len, 1, 0, (stream->curr_pck.flags & GF_ESI_DATA_REPEAT) ? 0 : 1, 0);
+
+ /*packet data is now copied in sections, discard it if not pull*/
+ if (!(stream->ifce->caps & GF_ESI_AU_PULL_CAP)) {
+ gf_free(stream->curr_pck.data);
+ stream->curr_pck.data = NULL;
+ stream->curr_pck.data_len = 0;
+ }
break;
case GF_M2TS_SYSTEMS_MPEG4_PES:
{
u32 src_data_len;
/*update SL config*/
- stream->sl_header.accessUnitStartFlag = (stream->pck.flags & GF_ESI_DATA_AU_START) ? 1 : 0;
- stream->sl_header.accessUnitEndFlag = (stream->pck.flags & GF_ESI_DATA_AU_END) ? 1 : 0;
- stream->sl_header.accessUnitLength += stream->pck.data_len;
- stream->sl_header.randomAccessPointFlag = (stream->pck.flags & GF_ESI_DATA_AU_RAP) ? 1: 0;
- stream->sl_header.compositionTimeStampFlag = (stream->pck.flags & GF_ESI_DATA_HAS_CTS) ? 1 : 0;
- stream->sl_header.compositionTimeStamp = stream->pck.cts;
- stream->sl_header.decodingTimeStampFlag = (stream->pck.flags & GF_ESI_DATA_HAS_DTS) ? 1: 0;
- stream->sl_header.decodingTimeStamp = stream->pck.dts;
-
- src_data = stream->pck.data;
- src_data_len = stream->pck.data_len;
- stream->pck.data_len = 0;
- stream->pck.data = NULL;
-
- gf_sl_packetize(&stream->sl_config, &stream->sl_header, src_data, src_data_len, &stream->pck.data, &stream->pck.data_len);
+ stream->sl_header.accessUnitStartFlag = (stream->curr_pck.flags & GF_ESI_DATA_AU_START) ? 1 : 0;
+ stream->sl_header.accessUnitEndFlag = (stream->curr_pck.flags & GF_ESI_DATA_AU_END) ? 1 : 0;
+#if 0
+ assert(stream->sl_header.accessUnitLength + stream->curr_pck.data_len < 65536); /*stream->sl_header.accessUnitLength type is u16*/
+ stream->sl_header.accessUnitLength += stream->curr_pck.data_len;
+#endif
+ stream->sl_header.randomAccessPointFlag = (stream->curr_pck.flags & GF_ESI_DATA_AU_RAP) ? 1: 0;
+ stream->sl_header.compositionTimeStampFlag = (stream->curr_pck.flags & GF_ESI_DATA_HAS_CTS) ? 1 : 0;
+ stream->sl_header.compositionTimeStamp = stream->curr_pck.cts;
+ stream->sl_header.decodingTimeStampFlag = (stream->curr_pck.flags & GF_ESI_DATA_HAS_DTS) ? 1: 0;
+ stream->sl_header.decodingTimeStamp = stream->curr_pck.dts;
+
+ src_data = stream->curr_pck.data;
+ src_data_len = stream->curr_pck.data_len;
+ stream->curr_pck.data_len = 0;
+ stream->curr_pck.data = NULL;
+
+ gf_sl_packetize(&stream->sl_config, &stream->sl_header, src_data, src_data_len, &stream->curr_pck.data, &stream->curr_pck.data_len);
/*discard src data*/
if (!(stream->ifce->caps & GF_ESI_AU_PULL_CAP)) {
gf_free(src_data);
- stream->pck_first->data = stream->pck.data;
- stream->pck_first->data_len = stream->pck.data_len;
}
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS Muxer] PID %d: Encapsulating MPEG-4 SL Data on PES - SL Header size\n", stream->pid, stream->pck.data_len - src_data_len));
+ GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, ("[MPEG-2 TS Muxer] PID %d: Encapsulating MPEG-4 SL Data (%p - %p) on PES - SL Header size %d\n", stream->pid, src_data, stream->curr_pck.data, stream->curr_pck.data_len - src_data_len));
+
+ /*moving from PES to SL reallocates a new buffer, force discard even in pull mode*/
+ stream->discard_data = 1;
}
break;
/*perform LATM encapsulation*/
gf_bs_write_int(bs, 1, 1);
}
/*write payloadLengthInfo*/
- size = stream->pck.data_len;
+ size = stream->curr_pck.data_len;
while (1) {
if (size>=255) {
gf_bs_write_int(bs, 255, 8);
break;
}
}
- gf_bs_write_data(bs, stream->pck.data, stream->pck.data_len);
+ gf_bs_write_data(bs, stream->curr_pck.data, stream->curr_pck.data_len);
gf_bs_align(bs);
- gf_bs_get_content(bs, &stream->pck.data, &stream->pck.data_len);
+ gf_free(stream->curr_pck.data);
+ gf_bs_get_content(bs, &stream->curr_pck.data, &stream->curr_pck.data_len);
gf_bs_del(bs);
/*rewrite LATM frame header*/
- size = stream->pck.data_len - 2;
- stream->pck.data[1] |= (size>>8) & 0x1F;
- stream->pck.data[2] = (size) & 0xFF;
+ size = stream->curr_pck.data_len - 2;
+ stream->curr_pck.data[1] |= (size>>8) & 0x1F;
+ stream->curr_pck.data[2] = (size) & 0xFF;
+ /*since we reallocated the packet data buffer, force a discard in pull mode*/
+ stream->discard_data = 1;
}
break;
+ /*perform ADTS encapsulation*/
+ case GF_M2TS_AUDIO_AAC:
+ if (stream->ifce->decoder_config) {
+ GF_M4ADecSpecInfo cfg;
+ GF_BitStream *bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
+ gf_m4a_get_config(stream->ifce->decoder_config, stream->ifce->decoder_config_size, &cfg);
+
+ gf_bs_write_int(bs, 0xFFF, 12);/*sync*/
+ gf_bs_write_int(bs, 0, 1);/*mpeg2 aac*/
+ gf_bs_write_int(bs, 0, 2); /*layer*/
+ gf_bs_write_int(bs, 1, 1); /* protection_absent*/
+ gf_bs_write_int(bs, cfg.base_object_type-1, 2);
+ gf_bs_write_int(bs, cfg.base_sr_index, 4);
+ gf_bs_write_int(bs, 0, 1);
+ gf_bs_write_int(bs, cfg.nb_chan, 3);
+ gf_bs_write_int(bs, 0, 4);
+ gf_bs_write_int(bs, 7+stream->curr_pck.data_len, 13);
+ gf_bs_write_int(bs, 0x7FF, 11);
+ gf_bs_write_int(bs, 0, 2);
+
+ gf_bs_write_data(bs, stream->curr_pck.data, stream->curr_pck.data_len);
+ gf_bs_align(bs);
+ gf_free(stream->curr_pck.data);
+ gf_bs_get_content(bs, &stream->curr_pck.data, &stream->curr_pck.data_len);
+ gf_bs_del(bs);
+ }
+ /*since we reallocated the packet data buffer, force a discard in pull mode*/
+ stream->discard_data = 1;
+ break;
}
/*compute next interesting time in TS unit: this will be DTS of next packet*/
- next_time = (u32) (stream->pck.dts - stream->initial_ts);
+ next_time = (u32) (stream->curr_pck.dts - stream->initial_ts);
/*we need to take into account transmission time, eg nb packets to send the data*/
if (next_time) {
u32 nb_pck, bytes, nb_bits, nb_ticks;
bytes = 184 - ADAPTATION_LENGTH_LENGTH - ADAPTATION_FLAGS_LENGTH - PCR_LENGTH;
bytes -= gf_m2ts_stream_get_pes_header_length(stream);
nb_pck=1;
- while (bytes<stream->pck.data_len) {
+ while (bytes<stream->curr_pck.data_len) {
bytes+=184;
nb_pck++;
}
/*PCR offset, in 90000 hz not in 270000000*/
pcr_offset = stream->program->pcr_init_time/300;
- stream->pck.cts = stream->pck.cts - stream->initial_ts + pcr_offset;
- stream->pck.dts = stream->pck.dts - stream->initial_ts + pcr_offset;
+ stream->curr_pck.cts = stream->curr_pck.cts - stream->initial_ts + pcr_offset;
+ stream->curr_pck.dts = stream->curr_pck.dts - stream->initial_ts + pcr_offset;
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS Muxer] PID %d: Next data schedule for %d:%09d - mux time %d:%09d\n", stream->pid, stream->time.sec, stream->time.nanosec, muxer->time.sec, muxer->time.nanosec));
/*compute bitrate if needed*/
if (!stream->bit_rate) {
if (!stream->last_br_time) {
- stream->last_br_time = stream->pck.dts + 1;
- stream->bytes_since_last_time = stream->pck.data_len;
+ stream->last_br_time = stream->curr_pck.dts + 1;
+ stream->bytes_since_last_time = stream->curr_pck.data_len;
} else {
- if (stream->pck.dts - stream->last_br_time - 1 >= 90000) {
+ if (stream->curr_pck.dts - stream->last_br_time - 1 >= 90000) {
u64 r = 8*stream->bytes_since_last_time;
r*=90000;
- stream->bit_rate = (u32) (r / (stream->pck.dts - stream->last_br_time - 1));
+ stream->bit_rate = (u32) (r / (stream->curr_pck.dts - stream->last_br_time - 1));
stream->program->mux->needs_reconfig = 1;
} else {
- stream->bytes_since_last_time += stream->pck.data_len;
+ stream->bytes_since_last_time += stream->curr_pck.data_len;
}
}
}
gf_bs_write_int(bs, 0x1, 24);//packet start code
gf_bs_write_u8(bs, stream->mpeg2_stream_id);// stream id
- use_pts = (stream->pck.flags & GF_ESI_DATA_HAS_CTS) ? 1 : 0;
- use_dts = (stream->pck.flags & GF_ESI_DATA_HAS_DTS) ? 1 : 0;
+ use_pts = (stream->curr_pck.flags & GF_ESI_DATA_HAS_CTS) ? 1 : 0;
+ use_dts = (stream->curr_pck.flags & GF_ESI_DATA_HAS_DTS) ? 1 : 0;
- pes_len = stream->pck.data_len + 3; // 3 = header size
+ pes_len = stream->curr_pck.data_len + 3; // 3 = header size
if (use_pts) pes_len += 5;
if (use_dts) pes_len += 5;
gf_bs_write_int(bs, pes_len, 16); // pes packet length
if (use_pts) {
gf_bs_write_int(bs, use_dts ? 0x3 : 0x2, 4); // reserved '0011' || '0010'
- t = ((stream->pck.cts >> 30) & 0x7);
+ t = ((stream->curr_pck.cts >> 30) & 0x7);
gf_bs_write_long_int(bs, t, 3);
gf_bs_write_int(bs, 1, 1); // marker bit
- t = ((stream->pck.cts >> 15) & 0x7fff);
+ t = ((stream->curr_pck.cts >> 15) & 0x7fff);
gf_bs_write_long_int(bs, t, 15);
gf_bs_write_int(bs, 1, 1); // marker bit
- t = stream->pck.cts & 0x7fff;
+ t = stream->curr_pck.cts & 0x7fff;
gf_bs_write_long_int(bs, t, 15);
gf_bs_write_int(bs, 1, 1); // marker bit
}
if (use_dts) {
gf_bs_write_int(bs, 0x1, 4); // reserved '0001'
- t = ((stream->pck.dts >> 30) & 0x7);
+ t = ((stream->curr_pck.dts >> 30) & 0x7);
gf_bs_write_long_int(bs, t, 3);
gf_bs_write_int(bs, 1, 1); // marker bit
- t = ((stream->pck.dts >> 15) & 0x7fff);
+ t = ((stream->curr_pck.dts >> 15) & 0x7fff);
gf_bs_write_long_int(bs, t, 15);
gf_bs_write_int(bs, 1, 1); // marker bit
- t = stream->pck.dts & 0x7fff;
+ t = stream->curr_pck.dts & 0x7fff;
gf_bs_write_long_int(bs, t, 15);
gf_bs_write_int(bs, 1, 1); // marker bit
}
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS Muxer] PID %d: Adding PES header at PCR "LLD" - has PTS %d (%d) - has DTS %d (%d)\n", stream->pid, gf_m2ts_get_pcr(stream->program)/300, use_pts, stream->pck.cts, use_dts, stream->pck.dts));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS Muxer] PID %d: Adding PES header at PCR "LLD" - has PTS %d (%d) - has DTS %d (%d)\n", stream->pid, gf_m2ts_get_pcr(stream->program)/300, use_pts, stream->curr_pck.cts, use_dts, stream->curr_pck.dts));
return pes_len+4; // 4 = start code + stream_id
}
bs = gf_bs_new(packet, 188, GF_BITSTREAM_WRITE);
hdr_len = gf_m2ts_stream_get_pes_header_length(stream);
- remain = stream->pck.data_len - stream->pck_offset;
+ remain = stream->curr_pck.data_len - stream->pck_offset;
needs_pcr = 0;
if (hdr_len && (stream==stream->program->pcr) ) {
if (stream->continuity_counter < 15) stream->continuity_counter++;
else stream->continuity_counter=0;
- is_rap = (hdr_len && (stream->pck.flags & GF_ESI_DATA_AU_RAP) ) ? 1 : 0;
+ is_rap = (hdr_len && (stream->curr_pck.flags & GF_ESI_DATA_AU_RAP) ) ? 1 : 0;
if (adaptation_field_control != GF_M2TS_ADAPTATION_NONE) {
u64 pcr = 0;
gf_bs_del(bs);
- memcpy(packet+188-payload_length, stream->pck.data + stream->pck_offset, payload_length);
+ memcpy(packet+188-payload_length, stream->curr_pck.data + stream->pck_offset, payload_length);
stream->pck_offset += payload_length;
- if (stream->pck_offset == stream->pck.data_len) {
- GF_M2TS_Packet *pck;
- /*discard first packet*/
- gf_mx_p(stream->mx);
- assert(stream->pck_first);
- pck = stream->pck_first;
- stream->pck_first = pck->next;
- gf_mx_v(stream->mx);
- gf_free(pck->data);
- gf_free(pck);
-
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG2-TS Muxer] Done sending PES (%d bytes) from PID %d at stream time %d:%d (DTS %d - PCR %d)\n", stream->pck.data_len, stream->pid, stream->time.sec, stream->time.nanosec, stream->pck.dts, gf_m2ts_get_pcr(stream->program)/300));
+ if (stream->pck_offset == stream->curr_pck.data_len) {
+ /*PES has been sent, discard internal buffer*/
+ gf_free(stream->curr_pck.data);
+ stream->curr_pck.data = NULL;
+ stream->curr_pck.data_len = 0;
+
+ GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, ("[MPEG2-TS Muxer] Done sending PES (%d bytes) from PID %d at stream time %d:%d (DTS "LLD" - PCR "LLD")\n", stream->curr_pck.data_len, stream->pid, stream->time.sec, stream->time.nanosec, stream->curr_pck.dts, gf_m2ts_get_pcr(stream->program)/300));
}
}
break;
case GPAC_OTI_AUDIO_AAC_MPEG4:
stream->mpeg2_stream_type = GF_M2TS_AUDIO_LATM_AAC;
+ stream->mpeg2_stream_type = GF_M2TS_AUDIO_AAC;
if (!ifce->repeat_rate) ifce->repeat_rate = 500;
break;
}
}
/*override signaling for all streams except BIFS/OD, to use MPEG-4 PES*/
- if (program->mux->mpeg4_signaling) {
+ if (program->mpeg4_signaling==GF_M2TS_MPEG4_SIGNALING_FULL) {
if (stream->mpeg2_stream_type != GF_M2TS_SYSTEMS_MPEG4_SECTIONS) {
stream->mpeg2_stream_type = GF_M2TS_SYSTEMS_MPEG4_PES;
stream->mpeg2_stream_id = 0xFA;/*ISO/IEC14496-1_SL-packetized_stream*/
return stream;
}
-#define GF_M2TS_PSI_REFRESH_RATE 200
+GF_Err gf_m2ts_program_stream_update_ts_scale(GF_ESInterface *_self, u32 time_scale)
+{
+ GF_M2TS_Mux_Stream *stream = (GF_M2TS_Mux_Stream *)_self->output_udta;
+ if (!stream || !time_scale)
+ return GF_BAD_PARAM;
+ stream->ts_scale = 90000.0 / time_scale;
+
+ return GF_OK;
+}
+
+void gf_m2ts_program_stream_update_sl_config(GF_ESInterface *_self, GF_SLConfig *slc)
+{
+ GF_M2TS_Mux_Stream *stream = (GF_M2TS_Mux_Stream *)_self->output_udta;
+ if (stream->program->iod && slc) {
+ memcpy(&stream->sl_config, slc, sizeof(GF_SLConfig));
+ }
+}
-GF_M2TS_Mux_Program *gf_m2ts_mux_program_add(GF_M2TS_Mux *muxer, u32 program_number, u32 pmt_pid)
+#define GF_M2TS_PSI_DEFAULT_REFRESH_RATE 200
+
+GF_M2TS_Mux_Program *gf_m2ts_mux_program_add(GF_M2TS_Mux *muxer, u32 program_number, u32 pmt_pid, u32 pmt_refresh_rate, Bool mpeg4_signaling)
{
GF_M2TS_Mux_Program *program;
GF_SAFEALLOC(program, GF_M2TS_Mux_Program);
program->mux = muxer;
+ program->mpeg4_signaling = mpeg4_signaling;
+
program->number = program_number;
if (muxer->programs) {
GF_M2TS_Mux_Program *p = muxer->programs;
program->pmt->program = program;
muxer->pat->table_needs_update = 1;
program->pmt->process = gf_m2ts_stream_process_pmt;
- program->pmt->refresh_rate_ms = GF_M2TS_PSI_REFRESH_RATE;
+ program->pmt->refresh_rate_ms = pmt_refresh_rate ? pmt_refresh_rate : GF_M2TS_PSI_DEFAULT_REFRESH_RATE;
return program;
}
-GF_M2TS_Mux *gf_m2ts_mux_new(u32 mux_rate, Bool real_time)
+GF_M2TS_Mux *gf_m2ts_mux_new(u32 mux_rate, u32 pat_refresh_rate, Bool real_time)
{
GF_BitStream *bs;
GF_M2TS_Mux *muxer;
GF_SAFEALLOC(muxer, GF_M2TS_Mux);
muxer->pat = gf_m2ts_stream_new(GF_M2TS_PID_PAT);
muxer->pat->process = gf_m2ts_stream_process_pat;
- muxer->pat->refresh_rate_ms = GF_M2TS_PSI_REFRESH_RATE;
+ muxer->pat->refresh_rate_ms = pat_refresh_rate ? pat_refresh_rate : GF_M2TS_PSI_DEFAULT_REFRESH_RATE;
muxer->real_time = real_time;
muxer->bit_rate = mux_rate;
if (mux_rate) muxer->fixed_rate = 1;
st->tables = tab;
}
while (st->pck_first) {
- GF_M2TS_Packet *pck = st->pck_first;
- st->pck_first = pck->next;
- gf_free(pck->data);
- gf_free(pck);
+ GF_M2TS_Packet *curr_pck = st->pck_first;
+ st->pck_first = curr_pck->next;
+ gf_free(curr_pck->data);
+ gf_free(curr_pck);
}
+ if (st->curr_pck.data) gf_free(st->curr_pck.data);
if (st->mx) gf_mx_del(st->mx);
gf_free(st);
}
muxer->needs_reconfig = 0;
}
+ /*PAT*/
res = muxer->pat->process(muxer, muxer->pat);
if (res && gf_m2ts_time_less_or_equal(&muxer->pat->time, &time) ) {
time = muxer->pat->time;
goto send_pck;
}
+ /*PMT, for each program*/
program = muxer->programs;
while (program) {
res = program->pmt->process(muxer, program->pmt);
/*force sending the PMT regardless of other streams*/
goto send_pck;
}
+ program = program->next;
+ }
+
+ /*PCR stream, for each program (send them first to avoid PCR to never be sent)*/
+ program = muxer->programs;
+ while (program) {
stream = program->streams;
while (stream) {
- nb_streams++;
- res = stream->process(muxer, stream);
- if (res) {
- if (gf_m2ts_time_less(&stream->time, &time)) {
- time = stream->time;
- stream_to_process = stream;
+ if (stream == program->pcr) {
+ nb_streams++;
+ res = stream->process(muxer, stream);
+ if (res) {
+ if (gf_m2ts_time_less(&stream->time, &time)) {
+ time = stream->time;
+ stream_to_process = stream;
+ goto send_pck;
+ }
+ } else {
+ if (stream->ifce->caps & GF_ESI_STREAM_IS_OVER) nb_streams_done ++;
+ }
+
+ break;
+ }
+ stream = stream->next;
+ }
+ program = program->next;
+ }
+
+ /*all streams except PCR, for each program*/
+ program = muxer->programs;
+ while (program) {
+ stream = program->streams;
+ while (stream) {
+ if (stream != program->pcr) {
+ nb_streams++;
+ res = stream->process(muxer, stream);
+ if (res) {
+ if (gf_m2ts_time_less(&stream->time, &time)) {
+ time = stream->time;
+ stream_to_process = stream;
+ goto send_pck;
+ }
+ } else {
+ if (stream->ifce->caps & GF_ESI_STREAM_IS_OVER) nb_streams_done ++;
}
- } else {
- if (stream->ifce->caps & GF_ESI_STREAM_IS_OVER) nb_streams_done ++;
}
stream = stream->next;
}
--- /dev/null
+/**\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) Jean Le Feuvre 2000-2005\r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ * Written by Pierre Souchay for VizionR SAS\r
+ *\r
+ */\r
+\r
+#define _GNU_SOURCE\r
+\r
+#include <gpac/internal/m3u8.h>\r
+#include <string.h>\r
+#include <stdio.h>\r
+#include <gpac/network.h>\r
+\r
+/*#define MYLOG(xx) GF_LOG( GF_LOG_INFO, GF_LOG_CONTAINER, xx )*/\r
+//#define MYLOG(xx) printf xx\r
+#define MYLOG(xx)\r
+\r
+\r
+#if defined(WIN32) || defined(_WIN32_WCE)\r
+#define bzero(a, b) memset(a, 0x0, b)\r
+#endif\r
+\r
+GF_Err cleanup_list_of_elements(GF_List * list) {\r
+ GF_Err result = GF_OK;\r
+ if (list == NULL)\r
+ return result;\r
+ while (gf_list_count(list)) {\r
+ PlaylistElement * pl = (PlaylistElement *) gf_list_get(list, 0);\r
+ if (pl)\r
+ result |= playlist_element_del(pl);\r
+ gf_list_rem(list, 0);\r
+ }\r
+ gf_list_del(list);\r
+ return result;\r
+}\r
+\r
+GF_Err playlist_element_del(PlaylistElement * e) {\r
+ GF_Err result = GF_OK;\r
+ if (e == NULL)\r
+ return result;\r
+ if (e->title) {\r
+ gf_free(e->title);\r
+ e->title = NULL;\r
+ }\r
+ if (e->codecs) {\r
+ gf_free(e->codecs);\r
+ e->codecs = NULL;\r
+ }\r
+ assert( e->url);\r
+ gf_free(e->url);\r
+ e->url = NULL;\r
+\r
+ switch (e->elementType) {\r
+ case TYPE_UNKNOWN:\r
+ case TYPE_STREAM:\r
+ break;\r
+ case TYPE_PLAYLIST:\r
+ assert( e->element.playlist.elements);\r
+ result |= cleanup_list_of_elements(e->element.playlist.elements);\r
+ e->element.playlist.elements = NULL;\r
+ default:\r
+ break;\r
+ }\r
+ gf_free(e);\r
+ return result;\r
+}\r
+\r
+Program * program_new(int programId) {\r
+ Program * program = (Program*)gf_malloc(sizeof(Program));\r
+ if (program == NULL) {\r
+ return NULL;\r
+ }\r
+ program->programId = programId;\r
+ program->bitrates = gf_list_new();\r
+ if (program->bitrates == NULL) {\r
+ gf_free(program);\r
+ return NULL;\r
+ }\r
+ return program;\r
+}\r
+\r
+GF_Err program_del(Program * program) {\r
+ GF_Err e = GF_OK;\r
+ if (program == NULL)\r
+ return e;\r
+ if ( program->bitrates) {\r
+ while (gf_list_count(program->bitrates)) {\r
+ GF_List * l = gf_list_get(program->bitrates, 0);\r
+ cleanup_list_of_elements(l);\r
+ gf_list_rem(program->bitrates, 0);\r
+ }\r
+ gf_list_del(program->bitrates);\r
+ }\r
+ program->bitrates = NULL;\r
+ gf_free(program);\r
+ return e;\r
+}\r
+\r
+/*\r
+GF_Err playlist_del(Playlist * pl){\r
+ GF_Err result = GF_OK;\r
+ if (pl == NULL)\r
+ return result;\r
+ if (pl->elements){\r
+ result|= cleanup_list_of_elements(pl->elements);\r
+ pl->elements = NULL;\r
+ }\r
+ gf_free(pl);\r
+ return result;\r
+}*/\r
+\r
+PlaylistElement * playlist_element_new(PlaylistElementType elementType, const char * url, const char * title, const char *codecs, int durationInfo) {\r
+ PlaylistElement * e = gf_malloc(sizeof(PlaylistElement));\r
+ bzero(e, sizeof(PlaylistElement));\r
+ assert( url );\r
+ if (e == NULL)\r
+ return NULL;\r
+ e->durationInfo = durationInfo;\r
+ e->title = (title ? gf_strdup(title) : NULL);\r
+ e->codecs = (codecs ? gf_strdup(codecs) : NULL);\r
+ assert( url);\r
+ e->url = gf_strdup(url);\r
+ e->bandwidth = 0;\r
+ e->elementType = elementType;\r
+ if (elementType == TYPE_PLAYLIST) {\r
+ e->element.playlist.is_ended = 0;\r
+ e->element.playlist.target_duration = durationInfo;\r
+ e->element.playlist.currentMediaSequence = 0;\r
+ e->element.playlist.mediaSequenceMin = 0;\r
+ e->element.playlist.mediaSequenceMax = 0;\r
+ e->element.playlist.elements = gf_list_new();\r
+ if (NULL == (e->element.playlist.elements)) {\r
+ if (e->title)\r
+ gf_free(e->title);\r
+ if (e->codecs)\r
+ gf_free(e->codecs);\r
+ if (e->url)\r
+ gf_free(e->url);\r
+ e->url = NULL;\r
+ e->title = NULL;\r
+ e->codecs = NULL;\r
+ gf_free(e);\r
+ return NULL;\r
+ }\r
+ } else {\r
+ /* Nothing to do, stream is an empty structure */\r
+ }\r
+ assert(e->bandwidth == 0);\r
+ assert(e->url);\r
+ return e;\r
+}\r
+/*\r
+Playlist * playlist_new(){\r
+ Playlist * pl = gf_malloc(sizeof(Playlist));\r
+ if (pl == NULL)\r
+ return NULL;\r
+ pl->currentMediaSequence = 1;\r
+ pl->target_duration = 0;\r
+ pl->mediaSequenceMin = 0;\r
+ pl->mediaSequenceMax = 0;\r
+ pl->is_ended = 0;\r
+ pl->elements = gf_list_new();\r
+ if (pl->elements == NULL){\r
+ gf_free(pl);\r
+ return NULL;\r
+ }\r
+ return pl;\r
+}\r
+ */\r
+\r
+VariantPlaylist * variant_playlist_new ()\r
+{\r
+ VariantPlaylist * pl = (VariantPlaylist*)gf_malloc( sizeof(VariantPlaylist) );\r
+ if (pl == NULL)\r
+ return NULL;\r
+ pl->programs = gf_list_new();\r
+ if (! pl->programs) {\r
+ gf_free( pl );\r
+ return NULL;\r
+ }\r
+ pl->currentProgram = -1;\r
+ pl->playlistNeedsRefresh = 1;\r
+ return pl;\r
+}\r
+\r
+GF_Err variant_playlist_del (VariantPlaylist * playlist) {\r
+ if (playlist == NULL)\r
+ return GF_OK;\r
+ assert( playlist->programs);\r
+ while (gf_list_count(playlist->programs)) {\r
+ Program * p = gf_list_get(playlist->programs, 0);\r
+ assert(p);\r
+ while (gf_list_count( p->bitrates )) {\r
+ PlaylistElement * pl = gf_list_get(p->bitrates, 0);\r
+ assert( pl );\r
+ playlist_element_del(pl);\r
+ gf_list_rem(p->bitrates, 0);\r
+ }\r
+ gf_list_del(p->bitrates);\r
+ p->bitrates = NULL;\r
+ program_del(p);\r
+ gf_list_rem(playlist->programs, 0);\r
+ }\r
+ gf_list_del(playlist->programs);\r
+ playlist->programs = NULL;\r
+ gf_free(playlist);\r
+ return GF_OK;\r
+}\r
+\r
+GF_Err playlist_element_dump(const PlaylistElement * e, int indent) {\r
+ int i;\r
+ GF_Err r = GF_OK;\r
+ for (i = 0 ; i < indent; i++)\r
+ printf(" ");\r
+ if (e == NULL) {\r
+ printf("NULL PlaylistElement\n");\r
+ return r;\r
+ }\r
+ printf("PlayListElement[%p, title=%s, codecs=%s, duration=%d, bandwidth=%d, url=%s, type=%s]\n",\r
+ (void*)e,\r
+ e->title,\r
+ e->codecs,\r
+ e->durationInfo,\r
+ e->bandwidth,\r
+ e->url,\r
+ e->elementType == TYPE_STREAM ? "stream" : "playlist");\r
+ if (TYPE_PLAYLIST == e->elementType) {\r
+ int sz;\r
+ assert( e->element.playlist.elements);\r
+ sz = gf_list_count(e->element.playlist.elements);\r
+ indent+=2;\r
+ for (i = 0 ; i < sz ; i++) {\r
+ PlaylistElement * el = gf_list_get(e->element.playlist.elements, i);\r
+ assert( el);\r
+ r|= playlist_element_dump( el, indent);\r
+ }\r
+ }\r
+ return r;\r
+}\r
+\r
+GF_Err variant_playlist_dump(const VariantPlaylist * pl) {\r
+ int i, count;\r
+ GF_Err e = GF_OK;\r
+ if (pl == NULL) {\r
+ printf("VariantPlaylist = NULL\n");\r
+ return e;\r
+ }\r
+ printf("VariantPlaylist = {\n");\r
+ assert( pl->programs);\r
+ count = gf_list_count( pl->programs);\r
+ for (i = 0 ; i < count ; i++) {\r
+ int j, countj;\r
+ Program * p = gf_list_get(pl->programs, i);\r
+ assert( p );\r
+ printf(" program[programId=%d]{\n", p->programId);\r
+ assert( p->bitrates );\r
+ countj = gf_list_count(p->bitrates);\r
+ for (j = 0; j < countj; j++) {\r
+ PlaylistElement * el = gf_list_get(p->bitrates, j);\r
+ assert(el);\r
+ e |= playlist_element_dump( el, 4);\r
+ }\r
+ printf(" }\n");\r
+ }\r
+ printf("}\n");\r
+ return e;\r
+}\r
+\r
+Program * variant_playlist_find_matching_program(const VariantPlaylist * pl, const u32 programId) {\r
+ u32 count, i;\r
+ assert( pl);\r
+ assert( pl->programs);\r
+ assert(programId >= 0);\r
+ count = gf_list_count(pl->programs);\r
+ for (i = 0 ; i < count ; i++) {\r
+ Program * cur = gf_list_get(pl->programs, i);\r
+ assert( cur );\r
+ if (programId == cur->programId) {\r
+ /* We found the program */\r
+ return cur;\r
+ }\r
+ }\r
+ return NULL;\r
+}\r
+\r
+Program * variant_playlist_get_current_program(const VariantPlaylist * pl) {\r
+ assert( pl );\r
+ return variant_playlist_find_matching_program(pl, pl->currentProgram);\r
+}\r
+\r
+\r
+\r
+typedef struct _s_accumulated_attributes {\r
+ char * title;\r
+ int durationInSeconds;\r
+ int bandwidth;\r
+ int programId;\r
+ char * codecs;\r
+ int targetDurationInSeconds;\r
+ int minMediaSequence;\r
+ int currentMediaSequence;\r
+ Bool isVariantPlaylist;\r
+ Bool isPlaylistEnded;\r
+} s_accumulated_attributes;\r
+\r
+static Bool safe_start_equals(const char * attribute, const char * line) {\r
+ size_t len, atlen;\r
+ if (line == NULL)\r
+ return 0;\r
+ len = strlen(line);\r
+ atlen = strlen(attribute);\r
+ if (len < atlen)\r
+ return 0;\r
+ return 0 == strncmp(attribute, line, atlen);\r
+}\r
+\r
+static char ** extractAttributes(const char * name, const char * line, const int numberOfAttributes) {\r
+ int sz, i, currentAttribute, start;\r
+ char ** ret;\r
+ int len = strlen(line);\r
+ start = strlen(name);\r
+ if (len <= start)\r
+ return NULL;\r
+ if (!safe_start_equals(name, line))\r
+ return NULL;\r
+ ret = gf_calloc((numberOfAttributes + 1 ), sizeof(char*));\r
+ currentAttribute = 0;\r
+ for (i = start ; i <= len ; i++) {\r
+ if (line[i] == '\0' || line[i] == ',') {\r
+ u32 spaces = 0;\r
+ sz = 1 + i - start;\r
+ while (line[start+spaces] == ' ') spaces++;\r
+ ret[currentAttribute] = gf_calloc( (1+sz-spaces), sizeof(char));\r
+ strncpy(ret[currentAttribute], &(line[start+spaces]), sz-spaces);\r
+ currentAttribute++;\r
+ start = i+1;\r
+ if (start == len) {\r
+ return ret;\r
+ }\r
+ }\r
+ }\r
+ if (currentAttribute == 0) {\r
+ gf_free(ret);\r
+ return NULL;\r
+ }\r
+ return ret;\r
+}\r
+\r
+/**\r
+ * Parses the attributes and accumulate into the attributes structure\r
+ */\r
+static char ** parseAttributes(const char * line, s_accumulated_attributes * attributes) {\r
+ int intValue, i;\r
+ char ** ret;\r
+ char * endPtr;\r
+ char * utility;\r
+ if (line == NULL)\r
+ return NULL;\r
+ if (!safe_start_equals("#EXT", line))\r
+ return NULL;\r
+ if (safe_start_equals("#EXT-X-ENDLIST", line)) {\r
+ attributes->isPlaylistEnded = 1;\r
+ return NULL;\r
+ }\r
+ ret = extractAttributes("#EXT-X-TARGETDURATION:", line, 1);\r
+ if (ret) {\r
+ /* #EXT-X-TARGETDURATION:<seconds> */\r
+ if (ret[0]) {\r
+ intValue = strtol(ret[0], &endPtr, 10);\r
+ if (endPtr != ret[0]) {\r
+ attributes->targetDurationInSeconds = intValue;\r
+ }\r
+ }\r
+ return ret;\r
+ }\r
+ ret = extractAttributes("#EXT-X-MEDIA-SEQUENCE:", line, 1);\r
+ if (ret) {\r
+ /* #EXT-X-MEDIA-SEQUENCE:<number> */\r
+ if (ret[0]) {\r
+ intValue = strtol(ret[0], &endPtr, 10);\r
+ if (endPtr != ret[0]) {\r
+ attributes->minMediaSequence = intValue;\r
+ attributes->currentMediaSequence = intValue;\r
+ }\r
+ }\r
+ return ret;\r
+ }\r
+ ret = extractAttributes("#EXTINF:", line, 2);\r
+ if (ret) {\r
+ /* #EXTINF:<duration>,<title> */\r
+ if (ret[0]) {\r
+ intValue = strtol(ret[0], &endPtr, 10);\r
+ if (endPtr != ret[0]) {\r
+ attributes->durationInSeconds = intValue;\r
+ }\r
+ }\r
+ if (ret[1]) {\r
+ attributes->title = gf_strdup(ret[1]);\r
+ }\r
+ return ret;\r
+ }\r
+ ret = extractAttributes("#EXT-X-KEY:", line, 2);\r
+ if (ret) {\r
+ /* #EXT-X-KEY:METHOD=<method>[,URI="<URI>"] */\r
+ /* Not Supported for now */\r
+ return ret;\r
+ }\r
+ ret = extractAttributes("#EXT-X-STREAM-INF:", line, 3);\r
+ if (ret) {\r
+ /* #EXT-X-STREAM-INF:[attribute=value][,attribute=value]* */\r
+ i = 0;\r
+ attributes->isVariantPlaylist = 1;\r
+ while (ret[i] != NULL) {\r
+ if (safe_start_equals("BANDWIDTH=", ret[i])) {\r
+ utility = &(ret[i][10]);\r
+ intValue = strtol(utility, &endPtr, 10);\r
+ if (endPtr != utility)\r
+ attributes->bandwidth = intValue;\r
+ } else if (safe_start_equals("PROGRAM-ID=", ret[i])) {\r
+ utility = &(ret[i][11]);\r
+ intValue = strtol(utility, &endPtr, 10);\r
+ if (endPtr != utility)\r
+ attributes->programId = intValue;\r
+ } else if (safe_start_equals("CODECS=\"", ret[i])) {\r
+ intValue = strlen(ret[i]);\r
+ if (ret[i][intValue-1] == '"') {\r
+ attributes->codecs = gf_strdup(&(ret[i][7]));\r
+ }\r
+ }\r
+ i++;\r
+ }\r
+ return ret;\r
+ }\r
+ return NULL;\r
+}\r
+\r
+#define M3U8_BUF_SIZE 2048\r
+\r
+GF_Err parse_root_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL)\r
+{\r
+ return parse_sub_playlist(file, playlist, baseURL, NULL, NULL);\r
+}\r
+\r
+GF_Err parse_sub_playlist(const char * file, VariantPlaylist ** playlist, const char * baseURL, Program * in_program, PlaylistElement *sub_playlist)\r
+{\r
+ int readen, readPointer, len, i, currentLineNumber;\r
+ FILE * f;\r
+ VariantPlaylist * pl;\r
+ char currentLine[M3U8_BUF_SIZE];\r
+ char ** attributes = NULL;\r
+ s_accumulated_attributes attribs;\r
+ f = gf_f64_open(file, "rt");\r
+ if (!f) {\r
+ GF_LOG( GF_LOG_ERROR, GF_LOG_CONTAINER,("[M3U8] Cannot Open m3u8 file %s for reading\n", file));\r
+ return GF_SERVICE_ERROR;\r
+ }\r
+ if (*playlist == NULL) {\r
+ *playlist = variant_playlist_new();\r
+ if (!(*playlist)) {\r
+ fclose(f);\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ }\r
+ pl = *playlist;\r
+ readen=0;\r
+ readPointer = 0;\r
+ currentLineNumber = 0;\r
+ bzero(&attribs, sizeof(s_accumulated_attributes));\r
+ attribs.bandwidth = 0;\r
+ attribs.durationInSeconds = 0;\r
+ attribs.targetDurationInSeconds = 0;\r
+ attribs.isVariantPlaylist = 0;\r
+ attribs.isPlaylistEnded = 0;\r
+ attribs.minMediaSequence = 0;\r
+ attribs.currentMediaSequence = 0;\r
+ while (fgets(currentLine, sizeof(currentLine), f)) {\r
+ char * eof;\r
+ currentLineNumber++;\r
+ eof = strchr(currentLine, '\r');\r
+ if (eof)\r
+ eof[0] = '\0';\r
+ eof = strchr(currentLine, '\n');\r
+ if (eof)\r
+ eof[0] = '\0';\r
+ len = strlen( currentLine);\r
+ if (len < 1)\r
+ continue;\r
+ if (currentLineNumber == 1) {\r
+ /* Playlist MUST start with #EXTM3U */\r
+ if (len < 7 || strncmp("#EXTM3U", currentLine, 7)!=0) {\r
+ fclose(f);\r
+ variant_playlist_del(pl);\r
+ GF_LOG( GF_LOG_ERROR, GF_LOG_CONTAINER, ("Failed to parse M3U8 File, it should start with #EXTM3U, but was : %s\n", currentLine));\r
+ return GF_STREAM_NOT_FOUND;\r
+ }\r
+ continue;\r
+ }\r
+ if (currentLine[0] == '#') {\r
+ /* A comment or a directive */\r
+ if (strncmp("#EXT", currentLine, 4)==0) {\r
+ attributes = parseAttributes(currentLine, &attribs);\r
+ if (attributes == NULL) {\r
+ MYLOG(("Comment at line %d : %s\n", currentLineNumber, currentLine));\r
+ } else {\r
+ MYLOG(("Directive at line %d: \"%s\", attributes=", currentLineNumber, currentLine));\r
+ i = 0;\r
+ while (attributes[i] != NULL) {\r
+ MYLOG((" [%d]='%s'", i, attributes[i]));\r
+ gf_free(attributes[i]);\r
+ attributes[i] = NULL;\r
+ i++;\r
+ }\r
+ MYLOG(("\n"));\r
+ gf_free(attributes);\r
+ attributes = NULL;\r
+ }\r
+ if (attribs.isPlaylistEnded) {\r
+ pl->playlistNeedsRefresh = 0;\r
+ }\r
+ }\r
+ } else {\r
+ char * fullURL = currentLine;\r
+ //printf("Line %d: '%s'\n", currentLineNumber, currentLine);\r
+\r
+ if (gf_url_is_local(currentLine)) {\r
+ /*\r
+ if (gf_url_is_local(baseURL)){\r
+ int num_chars = -1;\r
+ if (baseURL[strlen(baseURL)-1] == '/'){\r
+ num_chars = asprintf(&fullURL, "%s%s", baseURL, currentLine);\r
+ } else {\r
+ num_chars = asprintf(&fullURL, "%s/%s", baseURL, currentLine);\r
+ }\r
+ if (num_chars < 0 || fullURL == NULL){\r
+ variant_playlist_del(*playlist);\r
+ playlist = NULL;\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ } else */ {\r
+ fullURL = gf_url_concatenate(baseURL, currentLine);\r
+ }\r
+ assert( fullURL );\r
+ /*printf("*** calculated full path = %s from %s and %s\n", fullURL, currentLine, baseURL);*/\r
+ }\r
+ {\r
+ u32 count;\r
+ PlaylistElement * currentPlayList = sub_playlist;\r
+ /* First, we have to find the matching program */\r
+ Program * program = in_program;\r
+ if (!in_program) program = variant_playlist_find_matching_program(pl, attribs.programId);\r
+ /* We did not found the program, we create it */\r
+ if (program == NULL) {\r
+ program = program_new(attribs.programId);\r
+ if (program == NULL) {\r
+ /* OUT of memory */\r
+ variant_playlist_del(*playlist);\r
+ fclose(f);\r
+ playlist = NULL;\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ gf_list_add(pl->programs, program);\r
+ if (pl->currentProgram < 0)\r
+ pl->currentProgram = program->programId;\r
+ }\r
+\r
+ /* OK, we have a program, we have to choose the elements with same bandwidth */\r
+ assert( program );\r
+ assert( program->bitrates);\r
+ count = gf_list_count( program->bitrates);\r
+\r
+ if (!currentPlayList) {\r
+ for (i = 0; i < (s32) count; i++) {\r
+ PlaylistElement * itPlayListElement = gf_list_get(program->bitrates, i);\r
+ assert( itPlayListElement );\r
+ if (itPlayListElement->bandwidth == attribs.bandwidth) {\r
+ currentPlayList = itPlayListElement;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (attribs.isVariantPlaylist) {\r
+ /* We are the Variant Playlist */\r
+ if (currentPlayList != NULL) {\r
+ /* should not happen, it means we redefine something previsouly added */\r
+ //assert( 0 );\r
+ }\r
+ currentPlayList = playlist_element_new(\r
+ TYPE_UNKNOWN,\r
+ fullURL,\r
+ attribs.title,\r
+ attribs.codecs,\r
+ attribs.durationInSeconds);\r
+ if (currentPlayList == NULL) {\r
+ /* OUT of memory */\r
+ variant_playlist_del(*playlist);\r
+ playlist = NULL;\r
+ fclose(f);\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ assert( fullURL);\r
+ currentPlayList->url = gf_strdup(fullURL);\r
+ currentPlayList->title = attribs.title ? gf_strdup(attribs.title):NULL;\r
+ currentPlayList->codecs = attribs.codecs ? gf_strdup(attribs.codecs):NULL;\r
+ gf_list_add(program->bitrates, currentPlayList);\r
+ } else {\r
+ /* Normal Playlist */\r
+ assert( pl->programs);\r
+ if (currentPlayList == NULL) {\r
+ /* This is in facts a "normal" playlist without any element in it */\r
+ PlaylistElement * subElement;\r
+ assert(baseURL);\r
+ currentPlayList = playlist_element_new(\r
+ TYPE_PLAYLIST,\r
+ baseURL,\r
+ attribs.title,\r
+ attribs.codecs,\r
+ attribs.durationInSeconds);\r
+ if (currentPlayList == NULL) {\r
+ /* OUT of memory */\r
+ variant_playlist_del(*playlist);\r
+ playlist = NULL;\r
+ fclose(f);\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ assert(currentPlayList->element.playlist.elements);\r
+ assert( fullURL);\r
+ assert( currentPlayList->url);\r
+ currentPlayList->title = NULL;\r
+ currentPlayList->codecs = NULL;\r
+ subElement = playlist_element_new(\r
+ TYPE_UNKNOWN,\r
+ fullURL,\r
+ attribs.title,\r
+ attribs.codecs,\r
+ attribs.durationInSeconds);\r
+ if (subElement == NULL) {\r
+ variant_playlist_del(*playlist);\r
+ playlist_element_del(currentPlayList);\r
+ playlist = NULL;\r
+ fclose(f);\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ gf_list_add(currentPlayList->element.playlist.elements, subElement);\r
+ gf_list_add(program->bitrates, currentPlayList);\r
+ assert( program );\r
+ assert( program->bitrates);\r
+ assert( currentPlayList);\r
+\r
+ } else {\r
+ PlaylistElement * subElement = playlist_element_new(\r
+ TYPE_UNKNOWN,\r
+ fullURL,\r
+ attribs.title,\r
+ attribs.codecs,\r
+ attribs.durationInSeconds);\r
+ if (currentPlayList->elementType != TYPE_PLAYLIST) {\r
+ currentPlayList->elementType = TYPE_PLAYLIST;\r
+ if (!currentPlayList->element.playlist.elements)\r
+ currentPlayList->element.playlist.elements = gf_list_new();\r
+ }\r
+ if (subElement == NULL) {\r
+ variant_playlist_del(*playlist);\r
+ playlist_element_del(currentPlayList);\r
+ playlist = NULL;\r
+ fclose(f);\r
+ return GF_OUT_OF_MEM;\r
+ }\r
+ gf_list_add(currentPlayList->element.playlist.elements, subElement);\r
+ }\r
+ }\r
+\r
+ currentPlayList->element.playlist.currentMediaSequence = attribs.currentMediaSequence ;\r
+ /* We first set the default duration for element, aka targetDuration */\r
+ if (attribs.targetDurationInSeconds > 0) {\r
+ currentPlayList->element.playlist.target_duration = attribs.targetDurationInSeconds;\r
+ currentPlayList->durationInfo = attribs.targetDurationInSeconds;\r
+ }\r
+ if (attribs.durationInSeconds) {\r
+ currentPlayList->durationInfo = attribs.durationInSeconds;\r
+ }\r
+ currentPlayList->element.playlist.mediaSequenceMin = attribs.minMediaSequence;\r
+ currentPlayList->element.playlist.mediaSequenceMax = attribs.currentMediaSequence++;\r
+ if (attribs.bandwidth > 1)\r
+ currentPlayList->bandwidth = attribs.bandwidth;\r
+ if (attribs.isPlaylistEnded)\r
+ currentPlayList->element.playlist.is_ended = 1;\r
+ }\r
+ /* Cleanup all line-specific fields */\r
+ if (attribs.title) {\r
+ gf_free(attribs.title);\r
+ attribs.title = NULL;\r
+ }\r
+ attribs.durationInSeconds = 0;\r
+ attribs.bandwidth = 0;\r
+ attribs.programId = 0;\r
+ if (attribs.codecs != NULL) {\r
+ gf_free(attribs.codecs);\r
+ attribs.codecs = NULL;\r
+ }\r
+ if (fullURL != currentLine) {\r
+ gf_free(fullURL);\r
+ }\r
+ }\r
+ }\r
+ fclose(f);\r
+ return GF_OK;\r
+}\r
#if defined(WIN32) && !defined(__GNUC__)
fprintf(fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: %09lx\n", hh, mm, ss, ms, gf_f64_tell(fsub));
#else
- fprintf(fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: %09llx\n", hh, mm, ss, ms, gf_f64_tell(fsub));
+ fprintf(fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: " LLXPAD("09") "\n", hh, mm, ss, ms, gf_f64_tell(fsub));
#endif
if (vobsub_packetize_subpicture(fsub, samp->DTS, samp->data, samp->dataLength) != GF_OK) {
gf_isom_sample_del(&samp);
#ifdef GPAC_DISABLE_AV_PARSERS
return GF_NOT_SUPPORTED;
#else
+ GF_Err e = GF_OK;
GF_DecoderConfig *dcfg;
GF_GenericSampleDescription *udesc;
char szName[1000], szEXT[5], GUID[16];
gf_export_message(dumper, GF_OK, "Extracting MPEG-2 AAC");
break;
case GPAC_OTI_AUDIO_AAC_MPEG4:
+ if (!dcfg->decoderSpecificInfo) {
+ gf_export_message(dumper, GF_OK, "Could not extracting MPEG-4 AAC: descriptor not found");
+ gf_odf_desc_del((GF_Descriptor *) dcfg);
+ return GF_NON_COMPLIANT_BITSTREAM;
+ }
dsi = dcfg->decoderSpecificInfo->data;
dcfg->decoderSpecificInfo->data = NULL;
dsi_size = dcfg->decoderSpecificInfo->dataLength;
for (i=0; i<count; i++) {
GF_ISOSample *samp = gf_isom_get_sample(dumper->file, track, i+1, &di);
- if (!samp) break;
+ if (!samp) {
+ e = gf_isom_last_error(dumper->file);
+ break;
+ }
/*AVC sample to NALU*/
if (avccfg) {
u32 j, nal_size, remain;
remain = samp->dataLength;
while (remain) {
nal_size = 0;
- assert(remain>avccfg->nal_unit_size);
+ if (remain<avccfg->nal_unit_size){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("Corrupted NAL Unit: header size %d - bytes left %d\n", avccfg->nal_unit_size, remain) );
+ break;
+ }
for (j=0; j<avccfg->nal_unit_size; j++) {
nal_size |= ((u8) *ptr);
if (j+1<avccfg->nal_unit_size) nal_size<<=8;
ptr++;
}
gf_bs_write_u32(bs, 1);
+ if (remain < nal_size) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("Corrupted NAL Unit: size %d - bytes left %d\n", nal_size, remain) );
+ nal_size = remain;
+ }
gf_bs_write_data(bs, ptr, nal_size);
ptr += nal_size;
remain -= nal_size;
if (avccfg) gf_odf_avc_cfg_del(avccfg);
gf_bs_del(bs);
fclose(out);
- return GF_OK;
+ return e;
#endif /*GPAC_DISABLE_AV_PARSERS*/
}
GF_Err gf_media_export(GF_MediaExporter *dumper)
{
if (!dumper) return GF_BAD_PARAM;
- if (!dumper->out_name && !dumper->flags & GF_EXPORT_PROBE_ONLY) return GF_BAD_PARAM;
+ if (!dumper->out_name && !(dumper->flags & GF_EXPORT_PROBE_ONLY)) return GF_BAD_PARAM;
if (dumper->flags & GF_EXPORT_NATIVE) {
#ifndef GPAC_DISABLE_MPEG2TS
GF_AVCConfig *avcc = gf_isom_avc_config_get(file, track, 1);
GF_AVCConfigSlot *slc = (GF_AVCConfigSlot *)gf_list_get(avcc->sequenceParameterSets, 0);
par_n = par_d = 1;
- if (slc) gf_avc_get_sps_info(slc->data, slc->size, NULL, NULL, &par_n, &par_d);
+ if (slc) gf_avc_get_sps_info(slc->data, slc->size, NULL, NULL, NULL, &par_n, &par_d);
gf_odf_avc_cfg_del(avcc);
if ((par_n>1) && (par_d>1))
GF_ISOSample *samp;
GF_ESD *origin_esd;
GF_InitialObjectDescriptor *iod;
-
+ sampDTS = 0;
if (import->flags & GF_IMPORT_PROBE_ONLY) {
for (i=0; i<gf_isom_get_track_count(import->orig); i++) {
import->tk_info[i].track_num = gf_isom_get_track_id(import->orig, i+1);
/*couldn't get the sample, but still move on*/
goto exit;
}
+ /*if not first sample and same DTS as previous sample, force DTS++*/
+ if (i && (samp->DTS==sampDTS)) {
+ samp->DTS++;
+ }
e = gf_isom_add_sample(import->dest, track, di, samp);
}
sampDTS = samp->DTS;
samp = gf_isom_sample_new();
samp->data = buf;
samp->dataLength = buf_len;
- samp->DTS = dts_inc*(frames-1);
+ samp->DTS = (u64)dts_inc*(frames-1);
samp->IsRAP = (ftype==1) ? 1 : 0;
samp->CTS_Offset = 0;
e = gf_isom_add_sample(import->dest, track, di, samp);
import->esd->decoderConfig->decoderSpecificInfo->dataLength = (u32) gf_f64_tell(info);
import->esd->decoderConfig->decoderSpecificInfo->data = (char*)gf_malloc(sizeof(char) * import->esd->decoderConfig->decoderSpecificInfo->dataLength);
gf_f64_seek(info, 0, SEEK_SET);
- if (0==fread(import->esd->decoderConfig->decoderSpecificInfo->data, import->esd->decoderConfig->decoderSpecificInfo->dataLength, 1, info)){
+ if (0==fread(import->esd->decoderConfig->decoderSpecificInfo->data, 1, import->esd->decoderConfig->decoderSpecificInfo->dataLength, info)){
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER,
("[NHML import] Failed to read dataLength\n"));
}
max_size = samp->dataLength;
}
gf_f64_seek(mdia, offset, SEEK_SET);
- if (0==fread( samp->data, samp->dataLength, 1, mdia)){
+ if (0==fread( samp->data, 1, samp->dataLength, mdia)){
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("Failed to read samp->dataLength\n"));
}
if (is_start) {
samp->data = (char*)gf_realloc(samp->data, sizeof(char)*samp->dataLength);
}
gf_f64_seek(xml, breaker.from_pos, SEEK_SET);
- if (0==fread(samp->data, samp->dataLength, 1, xml)){
+ if (0==fread(samp->data, 1, samp->dataLength, xml)){
GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("Failed to read samp->dataLength\n"));
}
while ( (att = (GF_XMLAttribute *)gf_list_enum(node->attributes, &j))) {
if (!stricmp(att->name, "DTS") || !stricmp(att->name, "time")) {
u32 h, m, s, ms;
- if (sscanf(att->value, "%d:%d:%d.%d", &h, &m, &s, &ms) == 4) {
+ if (sscanf(att->value, "%u:%u:%u.%u", &h, &m, &s, &ms) == 4) {
samp->DTS = (u64) ( (Double) ( ((h*3600 + m*60 + s)*1000 + ms) / 1000.0) * timescale );
} else {
samp->DTS = atoi(att->value);
GF_Err gf_import_h264(GF_MediaImporter *import)
{
u64 nal_start, nal_end, total_size;
- u32 nal_size, track, trackID, di, cur_samp, nb_i, nb_idr, nb_p, nb_b, nb_sp, nb_si, nb_sei, max_w, max_h, duration, max_total_delay, nb_ei, nb_ep, nb_eb;
+ u32 nal_size, track, trackID, di, cur_samp, nb_i, nb_idr, nb_p, nb_b, nb_sp, nb_si, nb_sei, max_w, max_h, duration, max_total_delay;
s32 idx;
u8 nal_type;
GF_Err e;
s32 last_poc, max_last_poc, max_last_b_poc, poc_diff, prev_last_poc, min_poc, poc_shift;
Bool first_avc;
u32 last_svc_sps;
- Bool prev_is_nalu_prefix;
+ u32 prev_nalu_prefix_size;
Double FPS;
char *buffer;
u32 max_size = 4096;
if (!FPS) FPS = GF_IMPORT_DEFAULT_FPS;
get_video_timing(FPS, ×cale, &dts_inc);
+ poc_diff = 0;
+
restart_import:
memset(&avc, 0, sizeof(AVCState));
nal_start = gf_bs_get_position(bs);
duration = (u32) ( ((Double)import->duration) * timescale / 1000.0);
- nb_i = nb_idr = nb_p = nb_b = nb_sp = nb_si = nb_sei = nb_ei = nb_ep = nb_eb = 0;
+ nb_i = nb_idr = nb_p = nb_b = nb_sp = nb_si = nb_sei = 0;
max_w = max_h = 0;
first_nal = 1;
ref_frame = pred_frame = 0;
gf_isom_set_cts_packing(import->dest, track, 1);
has_cts_offset = 0;
- poc_diff = 0;
min_poc = 0;
poc_shift = 0;
- prev_is_nalu_prefix = 0;
+ prev_nalu_prefix_size = 0;
while (gf_bs_available(bs)) {
u8 nal_hdr, skip_nal, is_subseq, add_sps;
default:
break;
}
- if (prev_is_nalu_prefix) flush_sample = 0;
- prev_is_nalu_prefix=0;
-
switch (nal_type) {
case GF_AVC_NALU_SVC_SUBSEQ_PARAM:
if (import->flags & GF_IMPORT_SVC_NONE) break;
&& (avc.sps[idx].vui.time_scale <= 120*avc.sps[idx].vui.num_units_in_tick)
) {
/*ISO/IEC 14496-10 n11084 Table E-6*/
- u8 DeltaTfiDivisorTable[] = {1,1,1,2,2,2,2,3,3,4,6};
+/* not used : u8 DeltaTfiDivisorTable[] = {1,1,1,2,2,2,2,3,3,4,6}; */
u8 DeltaTfiDivisorIdx;
if (!avc.sps[idx].vui.pic_struct_present_flag) {
DeltaTfiDivisorIdx = 1 + (1-avc.s_info.field_pic_flag);
if (import->flags & GF_IMPORT_SVC_EXPLICIT) {
gf_import_message(import, GF_OK, "SVC-H264 import - frame size %d x %d at %02.3f FPS", avc.sps[idx].width, avc.sps[idx].height, FPS);
} else {
- gf_import_message(import, GF_OK, "SVC Detected - frame size %d x %d", avc.sps[idx].width, avc.sps[idx].height);
+ gf_import_message(import, GF_OK, "SVC Detected - SSPS ID %d - frame size %d x %d", idx-GF_SVC_SSPS_ID_SHIFT, avc.sps[idx].width, avc.sps[idx].height);
}
last_svc_sps = idx;
}
case GF_AVC_NALU_SVC_PREFIX_NALU:
if (import->flags & GF_IMPORT_SVC_NONE) break;
+ assert(prev_nalu_prefix_size==0);
copy_size = nal_size;
- prev_is_nalu_prefix = 1;
break;
case GF_AVC_NALU_SVC_SLICE:
{
if (! skip_nal) {
copy_size = nal_size;
switch (avc.s_info.slice_type) {
- case GF_AVC_TYPE_P: case GF_AVC_TYPE2_P: nb_ep++; break;
- case GF_AVC_TYPE_I: case GF_AVC_TYPE2_I: nb_ei++; break;
- case GF_AVC_TYPE_B: case GF_AVC_TYPE2_B: nb_eb++; break;
+ case GF_AVC_TYPE_P: case GF_AVC_TYPE2_P: avc.s_info.sps->nb_ep++; break;
+ case GF_AVC_TYPE_I: case GF_AVC_TYPE2_I: avc.s_info.sps->nb_ei++; break;
+ case GF_AVC_TYPE_B: case GF_AVC_TYPE2_B: avc.s_info.sps->nb_eb++; break;
}
}
break;
if (flush_sample && sample_data) {
GF_ISOSample *samp = gf_isom_sample_new();
- samp->DTS = dts_inc*cur_samp;
+ samp->DTS = (u64)dts_inc*cur_samp;
samp->IsRAP = sample_is_rap;
gf_bs_get_content(sample_data, &samp->data, &samp->dataLength);
gf_bs_del(sample_data);
sample_data = NULL;
+
+ if (prev_nalu_prefix_size) {
+ samp->dataLength -= size_length/8 + prev_nalu_prefix_size;
+
+ /*remove last subsample entry!*/
+ gf_isom_add_subsample(import->dest, track, cur_samp+1, 0, 0, 0);
+
+ /*rewrite last NALU prefix at the beginning of next sample*/
+ sample_data = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
+ gf_bs_write_data(sample_data, samp->data + samp->dataLength, size_length/8 + prev_nalu_prefix_size);
+
+ /*add subsample entry to next sample*/
+ gf_isom_add_subsample(import->dest, track, cur_samp+2, size_length/8 + prev_nalu_prefix_size, 1, 1);
+
+ prev_nalu_prefix_size = 0;
+ }
/*CTS recomuting is much trickier than with MPEG-4 ASP due to b-slice used as references - we therefore
store the POC as the CTS offset and update the whole table at the end*/
samp->CTS_Offset = last_poc - poc_shift;
gf_bs_write_int(sample_data, copy_size, size_length);
gf_bs_write_data(sample_data, buffer, copy_size);
+ /*fixme - we need finer grain for priority*/
+ if ((nal_type==GF_AVC_NALU_SVC_PREFIX_NALU) || (nal_type==GF_AVC_NALU_SVC_SLICE)) {
+ gf_isom_add_subsample(import->dest, track, cur_samp+1, copy_size+size_length, 1, 1);
+ } else {
+ gf_isom_add_subsample(import->dest, track, cur_samp+1, copy_size+size_length, 0, 0);
+ }
+
+
+ if (nal_type != GF_AVC_NALU_SVC_PREFIX_NALU) {
+ prev_nalu_prefix_size = 0;
+ } else {
+ prev_nalu_prefix_size = nal_size;
+ }
+
switch (nal_type) {
+ case GF_AVC_NALU_SVC_SLICE:
+ nal_size = nal_size;
case GF_AVC_NALU_NON_IDR_SLICE:
case GF_AVC_NALU_DP_A_SLICE:
case GF_AVC_NALU_DP_B_SLICE:
/*if #pics, compute smallest POC increase*/
if (avc.s_info.poc != last_poc) {
- if (!poc_diff || (poc_diff > abs(avc.s_info.poc-last_poc)))
- poc_diff = abs(avc.s_info.poc-last_poc); /*ideally we would need to start the parsing again as poc_diff helps computing max_total_delay*/
+ if (!poc_diff || (poc_diff > abs(avc.s_info.poc-last_poc))) {
+ poc_diff = abs(avc.s_info.poc-last_poc);/*ideally we would need to start the parsing again as poc_diff helps computing max_total_delay*/
+ }
last_poc = avc.s_info.poc;
}
/*ref slice, reset poc*/
if (import->flags & GF_IMPORT_DO_ABORT) break;
/*consume next start code*/
+ nal_start = AVC_NextStartCode(bs);
+ if (nal_start) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CODING, ("[avc-h264] invalid nal_size? Skipping "LLU" bytes to reach next start code\n", nal_start));
+ gf_bs_skip_bytes(bs, nal_start);
+ }
nal_start = AVC_IsStartCode(bs);
- assert(nal_start);
+ if (!nal_start) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CODING, ("[avc-h264] error: no start code found ("LLU" bytes read out of "LLU") - leaving\n", gf_bs_get_position(bs), gf_bs_get_size(bs)));
+ break;
+ }
nal_start = gf_bs_get_position(bs);
}
/*final flush*/
if (sample_data) {
GF_ISOSample *samp = gf_isom_sample_new();
- samp->DTS = dts_inc*cur_samp;
+ samp->DTS = (u64)dts_inc*cur_samp;
samp->IsRAP = sample_is_rap;
/*we store the frame order (based on the POC) as the CTS offset and update the whole table at the end*/
samp->CTS_Offset = last_poc - poc_shift;
avccfg->nal_unit_size = size_length/8;
svccfg->nal_unit_size = size_length/8;
- if (gf_list_count(avccfg->sequenceParameterSets)) {
+ if (gf_list_count(avccfg->sequenceParameterSets) || !gf_list_count(svccfg->sequenceParameterSets) ) {
gf_isom_avc_config_update(import->dest, track, 1, avccfg);
if (gf_list_count(svccfg->sequenceParameterSets)) {
gf_isom_svc_config_update(import->dest, track, 1, svccfg, 1);
gf_isom_set_pl_indication(import->dest, GF_ISOM_PL_VISUAL, 0x15);
gf_isom_modify_alternate_brand(import->dest, GF_ISOM_BRAND_AVC1, 1);
- if (nb_sp || nb_si) {
- gf_import_message(import, GF_OK, "Import results: %d samples - Slices: %d I %d P %d B %d SP %d SI - %d SEI - %d IDR",
- cur_samp, nb_i, nb_p, nb_b, nb_sp, nb_si, nb_sei, nb_idr);
+ if (!gf_list_count(avccfg->sequenceParameterSets) && !gf_list_count(svccfg->sequenceParameterSets)) {
+ e = gf_import_message(import, GF_NON_COMPLIANT_BITSTREAM, "Import results: No SPS or PPS found in the bitstream ! Nothing imported\n");
} else {
- gf_import_message(import, GF_OK, "Import results: %d samples - Slices: %d I %d P %d B - %d SEI - %d IDR",
- cur_samp, nb_i, nb_p, nb_b, nb_sei, nb_idr);
- }
+ u32 i;
+ if (nb_sp || nb_si) {
+ gf_import_message(import, GF_OK, "AVC Import results: %d samples - Slices: %d I %d P %d B %d SP %d SI - %d SEI - %d IDR",
+ cur_samp, nb_i, nb_p, nb_b, nb_sp, nb_si, nb_sei, nb_idr);
+ } else {
+ gf_import_message(import, GF_OK, "AVC Import results: %d samples - Slices: %d I %d P %d B - %d SEI - %d IDR",
+ cur_samp, nb_i, nb_p, nb_b, nb_sei, nb_idr);
+ }
- if (nb_ei || nb_ep)
- gf_import_message(import, GF_OK, "SVC Import results: Slices: %d I %d P %d B", nb_ei, nb_ep, nb_eb);
+ for (i=0; i<gf_list_count(svccfg->sequenceParameterSets); i++) {
+ AVC_SPS *sps;
+ GF_AVCConfigSlot *svcc = gf_list_get(svccfg->sequenceParameterSets, i);
+ sps = & avc.sps[svcc->id];
+ if (sps && (sps->state & AVC_SUBSPS_PARSED)) {
+ gf_import_message(import, GF_OK, "SVC (SSPS ID %d) Import results: Slices: %d I %d P %d B", svcc->id - GF_SVC_SSPS_ID_SHIFT, sps->nb_ei, sps->nb_ep, sps->nb_eb);
+ }
+ }
- if (max_total_delay>1) {
- gf_import_message(import, GF_OK, "\tStream uses B-slice references - max frame delay %d", max_total_delay);
+ if (max_total_delay>1) {
+ gf_import_message(import, GF_OK, "Stream uses forward prediction - stream CTS offset: %d frames", max_total_delay);
+ }
}
/*rewrite ESD*/
samp->dataLength = sizeof(null_subpic);
samp->data = (char*)null_subpic;
- err = gf_isom_add_sample(import->dest, track, di, samp);
- if (err) goto error;
-
subpic = vobsub->langs[trackID].subpos;
total = gf_list_count(subpic);
last_samp_dur = duration;
+ /*first sample has non-0 DTS, add an empty one*/
+ if (!c && (pos->start != 0)) {
+ err = gf_isom_add_sample(import->dest, track, di, samp);
+ if (err) goto error;
+ }
+
samp->data = packet;
samp->dataLength = psize;
samp->DTS = pos->start * 90;
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Authors: Cyril Concolato\r
+ * Copyright (c) Telecom ParisTech 2010-\r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / 3GPP/MPEG Media Presentation Description input module\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ *\r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ */\r
+\r
+#include <gpac/internal/mpd.h>\r
+#include <gpac/download.h>\r
+#include <gpac/internal/m3u8.h>\r
+#include <gpac/network.h>\r
+\r
+static u32 gf_mpd_parse_duration(char *duration) {\r
+ u32 i;\r
+ if (!duration) return 0;\r
+ i = 0;\r
+ while (1) {\r
+ if (duration[i] == ' ') i++;\r
+ else if (duration[i] == 0) return 0;\r
+ else {\r
+ break;\r
+ }\r
+ }\r
+ if (duration[i] == 'P') {\r
+ if (duration[i+1] == 0) return 0;\r
+ else if (duration[i+1] != 'T') return 0;\r
+ else {\r
+ char *sep1, *sep2;\r
+ u32 h, m;\r
+ double s;\r
+ h = m = 0;\r
+ s = 0;\r
+ if (NULL != (sep1 = strchr(duration+i+2, 'H'))) {\r
+ *sep1 = 0;\r
+ h = atoi(duration+i+2);\r
+ *sep1 = 'H';\r
+ sep1++;\r
+ } else {\r
+ sep1 = duration+i+2;\r
+ }\r
+ if (NULL != (sep2 = strchr(sep1, 'M'))) {\r
+ *sep2 = 0;\r
+ m = atoi(sep1);\r
+ *sep2 = 'M';\r
+ sep2++;\r
+ } else {\r
+ sep2 = sep1;\r
+ }\r
+ if (NULL != (sep1 = strchr(sep2, 'S'))) {\r
+ *sep1 = 0;\r
+ s = atof(sep2);\r
+ *sep1 = 'S';\r
+ }\r
+ return (u32)((h*3600+m*60+s)*1000);\r
+ }\r
+ } else {\r
+ return 0;\r
+ }\r
+}\r
+\r
+static GF_Err gf_mpd_parse_rep_cp(GF_XMLNode *root, GF_MPD_Representation *rep)\r
+{\r
+ u32 att_index;\r
+ GF_XMLAttribute *att;\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "SchemeInformation")) {\r
+ rep->content_protection_type = gf_strdup(att->value);\r
+ } else if (!strcmp(att->name, "schemeIdUri")) {\r
+ rep->content_protection_uri = gf_strdup(att->value);\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_rep_trickmode(GF_XMLNode *root, GF_MPD_Representation *rep)\r
+{\r
+ u32 att_index;\r
+ GF_XMLAttribute *att;\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "alternatePlayoutRate")) {\r
+ rep->alternatePlayoutRate = atof(att->value);\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_rep_initseg(GF_XMLNode *root, GF_MPD_Representation *rep, const char * baseURL)\r
+{\r
+ u32 att_index;\r
+ GF_XMLAttribute *att;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "sourceURL")) {\r
+ GF_URL_Info info;\r
+ GF_Err e;\r
+ gf_dm_url_info_init(&info);\r
+ e = gf_dm_get_url_info(att->value, &info, baseURL);\r
+ assert( e == GF_OK );\r
+ assert( info.canonicalRepresentation);\r
+ rep->init_url = gf_strdup(info.canonicalRepresentation);\r
+ gf_dm_url_info_del(&info);\r
+ } else if (!strcmp(att->name, "range")) {\r
+ rep->init_use_range = 1;\r
+ sscanf(att->value, "%d-%d", &rep->init_byterange_start, &rep->init_byterange_end);\r
+ }\r
+ att_index++;\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_rep_urltemplate(GF_XMLNode *root, GF_MPD_Representation *rep)\r
+{\r
+ u32 att_index;\r
+ GF_XMLAttribute *att;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "sourceURL")) {\r
+ rep->url_template = gf_strdup(att->value);\r
+ } else if (!strcmp(att->name, "id")) {\r
+ rep->id = gf_strdup(att->value);\r
+ } else if (!strcmp(att->name, "startIndex")) {\r
+ rep->startIndex = atoi(att->value)-1;\r
+ } else if (!strcmp(att->name, "endIndex")) {\r
+ rep->endIndex = atoi(att->value)-1;\r
+ }\r
+ att_index++;\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_rep_urlelt(GF_XMLNode *root, GF_MPD_SegmentInfo *seg, const char * baseURL)\r
+{\r
+ u32 att_index;\r
+ GF_XMLAttribute *att;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "sourceURL")) {\r
+ GF_URL_Info info;\r
+ GF_Err e;\r
+ gf_dm_url_info_init(&info);\r
+ e = gf_dm_get_url_info(att->value, &info, baseURL);\r
+ assert( e == GF_OK );\r
+ assert( info.canonicalRepresentation);\r
+ seg->url = gf_strdup(info.canonicalRepresentation);\r
+ gf_dm_url_info_del(&info);\r
+ } else if (!strcmp(att->name, "range")) {\r
+ seg->use_byterange = 1;\r
+ sscanf(att->value, "%d-%d", &seg->byterange_start, &seg->byterange_end);\r
+ }\r
+ att_index++;\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_rep_segmentinfo(GF_XMLNode *root, GF_MPD_Representation *rep)\r
+{\r
+ u32 att_index, child_index;\r
+ u32 nb_urlelements;\r
+ GF_XMLAttribute *att;\r
+ GF_XMLNode *child;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "duration")) {\r
+ rep->default_segment_duration = gf_mpd_parse_duration(att->value);\r
+ } else if (!strcmp(att->name, "baseURL")) {\r
+ rep->default_base_url = gf_strdup(att->value);\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ child_index = 0;\r
+ nb_urlelements = 0;\r
+ while (1) {\r
+ child = gf_list_get(root->content, child_index);\r
+ if (!child) {\r
+ break;\r
+ } else if (child->type == GF_XML_NODE_TYPE) {\r
+ if (!strcmp(child->name, "InitialisationSegmentURL")) {\r
+ gf_mpd_parse_rep_initseg(child, rep, rep->default_base_url);\r
+ } else if (!strcmp(child->name, "UrlTemplate")) {\r
+ gf_mpd_parse_rep_urltemplate(child, rep);\r
+ } else if (!strcmp(child->name, "Url")) {\r
+ nb_urlelements++;\r
+ }\r
+ }\r
+ child_index++;\r
+ }\r
+\r
+ /* We assume that URL Template has precedence over URL elements */\r
+ if (rep->url_template) {\r
+ /* TODO: expand the template to create segment urls*/\r
+ } else if (nb_urlelements) {\r
+ u32 urlelt_index = 0;\r
+ assert( !rep->segments );\r
+ rep->segments = gf_list_new();\r
+\r
+ child_index = 0;\r
+ while (1) {\r
+ child = gf_list_get(root->content, child_index);\r
+ if (!child) {\r
+ break;\r
+ } else if (child->type == GF_XML_NODE_TYPE) {\r
+ if (!strcmp(child->name, "Url")) {\r
+ GF_MPD_SegmentInfo *seg_info;\r
+ GF_SAFEALLOC(seg_info, GF_MPD_SegmentInfo);\r
+ if (!seg_info)\r
+ return GF_OUT_OF_MEM;\r
+ memset(seg_info, 0, sizeof(GF_MPD_SegmentInfo));\r
+ seg_info->byterange_end = 0;\r
+ seg_info->byterange_start = 0;\r
+ seg_info->use_byterange = 0;\r
+ seg_info->url = NULL;\r
+ gf_mpd_parse_rep_urlelt(child, seg_info, rep->default_base_url);\r
+ gf_list_add(rep->segments, seg_info);\r
+ urlelt_index++;\r
+ }\r
+ }\r
+ child_index++;\r
+ }\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_representation(GF_XMLNode *root, GF_MPD_Representation *rep)\r
+{\r
+ u32 att_index, child_index;\r
+ GF_XMLAttribute *att;\r
+ GF_XMLNode *child;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "bandwidth")) {\r
+ rep->bandwidth = atoi(att->value);\r
+ } else if (!strcmp(att->name, "width")) {\r
+ rep->width = atoi(att->value);\r
+ } else if (!strcmp(att->name, "height")) {\r
+ rep->height = atoi(att->value);\r
+ } else if (!strcmp(att->name, "lang")) {\r
+ rep->lang = gf_strdup(att->value);\r
+ } else if (!strcmp(att->name, "mimeType")) {\r
+ rep->mime = gf_strdup(att->value);\r
+ } else if (!strcmp(att->name, "group")) {\r
+ rep->groupID = atoi(att->value);\r
+ } else if (!strcmp(att->name, "startWithRAP")) {\r
+ if (!strcmp(att->value, "true")) rep->startWithRap = 1;\r
+ } else if (!strcmp(att->name, "qualityRanking")) {\r
+ rep->qualityRanking = atoi(att->value);\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ child_index = 0;\r
+ while (1) {\r
+ child = gf_list_get(root->content, child_index);\r
+ if (!child) {\r
+ break;\r
+ } else if (child->type == GF_XML_NODE_TYPE) {\r
+ if (!strcmp(child->name, "ContentProtection")) {\r
+ gf_mpd_parse_rep_cp(child, rep);\r
+ } else if (!strcmp(child->name, "TrickMode")) {\r
+ gf_mpd_parse_rep_trickmode(child, rep);\r
+ } else if (!strcmp(child->name, "SegmentInfo")) {\r
+ gf_mpd_parse_rep_segmentinfo(child, rep);\r
+ }\r
+ }\r
+ child_index++;\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_segment_info_default(GF_XMLNode *root, GF_MPD_Period *period)\r
+{\r
+ u32 att_index;\r
+ GF_XMLAttribute *att;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "duration")) {\r
+ period->default_segment_duration = gf_mpd_parse_duration(att->value);\r
+ } else if (!strcmp(att->name, "baseURL")) {\r
+ period->default_base_url = gf_strdup(att->value);\r
+ } else if (!strcmp(att->name, "sourceUrlTemplatePeriod")) {\r
+ period->url_template = gf_strdup(att->value);\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_period(GF_XMLNode *root, GF_MPD_Period *period)\r
+{\r
+ u32 att_index, child_index;\r
+ GF_XMLAttribute *att;\r
+ GF_XMLNode *child;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "start")) {\r
+ } else if (!strcmp(att->name, "segmentAlignmentFlag")) {\r
+ if (!strcmp(att->value, "true")) {\r
+ period->segment_alignment_flag = 1;\r
+ }\r
+ } else if (!strcmp(att->name, "bitstreamSwitchingFlag")) {\r
+ if (!strcmp(att->value, "true")) {\r
+ period->segment_alignment_flag = 1;\r
+ }\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ child_index = 0;\r
+ while (1) {\r
+ child = gf_list_get(root->content, child_index);\r
+ if (!child) {\r
+ break;\r
+ } else if (child->type == GF_XML_NODE_TYPE) {\r
+ if (!strcmp(child->name, "SegmentInfoDefault")) {\r
+ gf_mpd_parse_segment_info_default(child, period);\r
+ } else if (!strcmp(child->name, "Representation")) {\r
+ GF_MPD_Representation *rep;\r
+ GF_SAFEALLOC(rep, GF_MPD_Representation);\r
+ if (!rep)\r
+ return GF_OUT_OF_MEM;\r
+ memset( rep, 0, sizeof(GF_MPD_Representation));\r
+ gf_mpd_parse_representation(child, rep);\r
+ gf_list_add(period->representations, rep);\r
+ }\r
+ }\r
+ child_index++;\r
+ }\r
+\r
+ return GF_OK;\r
+}\r
+\r
+static GF_Err gf_mpd_parse_program_info(GF_XMLNode *root, GF_MPD *mpd)\r
+{\r
+ u32 att_index, child_index;\r
+ GF_XMLAttribute *att;\r
+ GF_XMLNode *child;\r
+\r
+ att_index = 0;\r
+ while (1) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ break;\r
+ } else if (!strcmp(att->name, "moreInformationURL")) {\r
+ mpd->more_info_url = gf_strdup(att->value);\r
+ }\r
+ att_index++;\r
+ }\r
+\r
+ child_index = 0;\r
+ while (1) {\r
+ child = gf_list_get(root->content, child_index);\r
+ if (!child) {\r
+ break;\r
+ } else if (child->type == GF_XML_NODE_TYPE) {\r
+ if (!strcmp(child->name, "Title")) {\r
+ GF_XMLNode *data_node = gf_list_get(child->content, 0);\r
+ if (data_node && data_node->type == GF_XML_TEXT_TYPE) {\r
+ mpd->title = gf_strdup(data_node->name);\r
+ }\r
+ } else if (!strcmp(child->name, "Source")) {\r
+ GF_XMLNode *data_node = gf_list_get(child->content, 0);\r
+ if (data_node && data_node->type == GF_XML_TEXT_TYPE) {\r
+ mpd->source = gf_strdup(data_node->name);\r
+ }\r
+ } else if (!strcmp(child->name, "Copyright")) {\r
+ GF_XMLNode *data_node = gf_list_get(child->content, 0);\r
+ if (data_node && data_node->type == GF_XML_TEXT_TYPE) {\r
+ mpd->copyright = gf_strdup(data_node->name);\r
+ }\r
+ }\r
+ }\r
+ child_index++;\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+GF_MPD *gf_mpd_new()\r
+{\r
+ GF_MPD *mpd;\r
+ GF_SAFEALLOC(mpd, GF_MPD);\r
+ if (mpd){\r
+ memset(mpd, 0, sizeof(GF_MPD));\r
+ }\r
+ return mpd;\r
+}\r
+\r
+void gf_mpd_del(GF_MPD *mpd)\r
+{\r
+ while (gf_list_count(mpd->periods)) {\r
+ GF_MPD_Period *period = gf_list_get(mpd->periods, 0);\r
+ gf_list_rem(mpd->periods, 0);\r
+ while (gf_list_count(period->representations)) {\r
+ GF_MPD_Representation *rep = gf_list_get(period->representations, 0);\r
+ gf_list_rem(period->representations, 0);\r
+\r
+ while (gf_list_count(rep->segments)) {\r
+ GF_MPD_SegmentInfo *seg = gf_list_get(rep->segments, 0);\r
+ gf_list_rem(rep->segments, 0);\r
+ if (seg->url) gf_free(seg->url);\r
+ gf_free(seg);\r
+ }\r
+ if (rep->content_protection_type) gf_free(rep->content_protection_type);\r
+ rep->content_protection_type = NULL;\r
+ if (rep->content_protection_uri) gf_free(rep->content_protection_uri);\r
+ rep->content_protection_uri = NULL;\r
+ if (rep->default_base_url) gf_free(rep->default_base_url);\r
+ rep->default_base_url = NULL;\r
+ if (rep->id) gf_free(rep->id);\r
+ rep->id = NULL;\r
+ if (rep->init_url) gf_free(rep->init_url);\r
+ rep->init_url = NULL;\r
+ if (rep->lang) gf_free(rep->lang);\r
+ rep->lang = NULL;\r
+ if (rep->mime) gf_free(rep->mime);\r
+ rep->mime = NULL;\r
+ if (rep->url_template) gf_free(rep->url_template);\r
+ rep->url_template = NULL;\r
+ if (rep->segments) gf_list_del(rep->segments);\r
+ rep->segments = NULL;\r
+ gf_free(rep);\r
+ }\r
+ gf_list_del(period->representations);\r
+ period->representations = NULL;\r
+ if (period->default_base_url) gf_free(period->default_base_url);\r
+ if (period->url_template) gf_free(period->url_template);\r
+\r
+ gf_free(period);\r
+ }\r
+ gf_list_del(mpd->periods);\r
+ mpd->periods = NULL;\r
+ if (mpd->base_url) gf_free(mpd->base_url);\r
+ mpd->base_url = NULL;\r
+ if (mpd->title) gf_free(mpd->title);\r
+ mpd->title = NULL;\r
+ if (mpd->source) gf_free(mpd->source);\r
+ mpd->source = NULL;\r
+ if (mpd->copyright) gf_free(mpd->copyright);\r
+ mpd->copyright = NULL;\r
+ if (mpd->more_info_url) gf_free(mpd->more_info_url);\r
+ mpd->more_info_url = NULL;\r
+ gf_free(mpd);\r
+}\r
+\r
+GF_Err gf_mpd_init_from_dom(GF_XMLNode *root, GF_MPD *mpd)\r
+{\r
+ u32 att_index, child_index;\r
+ GF_XMLAttribute *att;\r
+ GF_XMLNode *child;\r
+\r
+ if (!root || !mpd) return GF_BAD_PARAM;\r
+\r
+ assert( !mpd->periods );\r
+ mpd->periods = gf_list_new();\r
+\r
+ att_index = 0;\r
+ child_index = gf_list_count(root->attributes);\r
+ for (att_index = 0 ; att_index < child_index; att_index++) {\r
+ att = gf_list_get(root->attributes, att_index);\r
+ if (!att) {\r
+ continue;\r
+ } else if (!strcmp(att->name, "type")) {\r
+ if (!strcmp(att->value, "OnDemand")) mpd->type = GF_MPD_TYPE_ON_DEMAND;\r
+ else if (!strcmp(att->value, "Live")) mpd->type = GF_MPD_TYPE_LIVE;\r
+ } else if (!strcmp(att->name, "availabilityStartTime")) {\r
+ } else if (!strcmp(att->name, "availabilityEndTime")) {\r
+ } else if (!strcmp(att->name, "mediaPresentationDuration")) {\r
+ mpd->duration = gf_mpd_parse_duration(att->value);\r
+ } else if (!strcmp(att->name, "minimumUpdatePeriodMPD")) {\r
+ mpd->min_update_time = gf_mpd_parse_duration(att->value);\r
+ } else if (!strcmp(att->name, "minBufferTime")) {\r
+ mpd->min_buffer_time = gf_mpd_parse_duration(att->value);\r
+ } else if (!strcmp(att->name, "timeShiftBufferDepth")) {\r
+ mpd->time_shift_buffer_depth = gf_mpd_parse_duration(att->value);\r
+ } else if (!strcmp(att->name, "baseURL")) {\r
+ }\r
+ }\r
+\r
+ child_index = 0;\r
+ while (1) {\r
+ child = gf_list_get(root->content, child_index);\r
+ if (!child) {\r
+ break;\r
+ } else if (child->type == GF_XML_NODE_TYPE) {\r
+ if (!strcmp(child->name, "ProgramInformation")) {\r
+ gf_mpd_parse_program_info(child, mpd);\r
+ } else if (!strcmp(child->name, "Period")) {\r
+ GF_MPD_Period *period;\r
+ GF_SAFEALLOC(period, GF_MPD_Period);\r
+ if (!period)\r
+ return GF_OUT_OF_MEM;\r
+ period->representations = gf_list_new();\r
+ gf_mpd_parse_period(child, period);\r
+ gf_list_add(mpd->periods, period);\r
+ }\r
+ }\r
+ child_index++;\r
+ }\r
+ return GF_OK;\r
+}\r
+\r
+GF_Err gf_m3u8_to_mpd(GF_ClientService *service, const char *m3u8_file, const char *base_url,\r
+ const char *mpd_file,\r
+ u32 reload_count, char *mimeTypeForM3U8Segments)\r
+{\r
+ GF_Err e;\r
+ u32 i, count;\r
+ Double update_interval;\r
+ VariantPlaylist * pl = NULL;\r
+ Program *prog;\r
+ PlaylistElement *pe;\r
+ FILE *fmpd;\r
+ Bool is_end;\r
+\r
+ e = parse_root_playlist(m3u8_file, &pl, base_url);\r
+ if (e) {\r
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[M3U8] Failed to parse root playlist '%s', error = %s\n", m3u8_file, gf_error_to_string(e)));\r
+ if (pl) variant_playlist_del(pl);\r
+ pl = NULL;\r
+ return e;\r
+ }\r
+ if (mpd_file == NULL){\r
+ gf_delete_file(m3u8_file);\r
+ mpd_file = m3u8_file;\r
+ }\r
+ is_end = !pl->playlistNeedsRefresh;\r
+ i=0;\r
+ assert( pl );\r
+ assert( pl->programs );\r
+ while ((prog = gf_list_enum(pl->programs, &i))) {\r
+ u32 j=0;\r
+ while (NULL != (pe = gf_list_enum(prog->bitrates, &j))) {\r
+ if (pe->url && strstr(pe->url, ".m3u8")) {\r
+ char *suburl = gf_url_concatenate(base_url, pe->url);\r
+ if (!strcmp(base_url, suburl)) {\r
+ gf_free(suburl);\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD Generator] Not downloading, programs are identical for %s...\n", pe->url));\r
+ continue;\r
+ }\r
+ if (service) {\r
+ GF_DownloadSession *sess = gf_term_download_new(service, suburl, GF_NETIO_SESSION_NOT_THREADED, NULL, NULL);\r
+ if (!sess) {\r
+ gf_free(suburl);\r
+ break;\r
+ }\r
+ e = gf_dm_sess_process(sess);\r
+ if (e==GF_OK) {\r
+ e = parse_sub_playlist(gf_dm_sess_get_cache_name(sess), &pl, suburl, prog, pe);\r
+ }\r
+ gf_term_download_del(sess);\r
+ gf_free(suburl);\r
+ } else { /* for use in MP4Box */\r
+ extern GF_Err gf_dm_wget(const char *url, const char *filename);\r
+ e = gf_dm_wget(suburl, "tmp.m3u8");\r
+ if (e==GF_OK) {\r
+ e = parse_sub_playlist("tmp.m3u8", &pl, suburl, prog, pe);\r
+ }\r
+ gf_delete_file("tmp.m3u8");\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ update_interval = 0;\r
+ prog = gf_list_get(pl->programs, 0);\r
+ assert( prog );\r
+ pe = gf_list_last(prog->bitrates);\r
+ assert( pe );\r
+ /*update interval is set to the duration of the last media file with rules defined in http live streaming RFC section 6.3.4*/\r
+ switch (reload_count) {\r
+ case 0:\r
+ update_interval = pe->durationInfo;\r
+ break;\r
+ case 1:\r
+ update_interval = pe->durationInfo/2;\r
+ break;\r
+ case 2:\r
+ update_interval = 3*(pe->durationInfo/2);\r
+ break;\r
+ default:\r
+ update_interval = 3*(pe->durationInfo);\r
+ break;\r
+ }\r
+ if (is_end || ((pe->elementType == TYPE_PLAYLIST) && pe->element.playlist.is_ended)) {\r
+ update_interval = 0;\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD Generator] NO NEED to refresh playlist !\n"));\r
+ } else {\r
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("[MPD Generator] Playlist will be refreshed every %g seconds, len=%d\n", update_interval, pe->durationInfo));\r
+ }\r
+\r
+ assert( mpd_file );\r
+ fmpd = gf_f64_open(mpd_file, "wt");\r
+ if (!fmpd){\r
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[MPD Generator] Cannot write to temp file %s!\n", mpd_file));\r
+ variant_playlist_del(pl);\r
+ return GF_IO_ERR;\r
+ }\r
+ fprintf(fmpd, "<MPD type=\"Live\" xmlns=\"urn:mpeg:mpegB:schema:DASH:MPD:DIS2011\" profiles=\"urn:mpeg:mpegB:profile:dash:full:2011\"");\r
+ if (update_interval) fprintf(fmpd, " minimumUpdatePeriodMPD=\"PT%02.2gS\"", update_interval);\r
+ fprintf(fmpd, ">\n");\r
+\r
+ fprintf(fmpd, " <ProgramInformation moreInformationURL=\"http://gpac.sourceforge.net\">\n");\r
+ {\r
+ char * title = pe->title;\r
+ if (!title || strlen(title) < 2)\r
+ title = pe->url;\r
+ fprintf(fmpd, " <Title>%s</Title>\n", title );\r
+ }\r
+ fprintf(fmpd, " <Copyright>Generated from URL %s</Copyright>\n", base_url );\r
+ fprintf(fmpd, " <Source>Generated by GPAC %s from %s</Source>\n", GPAC_FULL_VERSION, base_url);\r
+\r
+ fprintf(fmpd, " </ProgramInformation>\n");\r
+ fprintf(fmpd, " <Period start=\"PT0S\">\n");\r
+\r
+ count = gf_list_count(pl->programs);\r
+ for (i=0; i<count; i++) {\r
+ u32 j, count2;\r
+ Program *prog = gf_list_get(pl->programs, i);\r
+ count2 = gf_list_count(prog->bitrates);\r
+ for (j = 0; j<count2; j++) {\r
+ PlaylistElement *pe = gf_list_get(prog->bitrates, j);\r
+ if (pe->elementType == TYPE_PLAYLIST) {\r
+ u32 k, count3;\r
+ char *base_url = gf_strdup(pe->url);\r
+ char *sep = strrchr(base_url, '/');\r
+ if (sep) *(sep+1) = 0;\r
+ if (pe->codecs && (pe->codecs[0] = '\"')) {\r
+ u32 len = strlen(pe->codecs);\r
+ strncpy(pe->codecs, pe->codecs+1, len-1);\r
+ pe->codecs[len-2] = 0;\r
+ }\r
+ /* SOUCHAY : if mime-type is still unknown, do not try to add codec information since it would be wrong */\r
+ if (!strcmp(M3U8_UNKOWN_MIME_TYPE, mimeTypeForM3U8Segments)){\r
+ fprintf(fmpd, " <Representation mimeType=\"%s\" bandwidth=\"%d\">\n", mimeTypeForM3U8Segments, pe->bandwidth);\r
+ } else {\r
+ fprintf(fmpd, " <Representation mimeType=\"%s%s%s\" bandwidth=\"%d\">\n", mimeTypeForM3U8Segments, (pe->codecs ? ";codecs=":""), (pe->codecs ? pe->codecs:""), pe->bandwidth);\r
+ }\r
+ fprintf(fmpd, "\n <SegmentInfo duration=\"PT%dS\" baseURL=\"%s\">\n", pe->durationInfo, base_url);\r
+ count3 = gf_list_count(pe->element.playlist.elements);\r
+ update_interval = (count3 - 1) * pe->durationInfo * 1000;\r
+ for (k=0; k<count3; k++) {\r
+ u32 cmp = 0;\r
+ PlaylistElement *elt = gf_list_get(pe->element.playlist.elements, k);\r
+ while (base_url[cmp] == elt->url[cmp]) cmp++;\r
+ fprintf(fmpd, " <Url sourceURL=\"%s\"/>\n", elt->url+cmp);\r
+ }\r
+ fprintf(fmpd, " </SegmentInfo>\n");\r
+ fprintf(fmpd, " </Representation>\n");\r
+ gf_free(base_url);\r
+ } else if (pe->elementType == TYPE_STREAM) {\r
+ fprintf(stdout, "NOT SUPPORTED: M3U8 Stream\n");\r
+ }\r
+ }\r
+ }\r
+ fprintf(fmpd, " </Period>\n");\r
+ fprintf(fmpd, "</MPD>");\r
+ fclose(fmpd);\r
+ variant_playlist_del(pl);\r
+ return GF_OK;\r
+}\r
+\r
#include <string.h>
#define DUMP_MPE_IP_DATAGRAMS
+//#define FORCE_DISABLE_MPEG4SL_OVER_MPEG2TS
#ifdef DUMP_MPE_IP_DATAGRAMS
#include <gpac/dvb_mpe.h>
pck.flags = 0;
while (sc_pos<data_len) {
- u32 sctype=0;
+ /* u32 sctype=0;*/
unsigned char *start = (unsigned char *)memchr(data+sc_pos, 0, data_len-sc_pos);
if (!start) break;
sc_pos = start - data;
if (nal_type==GF_AVC_NALU_ACCESS_UNIT) {
pck.flags = GF_M2TS_PES_PCK_AU_START;
force_new_au = 0;
- }
+ } else if (nal_type==GF_AVC_NALU_IDR_SLICE) {
+ pck.flags = GF_M2TS_PES_PCK_RAP;
+ }
else pck.flags = 0;
ts->on_event(ts, GF_M2TS_EVT_PES_PCK, &pck);
pck.data_len = data_len+1;
}
nal_type = pck.data[4] & 0x1F;
- if (nal_type==GF_AVC_NALU_ACCESS_UNIT)
+ if (nal_type==GF_AVC_NALU_ACCESS_UNIT) {
pck.flags = GF_M2TS_PES_PCK_AU_START;
+ } else if (nal_type==GF_AVC_NALU_IDR_SLICE) {
+ pck.flags = GF_M2TS_PES_PCK_RAP;
+ }
}
if (force_new_au) {
pck.flags |= GF_M2TS_PES_PCK_AU_START;
pck.data_len = hdr.frame_size - hdr_size;
ts->on_event(ts, GF_M2TS_EVT_PES_PCK, &pck);
- sc_pos += hdr.frame_size;
+ sc_pos += hdr.frame_size;
start = sc_pos;
/*update PTS in case we don't get any update*/
if (pes->aud_sr) {
{
GF_M2TS_SectionFilter *sec;
GF_SAFEALLOC(sec, GF_M2TS_SectionFilter);
+ if (!sec){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[MPEG-2 TS] gf_m2ts_section_filter_new : OUT OF MEMORY\n"));
+ return NULL;
+ }
sec->cc = -1;
sec->process_section = process_section_callback;
sec->process_individual = process_individual;
GF_M2TS_Section *section;
/*skip if already received*/
- if (status & GF_M2TS_TABLE_REPEAT)
+ if (status & GF_M2TS_TABLE_REPEAT)
if (!(es->flags & GF_M2TS_ES_SEND_REPEATED_SECTIONS))
return;
tag = data[4];
len = data[5];
while (info_length > first_loop_len) {
+#ifndef FORCE_DISABLE_MPEG4SL_OVER_MPEG2TS
if (tag == GF_M2TS_MPEG4_IOD_DESCRIPTOR) {
u8 scope, label;
u32 size;
gf_odf_parse_descriptor(iod_bs , (GF_Descriptor **) &pmt->program->pmt_iod, &size);
gf_bs_del(iod_bs );
} else {
+#else
+ {
+#endif
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] Skipping descriptor (0x%x) and others not supported\n", tag));
}
first_loop_len += 2 + len;
pes->lang = GF_4CC(' ', data[2], data[3], data[4]);
break;
case GF_M2TS_MPEG4_SL_DESCRIPTOR:
+#ifdef FORCE_DISABLE_MPEG4SL_OVER_MPEG2TS
+ es->mpeg4_es_id = es->pid;
+#else
es->mpeg4_es_id = ((data[2] & 0x1f) << 8) | data[3];
+#endif
es->flags |= GF_M2TS_ES_IS_SL;
break;
case GF_M2TS_REGISTRATION_DESCRIPTOR:
pes->sub.type = data[5];
pes->sub.composition_page_id = (data[6]<<8) | data[7];
pes->sub.ancillary_page_id = (data[8]<<8) | data[9];
-
+
es->stream_type = GF_M2TS_DVB_SUBTITLE;
break;
case GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR:
case GF_M2TS_DVB_VBI_DATA_DESCRIPTOR:
es->stream_type = GF_M2TS_DVB_VBI;
break;
-
+
default:
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] skipping descriptor (0x%x) not supported\n", tag));
break;
if (nb_es) {
evt_type = (status&GF_M2TS_TABLE_FOUND) ? GF_M2TS_EVT_PMT_FOUND : GF_M2TS_EVT_PMT_UPDATE;
if (ts->on_event) ts->on_event(ts, evt_type, pmt->program);
+ } else {
+ /* if we found no new ES it's simply a repeat of the PMT */
+ if (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);
}
}
if (ts->on_event) ts->on_event(ts, evt_type, NULL);
}
+static void gf_m2ts_process_cat(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
+{
+ u32 evt_type;
+/*
+ GF_M2TS_Program *prog;
+ GF_M2TS_SECTION_ES *pmt;
+ u32 i, nb_progs;
+ u32 nb_sections;
+ u32 data_size;
+ unsigned char *data;
+ GF_M2TS_Section *section;
+*/
+
+ /*wait for the last section */
+ if (!(status&GF_M2TS_TABLE_END)) return;
+
+ /*skip if already received*/
+ if (status&GF_M2TS_TABLE_REPEAT) {
+ if (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_CAT_REPEAT, NULL);
+ return;
+ }
+/*
+ nb_sections = gf_list_count(sections);
+ if (nb_sections > 1) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("CAT on multiple sections not supported\n"));
+ }
+
+ section = (GF_M2TS_Section *)gf_list_get(sections, 0);
+ data = section->data;
+ data_size = section->data_size;
+
+ nb_progs = data_size / 4;
+
+ for (i=0; i<nb_progs; i++) {
+ u16 number, pid;
+ number = (data[0]<<8) | data[1];
+ pid = (data[2]&0x1f)<<8 | data[3];
+ data += 4;
+ if (number==0) {
+ if (!ts->nit) {
+ ts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);
+ }
+ } else {
+ GF_SAFEALLOC(prog, GF_M2TS_Program);
+ prog->streams = gf_list_new();
+ prog->pmt_pid = pid;
+ prog->number = number;
+ gf_list_add(ts->programs, prog);
+ GF_SAFEALLOC(pmt, GF_M2TS_SECTION_ES);
+ pmt->flags = GF_M2TS_ES_IS_SECTION;
+ gf_list_add(prog->streams, pmt);
+ pmt->pid = prog->pmt_pid;
+ pmt->program = prog;
+ ts->ess[pmt->pid] = (GF_M2TS_ES *)pmt;
+ pmt->sec = gf_m2ts_section_filter_new(gf_m2ts_process_pmt, 0);
+ }
+ }
+*/
+
+ evt_type = (status&GF_M2TS_TABLE_UPDATE) ? GF_M2TS_EVT_CAT_UPDATE : GF_M2TS_EVT_CAT_FOUND;
+ if (ts->on_event) ts->on_event(ts, evt_type, NULL);
+}
static GFINLINE u64 gf_m2ts_get_pts(unsigned char *data)
{
if (hdr->payload_start) {
flush_pes = 1;
+ pes->pes_start_packet_number = ts->pck_number;
+ pes->before_last_pcr_value = pes->program->before_last_pcr_value;
+ pes->before_last_pcr_value_pck_number = pes->program->before_last_pcr_value_pck_number;
+ pes->last_pcr_value = pes->program->last_pcr_value;
+ pes->last_pcr_value_pck_number = pes->program->last_pcr_value_pck_number;
} else if (pes->pes_len && (pes->data_len + data_size == pes->pes_len + 6)) {
/* 6 = startcode+stream_id+length*/
/*reassemble pes*/
/*OK read header*/
gf_m2ts_pes_header(pes, pes->data+3, pes->data_len-3, &pesh);
+ {
+ GF_M2TS_PES_PCK pck;
+ memset(&pck, 0, sizeof(GF_M2TS_PES_PCK));
+ pck.PTS = pesh.PTS;
+ pck.DTS = pesh.DTS;
+ pck.stream = pes;
+ if (pes->rap) pck.flags |= GF_M2TS_PES_PCK_RAP;
+ pes->pes_end_packet_number = ts->pck_number;
+ if (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PES_TIMING, &pck);
+ }
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] PID %d Got PES header PTS %d\n", pes->pid, pesh.PTS));
/*3-byte start-code + 6 bytes header + hdr extensions*/
len = 9 + pesh.hdr_data_len;
- pes->reframe(ts, pes, pesh.DTS, pesh.PTS, pes->data+len, pes->data_len-len);
+ if (pes->reframe)
+ pes->reframe(ts, pes, pesh.DTS, pesh.PTS, pes->data+len, pes->data_len-len);
}
/*SL-packetized stream*/
else if ((u8) pes->data[3]==0xfa) {
pes->data_len += data_size;
if (paf && paf->random_access_indicator) pes->rap = 1;
- if (hdr->payload_start && !pes->pes_len && (pes->data_len>=6)) pes->pes_len = (pes->data[4]<<8) | pes->data[5];
-
+ if (hdr->payload_start && !pes->pes_len && (pes->data_len>=6)) {
+ pes->pes_len = (pes->data[4]<<8) | pes->data[5];
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] PID %d: Got PES packet len %d\n", pes->pid, pes->pes_len));
+ }
}
-static void gf_m2ts_get_adaptation_field(GF_M2TS_Demuxer *ts, GF_M2TS_AdaptationField *paf, unsigned char *data, u32 size)
+static void gf_m2ts_get_adaptation_field(GF_M2TS_Demuxer *ts, GF_M2TS_AdaptationField *paf, unsigned char *data, u32 size, u32 pid)
{
paf->discontinuity_indicator = (data[0] & 0x80) ? 1 : 0;
paf->random_access_indicator = (data[0] & 0x40) ? 1 : 0;
paf->PCR_ext = ((data[5] & 1) << 8) | data[6];
}
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] PID %d: Adaptation Field found: Discontinuity %d - RAP %d - PCR: "LLD"\n", pid, paf->discontinuity_indicator, paf->random_access_indicator, paf->PCR_flag ? paf->PCR_base * 300 + paf->PCR_ext : 0));
+
#if 0
if (paf->OPCR_flag == 1){
u32 base = (data[7] << 24) | (data[8] << 16) | (data[9] << 8) | data[10];
u32 payload_size, af_size;
u32 pos = 0;
+ ts->pck_number++;
+
/* read TS packet header*/
hdr.sync = data[0];
hdr.error = (data[1] & 0x80) ? 1 : 0;
}
paf = ⁡
memset(paf, 0, sizeof(GF_M2TS_AdaptationField));
- gf_m2ts_get_adaptation_field(ts, paf, data+5, af_size);
+ gf_m2ts_get_adaptation_field(ts, paf, data+5, af_size, hdr.pid);
pos += 1+af_size;
payload_size = 183 - af_size;
break;
}
paf = ⁡
memset(paf, 0, sizeof(GF_M2TS_AdaptationField));
- gf_m2ts_get_adaptation_field(ts, paf, data+5, af_size);
+ gf_m2ts_get_adaptation_field(ts, paf, data+5, af_size, hdr.pid);
payload_size = 0;
break;
/*reserved*/
if (hdr.pid == GF_M2TS_PID_PAT) {
gf_m2ts_gather_section(ts, ts->pat, NULL, &hdr, data, payload_size);
return;
+ } else if (hdr.pid == GF_M2TS_PID_CAT) {
+ gf_m2ts_gather_section(ts, ts->cat, NULL, &hdr, data, payload_size);
+ return;
} else {
es = ts->ess[hdr.pid];
if (paf && paf->PCR_flag && es) {
GF_M2TS_PES_PCK pck;
memset(&pck, 0, sizeof(GF_M2TS_PES_PCK));
- pck.PTS = paf->PCR_base * 300 + paf->PCR_ext;
+ es->program->before_last_pcr_value = es->program->last_pcr_value;
+ es->program->before_last_pcr_value_pck_number = es->program->last_pcr_value_pck_number;
+ es->program->last_pcr_value_pck_number = ts->pck_number;
+ es->program->last_pcr_value = paf->PCR_base * 300 + paf->PCR_ext;
+ pck.PTS = es->program->last_pcr_value;
pck.stream = (GF_M2TS_PES *)es;
+ if (paf->discontinuity_indicator) pck.flags = GF_M2TS_PES_PCK_DISCONTINUITY;
if (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PES_PCR, &pck);
}
return;
void gf_m2ts_reset_parsers(GF_M2TS_Demuxer *ts)
{
u32 i;
+ ts->pck_number = 0;
for (i=0; i<GF_M2TS_MAX_STREAMS; i++) {
GF_M2TS_ES *es = (GF_M2TS_ES *) ts->ess[i];
if (!es) continue;
if (pes->pid==pes->program->pmt_pid) return GF_BAD_PARAM;
- if (mode==GF_M2TS_PES_FRAMING_RAW) {
+ switch (mode) {
+ case GF_M2TS_PES_FRAMING_RAW:
pes->reframe = gf_m2ts_reframe_default;
- return GF_OK;
- } else if (mode==GF_M2TS_PES_FRAMING_SKIP) {
+ break;
+ case GF_M2TS_PES_FRAMING_SKIP:
if (pes->data) {
gf_free(pes->data);
pes->data = NULL;
pes->data_len = 0;
pes->pes_len = 0;
pes->reframe = NULL;
- return GF_OK;
- } else { // mode==GF_M2TS_PES_FRAMING_DEFAULT
+ break;
+ case GF_M2TS_PES_FRAMING_SKIP_NO_RESET:
+ pes->reframe = NULL;
+ break;
+ case GF_M2TS_PES_FRAMING_DEFAULT:
+ default:
switch (pes->stream_type) {
case GF_M2TS_VIDEO_MPEG1:
case GF_M2TS_VIDEO_MPEG2:
pes->reframe = gf_m2ts_reframe_default;
break;
}
- return GF_OK;
+ break;
}
+ return GF_OK;
}
GF_M2TS_Demuxer *gf_m2ts_demux_new()
ts->SDTs = gf_list_new();
ts->pat = gf_m2ts_section_filter_new(gf_m2ts_process_pat, 0);
+ ts->cat = gf_m2ts_section_filter_new(gf_m2ts_process_cat, 0);
ts->sdt = gf_m2ts_section_filter_new(gf_m2ts_process_sdt, 1);
ts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);
ts->eit = gf_m2ts_section_filter_new(NULL/*gf_m2ts_process_eit*/, 1);
{
u32 i;
if (ts->pat) gf_m2ts_section_filter_del(ts->pat);
+ if (ts->cat) gf_m2ts_section_filter_del(ts->cat);
if (ts->sdt) gf_m2ts_section_filter_del(ts->sdt);
if (ts->nit) gf_m2ts_section_filter_del(ts->nit);
if (ts->eit) gf_m2ts_section_filter_del(ts->eit);
switch (state) {
case 0:
- if (sscanf(szLine, "%d", &line) != 1) {
+ if (sscanf(szLine, "%u", &line) != 1) {
e = gf_import_message(import, GF_CORRUPTED_DATA, "Bad SRT formatting - expecting number got \"%s\"", szLine);
goto exit;
}
state = 1;
break;
case 1:
- if (sscanf(szLine, "%d:%d:%d,%d --> %d:%d:%d,%d", &sh, &sm, &ss, &sms, &eh, &em, &es, &ems) != 8) {
+ if (sscanf(szLine, "%u:%u:%u,%u --> %u:%u:%u,%u", &sh, &sm, &ss, &sms, &eh, &em, &es, &ems) != 8) {
e = gf_import_message(import, GF_CORRUPTED_DATA, "Error scanning SRT frame %d timing", curLine);
goto exit;
}
while ( (att=(GF_XMLAttribute*)gf_list_enum(node->attributes, &j))) {
if (!strcmp(att->name, "sampleTime")) {
u32 h, m, s, ms;
- if (sscanf(att->value, "%d:%d:%d.%d", &h, &m, &s, &ms) == 4) {
+ if (sscanf(att->value, "%u:%u:%u.%u", &h, &m, &s, &ms) == 4) {
ts = (h*3600 + m*60 + s)*1000 + ms;
} else {
ts = (u32) (atof(att->value) * 1000);
u32 r, g, b, a;
u32 res, v;
r = g = b = a = 0;
- if (sscanf(value, "%d%%, %d%%, %d%%, %d%%", &r, &g, &b, &a) != 4) {
+ if (sscanf(value, "%u%%, %u%%, %u%%, %u%%", &r, &g, &b, &a) != 4) {
gf_import_message(import, GF_OK, "Warning: color badly formatted");
}
v = (u32) (a*255/100);
static lang_type lang_table[] =
{
- {"--", "und" },
- {"cc", "und" },
- {"aa", "aar" },
- {"ab", "abk" },
- {"af", "afr" },
- {"am", "amh" },
- {"ar", "ara" },
- {"as", "ast" },
- {"ay", "aym" },
- {"az", "aze" },
- {"ba", "bak" },
- {"be", "bel" },
- {"bg", "bul" },
- {"bh", "bih" },
- {"bi", "bis" },
- {"bn", "ben" },
- {"bo", "tib" },
- {"br", "bre" },
- {"ca", "cat" },
- {"co", "cos" },
- {"cs", "cze" },
- {"cy", "wel" },
- {"da", "dan" },
- {"de", "ger" },
- {"dz", "dzo" },
- {"el", "gre" },
- {"en", "eng" },
- {"eo", "epo" },
- {"es", "spa" },
- {"et", "est" },
- {"eu", "baq" },
- {"fa", "per" },
- {"fi", "fin" },
- {"fj", "fij" },
- {"fo", "fao" },
- {"fr", "fre" },
- {"fy", "fry" },
- {"ga", "gle" },
- {"gl", "glg" },
- {"gn", "grn" },
- {"gu", "guj" },
- {"ha", "hau" },
- {"he", "heb" },
- {"hi", "hin" },
- {"hr", "scr" },
- {"hu", "hun" },
- {"hy", "arm" },
- {"ia", "ina" },
- {"id", "ind" },
- {"ik", "ipk" },
- {"is", "ice" },
- {"it", "ita" },
- {"iu", "iku" },
- {"ja", "jpn" },
- {"jv", "jav" },
- {"ka", "geo" },
- {"kk", "kaz" },
- {"kl", "kal" },
- {"km", "khm" },
- {"kn", "kan" },
- {"ko", "kor" },
- {"ks", "kas" },
- {"ku", "kur" },
- {"ky", "kir" },
- {"la", "lat" },
- {"ln", "lin" },
- {"lo", "lao" },
- {"lt", "lit" },
- {"lv", "lav" },
- {"mg", "mlg" },
- {"mi", "mao" },
- {"mk", "mac" },
- {"ml", "mlt" },
- {"mn", "mon" },
- {"mo", "mol" },
- {"mr", "mar" },
- {"ms", "may" },
- {"my", "bur" },
- {"na", "nau" },
- {"ne", "nep" },
- {"nl", "dut" },
- {"no", "nor" },
- {"oc", "oci" },
- {"om", "orm" },
- {"or", "ori" },
- {"pa", "pan" },
- {"pl", "pol" },
- {"ps", "pus" },
- {"pt", "por" },
- {"qu", "que" },
- {"rm", "roh" },
- {"rn", "run" },
- {"ro", "rum" },
- {"ru", "rus" },
- {"rw", "kin" },
- {"sa", "san" },
- {"sd", "snd" },
- {"sg", "sag" },
- {"sh", "scr" },
- {"si", "sin" },
- {"sk", "slo" },
- {"sl", "slv" },
- {"sm", "smo" },
- {"sn", "sna" },
- {"so", "som" },
- {"sq", "alb" },
- {"sr", "srp" },
- {"ss", "ssw" },
- {"st", "sot" },
- {"su", "sun" },
- {"sv", "swe" },
- {"sw", "swa" },
- {"ta", "tam" },
- {"te", "tel" },
- {"tg", "tgk" },
- {"th", "tha" },
- {"ti", "tir" },
- {"tk", "tuk" },
- {"tl", "tgl" },
- {"tn", "tsn" },
- {"to", "tog" },
- {"tr", "tur" },
- {"ts", "tso" },
- {"tt", "tat" },
- {"tw", "twi" },
- {"ug", "uig" },
- {"uk", "ukr" },
- {"ur", "urd" },
- {"uz", "uzb" },
- {"vi", "vie" },
- {"vo", "vol" },
- {"wo", "wol" },
- {"xh", "xho" },
- {"yi", "yid" },
- {"yo", "yor" },
- {"za", "zha" },
- {"zh", "chi" },
- {"zu", "zul" }
+{"--", "und" },
+{"aa", "aar" },
+{"ab", "abk" },
+{"af", "afr" },
+{"am", "amh" },
+{"ar", "ara" },
+{"as", "ast" },
+{"ay", "aym" },
+{"az", "aze" },
+{"ba", "bak" },
+{"be", "bel" },
+{"bg", "bul" },
+{"bh", "bih" },
+{"bi", "bis" },
+{"bn", "ben" },
+{"bo", "bod" }, // was "tib" (Tibetan)
+{"br", "bre" },
+{"ca", "cat" },
+{"cc", "und" },
+{"co", "cos" },
+{"cs", "ces" }, // was "cze" (Czech)
+{"cy", "cym" }, // was "wel" (Welsh)
+{"da", "dan" },
+{"de", "deu" }, // was "ger" (German)
+{"dz", "dzo" },
+{"el", "ell" }, // was "gre" (Greek, Modern (1453-))
+{"en", "eng" },
+{"eo", "epo" },
+{"es", "spa" },
+{"et", "est" },
+{"eu", "eus" }, // was "baq" (Basque)
+{"fa", "fas" }, // was "per" (Persian)
+{"fi", "fin" },
+{"fj", "fij" },
+{"fo", "fao" },
+{"fr", "fra" }, // was "fre" (French)
+{"fy", "fry" },
+{"ga", "gle" },
+{"gl", "glg" },
+{"gn", "grn" },
+{"gu", "guj" },
+{"ha", "hau" },
+{"he", "heb" },
+{"hi", "hin" },
+{"hr", "scr" },
+{"hu", "hun" },
+{"hy", "hye" }, // was "arm" (Armenian)
+{"ia", "ina" },
+{"id", "ind" },
+{"ik", "ipk" },
+{"is", "isl" }, // was "ice" (Icelandic)
+{"it", "ita" },
+{"iu", "iku" },
+{"ja", "jpn" },
+{"jv", "jav" },
+{"ka", "kat" }, // was "geo" (Georgian)
+{"kk", "kaz" },
+{"kl", "kal" },
+{"km", "khm" },
+{"kn", "kan" },
+{"ko", "kor" },
+{"ks", "kas" },
+{"ku", "kur" },
+{"ky", "kir" },
+{"la", "lat" },
+{"ln", "lin" },
+{"lo", "lao" },
+{"lt", "lit" },
+{"lv", "lav" },
+{"mg", "mlg" },
+{"mi", "mri" }, // was "mao" (Maori)
+{"mk", "mkd" }, // was "mac" (Macedonian)
+{"ml", "mlt" },
+{"mn", "mon" },
+{"mo", "mol" },
+{"mr", "mar" },
+{"ms", "msa" }, // was "may" (Malay)
+{"my", "mya" }, // was "bur" (Burmese)
+{"na", "nau" },
+{"ne", "nep" },
+{"nl", "nld" }, // was "dut" (Dutch; Flemish)
+{"no", "nor" },
+{"oc", "oci" },
+{"om", "orm" },
+{"or", "ori" },
+{"pa", "pan" },
+{"pl", "pol" },
+{"ps", "pus" },
+{"pt", "por" },
+{"qu", "que" },
+{"rm", "roh" },
+{"rn", "run" },
+{"ro", "ron" }, // was "rum" (Romanian; Moldavian; Moldovan)
+{"ru", "rus" },
+{"rw", "kin" },
+{"sa", "san" },
+{"sd", "snd" },
+{"sg", "sag" },
+{"sh", "scr" },
+{"si", "sin" },
+{"sk", "slk" }, // was "slo" (Slovak)
+{"sl", "slv" },
+{"sm", "smo" },
+{"sn", "sna" },
+{"so", "som" },
+{"sq", "sqi" }, // was "alb" (Albanian)
+{"sr", "srp" },
+{"ss", "ssw" },
+{"st", "sot" },
+{"su", "sun" },
+{"sv", "swe" },
+{"sw", "swa" },
+{"ta", "tam" },
+{"te", "tel" },
+{"tg", "tgk" },
+{"th", "tha" },
+{"ti", "tir" },
+{"tk", "tuk" },
+{"tl", "tgl" },
+{"tn", "tsn" },
+{"to", "tog" },
+{"tr", "tur" },
+{"ts", "tso" },
+{"tt", "tat" },
+{"tw", "twi" },
+{"ug", "uig" },
+{"uk", "ukr" },
+{"ur", "urd" },
+{"uz", "uzb" },
+{"vi", "vie" },
+{"vo", "vol" },
+{"wo", "wol" },
+{"xh", "xho" },
+{"yi", "yid" },
+{"yo", "yor" },
+{"za", "zha" },
+{"zh", "zho" }, // was "chi" (Chinese)
+{"zu", "zul" }
};
+
+
s32 vobsub_lang_name(u16 id)
{
u16 lang_id;
#include <gpac/internal/odf_dev.h>
#include <gpac/constants.h>
-
+#ifndef GPAC_DISABLE_AV_PARSERS
+#include <gpac/avparse.h>
+#endif
GF_EXPORT
const char *gf_odf_stream_type_name(u32 streamType)
GF_Err e;
GF_BitStream *bs;
GF_BIFSConfig *cfg;
+
+ if (oti>=GPAC_OTI_SCENE_BIFS_EXTENDED) return NULL;
+
if (!dsi || !dsi->data || !dsi->dataLength ) {
/* Hack for T-DMB non compliant streams (OnTimeTek ?) */
cfg = (GF_BIFSConfig *) gf_odf_desc_new(GF_ODF_BIFS_CFG_TAG);
return e;
}
+GF_EXPORT
+const char *gf_afx_get_type_description(u8 afx_code)
+{
+ switch (afx_code) {
+ case GPAC_AFX_3DMC:
+ return "AFX 3D Mesh Compression";
+ case GPAC_AFX_WAVELET_SUBDIVISION:
+ return "AFX Wavelet Subdivision Surface";
+ case GPAC_AFX_MESHGRID:
+ return "AFX Mesh Grid";
+ case GPAC_AFX_COORDINATE_INTERPOLATOR:
+ return "AFX Coordinate Interpolator";
+ case GPAC_AFX_ORIENTATION_INTERPOLATOR:
+ return "AFX Orientation Interpolator";
+ case GPAC_AFX_POSITION_INTERPOLATOR:
+ return "AFX Position Interpolator";
+ case GPAC_AFX_OCTREE_IMAGE:
+ return "AFX Octree Image";
+ case GPAC_AFX_BBA:
+ return "AFX BBA";
+ case GPAC_AFX_POINT_TEXTURE:
+ return "AFX Point Texture";
+ case GPAC_AFX_3DMC_EXT:
+ return "AFX 3D Mesh Compression Extension";
+ case GPAC_AFX_FOOTPRINT:
+ return "AFX FootPrint Representation";
+ case GPAC_AFX_ANIMATED_MESH:
+ return "AFX Animated Mesh Compression";
+ case GPAC_AFX_SCALABLE_COMPLEXITY:
+ return "AFX Scalable Complexity Representation";
+ default:
+ break;
+ }
+ return "AFX Unknown";
+}
+
+
+GF_EXPORT
+const char *gf_esd_get_textual_description(GF_ESD *esd)
+{
+ if (!esd || !esd->decoderConfig) return "Bad parameter";
+
+ switch (esd->decoderConfig->streamType) {
+ case GF_STREAM_OD:
+ return "MPEG-4 Object Descriptor";
+ case GF_STREAM_OCR:
+ return "MPEG-4 Object Clock Reference";
+ case GF_STREAM_SCENE:
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case 0x0:
+ case 0x1:
+ case 0x2:
+ case 0x3:
+ case 0xFF:
+ return "MPEG-4 BIFS Scene Description";
+ case GPAC_OTI_SCENE_BIFS_EXTENDED:
+ return "MPEG-4 Extended BIFS Scene Description";
+ case GPAC_OTI_SCENE_AFX:
+ if (!esd->decoderConfig->decoderSpecificInfo || !esd->decoderConfig->decoderSpecificInfo->data)
+ return "AFX Unknown";
+ return gf_afx_get_type_description(esd->decoderConfig->decoderSpecificInfo->data[0]);
+ case GPAC_OTI_SCENE_LASER:
+ {
+ GF_LASERConfig l_cfg;
+ gf_odf_get_laser_config(esd->decoderConfig->decoderSpecificInfo, &l_cfg);
+ if (! l_cfg.newSceneIndicator ) return "LASeR Scene Segment Description";
+ }
+ return "LASeR Scene Description";
+ case GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE:
+ return "MPEG-4 Synthesized Texture";
+ case GPAC_OTI_SCENE_SAF:
+ return "MPEG-4 SAF";
+ case GPAC_OTI_3GPP2_CMF:
+ return "3GPP2 CMF";
+ default:
+ return "Unknown Scene Type";
+ }
+ break;
+ case GF_STREAM_VISUAL:
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_VIDEO_MPEG2_SIMPLE:
+ return "MPEG-2 Visual Simple Profile";
+ case GPAC_OTI_VIDEO_MPEG2_MAIN:
+ return "MPEG-2 Visual Main Profile";
+ case GPAC_OTI_VIDEO_MPEG2_SNR:
+ return "MPEG-2 Visual SNR Profile";
+ case GPAC_OTI_VIDEO_MPEG2_SPATIAL:
+ return "MPEG-2 Visual SNR Profile";
+ case GPAC_OTI_VIDEO_MPEG2_HIGH:
+ return "MPEG-2 Visual SNR Profile";
+ case GPAC_OTI_VIDEO_MPEG2_422:
+ return "MPEG-2 Visual SNR Profile";
+ case GPAC_OTI_VIDEO_MPEG1:
+ return "MPEG-1 Video";
+ case GPAC_OTI_IMAGE_JPEG:
+ return "JPEG Image";
+ case GPAC_OTI_IMAGE_PNG:
+ return "PNG Image";
+ case GPAC_OTI_IMAGE_JPEG_2000:
+ return "JPEG2000 Image";
+ case GPAC_OTI_VIDEO_MPEG4_PART2:
+ return "MPEG-4 Part 2 Video";
+ case GPAC_OTI_VIDEO_AVC:
+ return "MPEG-4 AVC|H264 Video";
+ case GPAC_OTI_VIDEO_AVC_PS:
+ return "MPEG-4 AVC|H264 Parameter Set";
+ case GPAC_OTI_MEDIA_FFMPEG:
+ return "GPAC FFMPEG Private Video";
+ case GPAC_OTI_VIDEO_SMPTE_VC1:
+ return "SMPTE VC-1 Video";
+ case GPAC_OTI_VIDEO_DIRAC:
+ return "Dirac Video";
+ default:
+ return "Unknown Video type";
+ }
+ break;
+ case GF_STREAM_AUDIO:
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_AUDIO_AAC_MPEG2_MP:
+ return "MPEG-2 AAC Main Profile";
+ case GPAC_OTI_AUDIO_AAC_MPEG2_LCP:
+ return "MPEG-2 AAC Low Complexity Profile";
+ case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP:
+ return "MPEG-2 AAC Scaleable Sampling Rate Profile";
+ case GPAC_OTI_AUDIO_MPEG2_PART3:
+ return "MPEG-2 Audio Part 3";
+ case GPAC_OTI_AUDIO_MPEG1:
+ return "MPEG-1 Audio";
+ case GPAC_OTI_AUDIO_AAC_MPEG4:
+ {
+#ifdef GPAC_DISABLE_AV_PARSERS
+ return "MPEG-4 AAC";
+#else
+ GF_M4ADecSpecInfo a_cfg;
+ if (!esd->decoderConfig->decoderSpecificInfo) return "MPEG-4 AAC";
+ gf_m4a_get_config(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg);
+ return gf_m4a_object_type_name(a_cfg.base_object_type);
+#endif
+ }
+ break;
+ case GPAC_OTI_MEDIA_FFMPEG:
+ return "GPAC FFMPEG Private Audio";
+ case GPAC_OTI_AUDIO_EVRC_VOICE:
+ return "EVRC Voice";
+ case GPAC_OTI_AUDIO_SMV_VOICE:
+ return "SMV Voice";
+ case GPAC_OTI_AUDIO_AC3:
+ return "AC-3 audio";
+ case GPAC_OTI_AUDIO_AC3_ENHANCED:
+ return "Enhanced AC-3 Audio";
+ case GPAC_OTI_AUDIO_DRA:
+ return "DRA Audio";
+ case GPAC_OTI_AUDIO_ITU_G719:
+ return "ITU G719 Audio";
+ case GPAC_OTI_AUDIO_DTS_CA:
+ return "DTS Coherent Acoustics audio";
+ case GPAC_OTI_AUDIO_DTS_HD_HR:
+ return "DTS-HD High Resolution audio";
+ case GPAC_OTI_AUDIO_DTS_HD_MASTER:
+ return "DTS-HD Master audios";
+ default:
+ return "Unknown Audio Type";
+ }
+ break;
+ case GF_STREAM_MPEG7:
+ return "MPEG-7 Description";
+ case GF_STREAM_IPMP:
+ return "MPEG-4 IPMP";
+ case GF_STREAM_OCI:
+ return "MPEG-4 OCI";
+ case GF_STREAM_MPEGJ:
+ return "MPEG-4 MPEG-J";
+ case GF_STREAM_INTERACT:
+ return "MPEG-4 User Interaction";
+ case GF_STREAM_IPMP_TOOL:
+ return "MPEG-4 IPMP Tool";
+ case GF_STREAM_FONT:
+ return "MPEG-4 Font Data";
+ case GF_STREAM_TEXT:
+ return "MPEG-4 Streaming Text";
+ case GF_STREAM_ND_SUBPIC:
+ return "Nero Digital Subpicture";
+
+ case GF_STREAM_PRIVATE_SCENE:
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_PRIVATE_SCENE_GENERIC:
+ {
+ char *ext = strchr(esd->decoderConfig->decoderSpecificInfo->data + 4, '.');
+ if (!ext) return "GPAC Internal Scene Description";
+ ext += 1;
+ if (!strnicmp(ext, "bt", 2)) return "BT Scene Description";
+ if (!strnicmp(ext, "xmt", 2)) return "XMT Scene Description";
+ if (!strnicmp(ext, "wrl", 3)) return "VRML Scene Description";
+ if (!strnicmp(ext, "x3d", 3)) return "W3D Scene Description";
+ if (!strnicmp(ext, "x3dv", 4)) return "X3D Scene Description";
+ if (!strnicmp(ext, "swf", 3)) return "Flash (SWF) Scene Description";
+ if (!strnicmp(ext, "xsr", 3)) return "LASeR-ML Scene Description";
+ if (!strnicmp(ext, "wgt", 3)) return "W3C Widget Package";
+ if (!strnicmp(ext, "mgt", 3)) return "MPEG-U Widget Package";
+ }
+ return "GPAC Internal Scene Description";
+ case GPAC_OTI_PRIVATE_SCENE_SVG:
+ return "SVG";
+ case GPAC_OTI_PRIVATE_SCENE_LASER:
+ return "LASeR (XML)";
+ case GPAC_OTI_PRIVATE_SCENE_XBL:
+ return "XBL";
+ case GPAC_OTI_PRIVATE_SCENE_EPG:
+ return "DVB Event Information";
+ case GPAC_OTI_PRIVATE_SCENE_WGT:
+ return "W3C/MPEG-U Widget";
+ case GPAC_OTI_SCENE_SVG:
+ return "SVG over RTP";
+ case GPAC_OTI_SCENE_SVG_GZ:
+ return "SVG+gz over RTP";
+ case GPAC_OTI_SCENE_DIMS:
+ return "3GPP DIMS";
+ default:
+ return "Unknown Scene Description";
+ }
+ break;
+ case GF_STREAM_PRIVATE_MEDIA:
+ return "Opaque Decoder";
+ case GF_STREAM_4CC:
+ return gf_4cc_to_str(esd->decoderConfig->objectTypeIndication);
+ default:
+ return "Unknown Media Type";
+ }
+}
return 0;
}
-#define GET_U8(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u8) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (u8) d; } }
-#define GET_U16(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u16) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (u16) d; } }
-#define GET_U32(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u32) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (u32) d; } }
-#define GET_S32(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (s32) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (s32) d; } }
-#define GET_BOOL(field) { ret = 1; field = (!stricmp(val, "true") || !stricmp(val, "1")) ? 1 : 0; }
-
-#define GET_DOUBLE(field) { Float v; ret = 1; sscanf(val, "%f", &v); field = (Double) v;}
-#define GET_STRING(field) { ret = 1; field = gf_strdup(val); if (val[0] == '"') strcpy(field, val+1); if (field[strlen(field)-1] == '"') field[strlen(field)-1] = 0; }
+#include <gpac/internal/odf_parse_common.h>
void GF_IPMPX_ParseBinData(char *val, char **out_data, u32 *out_data_size)
{
if (j) {
szVal[j] = 0;
if (!strnicmp(szVal, "0x", 2)) { sscanf(szVal, "%x", &v); eventType[*eventTypeCount] = v; }
- else { sscanf(szVal, "%d", &v); eventType[*eventTypeCount] = v; }
+ else { sscanf(szVal, "%ud", &v); eventType[*eventTypeCount] = v; }
j=0;
(*eventTypeCount) += 1;
if (*eventTypeCount == 9) return GF_OK;
if (j) {
szVal[j] = 0;
if (!strnicmp(szVal, "0x", 2)) { sscanf(szVal, "%x", &v); data[count] = v; }
- else { sscanf(szVal, "%d", &v); data[count] = v; }
+ else { sscanf(szVal, "%ud", &v); data[count] = v; }
j=0;
count += 1;
if (count == alloc) {
GF_Err gf_ipmpx_set_field(GF_IPMPX_Data *_p, char *fieldName, char *val)
{
- u32 d, ret = 0;
+ u32 ret = 0;
if (!stricmp(val, "auto")) return GF_OK;
else if (!stricmp(val, "unspecified")) return GF_OK;
else p->flags |= 8;
ret = 1;
}
- else if (!stricmp(fieldName, "startDTS")) GET_U32(p->startDTS)
+ else if (!stricmp(fieldName, "startDTS")) GET_U64(p->startDTS)
else if (!stricmp(fieldName, "startPacketID")) GET_U32(p->startPacketID)
else if (!stricmp(fieldName, "expireDTS")) GET_U32(p->expireDTS)
else if (!stricmp(fieldName, "expirePacketID")) GET_U32(p->expirePacketID)
GF_Descriptor *gf_odf_new_dcd()
{
- GF_DecoderConfig *newDesc = (GF_DecoderConfig *) gf_malloc(sizeof(GF_DecoderConfig));
+ GF_DecoderConfig *newDesc;
+ GF_SAFEALLOC(newDesc, GF_DecoderConfig);
if (!newDesc) return NULL;
- newDesc->avgBitrate = 0;
- newDesc->bufferSizeDB = 0;
- newDesc->maxBitrate = 0;
- newDesc->objectTypeIndication = 0;
- newDesc->streamType = 0;
- newDesc->upstream = 0;
- newDesc->decoderSpecificInfo = NULL;
newDesc->profileLevelIndicationIndexDescriptor = gf_list_new();
newDesc->tag = GF_ODF_DCD_TAG;
return (GF_Descriptor *) newDesc;
e = gf_odf_delete_descriptor((GF_Descriptor *) dcd->decoderSpecificInfo);
if (e) return e;
}
+ if (dcd->rvc_config) {
+ e = gf_odf_delete_descriptor((GF_Descriptor *) dcd->rvc_config);
+ if (e) return e;
+ }
e = gf_odf_delete_descriptor_list(dcd->profileLevelIndicationIndexDescriptor);
if (e) return e;
gf_free(dcd);
************************************************************/
GF_EXPORT
-GF_Err gf_odf_codec_set_au(GF_ODCodec *codec, char *au, u32 au_length)
+GF_Err gf_odf_codec_set_au(GF_ODCodec *codec, const char *au, u32 au_length)
{
if (!codec ) return GF_BAD_PARAM;
if (!au || !au_length) return GF_OK;
return 0;
}
-#define GET_U8(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u8) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (u8) d; } }
-#define GET_U16(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u16) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (u16) d; } }
-#define GET_U32(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (u32) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (u32) d; } }
-#define GET_S32(field) { if (strstr(val, "0x")) { ret += sscanf(val, "%x", &d); if (ret) field = (s32) d; } else { ret += sscanf(val, "%d", &d); if (ret) field = (s32) d; } }
-#define GET_BOOL(field) { ret = 1; field = (!stricmp(val, "true") || !stricmp(val, "1")) ? 1 : 0; }
-
-#define GET_DOUBLE(field) { Float v; ret = 1; sscanf(val, "%f", &v); field = (Double) v;}
-#define GET_STRING(field) { ret = 1; field = gf_strdup(val); if (val[0] == '"') strcpy(field, val+1); if (field[strlen(field)-1] == '"') field[strlen(field)-1] = 0; }
+#include <gpac/internal/odf_parse_common.h>
void OD_ParseBinData(char *val, char **out_data, u32 *out_data_size)
{
GF_Err gf_odf_set_field(GF_Descriptor *desc, char *fieldName, char *val)
{
Bool OD_ParseUIConfig(char *val, char **out_data, u32 *out_data_size);
- u32 d, ret = 0;
+ u32 ret = 0;
if (!stricmp(val, "auto")) return GF_OK;
else if (!stricmp(val, "unspecified")) return GF_OK;
case GF_ODF_IOD_TAG:
{
GF_InitialObjectDescriptor *iod = (GF_InitialObjectDescriptor *)desc;
- if (!stricmp(fieldName, "objectDescriptorID") || !stricmp(fieldName, "binaryID")) ret += sscanf(val, "%hd", &iod->objectDescriptorID);
+ if (!stricmp(fieldName, "objectDescriptorID") || !stricmp(fieldName, "binaryID")) ret += sscanf(val, "%hu", &iod->objectDescriptorID);
else if (!stricmp(fieldName, "URLString")) {
iod->URLString = gf_strdup(val);
ret = 1;
case GF_ODF_OD_TAG:
{
GF_ObjectDescriptor *od = (GF_ObjectDescriptor *) desc;
- if (!stricmp(fieldName, "objectDescriptorID") || !stricmp(fieldName, "binaryID")) ret += sscanf(val, "%hd", &od->objectDescriptorID);
+ if (!stricmp(fieldName, "objectDescriptorID") || !stricmp(fieldName, "binaryID")) ret += sscanf(val, "%hu", &od->objectDescriptorID);
else if (!stricmp(fieldName, "URLString")) {
od->URLString = gf_strdup(val);
ret = 1;
}
}
else if (!stricmp(fieldName, "upStream")) GET_BOOL(dcd->upstream)
- else if (!stricmp(fieldName, "bufferSizeDB")) ret += sscanf(val, "%d", &dcd->bufferSizeDB);
- else if (!stricmp(fieldName, "maxBitRate")) ret += sscanf(val, "%d", &dcd->maxBitrate);
- else if (!stricmp(fieldName, "avgBitRate")) ret += sscanf(val, "%d", &dcd->avgBitrate);
+ else if (!stricmp(fieldName, "bufferSizeDB")) ret += sscanf(val, "%u", &dcd->bufferSizeDB);
+ else if (!stricmp(fieldName, "maxBitRate")) ret += sscanf(val, "%u", &dcd->maxBitrate);
+ else if (!stricmp(fieldName, "avgBitRate")) ret += sscanf(val, "%u", &dcd->avgBitrate);
}
break;
case GF_ODF_ESD_TAG:
{
GF_ESD *esd = (GF_ESD *)desc;
if (!stricmp(fieldName, "ES_ID") || !stricmp(fieldName, "binaryID")) {
- ret += sscanf(val, "%hd", &esd->ESID);
+ ret += sscanf(val, "%hu", &esd->ESID);
}
else if (!stricmp(fieldName, "streamPriority")) GET_U8(esd->streamPriority)
- else if (!stricmp(fieldName, "dependsOn_ES_ID") || !stricmp(fieldName, "dependsOnESID")) ret += sscanf(val, "%hd", &esd->dependsOnESID);
- else if (!stricmp(fieldName, "OCR_ES_ID")) ret += sscanf(val, "%hd", &esd->OCRESID);
+ else if (!stricmp(fieldName, "dependsOn_ES_ID") || !stricmp(fieldName, "dependsOnESID")) ret += sscanf(val, "%hu", &esd->dependsOnESID);
+ else if (!stricmp(fieldName, "OCR_ES_ID")) ret += sscanf(val, "%hu", &esd->OCRESID);
else if (!stricmp(fieldName, "URLstring")) {
esd->URLString = gf_strdup(val);
ret = 1;
else if (!stricmp(fieldName, "usePaddingFlag")) GET_BOOL(slc->usePaddingFlag)
else if (!stricmp(fieldName, "useTimeStampsFlag")) GET_BOOL(slc->useTimestampsFlag)
else if (!stricmp(fieldName, "useIdleFlag")) GET_BOOL(slc->useIdleFlag)
- else if (!stricmp(fieldName, "timeStampResolution")) ret += sscanf(val, "%d", &slc->timestampResolution);
- else if (!stricmp(fieldName, "OCRResolution")) ret += sscanf(val, "%d", &slc->OCRResolution);
+ else if (!stricmp(fieldName, "timeStampResolution")) ret += sscanf(val, "%u", &slc->timestampResolution);
+ else if (!stricmp(fieldName, "OCRResolution")) ret += sscanf(val, "%u", &slc->OCRResolution);
else if (!stricmp(fieldName, "timeStampLength")) GET_U8(slc->timestampLength)
else if (!stricmp(fieldName, "OCRLength")) GET_U8(slc->OCRLength)
else if (!stricmp(fieldName, "AU_Length")) GET_U8(slc->AULength)
else if (!stricmp(fieldName, "degradationPriorityLength")) GET_U8(slc->degradationPriorityLength)
else if (!stricmp(fieldName, "AU_seqNumLength")) GET_U8(slc->AUSeqNumLength)
else if (!stricmp(fieldName, "packetSeqNumLength")) GET_U8(slc->packetSeqNumLength)
- else if (!stricmp(fieldName, "timeScale")) ret += sscanf(val, "%d", &slc->timeScale);
- else if (!stricmp(fieldName, "accessUnitDuration")) ret += sscanf(val, "%hd", &slc->AUDuration);
- else if (!stricmp(fieldName, "compositionUnitDuration")) ret += sscanf(val, "%hd", &slc->CUDuration);
+ else if (!stricmp(fieldName, "timeScale")) ret += sscanf(val, "%u", &slc->timeScale);
+ else if (!stricmp(fieldName, "accessUnitDuration")) ret += sscanf(val, "%hu", &slc->AUDuration);
+ else if (!stricmp(fieldName, "compositionUnitDuration")) ret += sscanf(val, "%hu", &slc->CUDuration);
else if (!stricmp(fieldName, "startDecodingTimeStamp")) {
- ret += sscanf(val, "%d", &ts);
+ ret += sscanf(val, "%u", &ts);
slc->startDTS = ts;
}
else if (!stricmp(fieldName, "startCompositionTimeStamp")) {
- ret += sscanf(val, "%d", &ts);
+ ret += sscanf(val, "%u", &ts);
slc->startCTS = ts;
}
else if (!stricmp(fieldName, "durationFlag")) ret = 1;
s32 notused;
GF_BIFSConfig *bcd = (GF_BIFSConfig*)desc;
if (!stricmp(val, "auto")) return GF_OK;
- if (!stricmp(fieldName, "nodeIDbits")) ret += sscanf(val, "%hd", &bcd->nodeIDbits);
- else if (!stricmp(fieldName, "nodeIDbits")) ret += sscanf(val, "%hd", &bcd->nodeIDbits);
- else if (!stricmp(fieldName, "routeIDbits")) ret += sscanf(val, "%hd", &bcd->routeIDbits);
- else if (!stricmp(fieldName, "protoIDbits")) ret += sscanf(val, "%hd", &bcd->protoIDbits);
+ if (!stricmp(fieldName, "nodeIDbits")) ret += sscanf(val, "%hu", &bcd->nodeIDbits);
+ else if (!stricmp(fieldName, "nodeIDbits")) ret += sscanf(val, "%hu", &bcd->nodeIDbits);
+ else if (!stricmp(fieldName, "routeIDbits")) ret += sscanf(val, "%hu", &bcd->routeIDbits);
+ else if (!stricmp(fieldName, "protoIDbits")) ret += sscanf(val, "%hu", &bcd->protoIDbits);
else if (!stricmp(fieldName, "isCommandStream")) { /*GET_BOOL(bcd->isCommandStream)*/ ret = 1; }
else if (!stricmp(fieldName, "pixelMetric") || !stricmp(fieldName, "pixelMetrics")) GET_BOOL(bcd->pixelMetrics)
- else if (!stricmp(fieldName, "pixelWidth")) ret += sscanf(val, "%hd", &bcd->pixelWidth);
- else if (!stricmp(fieldName, "pixelHeight")) ret += sscanf(val, "%hd", &bcd->pixelHeight);
+ else if (!stricmp(fieldName, "pixelWidth")) ret += sscanf(val, "%hu", &bcd->pixelWidth);
+ else if (!stricmp(fieldName, "pixelHeight")) ret += sscanf(val, "%hu", &bcd->pixelHeight);
else if (!stricmp(fieldName, "use3DMeshCoding")) GET_BOOL(notused)
else if (!stricmp(fieldName, "usePredictiveMFField")) GET_BOOL(notused)
else if (!stricmp(fieldName, "randomAccess")) GET_BOOL(bcd->randomAccess)
GF_MuxInfo *mi = (GF_MuxInfo *)desc;
if (!stricmp(fieldName, "fileName") || !stricmp(fieldName, "url")) GET_STRING(mi->file_name)
else if (!stricmp(fieldName, "streamFormat")) GET_STRING(mi->streamFormat)
- else if (!stricmp(fieldName, "GroupID")) ret += sscanf(val, "%d", &mi->GroupID);
- else if (!stricmp(fieldName, "startTime")) ret += sscanf(val, "%d", &mi->startTime);
- else if (!stricmp(fieldName, "duration")) ret += sscanf(val, "%d", &mi->duration);
+ else if (!stricmp(fieldName, "GroupID")) ret += sscanf(val, "%u", &mi->GroupID);
+ else if (!stricmp(fieldName, "startTime")) ret += sscanf(val, "%u", &mi->startTime);
+ else if (!stricmp(fieldName, "duration")) ret += sscanf(val, "%u", &mi->duration);
else if (!stricmp(fieldName, "carouselPeriod")) {
- ret += sscanf(val, "%d", &mi->carousel_period_plus_one);
+ ret += sscanf(val, "%u", &mi->carousel_period_plus_one);
mi->carousel_period_plus_one += 1;
}
- else if (!stricmp(fieldName, "aggregateOnESID")) ret += sscanf(val, "%hd", &mi->aggregate_on_esid);
+ else if (!stricmp(fieldName, "aggregateOnESID")) ret += sscanf(val, "%hu", &mi->aggregate_on_esid);
#ifndef GPAC_DISABLE_MEDIA_IMPORT
else if (!stricmp(fieldName, "compactSize"))
case GF_ODF_ESD_INC_TAG:
{
GF_ES_ID_Inc *inc = (GF_ES_ID_Inc *)desc;
- if (!stricmp(fieldName, "trackID")) ret += sscanf(val, "%d", &inc->trackID);
+ if (!stricmp(fieldName, "trackID")) ret += sscanf(val, "%u", &inc->trackID);
}
break;
case GF_ODF_ESD_REF_TAG:
{
GF_ES_ID_Ref *inc = (GF_ES_ID_Ref *)desc;
- if (!stricmp(fieldName, "trackID")) ret += sscanf(val, "%hd", &inc->trackRef);
+ if (!stricmp(fieldName, "trackID")) ret += sscanf(val, "%hu", &inc->trackRef);
}
break;
case GF_ODF_TEXT_CFG_TAG:
txt->has_vid_info = 1;
}
else if (!stricmp(fieldName, "horizontal_offset")) {
- GET_S32(txt->horiz_offset)
+ GET_S16(txt->horiz_offset)
txt->has_vid_info = 1;
}
else if (!stricmp(fieldName, "vertical_offset")) {
{
GF_IPMPPtr *ipmpd = (GF_IPMPPtr*)desc;
if (!stricmp(fieldName, "IPMP_DescriptorID")) GET_U8(ipmpd->IPMP_DescriptorID)
- else if (!stricmp(fieldName, "IPMP_DescriptorIDEx")) ret += sscanf(val, "%hd", &ipmpd->IPMP_DescriptorIDEx);
- else if (!stricmp(fieldName, "IPMP_ES_ID")) ret += sscanf(val, "%hd", &ipmpd->IPMP_ES_ID);
+ else if (!stricmp(fieldName, "IPMP_DescriptorIDEx")) ret += sscanf(val, "%hu", &ipmpd->IPMP_DescriptorIDEx);
+ else if (!stricmp(fieldName, "IPMP_ES_ID")) ret += sscanf(val, "%hu", &ipmpd->IPMP_ES_ID);
}
break;
case GF_ODF_LANG_TAG:
GF_EXPORT
-void gf_sl_depacketize (GF_SLConfig *slConfig, GF_SLHeader *Header, char *PDU, u32 PDULength, u32 *HeaderLen)
+void gf_sl_depacketize (GF_SLConfig *slConfig, GF_SLHeader *Header, const char *PDU, u32 PDULength, u32 *HeaderLen)
{
GF_BitStream *bs;
*HeaderLen = 0;
#define BT_STR_CHECK_ALLOC \
if (i==size) { \
- res = (char*)gf_realloc(res, sizeof(char) * (size+500)); \
+ res = (char*)gf_realloc(res, sizeof(char) * (size+500+1)); \
size += 500; \
} \
i=0;
while (1) {
if (parser->line_buffer[parser->line_pos] == '\"')
- if (parser->line_buffer[parser->line_pos-1] != '\\') break;
+ if ( !parser->line_pos || (parser->line_buffer[parser->line_pos-1] != '\\') ) break;
BT_STR_CHECK_ALLOC
if (!strnicmp(str, "od://", 5)) odstr += 5;
else if (!strnicmp(str, "od:", 3)) odstr += 3;
/*be carefull, an url like "11-regression-test.mp4" will return 1 on sscanf :)*/
- if (sscanf(odstr, "%d", &id) == 1) {
+ if (sscanf(odstr, "%ud", &id) == 1) {
char szURL[20];
- sprintf(szURL, "%d", id);
+ sprintf(szURL, "%ud", id);
if (strcmp(szURL, odstr)) id=0;
}
if (id) {
for (i=0; i<size; i++) {
str = gf_bt_get_next(parser, 0);
if (strstr(str, "0x")) sscanf(str, "%x", &v);
- else sscanf(str, "%d", &v);
+ else sscanf(str, "%u", &v);
switch (img->numComponents) {
case 1:
img->pixels[i] = (char) v;
{
GF_Node *n;
u32 ID;
- if (sscanf(defName, "N%d", &ID) == 1) {
+ if (sscanf(defName, "N%ud", &ID) == 1) {
ID ++;
n = gf_sg_find_node(parser->load->scene_graph, ID);
/*if an existing node use*/
str = gf_bt_get_next(parser, 0);
gf_sg_vrml_mf_append(&proto->ExternProto, GF_SG_VRML_MFURL, (void **) &url);
if (!strnicmp(str, "od:", 3)) {
- sscanf(str, "od:%d", &url->OD_ID);
+ sscanf(str, "od:%ud", &url->OD_ID);
} else {
- if (!sscanf(str, "%d", &url->OD_ID)) {
+ if (!sscanf(str, "%ud", &url->OD_ID)) {
url->url = gf_strdup(str);
} else {
char szURL[20];
if (str[0] == 'D') {
parser->au_time += atoi(&str[1]);
} else {
- if (sscanf(str, "%d", &parser->au_time) != 1) {
+ if (sscanf(str, "%ud", &parser->au_time) != 1) {
gf_bt_report(parser, GF_BAD_PARAM, "Number expected got %s", str);
break;
}
return parser->last_error;
}
-static GF_Err gf_sm_load_bt_initialize(GF_SceneLoader *load, char *str, Bool input_only)
+static GF_Err gf_sm_load_bt_initialize(GF_SceneLoader *load, const char *str, Bool input_only)
{
u32 size;
gzFile gzInput;
parser->gz_in = gzInput;
} else {
- if (!str || (strlen(str)<5) ) return GF_BAD_PARAM;
+ if (!str || (strlen(str)<5) ) {
+ /*wait for first string data to be fed to the parser (for load from string)*/
+ parser->initialized = 0;
+ return GF_OK;
+ }
strncpy(BOM, str, 5);
}
}
-GF_Err load_bt_parse_string(GF_SceneLoader *load, char *str)
+GF_Err load_bt_parse_string(GF_SceneLoader *load, const char *str)
{
GF_Err e;
GF_BTParser *parser = (GF_BTParser *)load->loader_priv;
parser->file_size = 0;
parser->line_pos = 0;
}
- parser->line_buffer = str;
+ parser->line_buffer = gf_strdup(str);
parser->line_size = (s32)strlen(str);
if (!parser->initialized) {
GF_ESD *esd;
j=0;
while ((esd = (GF_ESD *)gf_list_enum(od->ESDescriptors, &j))) {
+ Bool import = 1;
if (esd->URLString) continue;
switch (esd->decoderConfig->streamType) {
case GF_STREAM_OD:
+ import = 0;
+ break;
case GF_STREAM_SCENE:
+ if ((esd->decoderConfig->objectTypeIndication != GPAC_OTI_SCENE_AFX) &&
+ (esd->decoderConfig->objectTypeIndication != GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE)
+ ) {
+ import = 0;
+ }
break;
/*dump the OCR track duration in case the OCR is used by media controls & co*/
case GF_STREAM_OCR:
dur = (Double) (s64) gf_isom_get_track_duration(mp4, track);
dur /= gf_isom_get_timescale(mp4);
mi->duration = (u32) (dur * 1000);
+ import = 0;
}
break;
default:
- {
+ break;
+ }
+ if (import) {
GF_MuxInfo *mi = (GF_MuxInfo *) gf_odf_desc_new(GF_ODF_MUXINFO_TAG);
gf_list_add(esd->extensionDescriptors, mi);
sprintf(szPath, "%s#%d", szName, esd->ESID);
mi->file_name = gf_strdup(szPath);
mi->streamFormat = gf_strdup("MP4");
}
- break;
- }
}
}
return;
GF_ESDUpdate *esdU = (GF_ESDUpdate *)com;
i=0;
while ((esd = (GF_ESD *)gf_list_enum(esdU->ESDescriptors, &i))) {
+ Bool import = 1;
if (esd->URLString) continue;
switch (esd->decoderConfig->streamType) {
case GF_STREAM_OD:
+ import = 0;
+ break;
case GF_STREAM_SCENE:
+ if ((esd->decoderConfig->objectTypeIndication != GPAC_OTI_SCENE_AFX) &&
+ (esd->decoderConfig->objectTypeIndication != GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE)
+ ) {
+ import = 0;
+ }
break;
/*dump the OCR track duration in case the OCR is used by media controls & co*/
case GF_STREAM_OCR:
dur = (Double) (s64) gf_isom_get_track_duration(mp4, track);
dur /= gf_isom_get_timescale(mp4);
mi->duration = (u32) (dur * 1000);
+ import = 0;
}
break;
default:
- {
+ break;
+ }
+ if (import) {
GF_MuxInfo *mi = (GF_MuxInfo *) gf_odf_desc_new(GF_ODF_MUXINFO_TAG);
gf_list_add(esd->extensionDescriptors, mi);
sprintf(szPath, "%s#%d", szName, esd->ESID);
mi->file_name = gf_strdup(szPath);
mi->streamFormat = gf_strdup("MP4");
}
- break;
- }
}
return;
}
u32 type = gf_isom_get_media_type(load->isom, i+1);
switch (type) {
case GF_ISOM_MEDIA_SCENE:
- break;
case GF_ISOM_MEDIA_OD:
break;
default:
esd = gf_isom_get_esd(load->isom, i+1, 1);
if (!esd) continue;
+
+ if ((esd->decoderConfig->objectTypeIndication == GPAC_OTI_SCENE_AFX) ||
+ (esd->decoderConfig->objectTypeIndication == GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE)
+ ) {
+ nb_samp += gf_isom_get_sample_count(load->isom, i+1);
+ continue;
+ }
sc = gf_sm_stream_new(load->ctx, esd->ESID, esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication);
sc->streamType = esd->decoderConfig->streamType;
sc->ESID = esd->ESID;
}
}
-static GF_Err gf_sm_load_initialize_svg(GF_SceneLoader *load, char *str_data, Bool is_fragment)
+static GF_Err gf_sm_load_initialize_svg(GF_SceneLoader *load, const char *str_data, Bool is_fragment)
{
GF_Err e;
GF_SVG_Parser *parser;
}
-GF_Err load_svg_parse_string(GF_SceneLoader *load, char *str)
-{
- GF_Err e;
- GF_SVG_Parser *parser = (GF_SVG_Parser *)load->loader_priv;
-
- if (!parser) {
- e = gf_sm_load_initialize_svg(load, str, 0);
- parser = (GF_SVG_Parser *)load->loader_priv;
- } else {
- e = gf_xml_sax_parse(parser->sax_parser, str);
- }
- if (e<0) return svg_report(parser, e, "Unable to parse chunk: %s", gf_xml_sax_get_error(parser->sax_parser) );
-
- svg_flush_animations(parser);
- return e;
-}
-
-
static void load_svg_done(GF_SceneLoader *load)
{
SVG_SAFExternalStream *st;
load->loader_priv = NULL;
}
+GF_Err load_svg_parse_string(GF_SceneLoader *load, const char *str)
+{
+ GF_Err e;
+ GF_SVG_Parser *parser = (GF_SVG_Parser *)load->loader_priv;
+
+ if (!parser) {
+ e = gf_sm_load_initialize_svg(load, str, 0);
+ parser = (GF_SVG_Parser *)load->loader_priv;
+ } else {
+ e = gf_xml_sax_parse(parser->sax_parser, str);
+ }
+ if (e<0) svg_report(parser, e, "Unable to parse chunk: %s", gf_xml_sax_get_error(parser->sax_parser) );
+ else e = parser->last_error;
+
+ svg_flush_animations(parser);
+
+ /*if error move to done state and wait for next XML chunk*/
+ if (e) load_svg_done(load);
+
+ return e;
+}
static GF_Err load_svg_suspend(GF_SceneLoader *load, Bool suspend)
{
if (!strnicmp(name, "od", 2)) ID = atoi(name + 2);
else if (!strnicmp(name, "iod", 3)) ID = atoi(name+ 3);
/*be carefull, an url like "11-regression-test.mp4" will return 1 on sscanf :)*/
- else if (sscanf(name, "%d", &ID) == 1) {
+ else if (sscanf(name, "%ud", &ID) == 1) {
char szURL[20];
- sprintf(szURL, "%d", ID);
+ sprintf(szURL, "%ud", ID);
if (strcmp(szURL, name)) {
ID = 0;
} else {
if (!strnicmp(name, "od", 2)) ID = atoi(name + 2);
else if (!strnicmp(name, "iod", 3)) ID = atoi(name + 3);
/*be carefull, an url like "11-regression-test.mp4" will return 1 on sscanf :)*/
- else if (sscanf(name, "%d", &ID) == 1) {
+ else if (sscanf(name, "%ud", &ID) == 1) {
char szURL[20];
- sprintf(szURL, "%d", ID);
+ sprintf(szURL, "%ud", ID);
if (strcmp(szURL, name)) {
ID = 0;
} else {
}
if (binID) {
/*remove temp links*/
- if (esdl->ESID == (u16) ( ( ((u32) esdl) >> 16) | ( ((u32)esdl) & 0x0000FFFF) ) ) {
+ if (esdl->ESID == (u16) ( ( (PTR_TO_U_CAST esdl) >> 16) | ( (PTR_TO_U_CAST esdl) & 0x0000FFFF) ) ) {
GF_StreamContext *sc;
j=0;
while ((sc = (GF_StreamContext *)gf_list_enum(parser->load->ctx->streams, &j))) {
{
u32 i, ID;
XMT_ODLink *l;
- if (sscanf(od_name, "%d", &ID)==1) return ID;
+ if (sscanf(od_name, "%ud", &ID)==1) return ID;
i=0;
while ((l = (XMT_ODLink*)gf_list_enum(parser->od_links, &i))) {
{
u32 i, ID;
XMT_ESDLink *l;
- if (sscanf(esd_name, "%d", &ID)==1) return ID;
+ if (sscanf(esd_name, "%ud", &ID)==1) return ID;
i=0;
while ((l = (XMT_ESDLink *)gf_list_enum(parser->esd_links, &i))) {
/*create a temp one*/
esdl = (XMT_ESDLink *)gf_malloc(sizeof(XMT_ESDLink));
memset(esdl, 0, sizeof(XMT_ESDLink));
- esdl->ESID = (u16) ( ((u32) esdl) >> 16) | ( ((u32)esdl) & 0x0000FFFF);
+ esdl->ESID = (u16) ( (PTR_TO_U_CAST esdl) >> 16) | ( (PTR_TO_U_CAST esdl) & 0x0000FFFF);
if (!strnicmp(stream_name, "es", 2)) esdl->ESID = atoi(&stream_name[2]);
esdl->desc_name = gf_strdup(stream_name);
gf_list_add(parser->esd_links, esdl);
{
GF_Node *n;
u32 ID;
- if (sscanf(name, "N%d", &ID) == 1) {
+ if (sscanf(name, "N%ud", &ID) == 1) {
ID ++;
n = gf_sg_find_node(parser->load->scene_graph, ID);
if (n) {
char *name = "pixels";
XMT_GET_ONE_VAL
if (strstr(value, "0x")) sscanf(value, "%x", &v);
- else sscanf(value, "%d", &v);
+ else sscanf(value, "%ud", &v);
switch (img->numComponents) {
case 1:
img->pixels[k] = (char) v;
M_Script *sc = (M_Script *) node;
gf_sg_vrml_mf_reset(& sc->url, GF_SG_VRML_MFSCRIPT);
gf_sg_vrml_mf_append(& sc->url, GF_SG_VRML_MFSCRIPT, (void **) &sc_f);
- sc->url.vals[0].script_text = (unsigned char*)gf_strdup(text_content);
+ sc->url.vals[0].script_text = gf_strdup(text_content);
}
break;
default:
}
-static GF_Err load_xmt_initialize(GF_SceneLoader *load, char *str_data)
+static GF_Err load_xmt_initialize(GF_SceneLoader *load, const char *str_data)
{
GF_Err e;
GF_XMTParser *parser;
return GF_OK;
}
-static GF_Err load_xmt_parse_string(GF_SceneLoader *load, char *str)
+static GF_Err load_xmt_parse_string(GF_SceneLoader *load, const char *str)
{
GF_Err e;
GF_XMTParser *parser = (GF_XMTParser *)load->loader_priv;
case '<':
fprintf(sdump->trace, "<");
break;
- case '\r': fprintf(sdump->trace, ""); break;
- case '\n': fprintf(sdump->trace, ""); break;
+ case '\r':
+ case '\n':
+ /* Does nothing : fprintf(sdump->trace, "");, fflush instead ?*/
+ break;
default:
if (uniLine[i]<128) {
fprintf(sdump->trace, "%c", (u8) uniLine[i]);
fprintf(sdump->trace, "/>\n");
return GF_OK;
}
+#ifdef UNUSED_FUNC
static GF_Err DumpLSRInsert(GF_SceneDumper *sdump, GF_Command *com)
{
return GF_OK;
}
+
+static GF_Err SD_SetSceneGraph(GF_SceneDumper *sdump, GF_SceneGraph *sg)
+{
+ if (sdump) sdump->sg = sg;
+ return GF_OK;
+}
+#endif /* UNUSED_FUNC */
+
static GF_Err DumpLSRRestore(GF_SceneDumper *sdump, GF_Command *com)
{
return GF_OK;
fprintf(dumper->trace, "</saf:mediaUnit>\n");
}
-
-static GF_Err SD_SetSceneGraph(GF_SceneDumper *sdump, GF_SceneGraph *sg)
-{
- if (sdump) sdump->sg = sg;
- return GF_OK;
-}
-
static GF_Err SD_DumpDOMElement(GF_SceneDumper *sdump, GF_DOMFullNode *node)
{
const char *ns;
#include <time.h>
-/* for DIMS GZ encoding */
-#include <zlib.h>
struct __tag_scene_engine
{
Bool embed_resources;
Bool dump_rap;
+ Bool first_dims_sent;
};
#ifndef GPAC_DISABLE_BIFS_ENC
GF_EXPORT
GF_Err gf_seng_enable_aggregation(GF_SceneEngine *seng, u16 ESID, u16 onESID)
{
- GF_Err e = GF_STREAM_NOT_FOUND;
GF_StreamContext *sc;
if (ESID) {
u32 i=0;
- while (sc = (GF_StreamContext*)gf_list_enum(seng->ctx->streams, &i)) {
- if (sc->ESID==ESID) break;
+ while (NULL != (sc = (GF_StreamContext*)gf_list_enum(seng->ctx->streams, &i))) {
+ if (0 != (sc->ESID==ESID)) break;
}
} else {
sc = (GF_StreamContext*)gf_list_get(seng->ctx->streams, 0);
return GF_OK;
}
-
-#define ZLIB_COMPRESS_SAFE 4
-
-static GF_Err compress_dims_payload(char **data, u32 data_len, u32 *max_size, u32 offset)
-{
- z_stream stream;
- int err;
- char *dest = (char *)gf_malloc(sizeof(char)*data_len*ZLIB_COMPRESS_SAFE);
- stream.next_in = (Bytef*)(*data) + offset;
- stream.avail_in = (uInt)data_len - offset;
- stream.next_out = ( Bytef*)dest;
- stream.avail_out = (uInt)data_len*ZLIB_COMPRESS_SAFE;
- stream.zalloc = (alloc_func)NULL;
- stream.zfree = (free_func)NULL;
- stream.opaque = (voidpf)NULL;
-
- err = deflateInit(&stream, 9);
- if (err != Z_OK) {
- gf_free(dest);
- return GF_IO_ERR;
- }
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- gf_free(dest);
- return GF_IO_ERR;
- }
- if (data_len - offset<stream.total_out) {
- GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[SceneEngine] compressed data (%d) larger than input (%d)\n", (u32) stream.total_out, (u32) data_len - offset));
- }
-
- if (*max_size < stream.total_out) {
- *max_size = data_len*ZLIB_COMPRESS_SAFE;
- *data = gf_realloc(*data, *max_size * sizeof(char));
- }
-
- memcpy((*data) + offset, dest, sizeof(char)*stream.total_out);
- *max_size = offset + stream.total_out;
- gf_free(dest);
-
- deflateEnd(&stream);
- return GF_OK;
-}
-
/* Set to 1 if you want every dump with a timed file name */
//#define DUMP_DIMS_LOG_WITH_TIME
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[SceneEngine] Sending DIMS data - sizes: raw (%d)", buffer_len));
if (compress_dims) {
dims_header |= GF_DIMS_UNIT_C;
- e = compress_dims_payload(&buffer, buffer_len, &buffer_len, 0);
+ e = gf_gz_compress_payload(&buffer, buffer_len, &buffer_len);
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("/ compressed (%d)", buffer_len));
if (e) goto exit;
}
return e;
}
-static Bool gf_sm_check_for_modif(GF_AUContext *au)
+static Bool gf_sm_check_for_modif(GF_SceneEngine *seng, GF_AUContext *au)
{
GF_Command *com;
Bool modified=0;
modified=1;
}
/*check each command*/
- while (com = gf_list_enum(au->commands, &i)) {
+ while (NULL != (com = gf_list_enum(au->commands, &i))) {
u32 j=0;
GF_CommandField *field;
if (!com->node) continue;
/*check root node (for SCENE_REPLACE) */
if (gf_node_dirty_get(com->node)) {
modified=1;
- gf_node_dirty_reset(com->node);
+ gf_node_dirty_reset(com->node, 1);
}
/*check all command fields of type SFNODE or MFNODE*/
- while (field = gf_list_enum(com->command_fields, &j)) {
+ while (NULL != (field = gf_list_enum(com->command_fields, &j))) {
switch (field->fieldType) {
case GF_SG_VRML_SFNODE:
if (field->new_node) {
if (gf_node_dirty_get(field->new_node)) {
modified=1;
- gf_node_dirty_reset(field->new_node);
+ gf_node_dirty_reset(field->new_node, 1);
}
}
break;
while (child) {
if (gf_node_dirty_get(child->node)) {
modified=1;
- gf_node_dirty_reset(child->node);
+ gf_node_dirty_reset(child->node, 1);
}
child = child->next;
}
}
}
}
+
+ if (!seng->first_dims_sent) {
+ if (au->owner->objectType==GPAC_OTI_SCENE_DIMS) {
+ GF_Node *root = gf_sg_get_root_node(seng->ctx->scene_graph);
+ if (gf_node_dirty_get(root)) {
+ modified=1;
+ gf_node_dirty_reset(root, 1);
+ }
+ } else {
+ }
+ seng->first_dims_sent = 1;
+ }
return modified;
}
/*in case using XMT*/
if (au->timing_sec) au->timing = (u64) (au->timing_sec * sc->timeScale);
- if (from_start && !j && !gf_sm_check_for_modif(au)) continue;
+ if (from_start && !j && !gf_sm_check_for_modif(seng, au)) continue;
switch (sc->objectType) {
#ifndef GPAC_DISABLE_BIFS_ENC
}
GF_EXPORT
-GF_Err gf_seng_get_stream_config(GF_SceneEngine *seng, u32 idx, u16 *ESID, const char **config, u32 *config_len, u32 *streamType, u32 *objectType, u32 *timeScale)
+GF_Err gf_seng_get_stream_config(GF_SceneEngine *seng, u32 idx, u16 *ESID, char * * const config, u32 *config_len, u32 *streamType, u32 *objectType, u32 *timeScale)
{
GF_StreamContext *sc = gf_list_get(seng->ctx->streams, idx);
if (!sc || !ESID || !config || !config_len) return GF_BAD_PARAM;
if (carousel_period) *carousel_period = (u32) -1;
if (aggregate_on_es_id) *aggregate_on_es_id = 0;
- while (sc = gf_list_enum(seng->ctx->streams, &i)) {
+ while (NULL != (sc = gf_list_enum(seng->ctx->streams, &i))) {
if (sc->ESID==ESID) {
if (carousel_period) *carousel_period = sc->carousel_period;
if (aggregate_on_es_id) *aggregate_on_es_id = sc->aggregate_on_esid;
GF_EXPORT
-GF_Err gf_sm_load_string(GF_SceneLoader *load, char *str, Bool do_clean)
+GF_Err gf_sm_load_string(GF_SceneLoader *load, const char *str, Bool do_clean)
{
GF_Err e;
if (!load->type) e = GF_BAD_PARAM;
}
*fmt = GF_TEXT_IMPORT_NONE;
if ((szLine[0]=='{') && strstr(szLine, "}{")) *fmt = GF_TEXT_IMPORT_SUB;
- else if (sscanf(szLine, "%d", &val)==1) {
- sprintf(szTest, "%d", val);
+ else if (sscanf(szLine, "%u", &val)==1) {
+ sprintf(szTest, "%u", val);
if (!strcmp(szTest, szLine)) *fmt = GF_TEXT_IMPORT_SRT;
}
else if (!strnicmp(szLine, "<?xml ", 6)) {
switch (state) {
case 0:
- if (sscanf(szLine, "%d", &line) != 1) {
+ if (sscanf(szLine, "%u", &line) != 1) {
GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[srt->bifs] bad frame format (src: %s)\n", szLine));
e = GF_CORRUPTED_DATA;
goto exit;
state = 1;
break;
case 1:
- if (sscanf(szLine, "%d:%d:%d,%d --> %d:%d:%d,%d", &sh, &sm, &ss, &sms, &eh, &em, &es, &ems) != 8) {
- GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[srt->bifs] bad frame %d (src: %s)\n", curLine, szLine));
+ if (sscanf(szLine, "%u:%u:%u,%u --> %u:%u:%u,%u", &sh, &sm, &ss, &sms, &eh, &em, &es, &ems) != 8) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[srt->bifs] bad frame %u (src: %s)\n", curLine, szLine));
e = GF_CORRUPTED_DATA;
goto exit;
}
#endif
#ifndef GPAC_DISABLE_SVG
+ tmp->dom_evt_mx = gf_mx_new("DOMEvent");
tmp->dom_evt.evt_list = gf_list_new();
tmp->dom_evt.ptr = tmp;
tmp->dom_evt.ptr_type = GF_DOM_EVENT_DOCUMENT;
gf_list_del(sg->smil_timed_elements);
gf_list_del(sg->modified_smil_timed_elements);
gf_list_del(sg->listeners_to_add);
+ gf_mx_del(sg->dom_evt_mx);
#endif
#ifdef GPAC_HAS_SPIDERMONKEY
gf_list_del(sg->scripts);
#ifndef GPAC_DISABLE_SVG
+ gf_mx_p(sg->dom_evt_mx);
/*remove listeners attached to the doc*/
while (gf_list_count(sg->dom_evt.evt_list)) {
GF_Node *n = gf_list_get(sg->dom_evt.evt_list, 0);
/*flush any pending add_listener*/
gf_dom_listener_reset_defered(sg);
+ gf_mx_v(sg->dom_evt_mx);
#endif
#ifndef GPAC_DISABLE_VRML
} else
#endif
ReplaceDEFNode(nlist->node, reg_node->node, NULL, 0);
-
+
+ /*direct cyclic reference to ourselves, make sure we update the parentList to the next entry before freeing it
+ since the next parent node could be reg_node again (reg_node->reg_node)*/
+ if (nlist->node==node) {
+ node->sgprivate->parents = next;
+ }
gf_free(nlist);
nlist = next;
}
#ifdef GF_SELF_REPLACE_ENABLE
sg->graph_has_been_reset = 1;
#endif
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_SCENE, ("[SceneGraph] Scene graph has been reset\n"));
}
sg->id_node_last = reg_node->next ? reg_node->next : reg_node;
}
if (to_del->NodeName) gf_free(to_del->NodeName);
+ to_del->NodeName = NULL;
gf_free(to_del);
break;
}
{
Bool check_root = 1;
GF_ParentList *nlist;
-
+#if defined GPAC_ANDROID
+ if ( !node || !node->sgprivate )
+ return;
+#else
if (!node) return;
-
+#endif
nlist = node->sgprivate->parents;
while (nlist) {
GF_Node *p = nlist->node;
nlist = nlist->next;
}
/*propagate to parent scene graph */
+#if defined GPAC_ANDROID
+ if (check_root && node->sgprivate->scenegraph) {
+#else
if (check_root) {
+#endif
/*if root node of the scenegraph*/
if (node->sgprivate->scenegraph->NodeCallback && (node==node->sgprivate->scenegraph->RootNode) ) {
node->sgprivate->scenegraph->NodeCallback(node->sgprivate->scenegraph->userpriv, GF_SG_CALLBACK_GRAPH_DIRTY, NULL, NULL);
GF_EXPORT
-void gf_node_dirty_reset(GF_Node *node)
+void gf_node_dirty_reset(GF_Node *node, Bool reset_children)
{
if (!node) return;
if (node->sgprivate->flags & ~GF_NODE_INTERNAL_FLAGS) {
node->sgprivate->flags &= GF_NODE_INTERNAL_FLAGS;
- dirty_children(node);
+ if (reset_children) {
+ dirty_children(node);
+ } else if (node->sgprivate->tag==TAG_MPEG4_Appearance) {
+ gf_node_dirty_reset( ((M_Appearance*)node)->material, 1);
+ }
}
}
const char *name = gf_node_get_name(anim);
if (name) return name;
else {
- sprintf(log_node_name, "0x%x", (u32) anim);
+ sprintf(log_node_name, "0x%p", anim);
return log_node_name;
}
}
void gf_sg_listener_post_add(GF_Node *obs, GF_Node *listener)
{
DOMAddListener *l;
+ gf_mx_p(obs->sgprivate->scenegraph->dom_evt_mx);
l = (DOMAddListener*)gf_malloc(sizeof(DOMAddListener));
l->listener = listener;
l->obs = obs;
gf_list_add(obs->sgprivate->scenegraph->listeners_to_add, l);
+ gf_mx_v(obs->sgprivate->scenegraph->dom_evt_mx);
}
void gf_dom_listener_process_add(GF_SceneGraph *sg)
{
u32 i, count;
+ gf_mx_p(sg->dom_evt_mx);
count = gf_list_count(sg->listeners_to_add);
for (i=0; i<count; i++) {
DOMAddListener *l = (DOMAddListener *)gf_list_get(sg->listeners_to_add, i);
gf_free(l);
}
gf_list_reset(sg->listeners_to_add);
+ gf_mx_v(sg->dom_evt_mx);
}
void gf_dom_listener_reset_defered(GF_SceneGraph *sg)
{
+ gf_mx_p(sg->dom_evt_mx);
while (gf_list_count(sg->listeners_to_add)) {
DOMAddListener *l = (DOMAddListener *)gf_list_get(sg->listeners_to_add, 0);
gf_list_rem(sg->listeners_to_add, 0);
gf_free(l);
}
+ gf_mx_v(sg->dom_evt_mx);
}
void gf_sg_handle_dom_event(GF_Node *hdl, GF_DOM_Event *event, GF_Node *observer)
#ifdef GPAC_HAS_SPIDERMONKEY
-#include <jsapi.h>
+#ifdef GPAC_ANDROID
+#ifndef XP_UNIX
+#define XP_UNIX
+#endif /* XP_UNIX */
+#endif
+
+#include <gpac/internal/smjs_api.h>
-JSBool my_js_has_instance(JSContext *c, JSObject *obj, jsval val, JSBool *vp);
static GFINLINE Bool ScriptAction(GF_SceneGraph *scene, u32 type, GF_Node *node, GF_JSAPIParam *param)
{
}
#define JSVAL_CHECK_STRING(_v) (JSVAL_IS_STRING(_v) || JSVAL_IS_NULL(_v))
-#define JSVAL_GET_STRING(_v) (JSVAL_IS_NULL(_v) ? NULL : JS_GetStringBytes(JSVAL_TO_STRING(_v)) )
-char *js_get_utf8(jsval val)
+char *js_get_utf8(JSContext *c, jsval val)
{
#if 0
jschar *utf16;
}
txt[len]=0;
return txt;
+#elif (JS_VERSION>=185)
+ if (!JSVAL_CHECK_STRING(val) || JSVAL_IS_NULL(val)) return NULL;
+ return SMJS_CHARS(c, val);
#else
if (!JSVAL_CHECK_STRING(val) || JSVAL_IS_NULL(val)) return NULL;
- return gf_strdup( JS_GetStringBytes(JSVAL_TO_STRING(val) ) );
+ return gf_strdup( SMJS_CHARS(c, val) );
#endif
}
static GF_DOMRuntime *dom_rt = NULL;
-static JSBool xml_dom3_not_implemented(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_dom3_not_implemented)
{
return JS_TRUE;
}
if (set_rooted && (gf_list_find(sg->objects, n->sgprivate->interact->js_binding->node)<0)) {
const char *name = gf_node_get_name(n);
if (name) {
- gf_js_add_named_root(c, &n->sgprivate->interact->js_binding->node, name);
+ gf_js_add_named_root(c, &n->sgprivate->interact->js_binding->node, GF_JSGC_OBJECT, name);
} else {
- gf_js_add_root(c, &n->sgprivate->interact->js_binding->node);
+ gf_js_add_root(c, &n->sgprivate->interact->js_binding->node, GF_JSGC_OBJECT);
}
gf_list_add(sg->objects, n->sgprivate->interact->js_binding->node);
}
if (n->sgprivate->parents && set_rooted) {
const char *name = gf_node_get_name(n);
if (name) {
- gf_js_add_named_root(c, &n->sgprivate->interact->js_binding->node, name);
+ gf_js_add_named_root(c, &n->sgprivate->interact->js_binding->node, GF_JSGC_OBJECT, name);
} else {
- gf_js_add_root(c, &n->sgprivate->interact->js_binding->node);
+ gf_js_add_root(c, &n->sgprivate->interact->js_binding->node, GF_JSGC_OBJECT);
}
gf_list_add(sg->objects, n->sgprivate->interact->js_binding->node);
}
gf_free(nl);
}
-static JSBool dom_nodelist_item(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(dom_nodelist_item)
{
GF_Node *n;
u32 count;
s32 idx;
DOMNodeList *nl;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &dom_rt->domNodeListClass, NULL) )
return JS_TRUE;
if ((argc!=1) || !JSVAL_IS_INT(argv[0]))
count = gf_node_list_get_count(nl->owner ? nl->owner->children : nl->child);
idx = JSVAL_TO_INT(argv[0]);
if ((idx<0) || ((u32) idx>=count)) {
- *rval = JSVAL_VOID;
+ SMJS_SET_RVAL( JSVAL_VOID );
return JS_TRUE;
}
n = gf_node_list_get_child(nl->owner ? nl->owner->children : nl->child, idx);
- *rval = dom_node_construct(c, n);
+ SMJS_SET_RVAL( dom_node_construct(c, n) );
return JS_TRUE;
}
-
-
-static JSBool dom_nodelist_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_nodelist_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
DOMNodeList *nl;
if (!JS_InstanceOf(c, obj, &dom_rt->domNodeListClass, NULL)
)
return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0:
nl = (DOMNodeList *) JS_GetPrivate(c, obj);
*vp = INT_TO_JSVAL( gf_node_list_get_count(nl->owner ? nl->owner->children : nl->child) );
}
return JS_TRUE;
}
-static JSBool dom_nodelist_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_nodelist_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
/*no write prop*/
return JS_TRUE;
}
/*dom event listener*/
#define JS_DOM3_EVEN_TARGET_INTERFACE \
- {"addEventListenerNS", dom_event_add_listener, 4, 0, 0}, \
- {"removeEventListenerNS", dom_event_remove_listener, 4, 0, 0}, \
- {"addEventListener", dom_event_add_listener, 3, 0, 0}, \
- {"removeEventListener", dom_event_remove_listener, 3, 0, 0}, \
- {"dispatchEvent", xml_dom3_not_implemented, 1, 0, 0},
+ SMJS_FUNCTION_SPEC("addEventListenerNS", dom_event_add_listener, 4), \
+ SMJS_FUNCTION_SPEC("removeEventListenerNS", dom_event_remove_listener, 4), \
+ SMJS_FUNCTION_SPEC("addEventListener", dom_event_add_listener, 3), \
+ SMJS_FUNCTION_SPEC("removeEventListener", dom_event_remove_listener, 3), \
+ SMJS_FUNCTION_SPEC("dispatchEvent", xml_dom3_not_implemented, 1),
static void dom_handler_remove(GF_Node *node, void *rs, Bool is_destroy)
SVG_handlerElement *handler = (SVG_handlerElement *)node;
if (handler->js_context && handler->js_fun_val) {
/*unprotect the function*/
- gf_js_remove_root(handler->js_context, &(handler->js_fun_val));
+ gf_js_remove_root(handler->js_context, &(handler->js_fun_val), GF_JSGC_VAL);
handler->js_fun_val=0;
gf_list_del_item(dom_rt->handlers, handler);
}
}
/*eventListeners routines used by document, element and connection interfaces*/
-JSBool gf_sg_js_event_add_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, GF_Node *on_node)
+JSBool SMJS_FUNCTION_EXT(gf_sg_js_event_add_listener, GF_Node *on_node)
{
GF_DOMEventTarget *target;
GF_FieldInfo info;
GF_Node *n = NULL;
jsval funval = 0;
JSObject *evt_handler;
+ SMJS_OBJ
+ SMJS_ARGS
target = NULL;
/*document interface*/
/*NS version (4 args in DOM2, 5 in DOM3 for evt_group param)*/
if (argc>=4) {
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- inNS = js_get_utf8(argv[0]);
+ inNS = js_get_utf8(c, argv[0]);
of = 1;
}
evt_handler = obj;
+ type = callback = NULL;
if (!JSVAL_CHECK_STRING(argv[of])) goto err_exit;
- type = JSVAL_GET_STRING(argv[of]);
- callback = NULL;
+ type = SMJS_CHARS(c, argv[of]);
if (JSVAL_CHECK_STRING(argv[of+1])) {
- callback = JSVAL_GET_STRING(argv[of+1]);
+ callback = SMJS_CHARS(c, argv[of+1]);
if (!callback) goto err_exit;
} else if (JSVAL_IS_OBJECT(argv[of+1])) {
if (JS_ObjectIsFunction(c, JSVAL_TO_OBJECT(argv[of+1]))) {
if (handler->js_fun_val) {
handler->js_context = c;
/*protect the function - we don't know how it was passed to us, so prevent it from being GCed*/
- gf_js_add_root(handler->js_context, &handler->js_fun_val);
+ gf_js_add_root(handler->js_context, &handler->js_fun_val, GF_JSGC_VAL);
handler->sgprivate->UserCallback = dom_handler_remove;
gf_list_add(dom_rt->handlers, handler);
}
err_exit:
if (inNS) gf_free(inNS);
- return JS_TRUE;
+ SMJS_FREE(c, type);
+ SMJS_FREE(c, callback);
+ return JS_TRUE;
}
-JSBool dom_event_add_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(dom_event_add_listener)
{
- return gf_sg_js_event_add_listener(c, obj, argc, argv, rval, NULL);
+ return gf_sg_js_event_add_listener(SMJS_CALL_ARGS, NULL);
}
-JSBool gf_sg_js_event_remove_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, GF_Node *vrml_node)
+JSBool SMJS_FUNCTION_EXT(gf_sg_js_event_remove_listener, GF_Node *vrml_node)
{
#ifndef GPAC_DISABLE_SVG
char *type, *callback;
jsval funval = 0;
GF_SceneGraph *sg = NULL;
GF_DOMEventTarget *target = NULL;
+ SMJS_OBJ
+ SMJS_ARGS
/*get the scenegraph first*/
sg = dom_get_doc(c, obj);
if (argc==4) {
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- inNS = js_get_utf8(argv[0]);
+ inNS = js_get_utf8(c, argv[0]);
of = 1;
}
+ type = callback = NULL;
if (!JSVAL_CHECK_STRING(argv[of])) goto err_exit;
- type = JSVAL_GET_STRING(argv[of]);
- callback = NULL;
+ type = SMJS_CHARS(c, argv[of]);
+
if (JSVAL_CHECK_STRING(argv[of+1])) {
- callback = JSVAL_GET_STRING(argv[of+1]);
+ callback = SMJS_CHARS(c, argv[of+1]);
} else if (JSVAL_IS_OBJECT(argv[of+1])) {
if (JS_ObjectIsFunction(c, JSVAL_TO_OBJECT(argv[of+1]) )) {
funval = argv[of+1];
err_exit:
if (inNS) gf_free(inNS);
+ SMJS_FREE(c, type);
+ SMJS_FREE(c, callback);
return JS_TRUE;
}
-JSBool dom_event_remove_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(dom_event_remove_listener)
{
- return gf_sg_js_event_remove_listener(c, obj, argc, argv, rval, NULL);
+ return gf_sg_js_event_remove_listener(SMJS_CALL_ARGS, NULL);
}
/*dom3 node*/
if (nobj && (gf_list_find(n->sgprivate->scenegraph->objects, nobj)<0) ) {
const char *name = gf_node_get_name(n);
if (name) {
- gf_js_add_named_root(c, &n->sgprivate->interact->js_binding->node, name);
+ gf_js_add_named_root(c, &n->sgprivate->interact->js_binding->node, GF_JSGC_OBJECT, name);
} else {
- gf_js_add_root(c, &n->sgprivate->interact->js_binding->node);
+ gf_js_add_root(c, &n->sgprivate->interact->js_binding->node, GF_JSGC_OBJECT);
}
gf_list_add(n->sgprivate->scenegraph->objects, nobj);
}
dom_node_changed(parent, 1, NULL);
}
-static JSBool xml_node_insert_before(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_insert_before)
{
s32 idx;
u32 tag;
GF_Node *n, *target, *new_node;
GF_ParentNode *par;
+ SMJS_OBJ
+ SMJS_ARGS
if (!argc || !JSVAL_IS_OBJECT(argv[0]))
return JS_TRUE;
}
}
dom_node_inserted(c, new_node, n, idx);
- *rval = argv[0];
+ SMJS_SET_RVAL( argv[0] );
return JS_TRUE;
}
-static JSBool xml_node_append_child(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_append_child)
{
u32 tag;
GF_Node *n, *new_node;
+ SMJS_OBJ
+ SMJS_ARGS
if (!argc || !JSVAL_IS_OBJECT(argv[0])) return JS_TRUE;
n = dom_get_node(c, obj);
if (!n) {
dom_node_inserted(c, new_node, n, -1);
- *rval = argv[0];
+ SMJS_SET_RVAL( argv[0] );
return JS_TRUE;
}
-static JSBool xml_node_replace_child(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_replace_child)
{
s32 idx;
u32 tag;
GF_Node *n, *new_node, *old_node;
GF_ParentNode *par;
+ SMJS_OBJ
+ SMJS_ARGS
if ((argc!=2) || !JSVAL_IS_OBJECT(argv[0]) || !JSVAL_IS_OBJECT(argv[1])) return JS_TRUE;
n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
/*whenever we remove a node from the tree, call GC to cleanup the JS binding if any. Not doing so may screw up node IDs*/
n->sgprivate->scenegraph->svg_js->force_gc = 1;
- *rval = argv[0];
+ SMJS_SET_RVAL( argv[0] );
return JS_TRUE;
}
-static JSBool xml_node_remove_child(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_remove_child)
{
u32 tag;
GF_Node *n, *old_node;
GF_ParentNode *par;
+ SMJS_OBJ
+ SMJS_ARGS
if (!argc || !JSVAL_IS_OBJECT(argv[0])) return JS_TRUE;
n = dom_get_node(c, obj);
} else {
return dom_throw_exception(c, GF_DOM_EXC_NOT_FOUND_ERR);
}
- *rval = argv[0];
+ SMJS_SET_RVAL( argv[0]);
dom_node_changed(n, 1, NULL);
/*whenever we remove a node from the tree, call GC to cleanup the JS binding if any. Not doing so may screw up node IDs*/
n->sgprivate->scenegraph->svg_js->force_gc = 1;
}
-static JSBool xml_clone_node(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_clone_node)
{
Bool deep;
GF_Node *n, *clone;
+ SMJS_OBJ
+ SMJS_ARGS
n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
deep = argc ? JSVAL_TO_BOOLEAN(argv[0]) : 0;
clone = gf_node_clone(n->sgprivate->scenegraph, n, NULL, "", deep);
- *rval = dom_node_construct(c, clone);
+ SMJS_SET_RVAL( dom_node_construct(c, clone) );
return JS_TRUE;
}
-static JSBool xml_node_has_children(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_has_children)
{
GF_Node *n;
+ SMJS_OBJ
n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
- *rval = BOOLEAN_TO_JSVAL( ((GF_ParentNode*)n)->children ? JS_TRUE : JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( ((GF_ParentNode*)n)->children ? JS_TRUE : JS_FALSE) );
return JS_TRUE;
}
-static JSBool xml_node_has_attributes(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_has_attributes)
{
u32 tag;
GF_Node *n;
+ SMJS_OBJ
n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
tag = gf_node_get_tag(n);
if (tag>=GF_NODE_FIRST_DOM_NODE_TAG) {
- *rval = BOOLEAN_TO_JSVAL( ((GF_DOMNode*)n)->attributes ? JS_TRUE : JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( ((GF_DOMNode*)n)->attributes ? JS_TRUE : JS_FALSE) );
} else {
/*not supported for other node types*/
- *rval = BOOLEAN_TO_JSVAL( JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( JS_FALSE) );
}
return JS_TRUE;
}
-static JSBool xml_node_is_same_node(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_node_is_same_node)
{
GF_Node *n, *a_node;
+ SMJS_OBJ
+ SMJS_ARGS
if (!argc || !JSVAL_IS_OBJECT(argv[0])) return JS_TRUE;
n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
a_node = dom_get_node(c, JSVAL_TO_OBJECT(argv[0]));
if (!a_node) return JS_TRUE;
- *rval = BOOLEAN_TO_JSVAL( (a_node==n) ? JS_TRUE : JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL( (a_node==n) ? JS_TRUE : JS_FALSE) );
return JS_TRUE;
}
return node_lookup_namespace_by_tag(gf_node_get_parent(node, 0), tag);
}
+#ifdef UNUSED_FUNC
+/**
+ * FIXME : function is not used by anybody
+ */
static u32 get_namespace_code_by_prefix(GF_Node *node, char *prefix)
{
/*browse attributes*/
/*browse for parent*/
return get_namespace_code_by_prefix(gf_node_get_parent(node, 0), prefix);
}
+#endif
-static JSBool dom_node_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_node_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
u32 tag;
GF_Node *n;
}
/*not supported*/
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
tag = n ? gf_node_get_tag(n) : 0;
par = (GF_ParentNode*)n;
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*"nodeName"*/
case 0:
if (sg) {
gf_node_changed(n, &info);
}
-static JSBool dom_node_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_node_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
u32 tag;
GF_Node *n;
/*note an element - we don't support property setting on document yet*/
if (!n) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
tag = n ? gf_node_get_tag(n) : 0;
par = (GF_ParentNode*)n;
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*"nodeValue"*/
case 1:
if ((tag==TAG_DOMText) && JSVAL_CHECK_STRING(*vp)) {
GF_DOMText *txt = (GF_DOMText *)n;
if (txt->textContent) gf_free(txt->textContent);
- txt->textContent = js_get_utf8(*vp);
+ txt->textContent = js_get_utf8(c, *vp);
dom_node_changed(n, 1, NULL);
}
/*we only support element and sg in the Node interface, no set*/
case 15:
{
char *txt;
- txt = js_get_utf8(*vp);
+ txt = js_get_utf8(c, *vp);
dom_node_set_textContent(n, txt);
if (txt) gf_free(txt);
}
}
}
-static JSBool dom_document_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_document_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
u32 prop_id;
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 2:/*implementation*/
return JS_TRUE;
}
-static JSBool dom_document_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_document_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
u32 prop_id;
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 6:/*"xmlStandalone"*/
return JS_TRUE;
}
-static JSBool xml_document_create_element(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_document_create_element)
{
u32 tag, ns;
GF_Node *n;
char *name, *xmlns;
+ SMJS_OBJ
+ SMJS_ARGS
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg || !argc || !JSVAL_CHECK_STRING(argv[0]) )
xmlns = NULL;
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- xmlns = js_get_utf8(argv[0]);
+ xmlns = js_get_utf8(c, argv[0]);
if (xmlns) ns = gf_sg_get_namespace_code_from_name(sg, xmlns);
- name = JSVAL_GET_STRING(argv[1]);
+ name = SMJS_CHARS(c, argv[1]);
} else {
- name = JSVAL_GET_STRING(argv[0]);
+ name = SMJS_CHARS(c, argv[0]);
}
if (name) {
elt->ns = gf_sg_get_namespace_code_from_name(sg, xmlns);
}
}
- *rval = dom_element_construct(c, n);
+ SMJS_SET_RVAL( dom_element_construct(c, n) );
}
if (xmlns) gf_free(xmlns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool xml_document_create_text(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_document_create_text)
{
GF_Node *n;
+ SMJS_OBJ
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg) return JS_TRUE;
n = gf_node_new(sg, TAG_DOMText);
if (argc) {
- char *str = js_get_utf8(argv[0]);
+ SMJS_ARGS
+ char *str = js_get_utf8(c, argv[0]);
if (!str) str = gf_strdup("");
((GF_DOMText*)n)->textContent = str;
}
- *rval = dom_text_construct(c, n);
+ SMJS_SET_RVAL( dom_text_construct(c, n) );
return JS_TRUE;
}
}
}
-static JSBool xml_document_elements_by_tag(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_document_elements_by_tag)
{
DOMNodeList *nl;
JSObject *new_obj;
char *name;
+ SMJS_OBJ
+ SMJS_ARGS
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg) return JS_TRUE;
if (!argc || !JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
+
/*NS version - TODO*/
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[1]);
+ name = SMJS_CHARS(c, argv[1]);
+ } else {
+ name = SMJS_CHARS(c, argv[0]);
}
GF_SAFEALLOC(nl, DOMNodeList);
xml_doc_gather_nodes((GF_ParentNode*)sg->RootNode, name, nl);
new_obj = JS_NewObject(c, &dom_rt->domNodeListClass, 0, 0);
JS_SetPrivate(c, new_obj, nl);
- *rval = OBJECT_TO_JSVAL(new_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(new_obj));
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool xml_document_element_by_id(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_document_element_by_id)
{
NodeIDedItem *reg_node;
GF_Node *n;
char *id;
+ SMJS_OBJ
+ SMJS_ARGS
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg) return JS_FALSE;
if (!argc || !JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- id = JSVAL_GET_STRING(argv[0]);
+ id = SMJS_CHARS(c, argv[0]);
/*we don't use the regular gf_sg_find_node_by_name because we may have nodes defined with the
same ID and we need to locate the first one which is inserted in the tree*/
}
reg_node = reg_node->next;
}
- *rval = dom_element_construct(c, n);
+ SMJS_SET_RVAL( dom_element_construct(c, n));
+ SMJS_FREE(c, id);
return JS_TRUE;
}
dom_node_finalize(c, obj);
}
-static JSBool dom_element_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_element_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
u32 prop_id;
GF_Node *n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 1: /*"tagName"*/
*vp = STRING_TO_JSVAL( JS_NewStringCopyZ(c, gf_node_get_class_name(n) ) );
return JS_TRUE;
}
-static JSBool xml_element_get_attribute(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_element_get_attribute)
{
char *name, *ns;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_node(c, obj);
- if (!n)
- return JS_TRUE;
+ if (!n) return JS_TRUE;
if (!argc || !JSVAL_CHECK_STRING(argv[0]))
return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
- ns = NULL;
+ name = ns = NULL;
/*NS version*/
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1]))
return JS_TRUE;
- ns = js_get_utf8(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
+ ns = js_get_utf8(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
+ } else {
+ name = SMJS_CHARS(c, argv[0]);
}
if (!name) goto exit;
if (!strcmp(name, "id") || !strcmp(name, "xml:id") ) {
char *sID = (char *) gf_node_get_name(n);
if (sID) {
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, sID ? sID : "") );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, sID ? sID : "") ) );
goto exit;
}
}
GF_DOMFullAttribute *att = (GF_DOMFullAttribute*)node->attributes;
while (att) {
if ((att->tag==TAG_DOM_ATT_any) && !strcmp(att->name, name)) {
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, *(char**)att->data ) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, *(char**)att->data ) ));
goto exit;
}
att = (GF_DOMFullAttribute *) att->next;
if (gf_node_get_attribute_by_name(n, name, ns_code, 0, 0, &info)==GF_OK) {
char *szAtt = gf_svg_dump_attribute(n, &info);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, szAtt) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, szAtt) ) );
if (szAtt) gf_free(szAtt);
goto exit;
}
}
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, "") );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, "") ));
exit:
if (ns) gf_free(ns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool xml_element_has_attribute(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_element_has_attribute)
{
char *name, *ns;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_node(c, obj);
if (!n)
return JS_TRUE;
if (!argc || !JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
- ns = NULL;
+ name = ns = NULL;
/*NS version*/
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- ns = js_get_utf8(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
+ ns = js_get_utf8(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
+ } else {
+ name = SMJS_CHARS(c, argv[0]);
}
if (!name) goto exit;
+
if (n->sgprivate->tag==TAG_DOMFullNode) {
GF_DOMFullNode *node = (GF_DOMFullNode*)n;
GF_DOMFullAttribute *att = (GF_DOMFullAttribute*)node->attributes;
while (att) {
if ((att->tag==TAG_DOM_ATT_any) && !strcmp(att->name, name)) {
- *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE));
goto exit;
}
att = (GF_DOMFullAttribute *) att->next;
else ns_code = gf_sg_get_namespace_code(n->sgprivate->scenegraph, NULL);
if (gf_node_get_attribute_by_name(n, name, ns_code, 0, 0, &info)==GF_OK) {
- *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
goto exit;
}
}
- *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_FALSE) );
exit:
if (ns) gf_free(ns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool xml_element_remove_attribute(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_element_remove_attribute)
{
u32 tag;
GF_DOMFullNode *node;
GF_DOMFullAttribute *prev, *att;
char *name, *ns;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
if (!argc || !JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
- ns = NULL;
+ name = ns = NULL;
/*NS version*/
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- ns = js_get_utf8(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
+ ns = js_get_utf8(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
+ } else {
+ name = SMJS_CHARS(c, argv[0]);
}
if (!name) goto exit;
}
exit:
if (ns) gf_free(ns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool xml_element_set_attribute(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_element_set_attribute)
{
u32 evtType, idx;
- char *name, *val, *ns;
+ char *name, *val, *ns, *_val;
char szVal[100];
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
if ((argc < 2)) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
idx = 1;
- ns = NULL;
+ _val = name = ns = NULL;
/*NS version*/
if (argc==3) {
char *sep;
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- ns = js_get_utf8(argv[0]);
+ ns = js_get_utf8(c, argv[0]);
gf_sg_add_namespace(n->sgprivate->scenegraph, ns, NULL);
- name = JSVAL_GET_STRING(argv[1]);
+ name = SMJS_CHARS(c, argv[1]);
idx = 2;
sep = strchr(name, ':');
if (sep) name = sep+1;
+ } else {
+ name = SMJS_CHARS(c, argv[0]);
}
val = NULL;
if (JSVAL_CHECK_STRING(argv[idx])) {
- val = JSVAL_GET_STRING(argv[idx]);
+ val = _val = SMJS_CHARS(c, argv[idx]);
} else if (JSVAL_IS_INT(argv[idx])) {
sprintf(szVal, "%d", JSVAL_TO_INT(argv[idx]));
val = szVal;
}
exit:
if (ns) gf_free(ns);
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, _val);
return JS_TRUE;
}
-static JSBool xml_element_elements_by_tag(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_element_elements_by_tag)
{
DOMNodeList *nl;
JSObject *new_obj;
char *name;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
if (!argc || !JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
/*NS version*/
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[1]);
+ name = SMJS_CHARS(c, argv[1]);
+ } else {
+ name = SMJS_CHARS(c, argv[0]);
}
GF_SAFEALLOC(nl, DOMNodeList);
- if (name && !strcmp(name, "*")) name = NULL;
+ if (name && !strcmp(name, "*")) {
+ SMJS_FREE(c, name);
+ name = NULL;
+ }
xml_doc_gather_nodes((GF_ParentNode*)n, name, nl);
new_obj = JS_NewObject(c, &dom_rt->domNodeListClass, 0, 0);
JS_SetPrivate(c, new_obj, nl);
- *rval = OBJECT_TO_JSVAL(new_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(new_obj) );
+
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool xml_element_set_id(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_element_set_id)
{
const char *node_name;
u32 node_id;
char *name;
Bool is_id;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_node(c, obj);
if (!n) return JS_TRUE;
if ((argc<2) || !JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[0]);
/*NS version*/
if (argc==2) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- name = JSVAL_GET_STRING(argv[1]);
+ name = SMJS_CHARS(c, argv[1]);
is_id = (JSVAL_TO_BOOLEAN(argv[2])==JS_TRUE) ? 1 : 0;
} else {
+ name = SMJS_CHARS(c, argv[0]);
is_id = (JSVAL_TO_BOOLEAN(argv[1])==JS_TRUE) ? 1 : 0;
}
node_name = gf_node_get_name_and_id(n, &node_id);
if (node_id && is_id) {
/*we only support ONE ID per node*/
+ SMJS_FREE(c, name);
return JS_TRUE;
}
if (is_id) {
} else if (node_id) {
gf_node_remove_id(n);
}
+ SMJS_FREE(c, name);
return JS_TRUE;
}
/*dom3 character/text/comment*/
-static JSBool dom_text_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_text_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
u32 prop_id;
GF_DOMText *txt = (GF_DOMText*)dom_get_node(c, obj);
if (!txt || (txt->sgprivate->tag != TAG_DOMText)) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 1: /*"data"*/
}
return JS_TRUE;
}
-static JSBool dom_text_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dom_text_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
u32 prop_id;
GF_DOMText *txt = (GF_DOMText*)dom_get_node(c, obj);
if (!txt || (txt->sgprivate->tag != TAG_DOMText)) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 1: /*"data"*/
if (txt->textContent) gf_free(txt->textContent);
txt->textContent = NULL;
if (JSVAL_CHECK_STRING(*vp)) {
- char *str = js_get_utf8(*vp);
+ char *str = js_get_utf8(c, *vp);
txt->textContent = str ? str : gf_strdup("" );
}
dom_node_changed((GF_Node*)txt, 0, NULL);
return JS_TRUE;
}
-static JSBool event_stop_propagation(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(event_stop_propagation)
{
+ SMJS_OBJ
GF_DOM_Event *evt = JS_GetPrivate(c, obj);
if (!evt) return JS_TRUE;
evt->event_phase |= GF_DOM_EVENT_PHASE_CANCEL;
return JS_TRUE;
}
-static JSBool event_stop_immediate_propagation(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(event_stop_immediate_propagation)
{
+ SMJS_OBJ
GF_DOM_Event *evt = JS_GetPrivate(c, obj);
if (!evt) return JS_TRUE;
evt->event_phase |= GF_DOM_EVENT_PHASE_CANCEL_ALL;
return JS_TRUE;
}
-static JSBool event_prevent_default(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(event_prevent_default)
{
+ SMJS_OBJ
GF_DOM_Event *evt = JS_GetPrivate(c, obj);
if (!evt) return JS_TRUE;
evt->event_phase |= GF_DOM_EVENT_PHASE_PREVENT;
return JS_TRUE;
}
-static JSBool event_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool event_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
JSString *s;
GF_DOM_Event *evt = JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (evt==NULL) return JS_TRUE;
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: /*type*/
s = JS_NewStringCopyZ(c, gf_dom_event_get_name(evt->type) );
*vp = STRING_TO_JSVAL( s );
return JS_TRUE;
case 56:/*bufferRemainingTime*/
if (!evt->mae) return JS_TRUE;
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, evt->mae->remaining_time) );
+ *vp = JS_MAKE_DOUBLE(c, evt->mae->remaining_time);
return JS_TRUE;
case 57:/*status*/
if (!evt->mae) return JS_TRUE;
/*VRML ones*/
case 60:/*width*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->screen_rect.width) ) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->screen_rect.width) );
return JS_TRUE;
case 61:/*height*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->screen_rect.height)) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->screen_rect.height) );
return JS_TRUE;
case 62:/*offset_x*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->screen_rect.x) ) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->screen_rect.x) );
return JS_TRUE;
case 63:/*offset_x*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->screen_rect.y)) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->screen_rect.y) );
return JS_TRUE;
case 64:/*vp_width*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->prev_translate.x)) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->prev_translate.x) );
return JS_TRUE;
case 65:/*vp_height*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->prev_translate.y)) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->prev_translate.y) );
return JS_TRUE;
case 66:/*translation_x*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->new_translate.x)) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->new_translate.x) );
return JS_TRUE;
case 67:/*translation_y*/
- *vp = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(evt->new_translate.y)) );
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(evt->new_translate.y) );
return JS_TRUE;
case 68:/*type3d*/
*vp = INT_TO_JSVAL(evt->detail); return JS_TRUE;
+ case 69:/*error*/
+ *vp = INT_TO_JSVAL(evt->error_state); return JS_TRUE;
default: return JS_TRUE;
}
ctx->recv_headers = NULL;
}
}
-static void xml_http_append_recv_header(XMLHTTPContext *ctx, char *hdr, char *val)
+static void xml_http_append_recv_header(XMLHTTPContext *ctx, const char *hdr, const char *val)
{
u32 nb_hdr = 0;
if (ctx->recv_headers) {
ctx->headers = NULL;
}
if (ctx->sess) {
- gf_dm_sess_del(ctx->sess);
+ GF_DownloadSession *tmp = ctx->sess;
ctx->sess = NULL;
+ gf_dm_sess_abort(tmp);
+ gf_dm_sess_del(tmp);
}
if (ctx->data) {
gf_free(ctx->data);
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (ctx) {
- if (ctx->onreadystatechange) gf_js_remove_root(c, &(ctx->onreadystatechange));
+ if (ctx->onreadystatechange) gf_js_remove_root(c, &(ctx->onreadystatechange), GF_JSGC_VAL);
xml_http_reset(ctx);
gf_free(ctx);
}
}
-static JSBool xml_http_constructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_constructor)
{
XMLHTTPContext *p;
+ SMJS_OBJ_CONSTRUCTOR
+
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
GF_SAFEALLOC(p, XMLHTTPContext);
p->c = c;
p->_this = obj;
JS_SetPrivate(c, obj, p);
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
GF_SceneGraph *scene;
GF_Node *n;
jsval rval;
- //GF_SceneGraph *scene = (GF_SceneGraph *) xml_get_scenegraph(ctx->c);
+
+ gf_sg_lock_javascript(ctx->c, 1);
if (ctx->onreadystatechange)
JS_CallFunction(ctx->c, ctx->_this, ctx->onreadystatechange, 0, NULL, &rval);
/*todo - fire XHR events*/
+
+ gf_sg_lock_javascript(ctx->c, 0);
+
/*Flush BIFS eventOut events*/
#ifndef GPAC_DISABLE_VRML
scene = JS_GetContextPrivate(ctx->c);
}
-static JSBool xml_http_open(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_open)
{
char *val;
GF_JSAPIParam par;
XMLHTTPContext *ctx;
GF_SceneGraph *scene;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
xml_http_reset(ctx);
- val = JSVAL_GET_STRING(argv[0]);
+ val = SMJS_CHARS(c, argv[0]);
if (strcmp(val, "GET") && strcmp(val, "POST") && strcmp(val, "HEAD")
- && strcmp(val, "PUT") && strcmp(val, "DELETE") && strcmp(val, "OPTIONS") )
+ && strcmp(val, "PUT") && strcmp(val, "DELETE") && strcmp(val, "OPTIONS") ) {
+ SMJS_FREE(c, val);
return JS_TRUE;
+ }
ctx->method = gf_strdup(val);
+
+ SMJS_FREE(c, val);
/*concatenate URL*/
scene = xml_get_scenegraph(c);
#endif
par.uri.nb_params = 0;
- par.uri.url = JSVAL_GET_STRING(argv[1]);
+ val = SMJS_CHARS(c, argv[1]);
+ par.uri.url = val;
ScriptAction(scene, GF_JSAPI_OP_RESOLVE_URI, scene->RootNode, &par);
ctx->url = (char *)par.uri.url;
+ SMJS_FREE(c, val);
/*async defaults to true*/
ctx->async = 1;
if (argc>2) {
+ val = NULL;
ctx->async = (JSVAL_TO_BOOLEAN(argv[2])==JS_TRUE) ? 1 : 0;
if (argc>3) {
if (!JSVAL_CHECK_STRING(argv[3])) return JS_TRUE;
- val = JSVAL_GET_STRING(argv[3]);
/*TODO*/
if (argc>4) {
- if (!JSVAL_CHECK_STRING(argv[3])) return JS_TRUE;
- val = JSVAL_GET_STRING(argv[3]);
+ if (!JSVAL_CHECK_STRING(argv[4])) return JS_TRUE;
+ val = SMJS_CHARS(c, argv[4]);
/*TODO*/
+ } else {
+ val = SMJS_CHARS(c, argv[3]);
}
}
+ SMJS_FREE(c, val);
}
/*OPEN success*/
ctx->readyState = 1;
return JS_TRUE;
}
-static JSBool xml_http_set_header(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_set_header)
{
char *hdr, *val;
XMLHTTPContext *ctx;
+ SMJS_OBJ
+ SMJS_ARGS
+
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!ctx) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- hdr = JSVAL_GET_STRING(argv[0]);
- val = JSVAL_GET_STRING(argv[1]);
+ hdr = SMJS_CHARS(c, argv[0]);
+ val = SMJS_CHARS(c, argv[1]);
xml_http_append_send_header(ctx, hdr, val);
+ SMJS_FREE(c, hdr);
+ SMJS_FREE(c, val);
return JS_TRUE;
}
static void xml_http_sax_start(void *sax_cbck, const char *node_name, const char *name_space, const GF_XMLAttribute *attributes, u32 nb_attributes)
static void xml_http_on_data(void *usr_cbk, GF_NETIO_Parameter *parameter)
{
+ Bool locked = 0;
XMLHTTPContext *ctx = (XMLHTTPContext *)usr_cbk;
+ /*make sure we can grab JS and the session is not destroyed*/
+ while (ctx->sess) {
+ if (gf_sg_try_lock_javascript(ctx->c) ){
+ locked = 1;
+ break;
+ }
+ gf_sleep(1);
+ }
/*if session not set, we've had an abort*/
- if (!ctx->sess) return;
+ if (!ctx->sess){
+ if (locked)
+ gf_sg_lock_javascript(ctx->c, 0);
+ return;
+ }
+
+ assert( locked );
+ gf_sg_lock_javascript(ctx->c, 0);
switch (parameter->msg_type) {
case GF_NETIO_SETUP:
xml_http_state_change(ctx);
}
-static JSBool xml_http_send(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_send)
{
GF_JSAPIParam par;
GF_SceneGraph *scene;
char *data = NULL;
XMLHTTPContext *ctx;
GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (ctx->readyState!=1) return JS_TRUE;
if (ctx->sess) return JS_TRUE;
+ scene = xml_get_scenegraph(c);
+ par.dnld_man = NULL;
+ ScriptAction(scene, GF_JSAPI_OP_GET_DOWNLOAD_MANAGER, NULL, &par);
+ if (!par.dnld_man) return JS_TRUE;
+
if (argc) {
if (JSVAL_IS_NULL(argv[0])) {
} else if (JSVAL_IS_OBJECT(argv[0])) {
return JS_TRUE;
} else {
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- data = JSVAL_GET_STRING(argv[0]);
+ data = SMJS_CHARS(c, argv[0]);
}
}
- scene = xml_get_scenegraph(c);
- par.dnld_man = NULL;
- ScriptAction(scene, GF_JSAPI_OP_GET_DOWNLOAD_MANAGER, NULL, &par);
- if (!par.dnld_man) return JS_TRUE;
-
/*reset previous text*/
if (ctx->data) gf_free(ctx->data);
ctx->data = data ? gf_strdup(data) : NULL;
+ SMJS_FREE(c, data);
+
ctx->use_cache = 0;
if (!strncmp(ctx->url, "http://", 7)) {
ctx->sess = gf_dm_sess_new(par.dnld_man, ctx->url, (ctx->use_cache ? 0 : GF_NETIO_SESSION_NOT_CACHED), xml_http_on_data, ctx, &e);
return JS_TRUE;
}
-static JSBool xml_http_abort(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_abort)
{
GF_DownloadSession *sess;
XMLHTTPContext *ctx;
+ SMJS_OBJ
+
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!ctx) return JS_TRUE;
return JS_TRUE;
}
-static JSBool xml_http_get_all_headers(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_get_all_headers)
{
u32 nb_hdr;
char szVal[4096];
XMLHTTPContext *ctx;
+ SMJS_OBJ
+
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!ctx) return JS_TRUE;
}
}
if (!szVal[0]) {
- *rval = JSVAL_VOID;
+ SMJS_SET_RVAL( JSVAL_VOID );
} else {
- JSString *s;
- s = JS_NewStringCopyZ(c, szVal);
- *rval = STRING_TO_JSVAL( s );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, szVal) ) );
}
return JS_TRUE;
}
-static JSBool xml_http_get_header(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(xml_http_get_header)
{
u32 nb_hdr;
char *hdr;
char szVal[2048];
XMLHTTPContext *ctx;
+ SMJS_OBJ
+ SMJS_ARGS
if (!argc || !JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!ctx) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
- hdr = JSVAL_GET_STRING(argv[0]);
/*must be received or loaded*/
if (ctx->readyState<3) return JS_TRUE;
+ hdr = SMJS_CHARS(c, argv[0]);
+
szVal[0] = 0;
nb_hdr = 0;
if (ctx->recv_headers) {
}
}
if (!szVal[0]) {
- *rval = JSVAL_VOID;
+ SMJS_SET_RVAL( JSVAL_VOID );
} else {
- JSString *s;
- s = JS_NewStringCopyZ(c, szVal);
- *rval = STRING_TO_JSVAL( s );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, szVal)) );
}
-
+ SMJS_FREE(c, hdr);
return JS_TRUE;
}
-static JSBool xml_http_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool xml_http_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
JSString *s;
XMLHTTPContext *ctx;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!ctx) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*onreadystatechange*/
case 0:
if (ctx->onreadystatechange) {
return JS_TRUE;
}
-static JSBool xml_http_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool xml_http_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
XMLHTTPContext *ctx;
if (!JS_InstanceOf(c, obj, &dom_rt->xmlHTTPRequestClass, NULL) ) return JS_TRUE;
ctx = (XMLHTTPContext *)JS_GetPrivate(c, obj);
if (!ctx) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*onreadystatechange*/
case 0:
break;
default:
return JS_TRUE;
}
- if (ctx->onreadystatechange) gf_js_remove_root(c, &(ctx->onreadystatechange));
+ if (ctx->onreadystatechange) gf_js_remove_root(c, &(ctx->onreadystatechange), GF_JSGC_VAL);
+ ctx->onreadystatechange = NULL;
if (JSVAL_IS_VOID(*vp)) {
- ctx->onreadystatechange = NULL;
return JS_TRUE;
}
else if (JSVAL_CHECK_STRING(*vp)) {
jsval fval;
- char *callback = JSVAL_GET_STRING(*vp);
+ char *callback = SMJS_CHARS(c, *vp);
if (! JS_LookupProperty(c, JS_GetGlobalObject(c), callback, &fval)) return JS_TRUE;
ctx->onreadystatechange = JS_ValueToFunction(c, fval);
+ SMJS_FREE(c, callback);
} else if (JSVAL_IS_OBJECT(*vp)) {
ctx->onreadystatechange = JS_ValueToFunction(c, *vp);
}
- if (ctx->onreadystatechange) gf_js_add_root(c, &(ctx->onreadystatechange));
+ if (ctx->onreadystatechange) gf_js_add_root(c, &(ctx->onreadystatechange), GF_JSGC_VAL);
return JS_TRUE;
}
return JS_TRUE;
}
-static JSBool dcci_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dcci_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_DOMFullAttribute *att;
GF_ChildNodeItem *child;
n = (GF_DOMFullNode*) dom_get_node(c, obj);
if (!n) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*value*/
case 0:
child = n->children;
return JS_PropertyStub(c, obj, id, vp);
}
-static JSBool dcci_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool dcci_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
GF_ChildNodeItem *child;
GF_DOMFullNode *n;
n = (GF_DOMFullNode*) dom_get_node(c, obj);
if (!n) return JS_TRUE;
- str = JSVAL_GET_STRING( *vp);
+ str = SMJS_CHARS(c, *vp);
if (!str) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*value*/
case 0:
+#if (JS_VERSION>=185)
+ dcci_getProperty(c, obj, (jsint) (3), &readonly);
+#else
dcci_getProperty(c, obj, INT_TO_JSVAL(3), &readonly);
- if (JSVAL_TO_BOOLEAN(readonly) == JS_TRUE) return JS_TRUE;
+#endif
+ if (JSVAL_TO_BOOLEAN(readonly) == JS_TRUE) break;
child = n->children;
while (child) {
if (child->node && (child->node->sgprivate->tag==TAG_DOMText)) {
evt.relatedNode = (GF_Node*)n;
gf_dom_event_fire((GF_Node*)n, &evt);
n->sgprivate->scenegraph->modified = 1;
- return JS_TRUE;
+ break;
/*propertyType*/
case 2:
- return JS_TRUE;
+ break;
/*all other properties are read-only*/
default:
- return JS_TRUE;
+ break;
}
- return JS_TRUE;
}
+ SMJS_FREE(c, str);
return JS_TRUE;
}
return 0;
}
-static JSBool dcci_has_property(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(dcci_has_property)
{
GF_DOMFullNode *n;
Bool deep;
char *ns, *name;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &dom_rt->DCCIClass, NULL) ) return JS_TRUE;
n = (GF_DOMFullNode*) dom_get_node(c, obj);
if (!n) return JS_TRUE;
if (argc!=3) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- ns = JSVAL_GET_STRING(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
+ ns = SMJS_CHARS(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
deep = JSVAL_TO_BOOLEAN(argv[2]) ? 1 : 0;
deep = dcci_prop_lookup(n, ns, name, deep, 1);
- *rval = BOOLEAN_TO_JSVAL(deep ? JS_TRUE : JS_FALSE);
-
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(deep ? JS_TRUE : JS_FALSE) );
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
}
}
-static JSBool dcci_search_property(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(dcci_search_property)
{
JSObject *new_obj;
DOMNodeList *nl;
GF_DOMFullNode *n;
Bool deep;
char *ns, *name;
+ SMJS_OBJ
+ SMJS_ARGS
+
if (!JS_InstanceOf(c, obj, &dom_rt->DCCIClass, NULL) ) return JS_TRUE;
n = (GF_DOMFullNode*) dom_get_node(c, obj);
if (!n) return JS_TRUE;
if (argc!=4) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[0])) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
- ns = JSVAL_GET_STRING(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
+ ns = SMJS_CHARS(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
/*todo - DCCI prop filter*/
deep = JSVAL_TO_BOOLEAN(argv[3]) ? 1 : 0;
dcci_prop_collect(nl, n, ns, name, deep, 1);
new_obj = JS_NewObject(c, &dom_rt->domNodeListClass, 0, 0);
JS_SetPrivate(c, new_obj, nl);
- *rval = OBJECT_TO_JSVAL(new_obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(new_obj) );
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
-static JSBool storage_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool storage_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &dom_rt->storageClass, NULL) ) return JS_TRUE;
return JS_TRUE;
}
-static JSBool storage_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool storage_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &dom_rt->storageClass, NULL) ) return JS_TRUE;
return JS_TRUE;
}
-static JSBool storage_constructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(storage_constructor)
{
+ SMJS_OBJ_CONSTRUCTOR
+
if (!JS_InstanceOf(c, obj, &dom_rt->storageClass, NULL) ) return JS_TRUE;
return JS_TRUE;
}
JS_SETUP_CLASS(dom_rt->domNodeClass, "Node", JSCLASS_HAS_PRIVATE, dom_node_getProperty, dom_node_setProperty, dom_node_finalize);
JS_SETUP_CLASS(dom_rt->domDocumentClass, "Document", JSCLASS_HAS_PRIVATE, dom_document_getProperty, dom_document_setProperty, dom_document_finalize);
/*Element uses the same destructor as node*/
- JS_SETUP_CLASS(dom_rt->domElementClass, "Element", JSCLASS_HAS_PRIVATE, dom_element_getProperty, JS_PropertyStub, dom_node_finalize);
+ JS_SETUP_CLASS(dom_rt->domElementClass, "Element", JSCLASS_HAS_PRIVATE, dom_element_getProperty, JS_PropertyStub_forSetter, dom_node_finalize);
/*Text uses the same destructor as node*/
JS_SETUP_CLASS(dom_rt->domTextClass, "Text", JSCLASS_HAS_PRIVATE, dom_text_getProperty, dom_text_setProperty, dom_node_finalize);
/*Event class*/
- JS_SETUP_CLASS(dom_rt->domEventClass , "Event", JSCLASS_HAS_PRIVATE, event_getProperty, JS_PropertyStub, JS_FinalizeStub);
+ JS_SETUP_CLASS(dom_rt->domEventClass , "Event", JSCLASS_HAS_PRIVATE, event_getProperty, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_SETUP_CLASS(dom_rt->domNodeListClass, "NodeList", JSCLASS_HAS_PRIVATE, dom_nodelist_getProperty, dom_nodelist_setProperty, dom_nodelist_finalize);
{
JSFunctionSpec nodeFuncs[] = {
- {"insertBefore", xml_node_insert_before, 2, 0, 0},
- {"replaceChild", xml_node_replace_child, 2, 0, 0},
- {"removeChild", xml_node_remove_child, 1, 0, 0},
- {"appendChild", xml_node_append_child, 1, 0, 0},
- {"hasChildNodes", xml_node_has_children, 0, 0, 0},
- {"cloneNode", xml_clone_node, 1, 0, 0},
- {"normalize", xml_dom3_not_implemented, 0, 0, 0},
- {"isSupported", xml_dom3_not_implemented, 2, 0, 0},
- {"hasAttributes", xml_node_has_attributes, 0, 0, 0},
- {"compareDocumentPosition", xml_dom3_not_implemented, 1, 0, 0},
- {"isSameNode", xml_node_is_same_node, 1, 0, 0},
- {"lookupPrefix", xml_dom3_not_implemented, 1, 0, 0},
- {"isDefaultNamespace", xml_dom3_not_implemented, 1, 0, 0},
- {"lookupNamespaceURI", xml_dom3_not_implemented, 1, 0, 0},
+ SMJS_FUNCTION_SPEC("insertBefore", xml_node_insert_before, 2),
+ SMJS_FUNCTION_SPEC("replaceChild", xml_node_replace_child, 2),
+ SMJS_FUNCTION_SPEC("removeChild", xml_node_remove_child, 1),
+ SMJS_FUNCTION_SPEC("appendChild", xml_node_append_child, 1),
+ SMJS_FUNCTION_SPEC("hasChildNodes", xml_node_has_children, 0),
+ SMJS_FUNCTION_SPEC("cloneNode", xml_clone_node, 1),
+ SMJS_FUNCTION_SPEC("normalize", xml_dom3_not_implemented, 0),
+ SMJS_FUNCTION_SPEC("isSupported", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("hasAttributes", xml_node_has_attributes, 0),
+ SMJS_FUNCTION_SPEC("compareDocumentPosition", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("isSameNode", xml_node_is_same_node, 1),
+ SMJS_FUNCTION_SPEC("lookupPrefix", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("isDefaultNamespace", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("lookupNamespaceURI", xml_dom3_not_implemented, 1),
/*we don't support full node compare*/
- {"isEqualNode", xml_node_is_same_node, 1, 0, 0},
- {"getFeature", xml_dom3_not_implemented, 2, 0, 0},
- {"setUserData", xml_dom3_not_implemented, 3, 0, 0},
- {"getUserData", xml_dom3_not_implemented, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("isEqualNode", xml_node_is_same_node, 1),
+ SMJS_FUNCTION_SPEC("getFeature", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("setUserData", xml_dom3_not_implemented, 3),
+ SMJS_FUNCTION_SPEC("getUserData", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec nodeProps[] = {
- {"nodeName", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"nodeValue", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"nodeType", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"parentNode", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"childNodes", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"firstChild", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"lastChild", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"previousSibling", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"nextSibling", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"attributes", 9, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"ownerDocument", 10, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"namespaceURI", 11, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"prefix", 12, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"localName", 13, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"baseURI", 14, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"textContent", 15, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"nodeName", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"nodeValue", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"nodeType", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"parentNode", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"childNodes", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"firstChild", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"lastChild", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"previousSibling", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"nextSibling", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"attributes", 9, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"ownerDocument", 10, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"namespaceURI", 11, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"prefix", 12, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"localName", 13, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"baseURI", 14, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"textContent", 15, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
/*elementTraversal interface*/
- {"firstElementChild", 16, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"lastElementChild", 17, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"previousElementSibling", 18, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"nextElementSibling", 19, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"firstElementChild", 16, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"lastElementChild", 17, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"previousElementSibling", 18, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"nextElementSibling", 19, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
}
{
JSFunctionSpec documentFuncs[] = {
- {"createElement", xml_document_create_element, 1, 0, 0},
- {"createDocumentFragment", xml_dom3_not_implemented, 0, 0, 0},
- {"createTextNode", xml_document_create_text, 1, 0, 0},
- {"createComment", xml_dom3_not_implemented, 1, 0, 0},
- {"createCDATASection", xml_dom3_not_implemented, 1, 0, 0},
- {"createProcessingInstruction", xml_dom3_not_implemented, 2, 0, 0},
- {"createAttribute", xml_dom3_not_implemented, 1, 0, 0},
- {"createEntityReference", xml_dom3_not_implemented, 1, 0, 0},
- {"getElementsByTagName", xml_document_elements_by_tag, 1, 0, 0},
- {"importNode", xml_dom3_not_implemented, 2, 0, 0},
- {"createElementNS", xml_document_create_element, 2, 0, 0},
- {"createAttributeNS", xml_dom3_not_implemented, 2, 0, 0},
- {"getElementsByTagNameNS", xml_document_elements_by_tag, 2, 0, 0},
- {"getElementById", xml_document_element_by_id, 1, 0, 0},
- {"adoptNode", xml_dom3_not_implemented, 1, 0, 0},
- {"normalizeDocument", xml_dom3_not_implemented, 0, 0, 0},
- {"renameNode", xml_dom3_not_implemented, 3, 0, 0},
+ SMJS_FUNCTION_SPEC("createElement", xml_document_create_element, 1),
+ SMJS_FUNCTION_SPEC("createDocumentFragment", xml_dom3_not_implemented, 0),
+ SMJS_FUNCTION_SPEC("createTextNode", xml_document_create_text, 1),
+ SMJS_FUNCTION_SPEC("createComment", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("createCDATASection", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("createProcessingInstruction", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("createAttribute", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("createEntityReference", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("getElementsByTagName", xml_document_elements_by_tag, 1),
+ SMJS_FUNCTION_SPEC("importNode", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("createElementNS", xml_document_create_element, 2),
+ SMJS_FUNCTION_SPEC("createAttributeNS", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("getElementsByTagNameNS", xml_document_elements_by_tag, 2),
+ SMJS_FUNCTION_SPEC("getElementById", xml_document_element_by_id, 1),
+ SMJS_FUNCTION_SPEC("adoptNode", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("normalizeDocument", xml_dom3_not_implemented, 0),
+ SMJS_FUNCTION_SPEC("renameNode", xml_dom3_not_implemented, 3),
/*eventTarget interface*/
JS_DOM3_EVEN_TARGET_INTERFACE
/*DocumentEvent interface*/
- {"createEvent", xml_dom3_not_implemented, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("createEvent", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec documentProps[] = {
- {"doctype", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"implementation", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"documentElement", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"inputEncoding", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"xmlEncoding", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"xmlStandalone", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"xmlVersion", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"strictErrorChecking", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"documentURI", 9, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"domConfig", 10, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"doctype", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"implementation", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"documentElement", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"inputEncoding", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"xmlEncoding", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"xmlStandalone", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"xmlVersion", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"strictErrorChecking", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"documentURI", 9, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"domConfig", 10, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0},
};
{
JSFunctionSpec elementFuncs[] = {
- {"getAttribute", xml_element_get_attribute, 1, 0, 0},
- {"setAttribute", xml_element_set_attribute, 2, 0, 0},
- {"removeAttribute", xml_element_remove_attribute, 1, 0, 0},
- {"getAttributeNS", xml_element_get_attribute, 2, 0, 0},
- {"setAttributeNS", xml_element_set_attribute, 3, 0, 0},
- {"removeAttributeNS", xml_element_remove_attribute, 2, 0, 0},
- {"hasAttribute", xml_element_has_attribute, 1, 0, 0},
- {"hasAttributeNS", xml_element_has_attribute, 2, 0, 0},
- {"getElementsByTagName", xml_element_elements_by_tag, 1, 0, 0},
- {"getElementsByTagNameNS", xml_element_elements_by_tag, 2, 0, 0},
- {"setIdAttribute", xml_element_set_id, 2, 0, 0},
- {"setIdAttributeNS", xml_element_set_id, 3, 0, 0},
- {"getAttributeNode", xml_dom3_not_implemented, 1, 0, 0},
- {"setAttributeNode", xml_dom3_not_implemented, 1, 0, 0},
- {"removeAttributeNode", xml_dom3_not_implemented, 1, 0, 0},
- {"getAttributeNodeNS", xml_dom3_not_implemented, 2, 0, 0},
- {"setAttributeNodeNS", xml_dom3_not_implemented, 1, 0, 0},
- {"setIdAttributeNode", xml_dom3_not_implemented, 2, 0, 0},
+ SMJS_FUNCTION_SPEC("getAttribute", xml_element_get_attribute, 1),
+ SMJS_FUNCTION_SPEC("setAttribute", xml_element_set_attribute, 2),
+ SMJS_FUNCTION_SPEC("removeAttribute", xml_element_remove_attribute, 1),
+ SMJS_FUNCTION_SPEC("getAttributeNS", xml_element_get_attribute, 2),
+ SMJS_FUNCTION_SPEC("setAttributeNS", xml_element_set_attribute, 3),
+ SMJS_FUNCTION_SPEC("removeAttributeNS", xml_element_remove_attribute, 2),
+ SMJS_FUNCTION_SPEC("hasAttribute", xml_element_has_attribute, 1),
+ SMJS_FUNCTION_SPEC("hasAttributeNS", xml_element_has_attribute, 2),
+ SMJS_FUNCTION_SPEC("getElementsByTagName", xml_element_elements_by_tag, 1),
+ SMJS_FUNCTION_SPEC("getElementsByTagNameNS", xml_element_elements_by_tag, 2),
+ SMJS_FUNCTION_SPEC("setIdAttribute", xml_element_set_id, 2),
+ SMJS_FUNCTION_SPEC("setIdAttributeNS", xml_element_set_id, 3),
+ SMJS_FUNCTION_SPEC("getAttributeNode", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("setAttributeNode", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("removeAttributeNode", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("getAttributeNodeNS", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("setAttributeNodeNS", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("setIdAttributeNode", xml_dom3_not_implemented, 2),
/*eventTarget interface*/
JS_DOM3_EVEN_TARGET_INTERFACE
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec elementProps[] = {
- {"tagName", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"schemaTypeInfo", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"tagName", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"schemaTypeInfo", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0},
};
dom_rt->dom_element_proto = JS_InitClass(c, global, dom_rt->dom_node_proto, &dom_rt->domElementClass, 0, 0, elementProps, elementFuncs, 0, 0);
{
JSFunctionSpec textFuncs[] = {
#if 0
- {"substringData", xml_dom3_not_implemented, 2, 0, 0},
- {"appendData", xml_dom3_not_implemented, 1, 0, 0},
- {"insertData", xml_dom3_not_implemented, 2, 0, 0},
- {"deleteData", xml_dom3_not_implemented, 2, 0, 0},
- {"replaceData", xml_dom3_not_implemented, 3, 0, 0},
+ SMJS_FUNCTION_SPEC("substringData", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("appendData", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("insertData", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("deleteData", xml_dom3_not_implemented, 2),
+ SMJS_FUNCTION_SPEC("replaceData", xml_dom3_not_implemented, 3),
/*text*/
- {"splitText", xml_dom3_not_implemented, 1, 0, 0},
- {"replaceWholeText", xml_dom3_not_implemented, 1, 0, 0},
+ SMJS_FUNCTION_SPEC("splitText", xml_dom3_not_implemented, 1),
+ SMJS_FUNCTION_SPEC("replaceWholeText", xml_dom3_not_implemented, 1),
#endif
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec textProps[] = {
- {"data", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"length", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"data", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"length", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*text*/
- {"isElementContentWhitespace", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"wholeText", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"isElementContentWhitespace", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"wholeText", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0},
};
JS_InitClass(c, global, dom_rt->dom_node_proto, &dom_rt->domTextClass, 0, 0, textProps, textFuncs, 0, 0);
/*event API*/
{
JSFunctionSpec eventFuncs[] = {
- {"stopPropagation", event_stop_propagation, 0, 0, 0},
- {"stopImmediatePropagation", event_stop_immediate_propagation, 0, 0, 0},
- {"preventDefault", event_prevent_default, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("stopPropagation", event_stop_propagation, 0),
+ SMJS_FUNCTION_SPEC("stopImmediatePropagation", event_stop_immediate_propagation, 0),
+ SMJS_FUNCTION_SPEC("preventDefault", event_prevent_default, 0),
#if 0
- {"initEvent", event_prevent_default, 3, 0, 0},
- {"initEventNS", event_prevent_default, 4, 0, 0},
+ SMJS_FUNCTION_SPEC("initEvent", event_prevent_default, 3),
+ SMJS_FUNCTION_SPEC("initEventNS", event_prevent_default, 4),
#endif
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec eventProps[] = {
- {"type", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"target", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"currentTarget", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"eventPhase", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"bubbles", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"cancelable", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"timeStamp", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"namespaceURI", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"defaultPrevented", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"type", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"target", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"currentTarget", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"eventPhase", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"bubbles", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"cancelable", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"timeStamp", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"namespaceURI", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"defaultPrevented", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*UIEvent*/
- {"detail", 20, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"detail", 20, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*text, connectionEvent*/
- {"data", 25, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"data", 25, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*MouseEvent*/
- {"screenX", 30, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"screenY", 31, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"clientX", 32, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"clientY", 33, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"button", 34, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"relatedTarget", 35, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"screenX", 30, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"screenY", 31, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"clientX", 32, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"clientY", 33, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"button", 34, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"relatedTarget", 35, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*wheelEvent*/
- {"wheelDelta", 36, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"wheelDelta", 36, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*keyboard*/
- {"keyIdentifier", 40, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"keyChar", 41, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"charCode", 42, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"keyIdentifier", 40, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"keyChar", 41, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"charCode", 42, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*progress*/
- {"lengthComputable",50, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"typeArg", 51, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"loaded", 52, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"total", 53, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"bufferLevelValid", 54, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"bufferLevel", 55, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"bufferRemainingTime", 56, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"status", 57, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"lengthComputable",50, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"typeArg", 51, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"loaded", 52, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"total", 53, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"bufferLevelValid", 54, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"bufferLevel", 55, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"bufferRemainingTime", 56, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"status", 57, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*used by vrml*/
- {"width", 60, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"height", 61, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"offset_x", 62, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"offset_y", 63, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"vp_width", 64, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"vp_height", 65, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"translation_x", 66, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"translation_y", 67, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"type3d", 68, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"width", 60, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"height", 61, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"offset_x", 62, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"offset_y", 63, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"vp_width", 64, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"vp_height", 65, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"translation_x", 66, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"translation_y", 67, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"type3d", 68, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"error", 69, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0},
{
JSFunctionSpec nodeListFuncs[] = {
- {"item", dom_nodelist_item, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("item", dom_nodelist_item, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec nodeListProps[] = {
- {"length", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"length", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(c, global, 0, &dom_rt->domNodeListClass, 0, 0, nodeListProps, nodeListFuncs, 0, 0);
{
JSPropertySpec xmlHTTPRequestClassProps[] = {
- {"onreadystatechange", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"readyState", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"responseText", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"responseXML", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"status", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"statusText", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"onreadystatechange", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"readyState", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"responseText", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"responseXML", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"status", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"statusText", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec xmlHTTPRequestClassFuncs[] = {
- {"open", xml_http_open, 2, 0, 0},
- {"setRequestHeader", xml_http_set_header, 2, 0, 0},
- {"send", xml_http_send, 0, 0, 0},
- {"abort", xml_http_abort, 0, 0, 0},
- {"getAllResponseHeaders", xml_http_get_all_headers, 0, 0, 0},
- {"getResponseHeader", xml_http_get_header, 1, 0, 0},
+ SMJS_FUNCTION_SPEC("open", xml_http_open, 2),
+ SMJS_FUNCTION_SPEC("setRequestHeader", xml_http_set_header, 2),
+ SMJS_FUNCTION_SPEC("send", xml_http_send, 0),
+ SMJS_FUNCTION_SPEC("abort", xml_http_abort, 0),
+ SMJS_FUNCTION_SPEC("getAllResponseHeaders", xml_http_get_all_headers, 0),
+ SMJS_FUNCTION_SPEC("getResponseHeader", xml_http_get_header, 1),
/*todo - addEventListener and removeEventListener*/
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(c, global, 0, &dom_rt->xmlHTTPRequestClass, xml_http_constructor, 0, xmlHTTPRequestClassProps, xmlHTTPRequestClassFuncs, 0, 0);
GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[DOMCore] XMLHttpRequest class initialized\n"));
{0, 0, 0, 0, 0}
};
JSFunctionSpec storageClassFuncs[] = {
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
dom_rt->storage_proto = JS_InitClass(c, global, 0, &dom_rt->storageClass, storage_constructor, 0, storageClassProps, storageClassFuncs, 0, 0);
GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[DOMCore] Storage class initialized\n"));
if (dcci && dcci->RootNode) {
JSPropertySpec DCCIClassProps[] = {
- {"value", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"valueType", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"propertyType", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"readOnly", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"DCCIMetadataInterfaceType", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"DCCIMetadataInterface", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"version", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"value", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"valueType", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"propertyType", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"readOnly", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"DCCIMetadataInterfaceType", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"DCCIMetadataInterface", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"version", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec DCCIClassFuncs[] = {
- {"hasProperty", dcci_has_property, 3, 0, 0},
- {"searchProperty", dcci_search_property, 4, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("hasProperty", dcci_has_property, 3),
+ SMJS_FUNCTION_SPEC("searchProperty", dcci_search_property, 4),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(c, global, dom_rt->dom_element_proto, &dom_rt->DCCIClass, 0, 0, DCCIClassProps, DCCIClassFuncs, 0, 0);
JS_SetPrivate(c, obj, NULL);
n->sgprivate->interact->js_binding->node=NULL;
if (gf_list_del_item(sg->objects, obj)>=0) {
- gf_js_remove_root(c, &(n->sgprivate->interact->js_binding->node));
+ gf_js_remove_root(c, &(n->sgprivate->interact->js_binding->node), GF_JSGC_OBJECT);
}
}
return;
JS_SetPrivate(c, obj, NULL);
n->sgprivate->interact->js_binding->node=NULL;
gf_node_unregister(n, NULL);
- gf_js_remove_root(c, &(n->sgprivate->interact->js_binding->node));
+ gf_js_remove_root(c, &(n->sgprivate->interact->js_binding->node), GF_JSGC_OBJECT);
}
gf_list_rem(sg->objects, 0);
}
SVG_handlerElement *handler = (SVG_handlerElement *)gf_list_get(dom_rt->handlers, i);
if (handler->js_context==c) {
/*unprotect the function*/
- gf_js_remove_root(handler->js_context, &(handler->js_fun_val));
+ gf_js_remove_root(handler->js_context, &(handler->js_fun_val), GF_JSGC_VAL);
handler->js_fun_val=0;
handler->js_context=0;
gf_list_rem(dom_rt->handlers, i);
MFVec4f *mf_output = (MFVec4f *)gf_node_get_private((GF_Node*)p);
u32 count, num_out;
Bool do_sum;
-
+ output.x = output.y = output.z = output.q = 0;
+ sf_out.x = sf_out.y = sf_out.z = sf_out.q = 0;
if (!p->sgprivate->interact || !mf_output) return;
do_sum = p->Sum;
/*GPAC internals*/
{ GF_EVENT_SCENE_ATTACHED, "gpac_scene_attached", GF_DOM_EVENT_DOM },
- { GF_EVENT_VP_RESIZE, "gpac_vp_changed", GF_DOM_EVENT_DOM },
+ { GF_EVENT_VP_RESIZE, "gpac_vp_changed", GF_DOM_EVENT_DOM },
};
u32 gf_dom_event_type_by_name(const char *name)
{ GF_KEY_DEADIOTA, "U+0345" },
{ GF_KEY_EURO, "U+20AC" },
{ GF_KEY_DEADVOICESOUND, "U+3099" },
- { GF_KEY_DEADSEMIVOICESOUND, "U+309A" }
+ { GF_KEY_DEADSEMIVOICESOUND, "U+309A" },
+ { GF_KEY_CHANNELUP, "ChannelUp" },
+ { GF_KEY_CHANNELDOWN, "ChannelDown" },
+ { GF_KEY_TEXT, "Text" },
+ { GF_KEY_INFO, "Info" },
+ { GF_KEY_EPG, "EPG" },
+ { GF_KEY_RECORD, "Record" },
+ { GF_KEY_BEGINPAGE, "BeginPage" }
};
const char *gf_dom_get_key_name(u32 key_identifier)
{
/* warning the comma and semicolumn should not be there when parsing a number in a path */
while ((d[i] != 0) && strchr(" ,;\r\n\t", d[i])) i++;
-
+
if (!d[i]) {
- GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[SVG Parsing] Parsing number with empty string or only spaces: %s\n", d));
+ GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[SVG Parsing] Parsing number with empty string or only spaces: %s\n", d));
return 0;
}
if (d[i] == '+') {
u32 hours;
u32 minutes;
Float seconds;
- if (sscanf(d, "%d:%d:%f", &hours, &minutes, &seconds) < 3) return GF_BAD_PARAM;
+ if (sscanf(d, "%ud:%ud:%f", &hours, &minutes, &seconds) < 3) return GF_BAD_PARAM;
*clock_value = hours*3600 + minutes*60 + seconds;
} else {
/* Partial Clock value : mm:ss(.frac) */
v->type = GF_SMIL_TIME_WALLCLOCK;
tmp += 10;
if ((tmp1 = strchr(tmp, 'T')) ) {
- /* From tmp to wallStartTime, we parse a date */
+ /* From tmp to wallStartTime, we parse a date
+ do not use %ud here, broken on Win32 (sscanf returns 1)
+ */
sscanf(tmp, "%d-%d-%dT", &year, &month, &day);
tmp1++;
tmp = tmp1;
if ((tmp1 = strchr(tmp, ':')) ) {
if ((tmp2 = strchr(tmp1, ':')) ) {
/* HHMMSS */
- sscanf(tmp, "%d:%d:%f", &hours, &minutes, &seconds);
+ sscanf(tmp, "%ud:%ud:%f", &hours, &minutes, &seconds);
} else {
/* HHMM */
- sscanf(tmp, "%d:%d", &hours, &minutes);
+ sscanf(tmp, "%ud:%ud", &hours, &minutes);
}
}
if (strchr(tmp, 'Z')) {
return GF_OK;
} else {
if ( (tmp1 = strchr(tmp, '+')) ) {
- sscanf(tmp1, "%d:%d", &nhours, &nminutes);
+ sscanf(tmp1, "%ud:%ud", &nhours, &nminutes);
} else if ( (tmp1 = strchr(tmp, '-')) ) {
- sscanf(tmp1, "%d:%d", &nhours, &nminutes);
+ sscanf(tmp1, "%ud:%ud", &nhours, &nminutes);
}
}
return GF_OK;
return 0;
}
i += read_chars;
- }
+ }
gf_mx2d_init(tmp);
gf_mx2d_add_scale(&tmp, sx, sy);
gf_mx2d_add_matrix(&tmp, mat);
GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[SVG Parsing] Error reading coefficient ty in ref transform: %s\n", attribute_content));
return GF_BAD_PARAM;
}
- i += read_chars;
+ i += read_chars;
} else {
GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[SVG Parsing] Unsupported syntax for ref transform attribute"));
}
char *d = attribute_content;
/* used to detect end of BNF production:
- "The processing of the BNF must consume as much of a given BNF production as possible,
+ "The processing of the BNF must consume as much of a given BNF production as possible,
stopping at the point when a character is encountered which no longer satisfies the production." */
u32 read_chars = 0;
/* Parses a length which is a number with a unit */
static u32 svg_parse_length(SVG_Number *number, char *value_string, Bool clamp0to1)
{
- char c;
+ char c = '\0';
char *unit = NULL;
- u32 len = 0;
- u32 unit_pos;
+ u32 len = 0;
+ u32 unit_pos = 0;
u32 unit_len = 0;
u32 read_chars;
GF_SAFEALLOC(f, SVG_Length)
read_chars = svg_parse_length(f, &(str[i]), 0);
if (!read_chars) {
- free(f);
+ gf_free(f);
return;
}
i += read_chars;
#ifdef GPAC_HAS_SPIDERMONKEY
-#include <jsapi.h>
+#ifdef GPAC_ANDROID
+#ifndef XP_UNIX
+#define XP_UNIX
+#endif
+#endif
-JSBool my_js_has_instance(JSContext *c, JSObject *obj, jsval val, JSBool *vp);
+#include <gpac/internal/smjs_api.h>
#define JSVAL_CHECK_STRING(_v) (JSVAL_IS_STRING(_v) || JSVAL_IS_NULL(_v))
-#define JSVAL_GET_STRING(_v) (JSVAL_IS_NULL(_v) ? NULL : JS_GetStringBytes(JSVAL_TO_STRING(_v)) )
static Bool svg_script_execute_handler(GF_Node *node, GF_DOM_Event *event, GF_Node *observer);
-
#define _ScriptMessage(_sg, _e, _msg) {\
GF_JSAPIParam par; \
par.info.e = _e; \
ptCI *pts;
} pathCI;
-static JSBool svg_connection_create(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
-
-static JSBool svg_nav_to_location(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(svg_nav_to_location)
{
GF_JSAPIParam par;
GF_SceneGraph *sg;
+ SMJS_OBJ
+ SMJS_ARGS
if ((argc!=1) || !JS_InstanceOf(c, obj, &svg_rt->globalClass, NULL)) return JS_TRUE;
sg = JS_GetPrivate(c, obj);
- par.uri.url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ par.uri.url = SMJS_CHARS(c, argv[0]);
par.uri.nb_params = 0;
ScriptAction(sg, GF_JSAPI_OP_LOAD_URL, sg->RootNode, &par);
+ SMJS_FREE(c, par.uri.url);
return JS_TRUE;
}
-static JSBool svg_parse_xml(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(svg_parse_xml)
{
GF_SceneGraph *sg;
JSObject *doc_obj;
GF_Node *node;
char *str;
+ SMJS_ARGS
GF_Node *gf_sm_load_svg_from_string(GF_SceneGraph *sg, char *svg_str);
doc_obj = JSVAL_TO_OBJECT(argv[1]);
node = gf_sm_load_svg_from_string(sg, str);
gf_free(str);
- *rval = dom_element_construct(c, node);
+ SMJS_SET_RVAL( dom_element_construct(c, node) );
return JS_TRUE;
}
GF_LOG(GF_LOG_ERROR, GF_LOG_SCRIPT, ("[JavaScript] Error: %s - line %d (%s)", msg, jserr->lineno, jserr->linebuf));
}
-static JSBool svg_echo(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(svg_echo)
{
GF_SceneGraph *sg;
+ SMJS_OBJ
+ SMJS_ARGS
if ((argc!=1) || !JS_InstanceOf(c, obj, &svg_rt->globalClass, NULL)) return JS_TRUE;
sg = JS_GetPrivate(c, obj);
if (!sg) return JS_TRUE;
if (JSVAL_IS_STRING(argv[0])) {
- char *str = JS_GetStringBytes(JS_ValueToString(c, argv[0]) );
+ char *str = SMJS_CHARS_FROM_STRING(c, JS_ValueToString(c, argv[0]) );
_ScriptMessage(sg, GF_SCRIPT_INFO, str);
+ SMJS_FREE(c, str);
}
return JS_TRUE;
}
JS_DefineProperty(c, obj, "NAV_UP_LEFT", INT_TO_JSVAL(11), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
}
-static JSBool global_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool global_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_SceneGraph *sg;
if (!JS_InstanceOf(c, obj, &svg_rt->globalClass, NULL) )
return JS_TRUE;
sg = JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
/*namespaceURI*/
case 0:
return JS_TRUE;
}
/*TODO - try to be more precise...*/
-static JSBool dom_imp_has_feature(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(dom_imp_has_feature)
{
- *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_FALSE) );
if (argc) {
u32 len;
char sep;
- char *fname = JS_GetStringBytes(JS_ValueToString(c, argv[0]));
+ SMJS_ARGS
+ char *fname = SMJS_CHARS(c, argv[0]);
if (!fname) return JS_TRUE;
while (strchr(" \t\n\r", fname[0])) fname++;
len = strlen(fname);
while (len && strchr(" \t\n\r", fname[len-1])) len--;
sep = fname[len];
fname[len] = 0;
- if (!stricmp(fname, "xml")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
- else if (!stricmp(fname, "core")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
- else if (!stricmp(fname, "traversal")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
- else if (!stricmp(fname, "uievents")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
- else if (!stricmp(fname, "mouseevents")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
- else if (!stricmp(fname, "mutationevents")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
- else if (!stricmp(fname, "events")) *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+ if (!stricmp(fname, "xml")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ else if (!stricmp(fname, "core")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ else if (!stricmp(fname, "traversal")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ else if (!stricmp(fname, "uievents")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ else if (!stricmp(fname, "mouseevents")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ else if (!stricmp(fname, "mutationevents")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ else if (!stricmp(fname, "events")) SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
fname[len] = sep;
+ SMJS_FREE(c, fname);
}
return JS_TRUE;
}
/*otherwise recursively get up the tree*/
return get_corresponding_use(gf_node_get_parent(n, 0));
}
-static JSBool svg_doc_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool svg_doc_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
u32 prop_id;
GF_SceneGraph *sg = dom_get_doc(c, obj);
if (!sg) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 0:/*global*/
*vp = OBJECT_TO_JSVAL( JS_GetGlobalObject(c) );
return JS_TRUE;
}
-static JSBool svg_element_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool svg_element_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
u32 prop_id;
GF_JSAPIParam par;
- jsdouble *d;
JSString *s;
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 5:/*currentScale*/
if (n->sgprivate->tag!=TAG_SVG_svg) return JS_TRUE;
if (ScriptAction(n->sgprivate->scenegraph, GF_JSAPI_OP_GET_SCALE, (GF_Node *)n, &par)) {
- d = JS_NewDouble(c, FIX2FLT(par.val) );
- *vp = DOUBLE_TO_JSVAL(d);
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(par.val) );
return JS_TRUE;
}
return JS_TRUE;
case 6:/*currentRotate*/
if (n->sgprivate->tag!=TAG_SVG_svg) return JS_TRUE;
if (ScriptAction(n->sgprivate->scenegraph, GF_JSAPI_OP_GET_ROTATION, (GF_Node *)n, &par)) {
- d = JS_NewDouble(c, FIX2FLT(par.val) );
- *vp = DOUBLE_TO_JSVAL(d);
+ *vp = JS_MAKE_DOUBLE(c, FIX2FLT(par.val) );
return JS_TRUE;
}
return JS_TRUE;
}
return JS_TRUE;
case 9:/*currentTime*/
- d = JS_NewDouble(c, gf_node_get_scene_time((GF_Node *)n) );
- *vp = DOUBLE_TO_JSVAL(d);
+ *vp = JS_MAKE_DOUBLE(c, gf_node_get_scene_time((GF_Node *)n) );
return JS_TRUE;
case 10:/*isPaused*/
*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
return JS_TRUE;
}
-static JSBool svg_element_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool svg_element_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
GF_JSAPIParam par;
jsdouble d;
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
- prop_id = JSVAL_TO_INT(id);
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
+ prop_id = SMJS_ID_TO_INT(id);
switch (prop_id) {
case 0:/*id*/
if (JSVAL_CHECK_STRING(*vp)) {
- char *id = JSVAL_GET_STRING(*vp);
+ char *id = SMJS_CHARS(c, *vp);
if (id) {
GF_FieldInfo info;
u32 nid = gf_node_get_id(n);
if (*(DOM_String *)info.far_ptr) gf_free(*(DOM_String *)info.far_ptr);
*(DOM_String *)info.far_ptr = gf_strdup(id);
}
+ SMJS_FREE(c, id);
}
}
return JS_TRUE;
case TAG_SVG_audio:
case TAG_SVG_video:
case TAG_SVG_set:
+ case TAG_LSR_updates:
/*not sure about this one...*/
case TAG_SVG_discard:
return n;
/*TODO*/
-JSBool svg_udom_smil_time_insert(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, Bool is_end)
+JSBool SMJS_FUNCTION_EXT(svg_udom_smil_time_insert, Bool is_end)
{
GF_FieldInfo info;
u32 i, count;
Double offset;
GF_List *times;
SMIL_Time *newtime;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = svg_udom_smil_check_instance(c, obj);
if (!n) return JS_TRUE;
return JS_TRUE;
}
-JSBool svg_udom_smil_begin(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_smil_begin)
{
- return svg_udom_smil_time_insert(c, obj, argc, argv, rval, 0);
+ return svg_udom_smil_time_insert(SMJS_CALL_ARGS, 0);
}
-JSBool svg_udom_smil_end(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_smil_end)
{
- return svg_udom_smil_time_insert(c, obj, argc, argv, rval, 1);
+ return svg_udom_smil_time_insert(SMJS_CALL_ARGS, 1);
}
/*TODO*/
-JSBool svg_udom_smil_pause(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_smil_pause)
{
u32 tag;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
tag = gf_node_get_tag(n);
return JS_TRUE;
}
/*TODO*/
-JSBool svg_udom_smil_resume(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_smil_resume)
{
u32 tag;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
tag = gf_node_get_tag(n);
return JS_TRUE;
}
-JSBool svg_udom_get_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_trait)
{
char *attValue, *ns, *name;
GF_Err e;
GF_FieldInfo info;
+ SMJS_ARGS
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
- ns = name =NULL;
+ ns = name = NULL;
if (! JSVAL_CHECK_STRING(argv[0]) ) return JS_TRUE;
if (argc==2) {
- ns = JSVAL_GET_STRING(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
+ ns = SMJS_CHARS(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
} else if (argc==1) {
- name = JSVAL_GET_STRING(argv[0]);
+ name = SMJS_CHARS(c, argv[0]);
} else return JS_TRUE;
- if (!name) return JS_TRUE;
+ if (!name) {
+ SMJS_FREE(c, ns);
+ return JS_TRUE;
+ }
if (!strcmp(name, "#text")) {
char *res = gf_dom_flatten_textContent(n);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, res) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, res) ) );
gf_free(res);
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, name);
return JS_TRUE;
}
e = gf_node_get_field_by_name(n, name, &info);
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, name);
+
if (e!=GF_OK) return JS_TRUE;
- *rval = JSVAL_VOID;
+ SMJS_SET_RVAL( JSVAL_VOID );
switch (info.fieldType) {
/* inheritable floats */
case SVG_GradientOffset_datatype:
/*end of DOM string traits*/
attValue = gf_svg_dump_attribute(n, &info);
- *rval = STRING_TO_JSVAL( JS_NewStringCopyZ(c, attValue) );
+ SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, attValue) ) );
if (attValue) gf_free(attValue);
return JS_TRUE;
/*dump to trait*/
return JS_TRUE;
}
-JSBool svg_udom_get_float_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_float_trait)
{
char *szName;
GF_FieldInfo info;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=1) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- *rval = JSVAL_VOID;
- if (gf_node_get_attribute_by_name(n, szName, 0, 1, 1, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ if (!szName) return JS_FALSE;
+
+ SMJS_SET_RVAL( JSVAL_VOID );
+
+ e = gf_node_get_attribute_by_name(n, szName, 0, 1, 1, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
switch (info.fieldType) {
/* inheritable floats */
{
SVG_Number *l = (SVG_Number *)info.far_ptr;
if (l->type==SVG_NUMBER_AUTO || l->type==SVG_NUMBER_INHERIT) return JS_TRUE;
- *rval = DOUBLE_TO_JSVAL( JS_NewDouble(c, FIX2FLT(l->value) ) );
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(l->value) ) );
return JS_TRUE;
}
case SVG_Clock_datatype:
- *rval = DOUBLE_TO_JSVAL( JS_NewDouble(c, *(SVG_Clock*)info.far_ptr ) );
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, *(SVG_Clock*)info.far_ptr ) );
return JS_TRUE;
default:
return JS_TRUE;
return JS_TRUE;
}
-JSBool svg_udom_get_matrix_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_matrix_trait)
{
char *szName;
JSObject *mO;
GF_FieldInfo info;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=1) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- *rval = JSVAL_VOID;
- if (gf_node_get_field_by_name(n, szName, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ SMJS_SET_RVAL( JSVAL_VOID );
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
if (info.fieldType==SVG_Transform_datatype) {
GF_Matrix2D *mx = gf_malloc(sizeof(GF_Matrix2D));
gf_mx2d_copy(*mx, ((SVG_Transform*)info.far_ptr)->mat);
JS_SetPrivate(c, mO, mx);
- *rval = OBJECT_TO_JSVAL(mO);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(mO) );
return JS_TRUE;
}
return JS_TRUE;
}
-JSBool svg_udom_get_rect_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_rect_trait)
{
JSObject *newObj;
char *szName;
GF_FieldInfo info;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=1) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- *rval = JSVAL_VOID;
- if (gf_node_get_field_by_name(n, szName, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ SMJS_SET_RVAL( JSVAL_VOID );
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
if (info.fieldType==SVG_ViewBox_datatype) {
rectCI *rc;
rc->w = FIX2FLT(v->width);
rc->h = FIX2FLT(v->height);
JS_SetPrivate(c, newObj, rc);
- *rval = OBJECT_TO_JSVAL(newObj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(newObj) );
return JS_TRUE;
}
return JS_TRUE;
}
-JSBool svg_udom_get_path_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_path_trait)
{
char *szName;
GF_FieldInfo info;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=1) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- *rval = JSVAL_VOID;
- if (gf_node_get_field_by_name(n, szName, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ SMJS_SET_RVAL( JSVAL_VOID );
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
if (info.fieldType==SVG_PathData_datatype) {
- *rval = OBJECT_TO_JSVAL( svg_new_path_object(c, info.far_ptr) );
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL( svg_new_path_object(c, info.far_ptr) ) );
return JS_TRUE;
}
return JS_TRUE;
}
-JSBool svg_udom_get_rgb_color_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_rgb_color_trait)
{
char *szName;
GF_FieldInfo info;
rgbCI *rgb;
+ GF_Err e;
JSObject *newObj;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=1) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- *rval = JSVAL_VOID;
- if (gf_node_get_field_by_name(n, szName, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ SMJS_SET_RVAL( JSVAL_VOID );
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
switch (info.fieldType) {
case SVG_Color_datatype:
rgb->g = (u8) (255*FIX2FLT(col->green)) ;
rgb->b = (u8) (255*FIX2FLT(col->blue)) ;
JS_SetPrivate(c, newObj, rgb);
- *rval = OBJECT_TO_JSVAL(newObj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(newObj) );
return JS_TRUE;
}
break;
rgb->g = (u8) (255*FIX2FLT(paint->color.green) );
rgb->b = (u8) (255*FIX2FLT(paint->color.blue) );
JS_SetPrivate(c, newObj, rgb);
- *rval = OBJECT_TO_JSVAL(newObj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(newObj) );
return JS_TRUE;
}
return JS_TRUE;
return JS_TRUE;
}
-JSBool svg_udom_set_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_trait)
{
char *ns, *name, *val;
GF_Err e;
GF_FieldInfo info;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc==3) {
if (!JSVAL_CHECK_STRING(argv[1])) return JS_TRUE;
if (!JSVAL_CHECK_STRING(argv[2])) return JS_TRUE;
- ns = JSVAL_GET_STRING(argv[0]);
- name = JSVAL_GET_STRING(argv[1]);
- val = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
+ ns = SMJS_CHARS(c, argv[0]);
+ name = SMJS_CHARS(c, argv[1]);
+ val = SMJS_CHARS(c, argv[2]);
} else if (argc==2) {
- name = JSVAL_GET_STRING(argv[0]);
- val = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- } else
+ name = SMJS_CHARS(c, argv[0]);
+ val = SMJS_CHARS(c, argv[1]);
+ } else {
return JS_TRUE;
- if (!name) return JS_TRUE;
+ }
+ if (!name) {
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, val);
+ return JS_TRUE;
+ }
if (!strcmp(name, "#text")) {
- if (!JSVAL_IS_STRING(argv[1])) return JS_TRUE;
- dom_node_set_textContent(n, val);
+ if (val) dom_node_set_textContent(n, val);
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, name);
+ SMJS_FREE(c, val);
return JS_TRUE;
}
e = gf_node_get_field_by_name(n, name, &info);
+ SMJS_FREE(c, ns);
+ SMJS_FREE(c, name);
-
- if (!val || (e!=GF_OK)) return JS_TRUE;
- *rval = JSVAL_VOID;
+ if (!val || (e!=GF_OK)) {
+ SMJS_FREE(c, val);
+ return JS_TRUE;
+ }
+ SMJS_SET_RVAL( JSVAL_VOID );
e = gf_svg_parse_attribute(n, &info, val, 0);
+ SMJS_FREE(c, val);
+
if (e) return dom_throw_exception(c, GF_DOM_EXC_INVALID_ACCESS_ERR);
dom_node_changed(n, 0, &info);
return JS_TRUE;
}
-JSBool svg_udom_set_float_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_float_trait)
{
GF_FieldInfo info;
jsdouble d;
+ GF_Err e;
+ char *szName;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
if (!JSVAL_IS_NUMBER(argv[1])) return JS_TRUE;
JS_ValueToNumber(c, argv[1], &d);
- *rval = JSVAL_VOID;
- if (gf_node_get_field_by_name(n, JS_GetStringBytes(JSVAL_TO_STRING(argv[0])), &info) != GF_OK) return JS_TRUE;
+ SMJS_SET_RVAL( JSVAL_VOID );
+ szName = SMJS_CHARS(c, argv[0]);
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
switch (info.fieldType) {
/* inheritable floats */
dom_node_changed(n, 0, &info);
return JS_TRUE;
}
-JSBool svg_udom_set_matrix_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_matrix_trait)
{
JSObject *mO;
char *szName;
GF_FieldInfo info;
GF_Matrix2D *mx;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=2) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+
if (JSVAL_IS_NULL(argv[1]) || !JSVAL_IS_OBJECT(argv[1])) return JS_TRUE;
mO = JSVAL_TO_OBJECT(argv[1]);
if (!JS_InstanceOf(c, mO, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx = JS_GetPrivate(c, mO);
if (!mx) return JS_TRUE;
- if (gf_node_get_field_by_name(n, szName, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
if (info.fieldType==SVG_Transform_datatype) {
gf_mx2d_copy(((SVG_Transform*)info.far_ptr)->mat, *mx);
}
return JS_TRUE;
}
-JSBool svg_udom_set_rect_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_rect_trait)
{
JSObject *rO;
char *szName;
GF_FieldInfo info;
rectCI *rc;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=2) return JS_TRUE;
if (!JSVAL_IS_STRING(argv[0])) return JS_TRUE;
- szName = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+
if (JSVAL_IS_NULL(argv[1]) || !JSVAL_IS_OBJECT(argv[1])) return JS_TRUE;
rO = JSVAL_TO_OBJECT(argv[1]);
if (!JS_InstanceOf(c, rO, &svg_rt->rectClass, NULL) ) return JS_TRUE;
rc = JS_GetPrivate(c, rO);
if (!rc) return JS_TRUE;
- if (gf_node_get_field_by_name(n, szName, &info) != GF_OK) return JS_TRUE;
+ szName = SMJS_CHARS(c, argv[0]);
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
if (info.fieldType==SVG_ViewBox_datatype) {
SVG_ViewBox *v = (SVG_ViewBox *)info.far_ptr;
}
return JS_TRUE;
}
-JSBool svg_udom_set_path_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_path_trait)
{
pathCI *path;
GF_FieldInfo info;
JSObject *pO;
+ char *szName;
+ GF_Err e;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (!JS_InstanceOf(c, pO, &svg_rt->pathClass, NULL) ) return JS_TRUE;
path = JS_GetPrivate(c, pO);
if (!path) return JS_TRUE;
- if (gf_node_get_field_by_name(n, JS_GetStringBytes(JSVAL_TO_STRING(argv[0])), &info) != GF_OK) return JS_TRUE;
+
+ szName = SMJS_CHARS(c, argv[0]);
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
if (info.fieldType==SVG_PathData_datatype) {
#if USE_GF_PATH
return JS_TRUE;
}
-JSBool svg_udom_set_rgb_color_trait(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_rgb_color_trait)
{
GF_FieldInfo info;
rgbCI *rgb;
JSObject *colO;
+ GF_Err e;
+ char *szName;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
rgb = JS_GetPrivate(c, colO);
if (!rgb) return JS_TRUE;
- *rval = JSVAL_VOID;
- if (gf_node_get_field_by_name(n, JS_GetStringBytes(JSVAL_TO_STRING(argv[0])), &info) != GF_OK) return JS_TRUE;
+ SMJS_SET_RVAL(JSVAL_VOID);
+ szName = SMJS_CHARS(c, argv[0]);
+ e = gf_node_get_field_by_name(n, szName, &info);
+ SMJS_FREE(c, szName);
+ if (e != GF_OK) return JS_TRUE;
switch (info.fieldType) {
case SVG_Color_datatype:
return JS_TRUE;
}
-static JSBool svg_get_bbox(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, Bool get_screen)
+static JSBool SMJS_FUNCTION_EXT(svg_get_bbox, Bool get_screen)
{
GF_JSAPIParam par;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n || argc) return JS_TRUE;
rc->w = FIX2FLT(par.bbox.max_edge.x - par.bbox.min_edge.x);
rc->h = FIX2FLT(par.bbox.max_edge.y - par.bbox.min_edge.y);
JS_SetPrivate(c, rO, rc);
- *rval = OBJECT_TO_JSVAL(rO);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(rO) );
} else {
- *rval = JSVAL_VOID;
+ SMJS_SET_RVAL( JSVAL_VOID );
}
return JS_TRUE;
}
return JS_TRUE;
}
-JSBool svg_udom_get_local_bbox(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_local_bbox)
{
- return svg_get_bbox(c, obj, argc, argv, rval, 0);
+ return svg_get_bbox(SMJS_CALL_ARGS, 0);
}
-JSBool svg_udom_get_screen_bbox(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_screen_bbox)
{
- return svg_get_bbox(c, obj, argc, argv, rval, 1);
+ return svg_get_bbox(SMJS_CALL_ARGS, 1);
}
-JSBool svg_udom_get_screen_ctm(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_screen_ctm)
{
GF_JSAPIParam par;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n || argc) return JS_TRUE;
GF_Matrix2D *mx = gf_malloc(sizeof(GF_Matrix2D));
gf_mx2d_from_mx(mx, &par.mx);
JS_SetPrivate(c, mO, mx);
- *rval = OBJECT_TO_JSVAL(mO);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(mO) );
return JS_TRUE;
}
return JS_TRUE;
}
-JSBool svg_udom_create_matrix_components(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_create_matrix_components)
{
GF_Matrix2D *mx;
JSObject *mat;
jsdouble v;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=6) return JS_TRUE;
mx->m[5] = FLT2FIX(v);
mat = JS_NewObject(c, &svg_rt->matrixClass, 0, 0);
JS_SetPrivate(c, mat, mx);
- *rval = OBJECT_TO_JSVAL(mat);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(mat) );
return JS_TRUE;
}
-JSBool svg_udom_create_rect(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_create_rect)
{
rectCI *rc;
JSObject *r;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
if (!n || argc) return JS_TRUE;
GF_SAFEALLOC(rc, rectCI);
r = JS_NewObject(c, &svg_rt->rectClass, 0, 0);
JS_SetPrivate(c, r, rc);
- *rval = OBJECT_TO_JSVAL(r);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(r) );
return JS_TRUE;
}
-JSBool svg_udom_create_point(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_create_point)
{
pointCI *pt;
JSObject *r;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
if (!n || argc) return JS_TRUE;
GF_SAFEALLOC(pt, pointCI);
r = JS_NewObject(c, &svg_rt->pointClass, 0, 0);
JS_SetPrivate(c, r, pt);
- *rval = OBJECT_TO_JSVAL(r);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(r) );
return JS_TRUE;
}
-JSBool svg_udom_create_path(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_create_path)
{
pathCI *path;
JSObject *p;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
if (!n || argc) return JS_TRUE;
GF_SAFEALLOC(path, pathCI);
p = JS_NewObject(c, &svg_rt->pathClass, 0, 0);
JS_SetPrivate(c, p, path);
- *rval = OBJECT_TO_JSVAL(p);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(p) );
return JS_TRUE;
}
-JSBool svg_udom_create_color(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_create_color)
{
rgbCI *col;
JSObject *p;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if (argc!=3) return JS_TRUE;
col->b = JSVAL_TO_INT(argv[2]);
p = JS_NewObject(c, &svg_rt->rgbClass, 0, 0);
JS_SetPrivate(c, p, col);
- *rval = OBJECT_TO_JSVAL(p);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(p) );
return JS_TRUE;
}
-JSBool svg_udom_move_focus(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_move_focus)
{
GF_JSAPIParam par;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if ((argc!=1) || !JSVAL_IS_OBJECT(argv[0])) return JS_TRUE;
return JS_TRUE;
return JS_TRUE;
}
-JSBool svg_udom_set_focus(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_set_focus)
{
GF_JSAPIParam par;
+ SMJS_OBJ
+ SMJS_ARGS
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
if ((argc!=1) || !JSVAL_IS_OBJECT(argv[0])) return JS_TRUE;
return JS_TRUE;
return JS_TRUE;
}
-JSBool svg_udom_get_focus(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_focus)
{
GF_JSAPIParam par;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
if (!n || argc) return JS_TRUE;
- *rval = JSVAL_VOID;
+ SMJS_SET_RVAL( JSVAL_VOID );
if (!ScriptAction(n->sgprivate->scenegraph, GF_JSAPI_OP_GET_FOCUS, (GF_Node *)n, &par))
return JS_TRUE;
if (par.node) {
- *rval = dom_element_construct(c, par.node);
+ SMJS_SET_RVAL( dom_element_construct(c, par.node) );
}
return JS_TRUE;
}
-JSBool svg_udom_get_time(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(svg_udom_get_time)
{
- jsdouble *d;
+ SMJS_OBJ
GF_Node *n = dom_get_element(c, obj);
if (!n) return JS_TRUE;
- d = JS_NewDouble(c, gf_node_get_scene_time(n));
- *rval = DOUBLE_TO_JSVAL(d);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, gf_node_get_scene_time(n)) );
return JS_TRUE;
}
-
-static JSBool svg_connection_set_encoding(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(svg_connection_create)
{
return JS_TRUE;
}
-static JSBool svg_connection_create(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+
+#ifdef UNUSED_FUNC
+/**
+ * FIXME : those 5 funcs and two variables are not used anywhere...
+ */
+static JSBool svg_connection_set_encoding(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_TRUE;
}
{
return JS_TRUE;
}
+
static JSPropertySpec connectionProps[] = {
- {"connected", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"connected", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
static JSFunctionSpec connectionFuncs[] = {
{"close", svg_connection_close, 0, 0, 0},
{0, 0, 0, 0, 0}
};
+#endif /* UNUSED_FUNC */
static void baseCI_finalize(JSContext *c, JSObject *obj)
{
if (data) gf_free(data);
}
-static JSBool rgb_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool rgb_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->rgbClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
rgbCI *col = JS_GetPrivate(c, obj);
if (!col) return JS_TRUE;
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: *vp = INT_TO_JSVAL(col->r); return JS_TRUE;
case 1: *vp = INT_TO_JSVAL(col->g); return JS_TRUE;
case 2: *vp = INT_TO_JSVAL(col->b); return JS_TRUE;
}
return JS_TRUE;
}
-static JSBool rgb_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool rgb_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->rgbClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
rgbCI *col = JS_GetPrivate(c, obj);
if (!col) return JS_TRUE;
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: col->r = JSVAL_TO_INT(*vp); return JS_TRUE;
case 1: col->g = JSVAL_TO_INT(*vp); return JS_TRUE;
case 2: col->b = JSVAL_TO_INT(*vp); return JS_TRUE;
}
-static JSBool rect_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool rect_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->rectClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
- jsdouble *d;
+ if (SMJS_ID_IS_INT(id)) {
rectCI *rc = JS_GetPrivate(c, obj);
if (!rc) return JS_TRUE;
if (rc->sg) {
rc->w = FIX2FLT(par.rc.width);
rc->h = FIX2FLT(par.rc.height);
}
- switch (JSVAL_TO_INT(id)) {
- case 0: d = JS_NewDouble(c, rc->x); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 1: d = JS_NewDouble(c, rc->y); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 2: d = JS_NewDouble(c, rc->w); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 3: d = JS_NewDouble(c, rc->h); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, rc->x); return JS_TRUE;
+ case 1: *vp = JS_MAKE_DOUBLE(c, rc->y); return JS_TRUE;
+ case 2: *vp = JS_MAKE_DOUBLE(c, rc->w); return JS_TRUE;
+ case 3: *vp = JS_MAKE_DOUBLE(c, rc->h); return JS_TRUE;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool rect_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool rect_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->rectClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
jsdouble d;
rectCI *rc = JS_GetPrivate(c, obj);
if (!rc) return JS_TRUE;
JS_ValueToNumber(c, *vp, &d);
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: rc->x = (Float) d; return JS_TRUE;
case 1: rc->y = (Float) d; return JS_TRUE;
case 2: rc->w = (Float) d; return JS_TRUE;
return JS_TRUE;
}
-static JSBool point_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool point_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->pointClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
- jsdouble *d;
+ if (SMJS_ID_IS_INT(id)) {
pointCI *pt = JS_GetPrivate(c, obj);
if (!pt) return JS_TRUE;
if (pt->sg) {
pt->x = FIX2FLT(par.pt.x);
pt->y = FIX2FLT(par.pt.y);
}
- switch (JSVAL_TO_INT(id)) {
- case 0: d = JS_NewDouble(c, pt->x); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 1: d = JS_NewDouble(c, pt->y); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, pt->x); return JS_TRUE;
+ case 1: *vp = JS_MAKE_DOUBLE(c, pt->y); return JS_TRUE;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool point_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool point_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->pointClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
jsdouble d;
pointCI *pt = JS_GetPrivate(c, obj);
if (!pt) return JS_TRUE;
JS_ValueToNumber(c, *vp, &d);
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: pt->x = (Float) d; break;
case 1: pt->y = (Float) d; break;
default: return JS_TRUE;
#endif
}
+#ifdef UNUSED_FUNC
static JSBool pathCI_constructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
pathCI *p;
*rval = OBJECT_TO_JSVAL(obj);
return JS_TRUE;
}
+#endif /* UNUSED_FUNC */
static void pathCI_finalize(JSContext *c, JSObject *obj)
{
}
}
-static JSBool path_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool path_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
- if (JSVAL_IS_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
pathCI *p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: *vp = INT_TO_JSVAL(p->nb_coms); return JS_TRUE;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool svg_path_get_segment(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_get_segment)
{
pathCI *p;
u32 idx;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
idx = JSVAL_TO_INT(argv[0]);
if (idx>=p->nb_coms) return JS_TRUE;
switch (p->tags[idx]) {
- case 0: *vp = INT_TO_JSVAL(77); return JS_TRUE; /* Move To */
- case 1: *vp = INT_TO_JSVAL(76); return JS_TRUE; /* Line To */
+ case 0: SMJS_SET_RVAL( INT_TO_JSVAL(77)); return JS_TRUE; /* Move To */
+ case 1: SMJS_SET_RVAL( INT_TO_JSVAL(76)); return JS_TRUE; /* Line To */
case 2:/* Curve To */
case 3:/* next Curve To */
- *vp = INT_TO_JSVAL(67); return JS_TRUE;
+ SMJS_SET_RVAL( INT_TO_JSVAL(67)); return JS_TRUE;
case 4:/* Quad To */
case 5:/* next Quad To */
- *vp = INT_TO_JSVAL(81); return JS_TRUE;
- case 6: *vp = INT_TO_JSVAL(90); return JS_TRUE; /* Close */
+ SMJS_SET_RVAL( INT_TO_JSVAL(81)); return JS_TRUE;
+ case 6: SMJS_SET_RVAL( INT_TO_JSVAL(90)); return JS_TRUE; /* Close */
}
return JS_TRUE;
}
-static JSBool svg_path_get_segment_param(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_get_segment_param)
{
- jsdouble *d;
pathCI *p;
ptCI *pt;
+ SMJS_OBJ
+ SMJS_ARGS
u32 i, idx, param_idx, pt_idx;
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
case 1:
if (param_idx>1) return JS_TRUE;
pt = &p->pts[pt_idx];
- d = JS_NewDouble(c, param_idx ? pt->y : pt->x);
- *vp = DOUBLE_TO_JSVAL(d);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, param_idx ? pt->y : pt->x));
return JS_TRUE;
case 2:/* Curve To */
if (param_idx>5) return JS_TRUE;
pt = &p->pts[pt_idx + (param_idx/2) ];
- d = JS_NewDouble(c, (param_idx%2) ? pt->y : pt->x);
- *vp = DOUBLE_TO_JSVAL(d);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, (param_idx%2) ? pt->y : pt->x));
return JS_TRUE;
case 3:/* Next Curve To */
if (param_idx>5) return JS_TRUE;
if (param_idx<2) {
pt = &p->pts[pt_idx - 1];
- d = JS_NewDouble(c, param_idx ? pt->y : pt->x);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, param_idx ? pt->y : pt->x));
} else {
param_idx-=2;
pt = &p->pts[pt_idx + (param_idx/2)];
- d = JS_NewDouble(c, (param_idx%2) ? pt->y : pt->x);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, (param_idx%2) ? pt->y : pt->x));
}
- *vp = DOUBLE_TO_JSVAL(d);
return JS_TRUE;
case 4:/* Quad To */
if (param_idx>3) return JS_TRUE;
pt = &p->pts[pt_idx + (param_idx/2) ];
- d = JS_NewDouble(c, (param_idx%2) ? pt->y : pt->x);
- *vp = DOUBLE_TO_JSVAL(d);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, (param_idx%2) ? pt->y : pt->x));
return JS_TRUE;
case 5:/* Next Quad To */
if (param_idx>3) return JS_TRUE;
if (param_idx<2) {
pt = &p->pts[pt_idx - 1];
- d = JS_NewDouble(c, param_idx ? pt->y : pt->x);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, param_idx ? pt->y : pt->x));
} else {
param_idx-=2;
pt = &p->pts[pt_idx];
- d = JS_NewDouble(c, param_idx ? pt->y : pt->x);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, param_idx ? pt->y : pt->x));
}
- *vp = DOUBLE_TO_JSVAL(d);
return JS_TRUE;
/*spec is quite obscur here*/
case 6:
- d = JS_NewDouble(c, 0);
- *vp = DOUBLE_TO_JSVAL(d);
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, 0));
return JS_TRUE;
}
return JS_TRUE;
p->pts = gf_realloc(p->pts, sizeof(ptCI)*(nb_pts+orig_pts));
return orig_pts;
}
-static JSBool svg_path_move_to(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_move_to)
{
pathCI *p;
jsdouble x, y;
u32 nb_pts;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
p->nb_coms++;
return JS_TRUE;
}
-static JSBool svg_path_line_to(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_line_to)
{
pathCI *p;
jsdouble x, y;
u32 nb_pts;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
return JS_TRUE;
}
-static JSBool svg_path_quad_to(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_quad_to)
{
pathCI *p;
jsdouble x1, y1, x2, y2;
u32 nb_pts;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
p->nb_coms++;
return JS_TRUE;
}
-static JSBool svg_path_curve_to(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_curve_to)
{
pathCI *p;
jsdouble x1, y1, x2, y2, x, y;
u32 nb_pts;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
p->nb_coms++;
return JS_TRUE;
}
-static JSBool svg_path_close(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_path_close)
{
pathCI *p;
+ SMJS_OBJ
if (!JS_InstanceOf(c, obj, &svg_rt->pathClass, NULL) ) return JS_TRUE;
p = JS_GetPrivate(c, obj);
if (!p) return JS_TRUE;
return JS_TRUE;
}
-static JSBool matrix_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool matrix_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
- jsdouble *d;
GF_Matrix2D *mx;
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx = JS_GetPrivate(c, obj);
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
if (!mx) return JS_TRUE;
- switch (JSVAL_TO_INT(id)) {
- case 0: d = JS_NewDouble(c, FIX2FLT(mx->m[0])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 1: d = JS_NewDouble(c, FIX2FLT(mx->m[3])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 2: d = JS_NewDouble(c, FIX2FLT(mx->m[1])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 3: d = JS_NewDouble(c, FIX2FLT(mx->m[4])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 4: d = JS_NewDouble(c, FIX2FLT(mx->m[2])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 5: d = JS_NewDouble(c, FIX2FLT(mx->m[5])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[0])); return JS_TRUE;
+ case 1: *vp = JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[3])); return JS_TRUE;
+ case 2: *vp = JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[1])); return JS_TRUE;
+ case 3: *vp = JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[4])); return JS_TRUE;
+ case 4: *vp = JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[2])); return JS_TRUE;
+ case 5: *vp = JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[5])); return JS_TRUE;
default: return JS_TRUE;
}
return JS_TRUE;
}
-static JSBool matrix_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool matrix_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
jsdouble d;
GF_Matrix2D *mx;
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx = JS_GetPrivate(c, obj);
- if (!JSVAL_IS_INT(id)) return JS_TRUE;
+ if (!SMJS_ID_IS_INT(id)) return JS_TRUE;
JS_ValueToNumber(c, *vp, &d);
- switch (JSVAL_TO_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: mx->m[0] = FLT2FIX(d); break;
case 1: mx->m[3] = FLT2FIX(d); break;
case 2: mx->m[1] = FLT2FIX(d); break;
}
return JS_TRUE;
}
-static JSBool svg_mx2d_get_component(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_mx2d_get_component)
{
- jsdouble *d;
GF_Matrix2D *mx;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx = JS_GetPrivate(c, obj);
if (!mx || (argc!=1)) return JS_TRUE;
if (!JSVAL_IS_INT(argv[0])) return JS_TRUE;
switch (JSVAL_TO_INT(argv[0])) {
- case 0: d = JS_NewDouble(c, FIX2FLT(mx->m[0])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 1: d = JS_NewDouble(c, FIX2FLT(mx->m[3])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 2: d = JS_NewDouble(c, FIX2FLT(mx->m[1])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 3: d = JS_NewDouble(c, FIX2FLT(mx->m[4])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 4: d = JS_NewDouble(c, FIX2FLT(mx->m[2])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
- case 5: d = JS_NewDouble(c, FIX2FLT(mx->m[5])); *vp = DOUBLE_TO_JSVAL(d); return JS_TRUE;
+ case 0: SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[0]))); return JS_TRUE;
+ case 1: SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[3]))); return JS_TRUE;
+ case 2: SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[1]))); return JS_TRUE;
+ case 3: SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[4]))); return JS_TRUE;
+ case 4: SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[2]))); return JS_TRUE;
+ case 5: SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(mx->m[5]))); return JS_TRUE;
}
return JS_TRUE;
}
-static JSBool svg_mx2d_multiply(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_mx2d_multiply)
{
JSObject *mat;
GF_Matrix2D *mx1, *mx2;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx1 = JS_GetPrivate(c, obj);
if (!mx1 || (argc!=1)) return JS_TRUE;
mx2 = JS_GetPrivate(c, mat);
if (!mx2) return JS_TRUE;
gf_mx2d_add_matrix(mx1, mx2);
- *vp = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
-static JSBool svg_mx2d_inverse(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_mx2d_inverse)
{
GF_Matrix2D *mx1;
+ SMJS_OBJ
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx1 = JS_GetPrivate(c, obj);
if (!mx1) return JS_TRUE;
gf_mx2d_inverse(mx1);
- *vp = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
-static JSBool svg_mx2d_translate(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_mx2d_translate)
{
jsdouble x, y;
GF_Matrix2D *mx1, mx2;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx1 = JS_GetPrivate(c, obj);
if (!mx1 || (argc!=2)) return JS_TRUE;
mx2.m[2] = FLT2FIX(x);
mx2.m[5] = FLT2FIX(y);
gf_mx2d_pre_multiply(mx1, &mx2);
- *vp = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
-static JSBool svg_mx2d_scale(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_mx2d_scale)
{
jsdouble scale;
GF_Matrix2D *mx1, mx2;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx1 = JS_GetPrivate(c, obj);
if (!mx1 || (argc!=1)) return JS_TRUE;
gf_mx2d_init(mx2);
mx2.m[0] = mx2.m[4] = FLT2FIX(scale);
gf_mx2d_pre_multiply(mx1, &mx2);
- *vp = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
-static JSBool svg_mx2d_rotate(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
+static JSBool SMJS_FUNCTION(svg_mx2d_rotate)
{
jsdouble angle;
GF_Matrix2D *mx1, mx2;
+ SMJS_OBJ
+ SMJS_ARGS
if (!JS_InstanceOf(c, obj, &svg_rt->matrixClass, NULL) ) return JS_TRUE;
mx1 = JS_GetPrivate(c, obj);
if (!mx1 || (argc!=1)) return JS_TRUE;
gf_mx2d_init(mx2);
gf_mx2d_add_rotation(&mx2, 0, 0, gf_mulfix(FLT2FIX(angle/180), GF_PI));
gf_mx2d_pre_multiply(mx1, &mx2);
- *vp = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj ));
return JS_TRUE;
}
JS_SetErrorReporter(scene->svg_js->js_ctx, svg_script_error);
/*init global object*/
- scene->svg_js->global = JS_NewObject(scene->svg_js->js_ctx, &svg_rt->globalClass, 0, 0 );
+ scene->svg_js->global = gf_sg_js_global_object(scene->svg_js->js_ctx, &svg_rt->globalClass);
+
JS_InitStandardClasses(scene->svg_js->js_ctx, scene->svg_js->global);
/*remember pointer to scene graph!!*/
JS_SetPrivate(scene->svg_js->js_ctx, scene->svg_js->global, scene);
{
JSPropertySpec globalClassProps[] = {
- {"connected", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"parent", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"connected", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"parent", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec globalClassFuncs[] = {
- {"createConnection", svg_connection_create, 0, 0, 0},
- {"gotoLocation", svg_nav_to_location, 1, 0, 0},
- {"alert", svg_echo, 0, 0, 0},
- {"print", svg_echo, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("createConnection", svg_connection_create, 0),
+ SMJS_FUNCTION_SPEC("gotoLocation", svg_nav_to_location, 1),
+ SMJS_FUNCTION_SPEC("alert", svg_echo, 0),
+ SMJS_FUNCTION_SPEC("print", svg_echo, 0),
/*technically, this is part of Implementation interface, not global, but let's try not to complicate things too much*/
- {"hasFeature", dom_imp_has_feature, 2, 0, 0},
- {"parseXML", svg_parse_xml, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("hasFeature", dom_imp_has_feature, 2),
+ SMJS_FUNCTION_SPEC("parseXML", svg_parse_xml, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_DefineFunctions(scene->svg_js->js_ctx, scene->svg_js->global, globalClassFuncs);
JS_DefineProperties(scene->svg_js->js_ctx, scene->svg_js->global, globalClassProps);
JSPropertySpec svgDocumentProps[] = {
/*in our implementation, defaultView is just an alias to the global Window object*/
- {"defaultView", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"defaultView", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
{
JSFunctionSpec svgElementFuncs[] = {
/*trait access interface*/
- {"getTrait", svg_udom_get_trait, 1, 0, 0},
- {"getTraitNS", svg_udom_get_trait, 2, 0, 0},
- {"getFloatTrait", svg_udom_get_float_trait, 1, 0, 0},
- {"getMatrixTrait", svg_udom_get_matrix_trait, 1, 0, 0},
- {"getRectTrait", svg_udom_get_rect_trait, 1, 0, 0},
- {"getPathTrait", svg_udom_get_path_trait, 1, 0, 0},
- {"getRGBColorTrait", svg_udom_get_rgb_color_trait, 1, 0, 0},
+ SMJS_FUNCTION_SPEC("getTrait", svg_udom_get_trait, 1),
+ SMJS_FUNCTION_SPEC("getTraitNS", svg_udom_get_trait, 2),
+ SMJS_FUNCTION_SPEC("getFloatTrait", svg_udom_get_float_trait, 1),
+ SMJS_FUNCTION_SPEC("getMatrixTrait", svg_udom_get_matrix_trait, 1),
+ SMJS_FUNCTION_SPEC("getRectTrait", svg_udom_get_rect_trait, 1),
+ SMJS_FUNCTION_SPEC("getPathTrait", svg_udom_get_path_trait, 1),
+ SMJS_FUNCTION_SPEC("getRGBColorTrait", svg_udom_get_rgb_color_trait, 1),
/*FALLBACK TO BASE-VALUE FOR NOW - WILL NEED EITHER DOM TREE-CLONING OR A FAKE RENDER
PASS FOR EACH PRESENTATION VALUE ACCESS*/
- {"getPresentationTrait", svg_udom_get_trait, 1, 0, 0},
- {"getPresentationTraitNS", svg_udom_get_trait, 2, 0, 0},
- {"getFloatPresentationTrait", svg_udom_get_float_trait, 1, 0, 0},
- {"getMatrixPresentationTrait", svg_udom_get_matrix_trait, 1, 0, 0},
- {"getRectPresentationTrait", svg_udom_get_rect_trait, 1, 0, 0},
- {"getPathPresentationTrait", svg_udom_get_path_trait, 1, 0, 0},
- {"getRGBColorPresentationTrait", svg_udom_get_rgb_color_trait, 1, 0, 0},
- {"setTrait", svg_udom_set_trait, 2, 0, 0},
- {"setTraitNS", svg_udom_set_trait, 3, 0, 0},
- {"setFloatTrait", svg_udom_set_float_trait, 2, 0, 0},
- {"setMatrixTrait", svg_udom_set_matrix_trait, 2, 0, 0},
- {"setRectTrait", svg_udom_set_rect_trait, 2, 0, 0},
- {"setPathTrait", svg_udom_set_path_trait, 2, 0, 0},
- {"setRGBColorTrait", svg_udom_set_rgb_color_trait, 2, 0, 0},
+ SMJS_FUNCTION_SPEC("getPresentationTrait", svg_udom_get_trait, 1),
+ SMJS_FUNCTION_SPEC("getPresentationTraitNS", svg_udom_get_trait, 2),
+ SMJS_FUNCTION_SPEC("getFloatPresentationTrait", svg_udom_get_float_trait, 1),
+ SMJS_FUNCTION_SPEC("getMatrixPresentationTrait", svg_udom_get_matrix_trait, 1),
+ SMJS_FUNCTION_SPEC("getRectPresentationTrait", svg_udom_get_rect_trait, 1),
+ SMJS_FUNCTION_SPEC("getPathPresentationTrait", svg_udom_get_path_trait, 1),
+ SMJS_FUNCTION_SPEC("getRGBColorPresentationTrait", svg_udom_get_rgb_color_trait, 1),
+ SMJS_FUNCTION_SPEC("setTrait", svg_udom_set_trait, 2),
+ SMJS_FUNCTION_SPEC("setTraitNS", svg_udom_set_trait, 3),
+ SMJS_FUNCTION_SPEC("setFloatTrait", svg_udom_set_float_trait, 2),
+ SMJS_FUNCTION_SPEC("setMatrixTrait", svg_udom_set_matrix_trait, 2),
+ SMJS_FUNCTION_SPEC("setRectTrait", svg_udom_set_rect_trait, 2),
+ SMJS_FUNCTION_SPEC("setPathTrait", svg_udom_set_path_trait, 2),
+ SMJS_FUNCTION_SPEC("setRGBColorTrait", svg_udom_set_rgb_color_trait, 2),
/*locatable interface*/
- {"getBBox", svg_udom_get_local_bbox, 0, 0, 0},
- {"getScreenCTM", svg_udom_get_screen_ctm, 0, 0, 0},
- {"getScreenBBox", svg_udom_get_screen_bbox, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("getBBox", svg_udom_get_local_bbox, 0),
+ SMJS_FUNCTION_SPEC("getScreenCTM", svg_udom_get_screen_ctm, 0),
+ SMJS_FUNCTION_SPEC("getScreenBBox", svg_udom_get_screen_bbox, 0),
/*svgSVGElement interface*/
- {"createSVGMatrixComponents", svg_udom_create_matrix_components, 0, 0, 0},
- {"createSVGRect", svg_udom_create_rect, 0, 0, 0},
- {"createSVGPath", svg_udom_create_path, 0, 0, 0},
- {"createSVGRGBColor", svg_udom_create_color, 0, 0, 0},
- {"createSVGPoint", svg_udom_create_point, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("createSVGMatrixComponents", svg_udom_create_matrix_components, 0),
+ SMJS_FUNCTION_SPEC("createSVGRect", svg_udom_create_rect, 0),
+ SMJS_FUNCTION_SPEC("createSVGPath", svg_udom_create_path, 0),
+ SMJS_FUNCTION_SPEC("createSVGRGBColor", svg_udom_create_color, 0),
+ SMJS_FUNCTION_SPEC("createSVGPoint", svg_udom_create_point, 0),
- {"moveFocus", svg_udom_move_focus, 0, 0, 0},
- {"setFocus", svg_udom_set_focus, 0, 0, 0},
- {"getCurrentFocusedObject", svg_udom_get_focus, 0, 0, 0},
- {"getCurrentTime", svg_udom_get_time, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("moveFocus", svg_udom_move_focus, 0),
+ SMJS_FUNCTION_SPEC("setFocus", svg_udom_set_focus, 0),
+ SMJS_FUNCTION_SPEC("getCurrentFocusedObject", svg_udom_get_focus, 0),
+ SMJS_FUNCTION_SPEC("getCurrentTime", svg_udom_get_time, 0),
/*timeControl interface*/
- {"beginElementAt", svg_udom_smil_begin, 1, 0, 0},
- {"beginElement", svg_udom_smil_begin, 0, 0, 0},
- {"endElementAt", svg_udom_smil_end, 1, 0, 0},
- {"endElement", svg_udom_smil_end, 0, 0, 0},
- {"pauseElement", svg_udom_smil_pause, 0, 0, 0},
- {"resumeElement", svg_udom_smil_resume, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("beginElementAt", svg_udom_smil_begin, 1),
+ SMJS_FUNCTION_SPEC("beginElement", svg_udom_smil_begin, 0),
+ SMJS_FUNCTION_SPEC("endElementAt", svg_udom_smil_end, 1),
+ SMJS_FUNCTION_SPEC("endElement", svg_udom_smil_end, 0),
+ SMJS_FUNCTION_SPEC("pauseElement", svg_udom_smil_pause, 0),
+ SMJS_FUNCTION_SPEC("resumeElement", svg_udom_smil_resume, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec svgElementProps[] = {
/*svgElement interface*/
- {"id", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"id", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
/*svgSVGElement interface*/
- {"currentScale", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"currentRotate", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"currentTranslate", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"viewport", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"currentTime", 9, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"currentScale", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"currentRotate", 6, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"currentTranslate", 7, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"viewport", 8, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"currentTime", 9, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
/*timeControl interface*/
- {"isPaused", 10, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"isPaused", 10, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*old SVG1.1 stuff*/
- {"ownerSVGElement", 11, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"ownerSVGElement", 11, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
/*SVGElementInstance*/
- {"correspondingElement", 12, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
- {"correspondingUseElement", 13, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"correspondingElement", 12, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
+ {"correspondingUseElement", 13, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
JSObject *elt_proto = dom_js_get_element_proto(scene->svg_js->js_ctx);
/*RGBColor class*/
{
JSPropertySpec rgbClassProps[] = {
- {"red", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"green", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"blue", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"red", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"green", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"blue", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(scene->svg_js->js_ctx, scene->svg_js->global, 0, &svg_rt->rgbClass, 0, 0, rgbClassProps, 0, 0, 0);
/*SVGRect class*/
{
JSPropertySpec rectClassProps[] = {
- {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"width", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"height", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"width", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"height", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(scene->svg_js->js_ctx, scene->svg_js->global, 0, &svg_rt->rectClass, 0, 0, rectClassProps, 0, 0, 0);
/*SVGPoint class*/
{
JSPropertySpec pointClassProps[] = {
- {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(scene->svg_js->js_ctx, scene->svg_js->global, 0, &svg_rt->pointClass, 0, 0, pointClassProps, 0, 0, 0);
/*SVGMatrix class*/
{
JSFunctionSpec matrixClassFuncs[] = {
- {"getComponent", svg_mx2d_get_component, 1, 0, 0},
- {"mMultiply", svg_mx2d_multiply, 1, 0, 0},
- {"inverse", svg_mx2d_inverse, 0, 0, 0},
- {"mTranslate", svg_mx2d_translate, 2, 0, 0},
- {"mScale", svg_mx2d_scale, 1, 0, 0},
- {"mRotate", svg_mx2d_rotate, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("getComponent", svg_mx2d_get_component, 1),
+ SMJS_FUNCTION_SPEC("mMultiply", svg_mx2d_multiply, 1),
+ SMJS_FUNCTION_SPEC("inverse", svg_mx2d_inverse, 0),
+ SMJS_FUNCTION_SPEC("mTranslate", svg_mx2d_translate, 2),
+ SMJS_FUNCTION_SPEC("mScale", svg_mx2d_scale, 1),
+ SMJS_FUNCTION_SPEC("mRotate", svg_mx2d_rotate, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec matrixClassProps[] = {
- {"a", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"b", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"c", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"d", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"e", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"f", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"a", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"b", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"c", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"d", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"e", 4, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"f", 5, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(scene->svg_js->js_ctx, scene->svg_js->global, 0, &svg_rt->matrixClass, 0, 0, matrixClassProps, matrixClassFuncs, 0, 0);
/*SVGPath class*/
{
JSFunctionSpec pathClassFuncs[] = {
- {"getSegment", svg_path_get_segment, 1, 0, 0},
- {"getSegmentParam", svg_path_get_segment_param, 2, 0, 0},
- {"moveTo", svg_path_move_to, 2, 0, 0},
- {"lineTo", svg_path_line_to, 2, 0, 0},
- {"quadTo", svg_path_quad_to, 4, 0, 0},
- {"curveTo", svg_path_curve_to, 6, 0, 0},
- {"close", svg_path_close, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("getSegment", svg_path_get_segment, 1),
+ SMJS_FUNCTION_SPEC("getSegmentParam", svg_path_get_segment_param, 2),
+ SMJS_FUNCTION_SPEC("moveTo", svg_path_move_to, 2),
+ SMJS_FUNCTION_SPEC("lineTo", svg_path_line_to, 2),
+ SMJS_FUNCTION_SPEC("quadTo", svg_path_quad_to, 4),
+ SMJS_FUNCTION_SPEC("curveTo", svg_path_curve_to, 6),
+ SMJS_FUNCTION_SPEC("close", svg_path_close, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec pathClassProps[] = {
- {"numberOfSegments", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, 0, 0},
+ {"numberOfSegments", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_READONLY, 0, 0},
{0, 0, 0, 0, 0}
};
proto = JS_InitClass(scene->svg_js->js_ctx, scene->svg_js->global, 0, &svg_rt->pathClass, 0, 0, pathClassProps, pathClassFuncs, 0, 0);
utf8_script = szFuncName;
}
- gf_sg_lock_javascript(1);
+ gf_sg_lock_javascript(sg->svg_js->js_ctx, 1);
prev_event = JS_GetPrivate(sg->svg_js->js_ctx, sg->svg_js->event);
JS_SetPrivate(sg->svg_js->js_ctx, sg->svg_js->event, event);
}
if (sg->svg_js->force_gc) {
- JS_GC(sg->svg_js->js_ctx);
+ gf_sg_js_call_gc(sg->svg_js->js_ctx);
sg->svg_js->force_gc = 0;
}
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(sg->svg_js->js_ctx, 0);
return (ret==JS_FALSE) ? 0 : 1;
}
static GF_Err JSScript_CreateSVGContext(GF_SceneGraph *sg)
{
GF_SVGJS *svg_js;
+ Bool do_lock = gf_sg_javascript_initialized();
GF_SAFEALLOC(svg_js, GF_SVGJS);
+
+ if (do_lock) gf_sg_lock_javascript(NULL, 1);
/*create new ecmascript context*/
svg_js->js_ctx = gf_sg_ecmascript_new(sg);
if (!svg_js->js_ctx) {
gf_free(svg_js);
+ if (do_lock) gf_sg_lock_javascript(NULL, 0);
return GF_SCRIPT_ERROR;
}
if (!svg_rt) {
GF_SAFEALLOC(svg_rt, GF_SVGuDOM);
JS_SETUP_CLASS(svg_rt->svgElement, "SVGElement", JSCLASS_HAS_PRIVATE, svg_element_getProperty, svg_element_setProperty, dom_element_finalize);
- JS_SETUP_CLASS(svg_rt->svgDocument, "SVGDocument", JSCLASS_HAS_PRIVATE, svg_doc_getProperty, JS_PropertyStub, dom_document_finalize);
- JS_SETUP_CLASS(svg_rt->globalClass, "Window", JSCLASS_HAS_PRIVATE, global_getProperty, JS_PropertyStub, JS_FinalizeStub);
+ JS_SETUP_CLASS(svg_rt->svgDocument, "SVGDocument", JSCLASS_HAS_PRIVATE, svg_doc_getProperty, JS_PropertyStub_forSetter, dom_document_finalize);
+ JS_SETUP_CLASS(svg_rt->globalClass, "Window", JSCLASS_HAS_PRIVATE, global_getProperty, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_SETUP_CLASS(svg_rt->rgbClass, "SVGRGBColor", JSCLASS_HAS_PRIVATE, rgb_getProperty, rgb_setProperty, baseCI_finalize);
JS_SETUP_CLASS(svg_rt->rectClass, "SVGRect", JSCLASS_HAS_PRIVATE, rect_getProperty, rect_setProperty, baseCI_finalize);
JS_SETUP_CLASS(svg_rt->pointClass, "SVGPoint", JSCLASS_HAS_PRIVATE, point_getProperty, point_setProperty, baseCI_finalize);
JS_SETUP_CLASS(svg_rt->matrixClass, "SVGMatrix", JSCLASS_HAS_PRIVATE, matrix_getProperty, matrix_setProperty, baseCI_finalize);
- JS_SETUP_CLASS(svg_rt->pathClass, "SVGPath", JSCLASS_HAS_PRIVATE, path_getProperty, JS_PropertyStub, pathCI_finalize);
+ JS_SETUP_CLASS(svg_rt->pathClass, "SVGPath", JSCLASS_HAS_PRIVATE, path_getProperty, JS_PropertyStub_forSetter, pathCI_finalize);
}
svg_rt->nb_inst++;
sg->svg_js = svg_js;
/*load SVG & DOM APIs*/
svg_init_js_api(sg);
+ if (do_lock) gf_sg_lock_javascript(NULL, 0);
svg_js->script_execute = svg_script_execute;
svg_js->handler_execute = svg_script_execute_handler;
return 1;
}
- gf_sg_lock_javascript(1);
+ gf_sg_lock_javascript(svg_js->js_ctx, 1);
ret = JS_EvaluateScript(svg_js->js_ctx, svg_js->global, jsscript, sizeof(char)*fsize, 0, 0, &rval);
if (svg_js->force_gc) {
- JS_GC(svg_js->js_ctx);
+ gf_sg_js_call_gc(svg_js->js_ctx);
svg_js->force_gc = 0;
}
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(svg_js->js_ctx, 0);
if (ret==JS_FALSE) success = 0;
gf_dom_listener_process_add(script->sgprivate->scenegraph);
#ifndef GPAC_DISABLE_LOG
if ((gf_log_get_level() >= (GF_LOG_DEBUG)) && (gf_log_get_tools() & (GF_LOG_SCRIPT))) {
- char *content;
+ char *content, *_content = NULL;
if (hdl->js_fun_val) {
JSString *s = JS_DecompileFunction(svg_js->js_ctx, JS_ValueToFunction(svg_js->js_ctx, (jsval) hdl->js_fun_val), 0);
- content = JS_GetStringBytes(s);
+ content = _content = SMJS_CHARS_FROM_STRING(svg_js->js_ctx, s);
} else if (hdl->js_fun) {
JSString *s=JS_DecompileFunction(svg_js->js_ctx, (JSFunction *)hdl->js_fun, 0);
- content = JS_GetStringBytes(s);
+ content = _content = SMJS_CHARS_FROM_STRING(svg_js->js_ctx, s);
} else if (txt) {
content = txt->textContent;
} else {
}
gf_log_lt(GF_LOG_DEBUG, GF_LOG_SCRIPT);
gf_log("[DOM Events ] Executing script code from handler: %s\n", content);
+ SMJS_FREE(svg_js->js_ctx, _content);
}
#endif
- gf_sg_lock_javascript(1);
+ gf_sg_lock_javascript(svg_js->js_ctx, 1);
prev_event = JS_GetPrivate(svg_js->js_ctx, svg_js->event);
/*break loops*/
if (prev_event && (prev_event->type==event->type) && (prev_event->target==event->target)) {
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(svg_js->js_ctx, 0);
return 0;
}
JS_SetPrivate(svg_js->js_ctx, svg_js->event, event);
ret = JS_CallFunction(svg_js->js_ctx, __this, (JSFunction *)hdl->js_fun, 1, argv, &rval);
}
else if (hdl->js_fun_val) {
- jsval funval = (JSWord) hdl->js_fun_val;
+ jsval funval = (jsval) hdl->js_fun_val;
ret = JS_CallFunctionValue(svg_js->js_ctx, __this, funval, 1, argv, &rval);
} else {
ret = JS_CallFunctionName(svg_js->js_ctx, hdl->evt_listen_obj, "handleEvent", 1, argv, &rval);
while (svg_js->force_gc) {
svg_js->force_gc = 0;
- JS_GC(svg_js->js_ctx);
+ gf_sg_js_call_gc(svg_js->js_ctx);
}
svg_js->in_script = 0;
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(svg_js->js_ctx, 0);
#ifdef DUMP_DEF_AND_ROOT
if ((event->type==GF_EVENT_CLICK) || (event->type==GF_EVENT_MOUSEOVER)) {
else return (tag == TAG_SVG_animation ||
tag == TAG_SVG_audio ||
tag == TAG_LSR_conditional ||
+ tag == TAG_LSR_updates ||
tag == TAG_SVG_video)?1:0;
}
return (node->sgprivate->UserPrivate || node->sgprivate->UserCallback) ? 1 : 0;
case TAG_SVG_audio:
case TAG_SVG_video:
+ case TAG_LSR_updates:
gf_smil_timing_init_runtime_info(node);
gf_smil_setup_events(node);
/*we may get called several times depending on xlink:href resoling for events*/
case TAG_SVG_animation:
case TAG_SVG_audio:
case TAG_SVG_video:
+ case TAG_LSR_updates:
gf_smil_timing_modified(node, field);
/*used by compositors*/
return 0;
}
}
owner->parent_graph->NodeCallback(owner->parent_graph->userpriv, GF_SG_CALLBACK_INIT, (GF_Node *) proto_node, NULL);
+ proto_node->flags |= GF_SG_PROTO_LOADED;
return;
}
/*not loaded yet*/
char *szName = strrchr(owner->ExternProto.vals[0].url, '#');
if (szName) {
szName++;
- if (sscanf(szName, "%d", &ID)) ID = (u32) -1;
+ if (sscanf(szName, "%u", &ID)) ID = (u32) -1;
}
/*if we have the proto name, use it*/
if (owner->Name) szName = owner->Name;
gf_free((char *) inst->proto_name);
- sg->pOwningProto = NULL;
/*and finally destroy the node. If the proto is a hardcoded one (UserCallback set), destroy the node first
since the hardcoded proto may need the scene graph when being destroyed*/
if (inst->sgprivate->UserCallback) {
+ gf_sg_reset(sg);
+ sg->pOwningProto = NULL;
gf_node_free((GF_Node *)inst);
gf_sg_del(sg);
} else {
gf_sg_reset(sg);
+ sg->pOwningProto = NULL;
gf_node_free((GF_Node *)inst);
gf_sg_del(sg);
}
if (r->ToNode && (r->ToField.fieldType==GF_SG_VRML_SCRIPT_FUNCTION) && r->ToField.on_event_in) {
r->is_setup = 0;
r->FromNode = NULL;
- r->ToField.on_event_in(r->ToNode, r);
+ if (!r->graph->pOwningProto) r->ToField.on_event_in(r->ToNode, r);
}
r->is_setup = 0;
Bool ret;
/*URL/String conversion clone*/
void VRML_FieldCopyCast(void *dest, u32 dst_field_type, void *orig, u32 ori_field_type);
-
+ assert(r->FromNode);
if (!r->is_setup) {
gf_sg_route_setup(r);
if (!r->is_setup) return 0;
gf_node_event_out(r->ToNode, r->ToField.fieldIndex);
}
/*and signal routes on exposed fields if field changed*/
- if (r->ToField.eventType == GF_SG_EVENT_EXPOSED_FIELD)
+ if (r->ToField.eventType == GF_SG_EVENT_EXPOSED_FIELD){
if (r->IS_route)
gf_node_event_out_proto(r->ToNode, r->ToField.fieldIndex);
else
gf_node_event_out(r->ToNode, r->ToField.fieldIndex);
-
+ }
return ret;
}
}
}
-#endif /*GPAC_DISABLE_VRML*/
\ No newline at end of file
+#endif /*GPAC_DISABLE_VRML*/
+
#include <gpac/modules/term_ext.h>
#include <gpac/modules/js_usr.h>
-#include <jsapi.h>
+#include <gpac/internal/smjs_api.h>
+
+
+
/*fixes for JS > 1.8.0rc1 where GC routines have changed*/
-Bool gf_js_add_root(JSContext *cx, void *rp)
+Bool gf_js_add_root(JSContext *cx, void *rp, u32 type)
{
-#ifdef SPIDERMONKEY_NEW_API
- return (JS_AddValueRoot(cx, rp)==JS_TRUE) ? 1 : 0;
+#if (JS_VERSION>=185)
+ JSBool ret;
+ switch (type) {
+ case GF_JSGC_STRING:
+ ret = JS_AddStringRoot(cx, rp);
+ break;
+ case GF_JSGC_OBJECT:
+ ret = JS_AddObjectRoot(cx, rp);
+ break;
+ case GF_JSGC_VAL:
+ ret = JS_AddValueRoot(cx, rp);
+ break;
+ default:
+ ret = JS_AddGCThingRoot(cx, rp);
+ break;
+ }
+ return (ret == JS_TRUE) ? 1 : 0;
#else
return (JS_AddRoot(cx, rp)==JS_TRUE) ? 1 : 0;
#endif
}
-Bool gf_js_add_named_root(JSContext *cx, void *rp, const char *name)
+Bool gf_js_add_named_root(JSContext *cx, void *rp, u32 type, const char *name)
{
-#ifdef SPIDERMONKEY_NEW_API
- return (JS_AddNamedValueRoot(cx, rp, name)==JS_TRUE) ? 1 : 0;
+#if (JS_VERSION>=185)
+ JSBool ret;
+ switch (type) {
+ case GF_JSGC_STRING:
+ ret = JS_AddNamedStringRoot(cx, rp, name);
+ break;
+ case GF_JSGC_OBJECT:
+ ret = JS_AddNamedObjectRoot(cx, rp, name);
+ break;
+ case GF_JSGC_VAL:
+ ret = JS_AddNamedValueRoot(cx, rp, name);
+ break;
+ default:
+ ret = JS_AddNamedGCThingRoot(cx, rp, name);
+ break;
+ }
+ return (ret == JS_TRUE) ? 1 : 0;
#else
return (JS_AddNamedRoot(cx, rp, name)==JS_TRUE) ? 1 : 0;
#endif
}
-Bool gf_js_remove_root(JSContext *cx, void *rp)
+Bool gf_js_remove_root(JSContext *cx, void *rp, u32 type)
{
-#ifdef SPIDERMONKEY_NEW_API
- return (JS_RemoveValueRoot(cx, rp)==JS_TRUE) ? 1 : 0;
+#if (JS_VERSION>=185)
+ JSBool ret;
+ switch (type) {
+ case GF_JSGC_STRING:
+ ret = JS_RemoveStringRoot(cx, rp);
+ break;
+ case GF_JSGC_OBJECT:
+ ret = JS_RemoveObjectRoot(cx, rp);
+ break;
+ case GF_JSGC_VAL:
+ ret = JS_RemoveValueRoot(cx, rp);
+ break;
+ default:
+ ret = JS_RemoveGCThingRoot(cx, rp);
+ break;
+ }
+ return (ret == JS_TRUE) ? 1 : 0;
#else
return (JS_RemoveRoot(cx, rp)==JS_TRUE) ? 1 : 0;
#endif
}
+JSObject *gf_sg_js_global_object(JSContext *cx, JSClass *__class)
+{
+#if (JS_VERSION>=185)
+ __class->flags |= JSCLASS_GLOBAL_FLAGS;
+ return JS_NewCompartmentAndGlobalObject(cx, __class, NULL);
+#else
+ return JS_NewObject(cx, __class, 0, 0 );
+#endif
+}
#if !defined(__GNUC__)
# if defined(_WIN32_WCE)
-# pragma comment(lib, "js")
+# pragma comment(lib, "js32")
# elif defined (WIN32)
# pragma comment(lib, "js32")
# endif
#endif
-/*define this macro to force Garbage Collection after each input to JS (script initialize/shutdown and all eventIn) */
-//#define FORCE_GC
+/*define this macro to force Garbage Collection after each input to JS (script initialize/shutdown and all eventIn)
+on latest SM, GC will crash if called from a different thread than the thread creating the contex, no clue why
+*/
+#if (JS_VERSION<180)
+#define FORCE_GC
+#endif
typedef struct
{
JSRuntime *js_runtime;
u32 nb_inst;
+ JSContext *ctx;
GF_Mutex *mx;
JSClass MFStringClass;
JSClass MFUrlClass;
JSClass MFNodeClass;
+ JSClass AnyClass;
#endif
/*extensions are loaded for the lifetime of the runtime NOT of the context - this avoids nasty
JSContext *gf_sg_ecmascript_new(GF_SceneGraph *sg)
{
+ JSContext *ctx;
if (!js_rt) {
JSRuntime *js_runtime = JS_NewRuntime(MAX_HEAP_BYTES);
if (!js_runtime) {
gf_sg_load_script_modules(sg);
}
js_rt->nb_inst++;
- return JS_NewContext(js_rt->js_runtime, STACK_CHUNK_BYTES);
+ ctx = JS_NewContext(js_rt->js_runtime, STACK_CHUNK_BYTES);
+ return ctx;
}
void gf_sg_ecmascript_del(JSContext *ctx)
{
- JS_SetGlobalObject(ctx, NULL);
+#ifdef JS_THREADSAFE
+ JS_ClearContextThread(ctx);
+ JS_SetContextThread(ctx);
+#endif
+
JS_DestroyContext(ctx);
if (js_rt) {
js_rt->nb_inst --;
}
}
-JSBool my_js_has_instance(JSContext *c, JSObject *obj, jsval val, JSBool *vp)
+#if (JS_VERSION>=185)
+JSBool gf_sg_js_has_instance(JSContext *c, JSObject *obj,const jsval *val, JSBool *vp)
+#else
+JSBool gf_sg_js_has_instance(JSContext *c, JSObject *obj, jsval val, JSBool *vp)
+#endif
{
*vp = JS_FALSE;
+#if (JS_VERSION>=185)
+ if (val && JSVAL_IS_OBJECT(*val)) {
+ JSObject *p = JSVAL_TO_OBJECT(*val);
+#else
if (JSVAL_IS_OBJECT(val)) {
- JSObject *p;
+ JSObject *p = JSVAL_TO_OBJECT(val);
+#endif
JSClass *js_class = JS_GET_CLASS(c, obj);
- p = JSVAL_TO_OBJECT(val);
if (JS_InstanceOf(c, p, js_class, NULL) ) *vp = JS_TRUE;
}
return JS_TRUE;
static void JSScript_NodeModified(GF_SceneGraph *sg, GF_Node *node, GF_FieldInfo *info, GF_Node *script);
-void JSScriptFromFile(GF_Node *node, const char *opt_file, Bool no_complain);
+Bool JSScriptFromFile(GF_Node *node, const char *opt_file, Bool no_complain);
+void gf_sg_js_call_gc(JSContext *c)
+{
+ gf_sg_lock_javascript(c, 1);
+ JS_GC(c);
+ gf_sg_lock_javascript(c, 0);
+}
#ifdef FORCE_GC
-void MyJSGC(JSContext *c) {
- JS_GC(c);
+void MyJSGC(JSContext *c)
+{
+ gf_sg_js_call_gc(c);
+
}
#endif
GF_LOG(GF_LOG_ERROR, GF_LOG_SCRIPT, ("[JavaScript] Error: %s - line %d (%s)", msg, jserr->lineno, jserr->linebuf));
}
-static void vrml_node_register(JSContext *c, GF_Node *node)
-{
- if (node) {
- GF_Node *parent = (GF_Node*)JS_GetContextPrivate(c);
- node->sgprivate->flags |= GF_NODE_HAS_BINDING;
- gf_node_register(node, (node == parent) ? NULL : parent);
- }
-}
-
-
-static JSBool JSPrint(JSContext *c, JSObject *p, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(JSPrint)
{
+ SMJS_ARGS
if (JSVAL_IS_STRING(argv[0])) {
- char *str = JS_GetStringBytes(JS_ValueToString(c, argv[0]) );
+ char *str = SMJS_CHARS(c, argv[0]);
_ScriptMessage(c, GF_SCRIPT_INFO, str);
+ SMJS_FREE(c, str);
}
return JS_TRUE;
}
-static JSBool getName(JSContext *c, JSObject *obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(getName)
{
JSString *s = JS_NewStringCopyZ(c, "GPAC RichMediaEngine");
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
return JS_TRUE;
}
-static JSBool getVersion(JSContext*c, JSObject*obj, uintN n, jsval *v, jsval *rval)
+
+static JSBool SMJS_FUNCTION(getVersion)
{
JSString *s = JS_NewStringCopyZ(c, GPAC_FULL_VERSION);
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
return JS_TRUE;
}
-static JSBool getCurrentSpeed(JSContext *c, JSObject *o, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(getCurrentSpeed)
{
GF_JSAPIParam par;
GF_Node *node = JS_GetContextPrivate(c);
par.time = 0;
ScriptAction(c, NULL, GF_JSAPI_OP_GET_SPEED, node->sgprivate->scenegraph->RootNode, &par);
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble( c, par.time));
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE( c, par.time) );
return JS_TRUE;
}
-static JSBool getCurrentFrameRate(JSContext *c, JSObject*o, uintN n, jsval *v, jsval*rval)
+static JSBool SMJS_FUNCTION(getCurrentFrameRate)
{
GF_JSAPIParam par;
GF_Node *node = JS_GetContextPrivate(c);
par.time = 0;
ScriptAction(c, NULL, GF_JSAPI_OP_GET_FPS, node->sgprivate->scenegraph->RootNode, &par);
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble( c, par.time));
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE( c, par.time) );
return JS_TRUE;
}
-static JSBool getWorldURL(JSContext*c, JSObject*obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(getWorldURL)
{
GF_JSAPIParam par;
GF_Node *node = JS_GetContextPrivate(c);
if (ScriptAction(c, NULL, GF_JSAPI_OP_RESOLVE_URI, node->sgprivate->scenegraph->RootNode, &par)) {
JSString *s = JS_NewStringCopyZ(c, par.uri.url);
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
gf_free(par.uri.url);
return JS_TRUE;
}
if (node->sgprivate->interact && node->sgprivate->interact->js_binding && node->sgprivate->interact->js_binding->node) {
field = node->sgprivate->interact->js_binding->node;
if (!field->is_rooted) {
- gf_js_add_root(priv->js_ctx, &field->obj);
+ gf_js_add_root(priv->js_ctx, &field->obj, GF_JSGC_OBJECT);
field->is_rooted=1;
}
return field->obj;
field->field.fieldType = GF_SG_VRML_SFNODE;
field->node = node;
field->field.far_ptr = &field->node;
- vrml_node_register(priv->js_ctx, node);
+
+
+ node->sgprivate->flags |= GF_NODE_HAS_BINDING;
+ gf_node_register(node, NULL);
obj = JS_NewObject(priv->js_ctx, &js_rt->SFNodeClass, 0, 0);
JS_SetPrivate(priv->js_ctx, obj, field);
- gf_list_add(priv->js_cache, obj);
field->obj = obj;
-
+ gf_list_add(priv->js_cache, obj);
/*remember the object*/
if (!node->sgprivate->interact) GF_SAFEALLOC(node->sgprivate->interact, struct _node_interactive_ext);
node->sgprivate->interact->js_binding->node = field;
if (!is_constructor) {
field->is_rooted = 1;
- gf_js_add_root(priv->js_ctx, &field->obj);
+ gf_js_add_root(priv->js_ctx, &field->obj, GF_JSGC_OBJECT);
}
return obj;
}
-static JSBool getScript(JSContext*c, JSObject*obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(getScript)
{
GF_ScriptPriv *priv = JS_GetScriptStack(c);
GF_Node *node = JS_GetContextPrivate(c);
JSObject *an_obj = node_get_binding(priv, node, 0);
- if (an_obj) *rval = OBJECT_TO_JSVAL(an_obj);
+ if (an_obj) SMJS_SET_RVAL( OBJECT_TO_JSVAL(an_obj) );
return JS_TRUE;
}
-static JSBool loadScript(JSContext*c, JSObject*obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(loadScript)
{
Bool no_complain = 0;
char *url;
GF_Node *node = JS_GetContextPrivate(c);
+ SMJS_ARGS
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_TRUE;
if ((argc>1) && JSVAL_IS_BOOLEAN(argv[1])) no_complain = (JSVAL_TO_BOOLEAN(argv[1])==JS_TRUE) ? 1 : 0;
- url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- if (url) JSScriptFromFile(node, url, no_complain);
+ url = SMJS_CHARS(c, argv[0]);
+ if (url) {
+ if ( JSScriptFromFile(node, url, no_complain) == 1) {
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_TRUE) );
+ } else {
+ SMJS_SET_RVAL( BOOLEAN_TO_JSVAL(JS_FALSE) );
+ }
+ }
+ SMJS_FREE(c, url);
return JS_TRUE;
}
-static JSBool getProto(JSContext*c, JSObject*obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(getProto)
{
JSObject *an_obj;
GF_ScriptPriv *priv = JS_GetScriptStack(c);
GF_Node *node = JS_GetContextPrivate(c);
+ SMJS_SET_RVAL( JSVAL_NULL);
if (!node->sgprivate->scenegraph->pOwningProto) {
- *rval = JSVAL_NULL;
return JS_TRUE;
}
node = (GF_Node *) node->sgprivate->scenegraph->pOwningProto;
an_obj = node_get_binding(priv, node, 0);
- if (an_obj) *rval = OBJECT_TO_JSVAL(an_obj);
+ if (an_obj) SMJS_SET_RVAL( OBJECT_TO_JSVAL(an_obj) );
return JS_TRUE;
}
jsval dom_element_construct(JSContext *c, GF_Node *n);
#endif
-static JSBool vrml_parse_xml(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vrml_parse_xml)
{
#ifndef GPAC_DISABLE_SVG
GF_SceneGraph *sg;
GF_Node *node;
char *str;
GF_Node *gf_sm_load_svg_from_string(GF_SceneGraph *sg, char *svg_str);
+ SMJS_ARGS
str = js_get_utf8(argv[0]);
if (!str) return JS_TRUE;
node = gf_sm_load_svg_from_string(sg, str);
gf_free(str);
- *rval = dom_element_construct(c, node);
+ SMJS_SET_RVAL( dom_element_construct(c, node) );
#endif
return JS_TRUE;
}
-static JSBool getElementById(JSContext*c, JSObject*obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(getElementById)
{
GF_Node *elt;
JSObject *an_obj;
u32 ID = 0;
GF_ScriptPriv *priv = JS_GetScriptStack(c);
GF_Node *sc = JS_GetContextPrivate(c);
- if (JSVAL_IS_STRING(argv[0])) name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ SMJS_ARGS
+ if (JSVAL_IS_STRING(argv[0])) name = SMJS_CHARS(c, argv[0]);
else if (JSVAL_IS_INT(argv[0])) ID = JSVAL_TO_INT(argv[0]);
if (!ID && !name) return JS_FALSE;
elt = NULL;
if (ID) elt = gf_sg_find_node(sc->sgprivate->scenegraph, ID);
else elt = gf_sg_find_node_by_name(sc->sgprivate->scenegraph, name);
+
+ SMJS_FREE(c, name);
if (!elt) return JS_TRUE;
an_obj = node_get_binding(priv, elt, 0);
- if (an_obj) *rval = OBJECT_TO_JSVAL(an_obj);
+ if (an_obj) SMJS_SET_RVAL( OBJECT_TO_JSVAL(an_obj) );
return JS_TRUE;
}
-static JSBool replaceWorld(JSContext*c, JSObject*o, uintN n, jsval *v, jsval *rv)
+static JSBool SMJS_FUNCTION(replaceWorld)
{
return JS_TRUE;
}
if (!r->FromNode) {
if (r->obj) {
- gf_js_remove_root(priv->js_ctx, &r->obj);
+// gf_js_remove_root(priv->js_ctx, &r->obj);
r->obj=NULL;
}
if (r->fun) {
- gf_js_remove_root(priv->js_ctx, &r->fun);
+// gf_js_remove_root(priv->js_ctx, &r->fun);
r->fun=0;
}
return;
t_info.fieldIndex = -1;
t_info.name = "timestamp";
+ gf_sg_lock_javascript(priv->js_ctx, 1);
+
argv[1] = gf_sg_script_to_smjs_field(priv, &t_info, node, 1);
argv[0] = gf_sg_script_to_smjs_field(priv, &r->FromField, r->FromNode, 1);
/*protect args*/
- if (JSVAL_IS_GCTHING(argv[0])) gf_js_add_root(priv->js_ctx, &argv[0]);
- if (JSVAL_IS_GCTHING(argv[1])) gf_js_add_root(priv->js_ctx, &argv[1]);
+ if (JSVAL_IS_GCTHING(argv[0])) gf_js_add_root(priv->js_ctx, &argv[0], GF_JSGC_VAL);
+ if (JSVAL_IS_GCTHING(argv[1])) gf_js_add_root(priv->js_ctx, &argv[1], GF_JSGC_VAL);
JS_CallFunctionValue(priv->js_ctx, obj, (jsval) r->fun, 2, argv, &rval);
/*release args*/
- if (JSVAL_IS_GCTHING(argv[0])) gf_js_remove_root(priv->js_ctx, &argv[0]);
- if (JSVAL_IS_GCTHING(argv[1])) gf_js_remove_root(priv->js_ctx, &argv[1]);
+ if (JSVAL_IS_GCTHING(argv[0])) gf_js_remove_root(priv->js_ctx, &argv[0], GF_JSGC_VAL);
+ if (JSVAL_IS_GCTHING(argv[1])) gf_js_remove_root(priv->js_ctx, &argv[1], GF_JSGC_VAL);
+
+ gf_sg_lock_javascript(priv->js_ctx, 0);
#ifdef FORCE_GC
MyJSGC(priv->js_ctx);
#endif
}
-static JSBool addRoute(JSContext*c, JSObject*o, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(addRoute)
{
GF_JSField *ptr;
GF_Node *n1, *n2;
char *f1, *f2;
GF_FieldInfo info;
u32 f_id1, f_id2;
+ GF_Err e;
+ SMJS_ARGS
if (argc!=4) return JS_FALSE;
if (!JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
n2 = NULL;
if (!JSVAL_IS_STRING(argv[1])) return JS_FALSE;
- f1 = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
+ f1 = SMJS_CHARS(c, argv[1]);
if (!f1) return JS_FALSE;
if (!strnicmp(f1, "_field", 6)) {
f_id1 = atoi(f1+6);
- if (gf_node_get_field(n1, f_id1, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field(n1, f_id1, &info);
} else {
- if (gf_node_get_field_by_name(n1, f1, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field_by_name(n1, f1, &info);
f_id1 = info.fieldIndex;
}
+ SMJS_FREE(c, f1);
+ if (e != GF_OK) return JS_FALSE;
if (!JSVAL_IS_OBJECT(argv[2])) return JS_FALSE;
n2 = * ((GF_Node **)ptr->field.far_ptr);
if (!n2) return JS_FALSE;
- f2 = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
+ f2 = SMJS_CHARS(c, argv[3]);
if (!f2) return JS_FALSE;
if (!strnicmp(f2, "_field", 6)) {
f_id2 = atoi(f2+6);
- if (gf_node_get_field(n2, f_id2, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field(n2, f_id2, &info);
} else {
if ((n2->sgprivate->tag==TAG_MPEG4_Script)
#ifndef GPAC_DISABLE_X3D
gf_sg_script_field_new(n2, GF_SG_SCRIPT_TYPE_EVENT_IN, src.fieldType, f2);
}
}
- if (gf_node_get_field_by_name(n2, f2, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field_by_name(n2, f2, &info);
f_id2 = info.fieldIndex;
}
+ SMJS_FREE(c, f2);
+ if (e != GF_OK) return JS_FALSE;
r = gf_sg_route_new(n1->sgprivate->scenegraph, n1, f_id1, n2, f_id2);
if (!r) return JS_FALSE;
r->ToField.name = JS_GetFunctionName( JS_ValueToFunction(c, argv[3] ) );
r->obj = JSVAL_TO_OBJECT( argv[2] ) ;
- gf_js_add_root(c, & r->obj);
+// gf_js_add_root(c, & r->obj);
r->fun = argv[3];
- gf_js_add_root(c, &r->fun);
+// gf_js_add_root(c, &r->fun);
r->is_setup = 1;
r->graph = n1->sgprivate->scenegraph;
}
-static JSBool deleteRoute(JSContext*c, JSObject*o, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(deleteRoute)
{
GF_JSField *ptr;
GF_Node *n1, *n2;
char *f1, *f2;
GF_FieldInfo info;
GF_Route *r;
+ GF_Err e;
u32 f_id1, f_id2, i;
+ SMJS_ARGS
if (argc!=4) return JS_FALSE;
+
if (!JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
+
+ if (JSVAL_IS_STRING(argv[1]) && (argv[2]==JSVAL_NULL) && (argv[3]==JSVAL_NULL)) {
+ ptr = (GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0]));
+ assert(ptr->field.fieldType==GF_SG_VRML_SFNODE);
+ n1 = * ((GF_Node **)ptr->field.far_ptr);
+ f1 = SMJS_CHARS(c, argv[1]);
+ if (!strcmp(f1, "ALL")) {
+ while (n1->sgprivate->interact && n1->sgprivate->interact->routes && gf_list_count(n1->sgprivate->interact->routes) ) {
+ r = gf_list_get(n1->sgprivate->interact->routes, 0);
+ gf_sg_route_del(r);
+ }
+ }
+ SMJS_FREE(c, f1);
+ return JS_TRUE;
+ }
+
if (!JSVAL_IS_OBJECT(argv[2]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[2]), &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
if (!JSVAL_IS_STRING(argv[1]) || !JSVAL_IS_STRING(argv[3])) return JS_FALSE;
if (!n1 || !n2) return JS_FALSE;
if (!n1->sgprivate->interact) return JS_TRUE;
- f1 = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- f2 = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
- if (!f1 || !f2) return JS_FALSE;
+ f1 = SMJS_CHARS(c, argv[1]);
+ f2 = SMJS_CHARS(c, argv[3]);
+ if (!f1 || !f2) {
+ SMJS_FREE(c, f1);
+ SMJS_FREE(c, f2);
+ return JS_FALSE;
+ }
if (!strnicmp(f1, "_field", 6)) {
f_id1 = atoi(f1+6);
- if (gf_node_get_field(n1, f_id1, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field(n1, f_id1, &info);
} else {
- if (gf_node_get_field_by_name(n1, f1, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field_by_name(n1, f1, &info);
f_id1 = info.fieldIndex;
}
+ SMJS_FREE(c, f1);
+ if (e != GF_OK) return JS_FALSE;
+
if (!strnicmp(f2, "_field", 6)) {
f_id2 = atoi(f2+6);
- if (gf_node_get_field(n2, f_id2, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field(n2, f_id2, &info);
} else {
- if (gf_node_get_field_by_name(n2, f2, &info) != GF_OK) return JS_FALSE;
+ e = gf_node_get_field_by_name(n2, f2, &info);
f_id2 = info.fieldIndex;
}
+ SMJS_FREE(c, f2);
+ if (e != GF_OK) return JS_FALSE;
i=0;
while ((r = gf_list_enum(n1->sgprivate->interact->routes, &i))) {
return JS_TRUE;
}
-static JSBool loadURL(JSContext*c, JSObject*obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(loadURL)
{
u32 i;
GF_JSAPIParam par;
jsuint len;
JSObject *p;
GF_JSField *f;
+ SMJS_ARGS
M_Script *script = (M_Script *) JS_GetContextPrivate(c);
if (argc < 1) return JS_FALSE;
if (JSVAL_IS_STRING(argv[0])) {
- JSString *str = JSVAL_TO_STRING(argv[0]);
- par.uri.url = JS_GetStringBytes(str);
+ Bool res;
+ par.uri.url = SMJS_CHARS(c, argv[0]);
/*TODO add support for params*/
par.uri.nb_params = 0;
- if (ScriptAction(c, NULL, GF_JSAPI_OP_LOAD_URL, (GF_Node *)script, &par))
- return JS_TRUE;
- return JS_FALSE;
+ res = ScriptAction(c, NULL, GF_JSAPI_OP_LOAD_URL, (GF_Node *)script, &par);
+ SMJS_FREE(c, par.uri.url);
+ return res ? JS_TRUE : JS_FALSE;
}
if (!JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
JS_GetElement(c, f->js_list, (jsint) i, &item);
if (JSVAL_IS_STRING(item)) {
- JSString *str = JSVAL_TO_STRING(item);
- par.uri.url = JS_GetStringBytes(str);
+ Bool res;
+ par.uri.url = SMJS_CHARS(c, item);
/*TODO add support for params*/
par.uri.nb_params = 0;
- if (ScriptAction(c, NULL, GF_JSAPI_OP_LOAD_URL, (GF_Node*)script, &par) )
- return JS_TRUE;
+ res = ScriptAction(c, NULL, GF_JSAPI_OP_LOAD_URL, (GF_Node*)script, &par);
+ SMJS_FREE(c, par.uri.url);
+ if (res) return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool setDescription(JSContext*c, JSObject*o, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(setDescription)
{
GF_JSAPIParam par;
GF_Node *node = JS_GetContextPrivate(c);
+ SMJS_ARGS
if (!argc || !JSVAL_IS_STRING(argv[0])) return JS_FALSE;
- par.uri.url = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
+ par.uri.url = SMJS_CHARS(c, argv[0]);
ScriptAction(c, NULL, GF_JSAPI_OP_SET_TITLE, node->sgprivate->scenegraph->RootNode, &par);
+ SMJS_FREE(c, par.uri.url);
return JS_TRUE;
}
-static JSBool createVrmlFromString(JSContext*c, JSObject*obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(createVrmlFromString)
{
#ifndef GPAC_DISABLE_LOADER_BT
GF_ScriptPriv *priv;
GF_FieldInfo field;
/*BT/VRML from string*/
GF_List *gf_sm_load_bt_from_string(GF_SceneGraph *in_scene, char *node_str);
- JSString *js_str;
char *str;
GF_List *nlist;
+ SMJS_ARGS
GF_Node *sc_node = JS_GetContextPrivate(c);
if (argc < 1) return JS_FALSE;
if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
- js_str = JSVAL_TO_STRING(argv[0]);
- str = JS_GetStringBytes(js_str);
+ str = SMJS_CHARS(c, argv[0]);
nlist = gf_sm_load_bt_from_string(sc_node->sgprivate->scenegraph, str);
- if (!nlist) return JSVAL_NULL;
+ SMJS_FREE(c, str);
+ if (!nlist) return JS_FALSE;
priv = JS_GetScriptStack(c);
memset(&field, 0, sizeof(GF_FieldInfo));
field.fieldType = GF_SG_VRML_MFNODE;
field.far_ptr = &nlist;
- *rval = gf_sg_script_to_smjs_field(priv, &field, NULL, 0);
+ SMJS_SET_RVAL( gf_sg_script_to_smjs_field(priv, &field, NULL, 0) );
/*don't forget to unregister all this stuff*/
while (gf_list_count(nlist)) {
#endif
}
-static JSBool getOption(JSContext*c, JSObject*obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(getOption)
{
JSString *s;
GF_JSAPIParam par;
GF_Node *sc_node = JS_GetContextPrivate(c);
- JSString *js_sec_name, *js_key_name;
- if (argc < 2) return JSVAL_FALSE;
+ Bool res;
+ SMJS_ARGS
+ if (argc < 2) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[0])) return JSVAL_FALSE;
- js_sec_name = JSVAL_TO_STRING(argv[0]);
- par.gpac_cfg.section = JS_GetStringBytes(js_sec_name);
+ if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
+ if (!JSVAL_IS_STRING(argv[1])) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[1])) return JSVAL_FALSE;
- js_key_name = JSVAL_TO_STRING(argv[1]);
- par.gpac_cfg.key = JS_GetStringBytes(js_key_name);
+ par.gpac_cfg.section = SMJS_CHARS(c, argv[0]);
+ par.gpac_cfg.key = SMJS_CHARS(c, argv[1]);
par.gpac_cfg.key_val = NULL;
- if (!ScriptAction(c, NULL, GF_JSAPI_OP_GET_OPT, sc_node->sgprivate->scenegraph->RootNode, &par))
- return JSVAL_FALSE;
+ res = ScriptAction(c, NULL, GF_JSAPI_OP_GET_OPT, sc_node->sgprivate->scenegraph->RootNode, &par);
+ SMJS_FREE(c, (char *)par.gpac_cfg.section);
+ SMJS_FREE(c, (char *)par.gpac_cfg.key);
+ if (!res) return JS_FALSE;
s = JS_NewStringCopyZ(c, par.gpac_cfg.key_val ? (const char *)par.gpac_cfg.key_val : "");
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
return JS_TRUE;
}
-static JSBool setOption(JSContext*c, JSObject*obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(setOption)
{
GF_JSAPIParam par;
GF_Node *sc_node = JS_GetContextPrivate(c);
- JSString *js_sec_name, *js_key_name, *js_key_val;
- if (argc < 3) return JSVAL_FALSE;
+ Bool res;
+ SMJS_ARGS
+ if (argc < 3) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[0])) return JSVAL_FALSE;
- js_sec_name = JSVAL_TO_STRING(argv[0]);
- par.gpac_cfg.section = JS_GetStringBytes(js_sec_name);
-
- if (!JSVAL_IS_STRING(argv[1])) return JSVAL_FALSE;
- js_key_name = JSVAL_TO_STRING(argv[1]);
- par.gpac_cfg.key = JS_GetStringBytes(js_key_name);
+ if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE;
+ if (!JSVAL_IS_STRING(argv[1])) return JS_FALSE;
+ if (!JSVAL_IS_STRING(argv[2])) return JS_FALSE;
- if (!JSVAL_IS_STRING(argv[2])) return JSVAL_FALSE;
- js_key_val = JSVAL_TO_STRING(argv[2]);
- par.gpac_cfg.key_val = JS_GetStringBytes(js_key_val);
+ par.gpac_cfg.section = SMJS_CHARS(c, argv[0]);
+ par.gpac_cfg.key = SMJS_CHARS(c, argv[1]);
+ par.gpac_cfg.key_val = SMJS_CHARS(c, argv[2]);
- if (!ScriptAction(c, NULL, GF_JSAPI_OP_SET_OPT, sc_node->sgprivate->scenegraph->RootNode, &par))
- return JSVAL_FALSE;
+ res = ScriptAction(c, NULL, GF_JSAPI_OP_SET_OPT, sc_node->sgprivate->scenegraph->RootNode, &par);
+ SMJS_FREE(c, (char *)par.gpac_cfg.section);
+ SMJS_FREE(c, (char *)par.gpac_cfg.key);
+ SMJS_FREE(c, (char *)par.gpac_cfg.key_val);
- return JSVAL_TRUE;
+ if (!res) return JS_FALSE;
+ return JS_TRUE;
}
void Script_FieldChanged(JSContext *c, GF_Node *parent, GF_JSField *parent_owner, GF_FieldInfo *field)
}
}
-JSBool gf_sg_script_eventout_set_prop(JSContext *c, JSObject *obj, jsval id, jsval *val)
+JSBool gf_sg_script_eventout_set_prop(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *val)
{
u32 i;
- const char *eventName;
+ char *eventName;
GF_ScriptPriv *script;
GF_Node *n;
GF_ScriptField *sf;
JSString *str = JS_ValueToString(c, id);
if (!str) return JS_FALSE;
- eventName = JS_GetStringBytes(str);
-
script = JS_GetScriptStack(c);
if (!script) return JS_FALSE;
n = (GF_Node *) JS_GetScript(c);
+ eventName = SMJS_CHARS_FROM_STRING(c, str);
i=0;
while ((sf = gf_list_enum(script->fields, &i))) {
if (!stricmp(sf->name, eventName)) {
gf_node_get_field(n, sf->ALL_index, &info);
gf_sg_script_to_node_field(c, *val, &info, n, NULL);
sf->activate_event_out = 1;
+ SMJS_FREE(c, eventName);
return JS_TRUE;
}
}
+ SMJS_FREE(c, eventName);
return JS_FALSE;
}
/*if ptr is a field, remove field binding from parent*/
if (ptr->owner && ptr->owner->sgprivate->interact && ptr->owner->sgprivate->interact->js_binding) {
- gf_list_del_item(ptr->owner->sgprivate->interact->js_binding->fields, ptr);
+ int res = gf_list_del_item(ptr->owner->sgprivate->interact->js_binding->fields, ptr);
+ assert(res>=0);
}
GF_ScriptPriv *priv;
if (ptr->js_ctx) c = ptr->js_ctx;
priv = JS_GetScriptStack(c);
-
gf_list_del_item(priv->js_cache, obj);
}
}
}
-static JSBool field_toString(JSContext *c, JSObject *obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(field_toString)
{
u32 i;
jsuint len;
char str[5000];
JSString *s;
jsval item;
+ SMJS_OBJ
GF_JSField *f = (GF_JSField *) JS_GetPrivate(c, obj);
if (!f) return JS_FALSE;
case GF_SG_VRML_MFSTRING:
case GF_SG_VRML_MFURL:
{
- JSString *j_str = JSVAL_TO_STRING(item);
- char *str_val = JS_GetStringBytes(j_str);
+ char *str_val = SMJS_CHARS(c, item);
strcat(str, str_val);
+ SMJS_FREE(c, str_val);
}
break;
default:
}
s = JS_NewStringCopyZ(c, str);
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
return JS_TRUE;
}
-static JSBool SFNodeConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(SFNodeConstructor)
{
u32 tag, ID;
GF_Node *new_node;
GF_JSField *field;
- JSString *str;
GF_Proto *proto;
GF_SceneGraph *sg;
char *node_name;
GF_ScriptPriv *priv = JS_GetScriptStack(c);
M_Script *sc = JS_GetScript(c);
+ SMJS_ARGS
+ SMJS_OBJ_CONSTRUCTOR
+ tag = 0;
if (!argc) {
field = NewJSField(c);
field->field.fieldType = GF_SG_VRML_SFNODE;
field->node = NULL;
field->field.far_ptr = &field->node;
JS_SetPrivate(c, obj, field);
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
if (!JS_InstanceOf(c, obj, &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
-
- str = JS_ValueToString(c, argv[0]);
- if (!str) return JS_FALSE;
-
ID = 0;
- node_name = JS_GetStringBytes(str);
+ node_name = SMJS_CHARS(c, argv[0]);
if (!strnicmp(node_name, "_proto", 6)) {
ID = atoi(node_name+6);
+ SMJS_FREE(c, node_name);
node_name = NULL;
locate_proto:
if (!sg->parent_scene) break;
sg = sg->parent_scene;
}
- if (!proto) return JS_FALSE;
+ if (!proto) {
+ SMJS_FREE(c, node_name);
+ return JS_FALSE;
+ }
/* create interface and load code in current graph*/
new_node = gf_sg_proto_create_instance(sc->sgprivate->scenegraph, proto);
- if (!new_node) return JS_FALSE;
+ if (!new_node) {
+ SMJS_FREE(c, node_name);
+ return JS_FALSE;
+ }
/*OK, instanciate proto code*/
if (gf_sg_proto_load_code(new_node) != GF_OK) {
gf_node_unregister(new_node, NULL);
+ SMJS_FREE(c, node_name);
return JS_FALSE;
}
} else {
}
if (!tag) goto locate_proto;
new_node = gf_node_new(sc->sgprivate->scenegraph, tag);
- if (!new_node) return JS_FALSE;
+ if (!new_node) {
+ SMJS_FREE(c, node_name);
+ return JS_FALSE;
+ }
gf_node_init(new_node);
}
+
+ SMJS_FREE(c, node_name);
obj = node_get_binding(priv, new_node, 1);
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return JS_TRUE;
}
) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] unregistering node %s (%s)\n", gf_node_get_name(ptr->node), gf_node_get_class_name(ptr->node)));
- gf_node_unregister(ptr->node, (ptr->node==parent) ? NULL : parent);
+ //gf_node_unregister(ptr->node, (ptr->node==parent) ? NULL : parent);
+ gf_node_unregister(ptr->node, NULL);
}
gf_free(ptr);
}
node_finalize_ex(c, obj, 1);
}
-static JSBool node_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool node_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_Node *n;
u32 index;
n = * ((GF_Node **)ptr->field.far_ptr);
priv = JS_GetScriptStack(c);
- if (n && JSVAL_IS_STRING(id) && ( (str = JSVAL_TO_STRING(id)) != 0) ) {
- char *fieldName = JS_GetStringBytes(str);
+ if (n && SMJS_ID_IS_STRING(id) && ( (str = SMJS_ID_TO_STRING(id)) != 0) ) {
+ char *fieldName = SMJS_CHARS_FROM_STRING(c, str);
if (!strnicmp(fieldName, "toString", 8)) {
+ SMJS_FREE(c, fieldName);
return JS_TRUE;
}
/*fieldID indexing*/
index = atoi(fieldName+6);
if ( gf_node_get_field(n, index, &info) == GF_OK) {
*vp = gf_sg_script_to_smjs_field(priv, &info, n, 0);
+ SMJS_FREE(c, fieldName);
return JS_TRUE;
}
} else if ( gf_node_get_field_by_name(n, fieldName, &info) == GF_OK) {
*vp = gf_sg_script_to_smjs_field(priv, &info, n, 0);
+ SMJS_FREE(c, fieldName);
return JS_TRUE;
}
+
+ if (!strcmp(fieldName, "_bounds")) {
+ GF_JSAPIParam par;
+ par.bbox.is_set = 0;
+ if (ScriptAction(c, n->sgprivate->scenegraph, GF_JSAPI_OP_GET_LOCAL_BBOX, (GF_Node *)n, &par) ) {
+ JSObject *_obj = JS_NewObject(priv->js_ctx, &js_rt->AnyClass, 0, 0);
+ Float x, y, w, h;
+ x = y = w = h = 0;
+ if (par.bbox.is_set) {
+ x = FIX2FLT(par.bbox.min_edge.x);
+ y = FIX2FLT(par.bbox.min_edge.y);
+ w = FIX2FLT(par.bbox.max_edge.x - par.bbox.min_edge.x);
+ h = FIX2FLT(par.bbox.max_edge.y - par.bbox.min_edge.y);
+ }
+ JS_DefineProperty(priv->js_ctx, _obj, "x", JS_MAKE_DOUBLE(c, x), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT );
+ JS_DefineProperty(priv->js_ctx, _obj, "y", JS_MAKE_DOUBLE(c, y), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT );
+ JS_DefineProperty(priv->js_ctx, _obj, "width", JS_MAKE_DOUBLE(c, w), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT );
+ JS_DefineProperty(priv->js_ctx, _obj, "height", JS_MAKE_DOUBLE(c, h), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT );
+ *vp = OBJECT_TO_JSVAL(_obj);
+ SMJS_FREE(c, fieldName);
+ return JS_TRUE;
+ }
+ }
+ SMJS_FREE(c, fieldName);
return JS_TRUE;
}
+
return JS_FALSE;
}
-static JSBool node_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool node_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
GF_Node *n;
GF_FieldInfo info;
/*this is the prototype*/
if (!ptr) {
- if (! JSVAL_IS_STRING(id)) return JS_FALSE;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] setting new prop/func %s for object prototype\n", JS_GetStringBytes(JSVAL_TO_STRING(id)) ));
+ if (! SMJS_ID_IS_STRING(id)) return JS_FALSE;
return JS_TRUE;
}
assert(ptr->field.fieldType==GF_SG_VRML_SFNODE);
n = * ((GF_Node **)ptr->field.far_ptr);
- if (n && JSVAL_IS_STRING(id)) {
- JSString *str = JSVAL_TO_STRING(id);
- fieldname = JS_GetStringBytes(str);
+ if (n && SMJS_ID_IS_STRING(id)) {
+ JSString *str = SMJS_ID_TO_STRING(id);
+ fieldname = SMJS_CHARS_FROM_STRING(c, str);
/*fieldID indexing*/
if (!strnicmp(fieldname, "_field", 6)) {
index = atoi(fieldname+6);
- if ( gf_node_get_field(n, index, &info) != GF_OK) return JS_TRUE;
+ SMJS_FREE(c, fieldname);
+ if ( gf_node_get_field(n, index, &info) != GF_OK) {
+ SMJS_FREE(c, fieldname);
+ return JS_TRUE;
+ }
} else {
if (gf_node_get_field_by_name(n, fieldname, &info) != GF_OK) {
/*VRML style*/
if (!strnicmp(fieldname, "set_", 4)) {
- fieldname+=4;
- if (gf_node_get_field_by_name(n, fieldname, &info) != GF_OK) return JS_TRUE;
+ if (gf_node_get_field_by_name(n, fieldname + 4, &info) != GF_OK) {
+ SMJS_FREE(c, fieldname);
+ return JS_TRUE;
+ }
} else {
+ SMJS_FREE(c, fieldname);
return JS_TRUE;
}
}
}
+ SMJS_FREE(c, fieldname);
+
if (gf_node_get_tag(n)==TAG_ProtoNode)
gf_sg_proto_mark_field_loaded(n, &info);
}
return JS_TRUE;
}
-static JSBool node_toString(JSContext *c, JSObject *obj, uintN i, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(node_toString)
{
char str[1000];
u32 id;
JSString *s;
GF_JSField *f;
const char *name;
+ SMJS_OBJ
if (! JS_InstanceOf(c, obj, &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
f = (GF_JSField *) JS_GetPrivate(c, obj);
if (!f) return JS_FALSE;
strcat(str, gf_node_get_class_name(n));
s = JS_NewStringCopyZ(c, (const char *) str);
if (!s) return JS_FALSE;
- *rval = STRING_TO_JSVAL(s);
+ SMJS_SET_RVAL( STRING_TO_JSVAL(s) );
return JS_TRUE;
}
-static JSBool node_getTime(JSContext *c, JSObject *obj, uintN i, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(node_getTime)
{
GF_Node *n;
GF_JSField *f;
+ SMJS_OBJ
if (! JS_InstanceOf(c, obj, &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
f = (GF_JSField *) JS_GetPrivate(c, obj);
if (!f) return JS_FALSE;
n = * ((GF_Node **)f->field.far_ptr);
if (!n) return JS_FALSE;
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble(c, gf_node_get_scene_time(n) ));
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, gf_node_get_scene_time(n)) );
return JS_TRUE;
}
JS_SetPrivate(c, obj, field);
return field;
}
-static JSBool SFImageConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(SFImageConstructor)
{
u32 w, h, nbComp;
MFInt32 *pixels;
+ SMJS_ARGS
+ SMJS_OBJ_CONSTRUCTOR
if (argc<4) return 0;
if (!JSVAL_IS_INT(argv[0]) || !JSVAL_IS_INT(argv[1]) || !JSVAL_IS_INT(argv[2])) return JS_FALSE;
if (!JSVAL_IS_OBJECT(argv[3]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[3]), &js_rt->MFInt32Class, NULL)) return JS_FALSE;
SFImage_Create(c, obj, w, h, nbComp, pixels);
return JS_TRUE;
}
-static JSBool image_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+
+static JSBool image_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_ScriptPriv *priv = JS_GetScriptStack(c);
GF_JSField *val = (GF_JSField *) JS_GetPrivate(c, obj);
SFImage *sfi;
if (!val) return JS_FALSE;
sfi = (SFImage*)val->field.far_ptr;
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0: *vp = INT_TO_JSVAL( sfi->width ); break;
case 1: *vp = INT_TO_JSVAL( sfi->height); break;
case 2: *vp = INT_TO_JSVAL( sfi->numComponents ); break;
return JS_TRUE;
}
-static JSBool image_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool image_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
u32 ival;
Bool changed = 0;
/*this is the prototype*/
if (!ptr) {
- if (! JSVAL_IS_STRING(id)) return JS_FALSE;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] setting new prop/func %s for object prototype\n", JS_GetStringBytes(JSVAL_TO_STRING(id)) ));
+ if (! SMJS_ID_IS_STRING(id)) return JS_FALSE;
return JS_TRUE;
}
sfi = (SFImage*)ptr->field.far_ptr;
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id) && SMJS_ID_TO_INT(id) >= 0 && SMJS_ID_TO_INT(id) < 4) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0:
ival = JSVAL_TO_INT(*vp);
changed = ! (sfi->width == ival);
JS_SetPrivate(c, obj, field);
return field;
}
-static JSBool SFVec2fConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(SFVec2fConstructor)
{
jsdouble x = 0.0, y = 0.0;
+ SMJS_ARGS
+ SMJS_OBJ_CONSTRUCTOR
if (argc > 0) JS_ValueToNumber(c, argv[0], &x);
if (argc > 1) JS_ValueToNumber(c, argv[1], &y);
SFVec2f_Create(c, obj, FLT2FIX( x), FLT2FIX( y));
return JS_TRUE;
}
-static JSBool vec2f_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool vec2f_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_JSField *val = (GF_JSField *) JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
- case 0: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFVec2f*)val->field.far_ptr)->x) )); break;
- case 1: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFVec2f*)val->field.far_ptr)->y) )); break;
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFVec2f*)val->field.far_ptr)->x)); break;
+ case 1: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFVec2f*)val->field.far_ptr)->y)); break;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool vec2f_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool vec2f_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
jsdouble d;
Fixed v;
/*this is the prototype*/
if (!ptr) {
- if (! JSVAL_IS_STRING(id)) return JS_FALSE;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] setting new prop/func %s for object prototype\n", JS_GetStringBytes(JSVAL_TO_STRING(id)) ));
+ if (! SMJS_ID_IS_STRING(id)) return JS_FALSE;
return JS_TRUE;
}
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 2 && JS_ValueToNumber(c, *vp, &d)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id)) {
+ JS_ValueToNumber(c, *vp, &d);
+ switch (SMJS_ID_TO_INT(id)) {
case 0:
v = FLT2FIX( d);
changed = ! ( ((SFVec2f*)ptr->field.far_ptr)->x == v);
return JS_FALSE;
}
-static JSBool vec2f_add(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_add)
{
SFVec2f *v1, *v2;
JSObject *pNew;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec2fClass, NULL))
return JS_FALSE;
v2 = ((GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0])))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec2fClass, 0, JS_GetParent(c, obj));
SFVec2f_Create(c, pNew, v1->x + v2->x, v1->y + v2->y);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec2f_subtract(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_subtract)
{
SFVec2f *v1, *v2;
JSObject *pNew;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec2fClass, NULL))
return JS_FALSE;
v2 = ((GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0])))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec2fClass, 0, JS_GetParent(c, obj));
SFVec2f_Create(c, pNew, v1->x - v2->x, v1->y - v2->y);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec2f_negate(JSContext *c, JSObject *obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_negate)
{
SFVec2f *v1;
JSObject *pNew;
+ SMJS_OBJ
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec2fClass, 0, JS_GetParent(c, obj));
SFVec2f_Create(c, pNew, -v1->x , -v1->y );
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec2f_multiply(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_multiply)
{
SFVec2f *v1;
JSObject *pNew;
jsdouble d;
Fixed v;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0) return JS_FALSE;
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec2fClass, 0, JS_GetParent(c, obj));
JS_ValueToNumber(c, argv[0], &d );
v = FLT2FIX( d);
SFVec2f_Create(c, pNew, gf_mulfix(v1->x , v), gf_mulfix(v1->y, v) );
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec2f_divide(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_divide)
{
SFVec2f *v1;
JSObject *pNew;
jsdouble d;
Fixed v;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0) return JS_FALSE;
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec2fClass, 0, JS_GetParent(c, obj));
JS_ValueToNumber(c, argv[0], &d );
v = FLT2FIX(d);
SFVec2f_Create(c, pNew, gf_divfix(v1->x, v), gf_divfix(v1->y, v));
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec2f_length(JSContext *c, JSObject *obj, uintN n, jsval *val, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_length)
{
Double res;
SFVec2f *v1;
+ SMJS_OBJ
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
res = FIX2FLT(gf_v2d_len(v1));
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble(c, res) );
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, res) );
return JS_TRUE;
}
-static JSBool vec2f_normalize(JSContext *c, JSObject *obj, uintN n, jsval *val, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_normalize)
{
SFVec2f *v1;
Fixed res;
JSObject *pNew;
+ SMJS_OBJ
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
res = gf_v2d_len(v1);
pNew = JS_NewObject(c, &js_rt->SFVec2fClass, 0, JS_GetParent(c, obj));
SFVec2f_Create(c, pNew, gf_divfix(v1->x, res), gf_divfix(v1->y, res) );
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec2f_dot(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec2f_dot)
{
SFVec2f *v1, *v2;
+ SMJS_OBJ
+ SMJS_ARGS
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec2fClass, NULL))
return JS_FALSE;
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
v2 = ((GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0])))->field.far_ptr;
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( gf_mulfix(v1->x, v2->x) + gf_mulfix(v1->y, v2->y) ) ) );
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT( gf_mulfix(v1->x, v2->x) + gf_mulfix(v1->y, v2->y) ) ) );
return JS_TRUE;
}
JS_SetPrivate(c, obj, field);
return field;
}
-static JSBool SFVec3fConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(SFVec3fConstructor)
{
+ SMJS_ARGS
jsdouble x = 0.0, y = 0.0, z = 0.0;
+ SMJS_OBJ_CONSTRUCTOR
if (argc > 0) JS_ValueToNumber(c, argv[0], &x);
if (argc > 1) JS_ValueToNumber(c, argv[1], &y);
if (argc > 2) JS_ValueToNumber(c, argv[2], &z);
SFVec3f_Create(c, obj, FLT2FIX( x), FLT2FIX( y), FLT2FIX( z));
return JS_TRUE;
}
-static JSBool vec3f_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool vec3f_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_JSField *val = (GF_JSField *) JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
- case 0: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFVec3f*)val->field.far_ptr)->x) )); break;
- case 1: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFVec3f*)val->field.far_ptr)->y) )); break;
- case 2: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFVec3f*)val->field.far_ptr)->z) )); break;
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFVec3f*)val->field.far_ptr)->x) ); break;
+ case 1: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFVec3f*)val->field.far_ptr)->y) ); break;
+ case 2: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFVec3f*)val->field.far_ptr)->z) ); break;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool vec3f_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool vec3f_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
jsdouble d;
Fixed v;
/*this is the prototype*/
if (!ptr) {
- if (! JSVAL_IS_STRING(id)) return JS_FALSE;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] setting new prop/func %s for object prototype\n", JS_GetStringBytes(JSVAL_TO_STRING(id)) ));
+ if (! SMJS_ID_IS_STRING(id)) return JS_FALSE;
return JS_TRUE;
}
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 3 && JS_ValueToNumber(c, *vp, &d)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id) && SMJS_ID_TO_INT(id) >= 0 && SMJS_ID_TO_INT(id) < 3 && JS_ValueToNumber(c, *vp, &d)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0:
v = FLT2FIX( d);
changed = ! ( ((SFVec3f*)ptr->field.far_ptr)->x == v);
}
return JS_FALSE;
}
-static JSBool vec3f_add(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_add)
{
SFVec3f *v1, *v2;
JSObject *pNew;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec3fClass, NULL))
return JS_FALSE;
v2 = ((GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0])))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
SFVec3f_Create(c, pNew, v1->x + v2->x, v1->y + v2->y, v1->z + v2->z);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec3f_subtract(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_subtract)
{
SFVec3f *v1, *v2;
JSObject *pNew;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec3fClass, NULL))
return JS_FALSE;
v2 = ((GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0])))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
SFVec3f_Create(c, pNew, v1->x - v2->x, v1->y - v2->y, v1->z - v2->z);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec3f_negate(JSContext *c, JSObject *obj, uintN n, jsval *v, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_negate)
{
SFVec3f *v1;
JSObject *pNew;
+ SMJS_OBJ
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
SFVec3f_Create(c, pNew, -v1->x , -v1->y , -v1->z );
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec3f_multiply(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_multiply)
{
SFVec3f *v1;
JSObject *pNew;
jsdouble d;
Fixed v;
+ SMJS_OBJ
+ SMJS_ARGS
if (argc<=0) return JS_FALSE;
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
JS_ValueToNumber(c, argv[0], &d );
v = FLT2FIX(d);
SFVec3f_Create(c, pNew, gf_mulfix(v1->x, v), gf_mulfix(v1->y, v), gf_mulfix(v1->z, v) );
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec3f_divide(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_divide)
{
SFVec3f *v1;
JSObject *pNew;
jsdouble d;
Fixed v;
+ SMJS_OBJ
+ SMJS_ARGS
if (argc<=0) return JS_FALSE;
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
JS_ValueToNumber(c, argv[0], &d );
v = FLT2FIX(d);
SFVec3f_Create(c, pNew, gf_divfix(v1->x, v), gf_divfix(v1->y, v), gf_divfix(v1->z, v));
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec3f_length(JSContext *c, JSObject *obj, uintN n, jsval *val, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_length)
{
Fixed res;
SFVec3f *v1;
+ SMJS_OBJ
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
res = gf_vec_len(*v1);
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT(res)) );
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(res) ) );
return JS_TRUE;
}
-static JSBool vec3f_normalize(JSContext *c, JSObject *obj, uintN n, jsval *val, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_normalize)
{
SFVec3f v1;
JSObject *pNew;
+ SMJS_OBJ
v1 = * (SFVec3f *) ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
gf_vec_norm(&v1);
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
SFVec3f_Create(c, pNew, v1.x, v1.y, v1.z);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool vec3f_dot(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_dot)
{
SFVec3f v1, v2;
+ SMJS_OBJ
+ SMJS_ARGS
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec3fClass, NULL))
return JS_FALSE;
v1 = *(SFVec3f *) ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
v2 = *(SFVec3f *) ((GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0])))->field.far_ptr;
- *rval = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT(gf_vec_dot(v1, v2))) );
+ SMJS_SET_RVAL( JS_MAKE_DOUBLE(c, FIX2FLT(gf_vec_dot(v1, v2)) ) );
return JS_TRUE;
}
-static JSBool vec3f_cross(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vec3f_cross)
{
SFVec3f v1, v2, v3;
JSObject *pNew;
-
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec3fClass, NULL))
return JS_FALSE;
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
v3 = gf_vec_cross(v1, v2);
SFVec3f_Create(c, pNew, v3.x, v3.y, v3.z);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
JS_SetPrivate(c, obj, field);
return field;
}
-static JSBool SFRotationConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(SFRotationConstructor)
{
JSObject *an_obj;
SFVec3f v1, v2;
Fixed l1, l2, dot;
+ SMJS_ARGS
jsdouble x = 0.0, y = 0.0, z = 0.0, a = 0.0;
+ SMJS_OBJ_CONSTRUCTOR
+
if (argc == 0) {
SFRotation_Create(c, obj, FLT2FIX(x), FLT2FIX(y), FIX_ONE, FLT2FIX(a) );
return JS_TRUE;
return JS_TRUE;
}
-static JSBool rot_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool rot_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_JSField *val = (GF_JSField *) JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
- case 0: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->x)) ); break;
- case 1: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->y)) ); break;
- case 2: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->z)) ); break;
- case 3: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->q)) ); break;
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->x)); break;
+ case 1: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->y)); break;
+ case 2: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->z)); break;
+ case 3: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFRotation*)val->field.far_ptr)->q)); break;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool rot_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool rot_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
jsdouble d;
Fixed v;
/*this is the prototype*/
if (!ptr) {
- if (! JSVAL_IS_STRING(id)) return JS_FALSE;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] setting new prop/func %s for object prototype\n", JS_GetStringBytes(JSVAL_TO_STRING(id)) ));
+ if (! SMJS_ID_IS_STRING(id)) return JS_FALSE;
return JS_TRUE;
}
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4 && JS_ValueToNumber(c, *vp, &d)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id) && SMJS_ID_TO_INT(id) >= 0 && SMJS_ID_TO_INT(id) < 4 && JS_ValueToNumber(c, *vp, &d)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0:
v = FLT2FIX(d);
changed = ! ( ((SFRotation*)ptr->field.far_ptr)->x == v);
}
return JS_FALSE;
}
-static JSBool rot_getAxis(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(rot_getAxis)
{
SFRotation r;
JSObject *pNew;
+ SMJS_OBJ
r = * (SFRotation *) ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
SFVec3f_Create(c, pNew, r.x, r.y, r.z);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool rot_inverse(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(rot_inverse)
{
SFRotation r;
JSObject *pNew;
+ SMJS_OBJ
r = * (SFRotation *) ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
pNew = JS_NewObject(c, &js_rt->SFRotationClass, 0, JS_GetParent(c, obj));
SFRotation_Create(c, pNew, r.x, r.y, r.z, r.q-GF_PI);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool rot_multiply(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(rot_multiply)
{
SFRotation r1, r2;
SFVec4f q1, q2;
JSObject *pNew;
+ SMJS_OBJ
+ SMJS_ARGS
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFRotationClass, NULL))
return JS_FALSE;
pNew = JS_NewObject(c, &js_rt->SFRotationClass, 0, JS_GetParent(c, obj));
SFRotation_Create(c, pNew, r1.x, r1.y, r1.z, r1.q);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool rot_multVec(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(rot_multVec)
{
SFVec3f v;
SFRotation r;
GF_Matrix mx;
JSObject *pNew;
+ SMJS_OBJ
+ SMJS_ARGS
if (argc<=0) return JS_FALSE;
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec3fClass, NULL))
gf_mx_apply_vec(&mx, &v);
pNew = JS_NewObject(c, &js_rt->SFVec3fClass, 0, JS_GetParent(c, obj));
SFVec3f_Create(c, pNew, v.x, v.y, v.z);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
-static JSBool rot_setAxis(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(rot_setAxis)
{
SFVec3f v;
SFRotation r;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=0) return JS_FALSE;
if (argc<=0 || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFVec3fClass, NULL))
r.z = v.z;
return JS_TRUE;
}
-static JSBool rot_slerp(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(rot_slerp)
{
SFRotation v1, v2, res;
SFVec4f q1, q2;
JSObject *pNew;
jsdouble d;
+ SMJS_ARGS
+ SMJS_OBJ
if (argc<=1) return JS_FALSE;
if (!JSVAL_IS_DOUBLE(argv[1]) || !JSVAL_IS_OBJECT(argv[0]) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(argv[0]), &js_rt->SFRotationClass, NULL)) return JS_FALSE;
res = gf_quat_to_rotation(&q1);
pNew = JS_NewObject(c, &js_rt->SFRotationClass, 0, JS_GetParent(c, obj));
SFRotation_Create(c, pNew, res.x, res.y, res.z, res.q);
- *rval = OBJECT_TO_JSVAL(pNew);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(pNew) );
return JS_TRUE;
}
JS_SetPrivate(c, obj, field);
return field;
}
-static JSBool SFColorConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(SFColorConstructor)
{
+ SMJS_ARGS
jsdouble r = 0.0, g = 0.0, b = 0.0;
+ SMJS_OBJ_CONSTRUCTOR
if (argc > 0) JS_ValueToNumber(c, argv[0], &r);
if (argc > 1) JS_ValueToNumber(c, argv[1], &g);
if (argc > 2) JS_ValueToNumber(c, argv[2], &b);
SFColor_Create(c, obj, FLT2FIX( r), FLT2FIX( g), FLT2FIX( b));
return JS_TRUE;
}
-static JSBool color_getProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool color_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp)
{
GF_JSField *val = (GF_JSField *) JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
- case 0: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFColor*)val->field.far_ptr)->red)) ); break;
- case 1: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFColor*)val->field.far_ptr)->green)) ); break;
- case 2: *vp = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT( ((SFColor*)val->field.far_ptr)->blue)) ); break;
+ if (SMJS_ID_IS_INT(id)) {
+ switch (SMJS_ID_TO_INT(id)) {
+ case 0: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFColor*)val->field.far_ptr)->red)); break;
+ case 1: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFColor*)val->field.far_ptr)->green)); break;
+ case 2: *vp = JS_MAKE_DOUBLE(c, FIX2FLT( ((SFColor*)val->field.far_ptr)->blue)); break;
default: return JS_TRUE;
}
}
return JS_TRUE;
}
-static JSBool color_setProperty(JSContext *c, JSObject *obj, jsval id, jsval *vp)
+static JSBool color_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp)
{
jsdouble d;
Fixed v;
GF_JSField *ptr = (GF_JSField *) JS_GetPrivate(c, obj);
/*this is the prototype*/
if (!ptr) {
- if (! JSVAL_IS_STRING(id)) return JS_FALSE;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] setting new prop/func %s for object prototype\n", JS_GetStringBytes(JSVAL_TO_STRING(id)) ));
+ if (! SMJS_ID_IS_STRING(id)) return JS_FALSE;
return JS_TRUE;
}
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 3 && JS_ValueToNumber(c, *vp, &d)) {
- switch (JSVAL_TO_INT(id)) {
+ if (SMJS_ID_IS_INT(id) && SMJS_ID_TO_INT(id) >= 0 && SMJS_ID_TO_INT(id) < 3 && JS_ValueToNumber(c, *vp, &d)) {
+ switch (SMJS_ID_TO_INT(id)) {
case 0:
v = FLT2FIX(d);
changed = ! ( ((SFColor*)ptr->field.far_ptr)->red == v);
}
return JS_FALSE;
}
-static JSBool color_setHSV(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rv)
+static JSBool SMJS_FUNCTION(color_setHSV)
{
SFColor *v1, hsv;
jsdouble h, s, v;
+ SMJS_OBJ
+ SMJS_ARGS
GF_JSField *ptr = (GF_JSField *) JS_GetPrivate(c, obj);
if (argc != 3) return JS_FALSE;
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
return JS_TRUE;
}
-static JSBool color_getHSV(JSContext *c, JSObject *obj, uintN n, jsval *va, jsval *rval)
+static JSBool SMJS_FUNCTION(color_getHSV)
{
SFColor *v1, hsv;
jsval vec[3];
JSObject *arr;
-
+ SMJS_OBJ
v1 = ((GF_JSField *) JS_GetPrivate(c, obj))->field.far_ptr;
hsv = *v1;
SFColor_toHSV(&hsv);
- vec[0] = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT(hsv.red)));
- vec[1] = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT(hsv.green)));
- vec[2] = DOUBLE_TO_JSVAL(JS_NewDouble(c, FIX2FLT(hsv.blue)));
+ vec[0] = JS_MAKE_DOUBLE(c, FIX2FLT(hsv.red));
+ vec[1] = JS_MAKE_DOUBLE(c, FIX2FLT(hsv.green));
+ vec[2] = JS_MAKE_DOUBLE(c, FIX2FLT(hsv.blue));
arr = JS_NewArrayObject(c, 3, vec);
- *rval = OBJECT_TO_JSVAL(arr);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(arr) );
return JS_TRUE;
}
GF_ScriptPriv *priv = JS_GetScriptStack(c);
ptr->obj = obj;
ptr->js_list = JS_NewArrayObject(c, (jsint) argc, argv);
- gf_js_add_root(c, &ptr->js_list);
+
+ gf_js_add_root(c, &ptr->js_list, GF_JSGC_OBJECT);
ptr->is_rooted = 1;
gf_list_add(priv->js_cache, obj);
}
-static JSBool MFArrayConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, u32 fieldType)
-{
- GF_JSField *ptr = NewJSField(c);
- ptr->field.fieldType = fieldType;
- setup_js_array(c, obj, ptr, (jsint) argc, argv);
- JS_SetPrivate(c, obj, ptr);
- *rval = OBJECT_TO_JSVAL(obj);
- return obj == 0 ? JS_FALSE : JS_TRUE;
-}
+#define MFARRAY_CONSTRUCTOR(_fieldType) \
+ GF_JSField *ptr; \
+ SMJS_ARGS \
+ SMJS_OBJ_CONSTRUCTOR \
+ ptr = NewJSField(c); \
+ ptr->field.fieldType = _fieldType; \
+ setup_js_array(c, obj, ptr, (jsint) argc, argv); \
+ JS_SetPrivate(c, obj, ptr); \
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) ); \
+ return obj == 0 ? JS_FALSE : JS_TRUE; \
-static JSBool MFBoolConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFBoolConstructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFBOOL);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFBOOL);
}
-static JSBool MFInt32Constructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFInt32Constructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFINT32);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFINT32);
}
-static JSBool MFFloatConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFFloatConstructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFFLOAT);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFFLOAT);
}
-static JSBool MFTimeConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFTimeConstructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFTIME);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFTIME);
}
-static JSBool MFStringConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFStringConstructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFSTRING);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFSTRING);
}
-static JSBool MFURLConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFURLConstructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFURL);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFURL);
}
-static JSBool MFNodeConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFNodeConstructor)
{
- return MFArrayConstructor(c, obj, argc, argv, rval, GF_SG_VRML_MFNODE);
+ MFARRAY_CONSTRUCTOR(GF_SG_VRML_MFNODE);
}
GF_LOG(GF_LOG_DEBUG, GF_LOG_SCRIPT, ("[VRML JS] unregistering MFField %s\n", ptr->field.name));
if (ptr->js_list && ptr->is_rooted) {
- gf_js_remove_root(c, &ptr->js_list);
+ gf_js_remove_root(c, &ptr->js_list, GF_JSGC_OBJECT);
}
/*MFNode*/
array_finalize_ex(c, obj, 1);
}
-JSBool array_getElement(JSContext *c, JSObject *obj, jsval id, jsval *rval)
+JSBool array_getElement(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *rval)
{
u32 i;
GF_JSField *ptr = (GF_JSField *) JS_GetPrivate(c, obj);
- if (JSVAL_IS_INT(id)) {
- i = JSVAL_TO_INT(id);
- JS_GetElement(c, ptr->js_list, (jsint) i, rval);
+ if (SMJS_ID_IS_INT(id)) {
+ i = SMJS_ID_TO_INT(id);
+ if (ptr->field.fieldType==GF_SG_VRML_MFNODE) {
+ GF_Node *node = gf_node_list_get_child(*(GF_ChildNodeItem **)ptr->field.far_ptr, i);
+ JSObject *anobj = node ? node_get_binding(JS_GetScriptStack(c), node, 0) : NULL;
+ if (anobj) *rval = OBJECT_TO_JSVAL(anobj);
+ } else {
+ JS_GetElement(c, ptr->js_list, (jsint) i, rval);
+ }
}
return JS_TRUE;
}
//this could be overloaded for each MF type...
-JSBool array_setElement(JSContext *c, JSObject *obj, jsval id, jsval *rval)
+JSBool array_setElement(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *rval)
{
u32 ind;
jsuint len;
char *str_val;
void *sf_slot;
GF_JSField *ptr = (GF_JSField *) JS_GetPrivate(c, obj);
- ind = JSVAL_TO_INT(id);
+ ind = SMJS_ID_TO_INT(id);
ret = JS_GetArrayLength(c, ptr->js_list, &len);
if (ret==JS_FALSE) return JS_FALSE;
if (gf_sg_vrml_is_sf_field(ptr->field.fieldType)) return JS_FALSE;
+
switch (ptr->field.fieldType) {
case GF_SG_VRML_MFVEC2F: the_sf_class = &js_rt->SFVec2fClass; break;
case GF_SG_VRML_MFVEC3F: the_sf_class = &js_rt->SFVec3fClass; break;
break;
case GF_SG_VRML_MFFLOAT:
case GF_SG_VRML_MFTIME:
- a_val = DOUBLE_TO_JSVAL( JS_NewDouble(c, 0) );
+ a_val = JS_MAKE_DOUBLE(c, 0);
break;
case GF_SG_VRML_MFSTRING:
case GF_SG_VRML_MFURL:
break;
}
- if (ptr->field.fieldType!=GF_SG_VRML_MFNODE)
+ if (ptr->field.fieldType!=GF_SG_VRML_MFNODE) {
gf_sg_vrml_mf_insert(ptr->field.far_ptr, ptr->field.fieldType, &sf_slot, len);
-
- JS_SetElement(c, ptr->js_list, len, &a_val);
+ JS_SetElement(c, ptr->js_list, len, &a_val);
+ }
len++;
}
if (ptr->field.far_ptr && (ptr->field.fieldType!=GF_SG_VRML_MFNODE))
gf_sg_vrml_mf_insert(ptr->field.far_ptr, ptr->field.fieldType, &sf_slot, ind);
}
+ if (ptr->field.far_ptr && (ptr->field.fieldType!=GF_SG_VRML_MFNODE)) {
+ u32 items = ((GenMFField *)ptr->field.far_ptr)->count;
+ while (ind>=items) {
+ gf_sg_vrml_mf_insert(ptr->field.far_ptr, ptr->field.fieldType, &sf_slot, ind);
+ items++;
+ }
+ }
+
/*assign object*/
if (ptr->field.fieldType==GF_SG_VRML_MFNODE) {
- if (JSVAL_IS_VOID(*rval) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(*rval), &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
+ if (JSVAL_IS_VOID(*rval) || JSVAL_IS_NULL(*rval) || !JS_InstanceOf(c, JSVAL_TO_OBJECT(*rval), &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
} else if (the_sf_class) {
if (JSVAL_IS_VOID(*rval)) return JS_FALSE;
if (!JS_InstanceOf(c, JSVAL_TO_OBJECT(*rval), the_sf_class, NULL) ) return JS_FALSE;
/*rewrite MFNode entry*/
if (ptr->field.fieldType==GF_SG_VRML_MFNODE) {
GF_Node *prev_n, *new_n;
- JSObject *anobj;
- GF_JSField *pf;
if (!ptr->owner) return JS_TRUE;
- anobj = JSVAL_TO_OBJECT(*rval);
- pf = JS_GetPrivate(c, anobj);
-
+ /*get new node*/
+ from = (GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(*rval));
+ new_n = *(GF_Node**)from->field.far_ptr;
- anobj = node_get_binding(JS_GetScriptStack(c), pf->node, 0);
+#if 0
+ anobj = node_get_binding(JS_GetScriptStack(c), from->node, 0);
/*add it to the new object if needed*/
ret = JS_SetElement(c, ptr->js_list, ind, rval);
+#endif
/*get and delete previous node if any, but unregister later*/
prev_n = gf_node_list_del_child_idx( (GF_ChildNodeItem **)ptr->field.far_ptr, ind);
- /*get new node*/
- from = (GF_JSField *) JS_GetPrivate(c, JSVAL_TO_OBJECT(*rval));
- new_n = *(GF_Node**)from->field.far_ptr;
if (new_n) {
gf_node_list_insert_child( (GF_ChildNodeItem **)ptr->field.far_ptr , new_n, ind);
gf_node_register(new_n, ptr->owner);
+
+ /*node created from script and inserted in the tree, root it*/
+ if (!from->is_rooted)
+ node_get_binding(JS_GetScriptStack(c), new_n, 0);
}
/*unregister previous node*/
if (prev_n) gf_node_unregister(prev_n, ptr->owner);
((MFString *)ptr->field.far_ptr)->vals[ind] = NULL;
}
str = JSVAL_IS_STRING(*rval) ? JSVAL_TO_STRING(*rval) : JS_ValueToString(c, *rval);
- str_val = JS_GetStringBytes(str);
+ str_val = SMJS_CHARS_FROM_STRING(c, str);
((MFString *)ptr->field.far_ptr)->vals[ind] = gf_strdup(str_val);
+ SMJS_FREE(c, str_val);
break;
case GF_SG_VRML_MFURL:
((MFURL *)ptr->field.far_ptr)->vals[ind].url = NULL;
}
str = JSVAL_IS_STRING(*rval) ? JSVAL_TO_STRING(*rval) : JS_ValueToString(c, *rval);
- str_val = JS_GetStringBytes(str);
+ str_val = SMJS_CHARS_FROM_STRING(c, str);
((MFURL *)ptr->field.far_ptr)->vals[ind].url = gf_strdup(str_val);
((MFURL *)ptr->field.far_ptr)->vals[ind].OD_ID = 0;
+ SMJS_FREE(c, str_val);
break;
case GF_SG_VRML_MFVEC2F:
return JS_TRUE;
}
-JSBool array_setLength(JSContext *c, JSObject *obj, jsval v, jsval *val)
+JSBool array_setLength(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *val)
{
u32 len, i, sftype;
JSBool ret;
case GF_SG_VRML_SFINT32: a_val = INT_TO_JSVAL(0); break;
case GF_SG_VRML_SFFLOAT:
case GF_SG_VRML_SFTIME:
- a_val = DOUBLE_TO_JSVAL( JS_NewDouble(c, 0) );
+ a_val = JS_MAKE_DOUBLE(c, 0);
break;
case GF_SG_VRML_SFSTRING:
case GF_SG_VRML_SFURL:
return JS_TRUE;
}
-JSBool array_getLength(JSContext *c, JSObject *obj, jsval v, jsval *val)
+JSBool array_getLength(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *val)
{
+ JSBool ret;
jsuint len;
GF_JSField *ptr = (GF_JSField *) JS_GetPrivate(c, obj);
- JSBool ret = JS_GetArrayLength(c, ptr->js_list, &len);
+
+ if (ptr->field.fieldType==GF_SG_VRML_MFNODE) {
+ len = gf_node_list_get_count(*(GF_ChildNodeItem **)ptr->field.far_ptr);
+ ret = JS_TRUE;
+ } else {
+ ret = JS_GetArrayLength(c, ptr->js_list, &len);
+ }
*val = INT_TO_JSVAL(len);
return ret;
}
/* MFVec2f class constructor */
-static JSBool MFVec2fConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFVec2fConstructor)
{
jsval val;
JSObject *item;
u32 i;
+ SMJS_ARGS
GF_JSField *ptr = NewJSField(c);
+ SMJS_OBJ_CONSTRUCTOR
+
setup_js_array(c, obj, ptr, 0, 0);
JS_SetArrayLength(c, ptr->js_list, argc);
JS_SetPrivate(c, obj, ptr);
JS_SetElement(c, ptr->js_list, i, &argv[i]);
}
}
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return obj == 0 ? JS_FALSE : JS_TRUE;
}
/* MFVec3f class constructor */
-static JSBool MFVec3fConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFVec3fConstructor)
{
jsval val;
JSObject *item;
u32 i;
- GF_JSField *ptr = NewJSField(c);
+ SMJS_ARGS
+ GF_JSField *ptr;
+ SMJS_OBJ_CONSTRUCTOR
+
+ ptr = NewJSField(c);
ptr->field.fieldType = GF_SG_VRML_MFVEC3F;
setup_js_array(c, obj, ptr, 0, 0);
JS_SetArrayLength(c, ptr->js_list, argc);
JS_SetElement(c, ptr->js_list, i, &argv[i]);
}
}
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return obj == 0 ? JS_FALSE : JS_TRUE;
}
/* MFRotation class constructor */
-static JSBool MFRotationConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFRotationConstructor)
{
jsval val;
JSObject *item;
u32 i;
- GF_JSField *ptr = NewJSField(c);
+ SMJS_ARGS
+ GF_JSField *ptr;
+ SMJS_OBJ_CONSTRUCTOR
+
+ ptr = NewJSField(c);
ptr->field.fieldType = GF_SG_VRML_MFROTATION;
setup_js_array(c, obj, ptr, 0, 0);
JS_SetArrayLength(c, ptr->js_list, argc);
JS_SetElement(c, ptr->js_list, i, &argv[i]);
}
}
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return obj == 0 ? JS_FALSE : JS_TRUE;
}
/*MFColor class constructor */
-static JSBool MFColorConstructor(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(MFColorConstructor)
{
jsval val;
JSObject *item;
u32 i;
- GF_JSField *ptr = NewJSField(c);
+ SMJS_ARGS
+ GF_JSField *ptr;
+ SMJS_OBJ_CONSTRUCTOR
+
+ ptr = NewJSField(c);
ptr->field.fieldType = GF_SG_VRML_MFCOLOR;
setup_js_array(c, obj, ptr, 0, 0);
JS_SetArrayLength(c, ptr->js_list, argc);
JS_SetElement(c, ptr->js_list, i, &argv[i]);
}
}
- *rval = OBJECT_TO_JSVAL(obj);
+ SMJS_SET_RVAL( OBJECT_TO_JSVAL(obj) );
return obj == 0 ? JS_FALSE : JS_TRUE;
}
#ifndef GPAC_DISABLE_SVG
-JSBool gf_sg_js_event_add_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, GF_Node *vrml_node);
-JSBool gf_sg_js_event_remove_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval, GF_Node *vrml_node);
+/*CHECK IF THIS WORKS WITH NEW API*/
+JSBool SMJS_FUNCTION_EXT(gf_sg_js_event_add_listener, GF_Node *vrml_node);
+JSBool SMJS_FUNCTION_EXT(gf_sg_js_event_remove_listener, GF_Node *vrml_node);
-JSBool vrml_event_add_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(vrml_event_add_listener)
{
GF_Node *node;
GF_JSField *ptr;
+ SMJS_OBJ
+ SMJS_ARGS
if (! JS_InstanceOf(c, obj, &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
ptr = (GF_JSField *) JS_GetPrivate(c, obj);
assert(ptr->field.fieldType==GF_SG_VRML_SFNODE);
node = * ((GF_Node **)ptr->field.far_ptr);
- return gf_sg_js_event_add_listener(c, obj, argc, argv, rval, node);
+ return gf_sg_js_event_add_listener(SMJS_CALL_ARGS, node);
}
-JSBool vrml_event_remove_listener(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+JSBool SMJS_FUNCTION(vrml_event_remove_listener)
{
GF_Node *node;
GF_JSField *ptr;
+ SMJS_OBJ
+ SMJS_ARGS
if (! JS_InstanceOf(c, obj, &js_rt->SFNodeClass, NULL) ) return JS_FALSE;
ptr = (GF_JSField *) JS_GetPrivate(c, obj);
assert(ptr->field.fieldType==GF_SG_VRML_SFNODE);
node = * ((GF_Node **)ptr->field.far_ptr);
- return gf_sg_js_event_remove_listener(c, obj, argc, argv, rval, node);
+ return gf_sg_js_event_remove_listener(SMJS_CALL_ARGS, node);
}
#endif
-static JSBool vrml_dom3_not_implemented(JSContext *c, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool SMJS_FUNCTION(vrml_dom3_not_implemented)
{
return JS_FALSE;
}
/*GCC port: classes are declared within code since JS_PropertyStub and co are exported symbols
from JS runtime lib, so with non-constant addresses*/
JS_SETUP_CLASS(js_rt->globalClass, "global", JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub, JS_FinalizeStub);
+ JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
+
+ JS_SETUP_CLASS(js_rt->AnyClass, "AnyClass", JSCLASS_HAS_PRIVATE,
+ JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_SETUP_CLASS(js_rt->browserClass , "Browser", 0,
- JS_PropertyStub, JS_PropertyStub, JS_FinalizeStub);
+ JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
JS_SETUP_CLASS(js_rt->SFNodeClass, "SFNode", JSCLASS_HAS_PRIVATE,
node_getProperty, node_setProperty, node_finalize);
JS_SetErrorReporter(sc->js_ctx, script_error);
- sc->js_obj = JS_NewObject(sc->js_ctx, &js_rt->globalClass, 0, 0 );
+ sc->js_obj = gf_sg_js_global_object(sc->js_ctx, &js_rt->globalClass);
+
JS_InitStandardClasses(sc->js_ctx, sc->js_obj);
{
JSFunctionSpec globalFunctions[] = {
- {"print", JSPrint, 0, 0, 0},
- {"alert", JSPrint, 0, 0, 0},
- {"parseXML", vrml_parse_xml, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("print", JSPrint, 0),
+ SMJS_FUNCTION_SPEC("alert", JSPrint, 0),
+ SMJS_FUNCTION_SPEC("parseXML", vrml_parse_xml, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_DefineFunctions(sc->js_ctx, sc->js_obj, globalFunctions );
}
JS_DefineProperty(sc->js_ctx, sc->js_browser, "_this", PRIVATE_TO_JSVAL(script), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT );
{
JSFunctionSpec browserFunctions[] = {
- {"getName", getName, 0, 0, 0},
- {"getVersion", getVersion, 0, 0, 0},
- {"getCurrentSpeed", getCurrentSpeed, 0, 0, 0},
- {"getCurrentFrameRate", getCurrentFrameRate, 0, 0, 0},
- {"getWorldURL", getWorldURL, 0, 0, 0},
- {"replaceWorld", replaceWorld, 1, 0, 0},
- {"addRoute", addRoute, 4, 0, 0},
- {"deleteRoute", deleteRoute, 4, 0, 0},
- {"loadURL", loadURL, 1, 0, 0},
- {"createVrmlFromString", createVrmlFromString, 1, 0, 0},
- {"setDescription", setDescription, 1, 0, 0},
- {"print", JSPrint, 1, 0, 0},
- {"getOption", getOption, 2, 0, 0},
- {"setOption", setOption, 3, 0, 0},
- {"getScript", getScript, 0, 0, 0},
- {"getProto", getProto, 0, 0, 0},
- {"loadScript", loadScript, 1, 0, 0},
- {"getElementById", getElementById, 1, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("getName", getName, 0),
+ SMJS_FUNCTION_SPEC("getVersion", getVersion, 0),
+ SMJS_FUNCTION_SPEC("getCurrentSpeed", getCurrentSpeed, 0),
+ SMJS_FUNCTION_SPEC("getCurrentFrameRate", getCurrentFrameRate, 0),
+ SMJS_FUNCTION_SPEC("getWorldURL", getWorldURL, 0),
+ SMJS_FUNCTION_SPEC("replaceWorld", replaceWorld, 1),
+ SMJS_FUNCTION_SPEC("addRoute", addRoute, 4),
+ SMJS_FUNCTION_SPEC("deleteRoute", deleteRoute, 4),
+ SMJS_FUNCTION_SPEC("loadURL", loadURL, 1),
+ SMJS_FUNCTION_SPEC("createVrmlFromString", createVrmlFromString, 1),
+ SMJS_FUNCTION_SPEC("setDescription", setDescription, 1),
+ SMJS_FUNCTION_SPEC("print", JSPrint, 1),
+ SMJS_FUNCTION_SPEC("getOption", getOption, 2),
+ SMJS_FUNCTION_SPEC("setOption", setOption, 3),
+ SMJS_FUNCTION_SPEC("getScript", getScript, 0),
+ SMJS_FUNCTION_SPEC("getProto", getProto, 0),
+ SMJS_FUNCTION_SPEC("loadScript", loadScript, 1),
+ SMJS_FUNCTION_SPEC("getElementById", getElementById, 1),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_DefineFunctions(sc->js_ctx, sc->js_browser, browserFunctions);
}
{
JSFunctionSpec SFNodeMethods[] = {
- {"toString", node_toString, 0, 0, 0},
- {"getTime", node_getTime, 0, 0, 0},
+ SMJS_FUNCTION_SPEC("toString", node_toString, 0),
+ SMJS_FUNCTION_SPEC("getTime", node_getTime, 0),
#ifndef GPAC_DISABLE_SVG
- {"addEventListenerNS", vrml_event_add_listener, 4, 0, 0},
- {"removeEventListenerNS", vrml_event_remove_listener, 4, 0, 0},
- {"addEventListener", vrml_event_add_listener, 3, 0, 0},
- {"removeEventListener", vrml_event_remove_listener, 3, 0, 0},
- {"dispatchEvent", vrml_dom3_not_implemented, 1, 0, 0},
+ SMJS_FUNCTION_SPEC("addEventListenerNS", vrml_event_add_listener, 4),
+ SMJS_FUNCTION_SPEC("removeEventListenerNS", vrml_event_remove_listener, 4),
+ SMJS_FUNCTION_SPEC("addEventListener", vrml_event_add_listener, 3),
+ SMJS_FUNCTION_SPEC("removeEventListener", vrml_event_remove_listener, 3),
+ SMJS_FUNCTION_SPEC("dispatchEvent", vrml_dom3_not_implemented, 1),
#endif
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JSPropertySpec SFNodeProps[] = {
- {"__dummy", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"__dummy", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->SFNodeClass, SFNodeConstructor, 1, SFNodeProps, SFNodeMethods, 0, 0);
}
{
JSPropertySpec SFVec2fProps[] = {
- {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec SFVec2fMethods[] = {
- {"add", vec2f_add, 1, 0, 0},
- {"divide", vec2f_divide, 1, 0, 0},
- {"dot", vec2f_dot, 1, 0, 0},
- {"length", vec2f_length, 0, 0, 0},
- {"multiply", vec2f_multiply, 1, 0, 0},
- {"normalize", vec2f_normalize,0, 0, 0},
- {"subtract", vec2f_subtract, 1, 0, 0},
- {"negate", vec2f_negate, 0, 0, 0},
- {"toString", field_toString, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("add", vec2f_add, 1),
+ SMJS_FUNCTION_SPEC("divide", vec2f_divide, 1),
+ SMJS_FUNCTION_SPEC("dot", vec2f_dot, 1),
+ SMJS_FUNCTION_SPEC("length", vec2f_length, 0),
+ SMJS_FUNCTION_SPEC("multiply", vec2f_multiply, 1),
+ SMJS_FUNCTION_SPEC("normalize", vec2f_normalize,0),
+ SMJS_FUNCTION_SPEC("subtract", vec2f_subtract, 1),
+ SMJS_FUNCTION_SPEC("negate", vec2f_negate, 0),
+ SMJS_FUNCTION_SPEC("toString", field_toString, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->SFVec2fClass, SFVec2fConstructor, 0, SFVec2fProps, SFVec2fMethods, 0, 0);
}
{
JSPropertySpec SFVec3fProps[] = {
- {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"z", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"z", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec SFVec3fMethods[] = {
- {"add", vec3f_add, 1, 0, 0},
- {"divide", vec3f_divide, 1, 0, 0},
- {"dot", vec3f_dot, 1, 0, 0},
- {"length", vec3f_length, 0, 0, 0},
- {"multiply", vec3f_multiply, 1, 0, 0},
- {"normalize", vec3f_normalize,0, 0, 0},
- {"subtract", vec3f_subtract, 1, 0, 0},
- {"cross", vec3f_cross, 1, 0, 0},
- {"negate", vec3f_negate, 0, 0, 0},
- {"toString", field_toString, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("add", vec3f_add, 1),
+ SMJS_FUNCTION_SPEC("divide", vec3f_divide, 1),
+ SMJS_FUNCTION_SPEC("dot", vec3f_dot, 1),
+ SMJS_FUNCTION_SPEC("length", vec3f_length, 0),
+ SMJS_FUNCTION_SPEC("multiply", vec3f_multiply, 1),
+ SMJS_FUNCTION_SPEC("normalize", vec3f_normalize,0),
+ SMJS_FUNCTION_SPEC("subtract", vec3f_subtract, 1),
+ SMJS_FUNCTION_SPEC("cross", vec3f_cross, 1),
+ SMJS_FUNCTION_SPEC("negate", vec3f_negate, 0),
+ SMJS_FUNCTION_SPEC("toString", field_toString, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->SFVec3fClass, SFVec3fConstructor, 0, SFVec3fProps, SFVec3fMethods, 0, 0);
}
{
JSPropertySpec SFRotationProps[] = {
- {"xAxis", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"yAxis", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"zAxis", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"angle", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"xAxis", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"yAxis", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"zAxis", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"angle", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec SFRotationMethods[] = {
- {"getAxis", rot_getAxis, 1, 0, 0},
- {"inverse", rot_inverse, 1, 0, 0},
- {"multiply", rot_multiply, 1, 0, 0},
- {"multVec", rot_multVec, 0, 0, 0},
- {"setAxis", rot_setAxis, 1, 0, 0},
- {"slerp", rot_slerp,0, 0, 0},
- {"toString", field_toString, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("getAxis", rot_getAxis, 1),
+ SMJS_FUNCTION_SPEC("inverse", rot_inverse, 1),
+ SMJS_FUNCTION_SPEC("multiply", rot_multiply, 1),
+ SMJS_FUNCTION_SPEC("multVec", rot_multVec, 0),
+ SMJS_FUNCTION_SPEC("setAxis", rot_setAxis, 1),
+ SMJS_FUNCTION_SPEC("slerp", rot_slerp,0),
+ SMJS_FUNCTION_SPEC("toString", field_toString, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->SFRotationClass, SFRotationConstructor, 0, SFRotationProps, SFRotationMethods, 0, 0);
}
{
JSPropertySpec SFColorProps[] = {
- {"r", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"g", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"b", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"r", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"g", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"b", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JSFunctionSpec SFColorMethods[] = {
- {"setHSV", color_setHSV, 3, 0, 0},
- {"getHSV", color_getHSV, 0, 0, 0},
- {"toString", field_toString, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("setHSV", color_setHSV, 3),
+ SMJS_FUNCTION_SPEC("getHSV", color_getHSV, 0),
+ SMJS_FUNCTION_SPEC("toString", field_toString, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->SFColorClass, SFColorConstructor, 0, SFColorProps, SFColorMethods, 0, 0);
}
{
JSPropertySpec SFImageProps[] = {
- {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"comp", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
- {"array", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0},
+ {"x", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"y", 1, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"comp", 2, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
+ {"array", 3, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0},
{0, 0, 0, 0, 0}
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->SFImageClass, SFImageConstructor, 0, SFImageProps, 0, 0, 0);
{
JSPropertySpec MFArrayProp[] = {
- { "length", 0, JSPROP_PERMANENT, array_getLength, array_setLength },
- { "assign", 0, JSPROP_PERMANENT, array_getElement, array_setElement},
+ { "length", 0, JSPROP_PERMANENT | JSPROP_SHARED, array_getLength, array_setLength },
+ { "assign", 1, JSPROP_PERMANENT | JSPROP_SHARED, array_getElement, array_setElement},
{ 0, 0, 0, 0, 0 }
};
JSFunctionSpec MFArrayMethods[] = {
- {"toString", field_toString, 0, 0, 0},
- {0, 0, 0, 0, 0}
+ SMJS_FUNCTION_SPEC("toString", field_toString, 0),
+ SMJS_FUNCTION_SPEC(0, 0, 0)
};
JS_InitClass(sc->js_ctx, sc->js_obj, 0, &js_rt->MFInt32Class, MFInt32Constructor, 0, MFArrayProp, MFArrayMethods, 0, 0);
{
SFString *s = (SFString*)field->far_ptr;
JSString *str = JSVAL_IS_STRING(val) ? JSVAL_TO_STRING(val) : JS_ValueToString(c, val);
- char *str_val = JS_GetStringBytes(str);
+ char *str_val = SMJS_CHARS_FROM_STRING(c, str);
/*we do filter strings since rebuilding a text is quite slow, so let's avoid killing the compositors*/
if (!s->buffer || strcmp(str_val, s->buffer)) {
if ( s->buffer) gf_free(s->buffer);
s->buffer = gf_strdup(str_val);
Script_FieldChanged(c, owner, parent, field);
}
+ SMJS_FREE(c, str_val);
return;
}
case GF_SG_VRML_SFURL:
{
+ char *str_val;
JSString *str = JSVAL_IS_STRING(val) ? JSVAL_TO_STRING(val) : JS_ValueToString(c, val);
if (((SFURL*)field->far_ptr)->url) gf_free(((SFURL*)field->far_ptr)->url);
- ((SFURL*)field->far_ptr)->url = gf_strdup(JS_GetStringBytes(str));
+ str_val = SMJS_CHARS_FROM_STRING(c, str);
+ ((SFURL*)field->far_ptr)->url = gf_strdup(str_val);
((SFURL*)field->far_ptr)->OD_ID = 0;
Script_FieldChanged(c, owner, parent, field);
+ SMJS_FREE(c, str_val);
return;
}
case GF_SG_VRML_MFSTRING:
if (JSVAL_IS_STRING(val)) {
+ char *str_val;
JSString *str = JSVAL_TO_STRING(val);
gf_sg_vrml_mf_reset(field->far_ptr, field->fieldType);
gf_sg_vrml_mf_alloc(field->far_ptr, field->fieldType, 1);
- ((MFString*)field->far_ptr)->vals[0] = gf_strdup(JS_GetStringBytes(str));
+ str_val = SMJS_CHARS_FROM_STRING(c, str);
+ ((MFString*)field->far_ptr)->vals[0] = gf_strdup(str_val);
Script_FieldChanged(c, owner, parent, field);
+ SMJS_FREE(c, str_val);
return;
}
case GF_SG_VRML_MFURL:
if (JSVAL_IS_STRING(val)) {
+ char *str_val;
JSString *str = JSVAL_TO_STRING(val);
gf_sg_vrml_mf_reset(field->far_ptr, field->fieldType);
gf_sg_vrml_mf_alloc(field->far_ptr, field->fieldType, 1);
- ((MFURL*)field->far_ptr)->vals[0].url = gf_strdup(JS_GetStringBytes(str));
+ str_val = SMJS_CHARS_FROM_STRING(c, str);
+ ((MFURL*)field->far_ptr)->vals[0].url = gf_strdup(str_val);
((MFURL*)field->far_ptr)->vals[0].OD_ID = 0;
Script_FieldChanged(c, owner, parent, field);
+ SMJS_FREE(c, str_val);
return;
}
{
MFString *mfs = (MFString *) field->far_ptr;
JSString *str = JSVAL_IS_STRING(item) ? JSVAL_TO_STRING(item) : JS_ValueToString(c, item);
- char *str_val = JS_GetStringBytes(str);
+ char *str_val = SMJS_CHARS_FROM_STRING(c, str);
if (!mfs->vals[i] || strcmp(str_val, mfs->vals[i]) ) {
if (mfs->vals[i]) gf_free(mfs->vals[i]);
mfs->vals[i] = gf_strdup(str_val);
changed = 1;
}
+ SMJS_FREE(c, str_val);
}
break;
case GF_SG_VRML_MFURL:
{
+ char *str_val;
MFURL *mfu = (MFURL *) field->far_ptr;
JSString *str = JSVAL_IS_STRING(item) ? JSVAL_TO_STRING(item) : JS_ValueToString(c, item);
if (mfu->vals[i].url) gf_free(mfu->vals[i].url);
- mfu->vals[i].url = gf_strdup(JS_GetStringBytes(str));
+ str_val = SMJS_CHARS_FROM_STRING(c, str);
+ mfu->vals[i].url = gf_strdup(str_val);
mfu->vals[i].OD_ID = 0;
+ SMJS_FREE(c, str_val);
}
break;
JS_SetArrayLength(priv->js_ctx, jsf->js_list, 0);
JS_SetArrayLength(priv->js_ctx, jsf->js_list, f->count);
for (i=0; i<f->count; i++) {
- newVal = DOUBLE_TO_JSVAL(JS_NewDouble(priv->js_ctx, FIX2FLT(f->vals[i])));
+ newVal = JS_MAKE_DOUBLE(priv->js_ctx, FIX2FLT(f->vals[i]));
JS_SetElement(priv->js_ctx, jsf->js_list, (jsint) i, &newVal);
}
}
JS_SetArrayLength(priv->js_ctx, jsf->js_list, 0);
JS_SetArrayLength(priv->js_ctx, jsf->js_list, f->count);
for (i=0; i<f->count; i++) {
- newVal = DOUBLE_TO_JSVAL(JS_NewDouble(priv->js_ctx, f->vals[i]));
+ newVal = JS_MAKE_DOUBLE(priv->js_ctx, f->vals[i]);
JS_SetElement(priv->js_ctx, jsf->js_list, (jsint) i, &newVal);
}
}
*/
case GF_SG_VRML_MFNODE:
{
+#if 0
GF_ChildNodeItem *f = *(GF_ChildNodeItem **) field->far_ptr;
- u32 cache_count, j;
+ u32 j;
jsuint count;
GF_List *temp_objs = gf_list_new();
/*1: find all existing objs for each node*/
JS_GetArrayLength(priv->js_ctx, jsf->js_list, &count);
- cache_count = gf_list_count(priv->js_cache);
+ /*this may introduce bugs when a child is being replaced through an update command, but it is way
+ too costly to handle in script*/
+ if (gf_node_list_get_count(f)==count) return;
+
+ fprintf(stdout, "rewriting MFNode cache\n");
while (f) {
slot = NULL;
/*first look in the original array*/
JS_SetElement(priv->js_ctx, jsf->js_list, (jsint) j, &newVal);
}
gf_list_del(temp_objs);
+#endif
}
break;
}
JSObject *obj = NULL;
GF_JSField *jsf = NULL;
GF_JSField *slot = NULL;
- GF_Node *n;
- jsdouble *d;
jsval newVal;
JSString *s;
case GF_SG_VRML_SFINT32:
return INT_TO_JSVAL( * ((SFInt32 *) field->far_ptr));
case GF_SG_VRML_SFFLOAT:
- d = JS_NewDouble(priv->js_ctx, FIX2FLT(* ((SFFloat *) field->far_ptr) ));
- return DOUBLE_TO_JSVAL(d);
+ return JS_MAKE_DOUBLE(priv->js_ctx, FIX2FLT(* ((SFFloat *) field->far_ptr) ));
case GF_SG_VRML_SFTIME:
- d = JS_NewDouble(priv->js_ctx, * ((SFTime *) field->far_ptr));
- return DOUBLE_TO_JSVAL(d);
+ return JS_MAKE_DOUBLE(priv->js_ctx, * ((SFTime *) field->far_ptr));
case GF_SG_VRML_SFSTRING:
{
s = JS_NewStringCopyZ(priv->js_ctx, ((SFString *) field->far_ptr)->buffer);
obj = JS_ConstructObject(priv->js_ctx, &js_rt->MFFloatClass, 0, priv->js_obj);
SETUP_MF_FIELD
for (i=0; i<f->count; i++) {
- jsval newVal = DOUBLE_TO_JSVAL(JS_NewDouble(priv->js_ctx, FIX2FLT(f->vals[i])));
+ jsval newVal = JS_MAKE_DOUBLE(priv->js_ctx, FIX2FLT(f->vals[i]));
JS_SetElement(priv->js_ctx, jsf->js_list, (jsint) i, &newVal);
}
break;
obj = JS_ConstructObject(priv->js_ctx, &js_rt->MFTimeClass, 0, priv->js_obj);
SETUP_MF_FIELD
for (i=0; i<f->count; i++) {
- jsval newVal = DOUBLE_TO_JSVAL( JS_NewDouble(priv->js_ctx, f->vals[i]) );
+ jsval newVal = JS_MAKE_DOUBLE(priv->js_ctx, f->vals[i]);
JS_SetElement(priv->js_ctx, jsf->js_list, (jsint) i, &newVal);
}
break;
case GF_SG_VRML_MFNODE:
{
- u32 size, count;
+ u32 size;
GF_ChildNodeItem *f = * ((GF_ChildNodeItem **)field->far_ptr);
obj = JS_ConstructObject(priv->js_ctx, &js_rt->MFNodeClass, 0, priv->js_obj);
SETUP_MF_FIELD
size = gf_node_list_get_count(f);
if (JS_SetArrayLength(priv->js_ctx, jsf->js_list, size) != JS_TRUE) return JSVAL_NULL;
- count = gf_list_count(priv->js_cache);
+ /*get binding for all objects*/
+ while (f) {
+ node_get_binding(priv, f->node, 0);
+ f = f->next;
+ }
+
+#if 0
i=0;
while (f) {
JSObject *pf;
if (n->sgprivate->tag == TAG_ProtoNode) {
GF_ProtoInstance *proto_inst = (GF_ProtoInstance *) n;
- if (!proto_inst->RenderingNode)
+ if (!proto_inst->RenderingNode && !(proto_inst->flags&GF_SG_PROTO_LOADED) )
gf_sg_proto_instanciate(proto_inst);
}
f = f->next;
i++;
}
+#endif
break;
}
if (jsf->is_rooted) {
if (jsf->js_list) {
- gf_js_remove_root(priv->js_ctx, &jsf->js_list);
+ gf_js_remove_root(priv->js_ctx, &jsf->js_list, GF_JSGC_OBJECT);
} else {
- gf_js_remove_root(priv->js_ctx, &jsf->obj);
+ gf_js_remove_root(priv->js_ctx, &jsf->obj, GF_JSGC_OBJECT);
}
jsf->is_rooted=0;
}
JS_CallFunctionValue(priv->js_ctx, priv->js_obj, fval, 0, NULL, &rval);
#endif
- if (priv->event) gf_js_remove_root(priv->js_ctx, &priv->event);
+ gf_sg_lock_javascript(priv->js_ctx, 1);
+
+ if (priv->event) gf_js_remove_root(priv->js_ctx, &priv->event, GF_JSGC_OBJECT);
/*unprotect all cached objects from GC*/
JS_ReleaseRootObjects(priv);
gf_list_del(priv->js_cache);
priv->js_ctx = NULL;
+
+ gf_sg_lock_javascript(priv->js_ctx, 0);
+
/*unregister script from parent scene (cf base_scenegraph::sg_reset) */
gf_list_del_item(node->sgprivate->scenegraph->scripts, node);
}
*/
sf->last_route_time = time;
- gf_sg_lock_javascript(1);
+ gf_sg_lock_javascript(priv->js_ctx, 1);
//locate function
if (! JS_LookupProperty(priv->js_ctx, priv->js_obj, sf->name, &fval) || JSVAL_IS_VOID(fval)) {
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(priv->js_ctx, 0);
return;
}
argv[1] = gf_sg_script_to_smjs_field(priv, &t_info, node, 1);
/*protect args*/
- if (JSVAL_IS_GCTHING(argv[0])) gf_js_add_root(priv->js_ctx, &argv[0]);
- if (JSVAL_IS_GCTHING(argv[1])) gf_js_add_root(priv->js_ctx, &argv[1]);
+ if (JSVAL_IS_GCTHING(argv[0])) gf_js_add_root(priv->js_ctx, &argv[0], GF_JSGC_VAL);
+ if (JSVAL_IS_GCTHING(argv[1])) gf_js_add_root(priv->js_ctx, &argv[1], GF_JSGC_VAL);
JS_CallFunctionValue(priv->js_ctx, priv->js_obj, fval, 2, argv, &rval);
/*release args*/
- if (JSVAL_IS_GCTHING(argv[0])) gf_js_remove_root(priv->js_ctx, &argv[0]);
- if (JSVAL_IS_GCTHING(argv[1])) gf_js_remove_root(priv->js_ctx, &argv[1]);
+ if (JSVAL_IS_GCTHING(argv[0])) gf_js_remove_root(priv->js_ctx, &argv[0], GF_JSGC_VAL);
+ if (JSVAL_IS_GCTHING(argv[1])) gf_js_remove_root(priv->js_ctx, &argv[1], GF_JSGC_VAL);
+
+ gf_sg_lock_javascript(priv->js_ctx, 0);
+
+ gf_js_vrml_flush_event_out(node, priv);
#ifdef FORCE_GC
MyJSGC(priv->js_ctx);
#endif
-
- gf_sg_lock_javascript(0);
-
- gf_js_vrml_flush_event_out(node, priv);
}
}
/*fetches each listed URL and attempts to load the script - this is SYNCHRONOUS*/
-void JSScriptFromFile(GF_Node *node, const char *opt_file, Bool no_complain)
+Bool JSScriptFromFile(GF_Node *node, const char *opt_file, Bool no_complain)
{
GF_JSAPIParam par;
u32 i;
char *url;
GF_Err e;
const char *ext;
- MFScript the_url;
- SFScript __url;
M_Script *script = (M_Script *)node;
par.dnld_man = NULL;
ScriptAction(NULL, node->sgprivate->scenegraph, GF_JSAPI_OP_GET_DOWNLOAD_MANAGER, NULL, &par);
- if (!par.dnld_man) return;
+ if (!par.dnld_man) return 0;
dnld_man = par.dnld_man;
- if (opt_file) {
- the_url.count = 1;
- __url.script_text = (char *) opt_file;
- the_url.vals = &__url;
- } else {
- the_url = script->url;
- }
-
- for (i=0; i<the_url.count; i++) {
- par.uri.url = the_url.vals[i].script_text;
+ for (i=0; i<script->url.count; i++) {
+ char *_url = script->url.vals[i].script_text;
+ if (opt_file) {
+ if (strnicmp(_url+4, "script:", 7) && strnicmp(_url+5, "script:", 5)) {
+ _url = gf_url_concatenate(script->url.vals[i].script_text, opt_file);
+ } else {
+ _url = gf_strdup(opt_file);
+ }
+ }
+ par.uri.url = _url;
par.uri.nb_params = 0;
ScriptAction(NULL, node->sgprivate->scenegraph, GF_JSAPI_OP_RESOLVE_URI, node, &par);
+ if (opt_file) gf_free(_url);
url = (char *)par.uri.url;
ext = strrchr(url, '.');
if (!strstr(url, "://") || !strnicmp(url, "file://", 7)) {
Bool res = vrml_js_load_script(script, url, opt_file ? 0 : 1);
gf_free(url);
- if (res || no_complain) return;
+ if (res) return 1;
+ if (no_complain) return 0;
} else {
GF_DownloadSession *sess = gf_dm_sess_new(dnld_man, url, GF_NETIO_SESSION_NOT_THREADED, NULL, NULL, &e);
if (sess) {
gf_dm_sess_del(sess);
}
gf_free(url);
- if (!e) return;
+ if (!e) return 1;
}
}
par.info.e = GF_SCRIPT_ERROR;
par.info.msg = "Cannot fetch script";
ScriptAction(NULL, node->sgprivate->scenegraph, GF_JSAPI_OP_MESSAGE, NULL, &par);
+ return 0;
}
static void JSScript_LoadVRML(GF_Node *node)
char *str;
JSBool ret;
u32 i;
+ Bool do_lock = gf_sg_javascript_initialized();
Bool local_script;
jsval rval, fval;
M_Script *script = (M_Script *)node;
}
local_script = str ? 1 : 0;
+ if (do_lock) gf_sg_lock_javascript(priv->js_ctx, 1);
priv->js_ctx = gf_sg_ecmascript_new(node->sgprivate->scenegraph);
if (!priv->js_ctx) {
+ if (do_lock) gf_sg_lock_javascript(priv->js_ctx, 0);
GF_LOG(GF_LOG_ERROR, GF_LOG_SCRIPT, ("[VRML JS] Cannot allocate ECMAScript context for node\n"));
return;
}
- gf_sg_lock_javascript(1);
+ if (!do_lock) gf_sg_lock_javascript(priv->js_ctx, 1);
JS_SetContextPrivate(priv->js_ctx, node);
gf_sg_script_init_sm_api(priv, node);
dom_js_load(node->sgprivate->scenegraph, priv->js_ctx, priv->js_obj);
/*create event object, and remember it*/
priv->event = dom_js_define_event(priv->js_ctx, priv->js_obj);
- gf_js_add_root(priv->js_ctx, &priv->event);
+ gf_js_add_root(priv->js_ctx, &priv->event, GF_JSGC_OBJECT);
#endif
gf_sg_load_script_extensions(node->sgprivate->scenegraph, priv->js_ctx, priv->js_obj, 0);
if (!local_script) {
JSScriptFromFile(node, NULL, 0);
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(priv->js_ctx, 0);
return;
}
gf_js_vrml_flush_event_out(node, priv);
}
+ gf_sg_lock_javascript(priv->js_ctx, 0);
+
#ifdef FORCE_GC
MyJSGC(priv->js_ctx);
#endif
-
- gf_sg_lock_javascript(0);
}
static void JSScript_Load(GF_Node *node)
GF_JSField *jsf;
/*this is REPLACE NODE signaling*/
if (script) {
- u32 i, count;
+ u32 count;
GF_ScriptPriv *priv = gf_node_get_private(script);
count = gf_list_count(priv->js_cache);
for (i=0; i<count; i++) {
jsf->node = NULL;
}
}
-
return;
}
if (gf_list_del_item(sg->objects, node->sgprivate->interact->js_binding->node)>=0) {
#ifndef GPAC_DISABLE_SVG
- JSBool ret = gf_js_remove_root(sg->svg_js->js_ctx, &(node->sgprivate->interact->js_binding->node));
+ JSBool ret = gf_js_remove_root(sg->svg_js->js_ctx, &(node->sgprivate->interact->js_binding->node), GF_JSGC_OBJECT);
if (sg->svg_js->in_script)
sg->svg_js->force_gc = 1;
else
{
- JS_GC(sg->svg_js->js_ctx);
+ gf_sg_js_call_gc(sg->svg_js->js_ctx);
JS_ClearNewbornRoots(sg->svg_js->js_ctx);
}
#endif
}
return;
}
-
/*this is unregister signaling*/
+
+#if 0
if (node->sgprivate->parents) {
switch (node->sgprivate->parents->node->sgprivate->tag) {
case TAG_MPEG4_Script:
}
return;
}
+#else
+ if (!node->sgprivate->parents && node->sgprivate->interact->js_binding->node) {
+ GF_JSField *field = node->sgprivate->interact->js_binding->node;
+ if (field->is_rooted) {
+ gf_js_remove_root(field->js_ctx, &field->obj, GF_JSGC_OBJECT);
+ field->is_rooted = 0;
+ }
+ return;
+ }
+#endif
+
/*final destroy*/
if (!node->sgprivate->num_instances) {
i=0;
if (jsf->js_list) {
u32 j;
- jsuint count;
- JS_GetArrayLength(jsf->js_ctx, jsf->js_list, &count);
-
- for (j=0; j<count; j++) {
- jsval item;
- JS_GetElement(jsf->js_ctx, jsf->js_list, (jsint) j, &item);
- if (JSVAL_IS_OBJECT(item)) {
- GF_JSField *afield = JS_GetPrivate(jsf->js_ctx, JSVAL_TO_OBJECT(item));
- afield->owner = NULL;
+
+ if (jsf->field.fieldType != GF_SG_VRML_MFNODE) {
+ jsuint count;
+ JS_GetArrayLength(jsf->js_ctx, jsf->js_list, &count);
+
+ for (j=0; j<count; j++) {
+ jsval item;
+ JS_GetElement(jsf->js_ctx, jsf->js_list, (jsint) j, &item);
+ if (JSVAL_IS_OBJECT(item)) {
+ GF_JSField *afield = JS_GetPrivate(jsf->js_ctx, JSVAL_TO_OBJECT(item));
+ afield->owner = NULL;
+ }
}
}
- gf_js_remove_root(jsf->js_ctx, &jsf->js_list);
+
+ if (jsf->is_rooted) gf_js_remove_root(jsf->js_ctx, &jsf->js_list, GF_JSGC_OBJECT);
jsf->js_list = NULL;
}
}
We also have a special value '-1' for the NDT for addChildren and removeChildren*/
+#if 0
if ((info->NDTtype == (u32) -1) || (node == (GF_Node*)JS_GetScript(jsf->js_ctx))) {
gf_sg_script_update_cached_object( JS_GetScriptStack(jsf->js_ctx), jsf->obj, jsf, &jsf->field, node);
}
+#endif
return;
}
}
if (prev_event && (prev_event->type==event->type) && (prev_event->target==event->target))
return;
- gf_sg_lock_javascript(1);
+ gf_sg_lock_javascript(priv->js_ctx, 1);
prev_type = event->is_vrml;
event->is_vrml = 1;
argv[0] = OBJECT_TO_JSVAL(evt);
if (hdl->js_fun_val) {
- jsval funval = (JSWord) hdl->js_fun_val;
+ jsval funval = (jsval ) hdl->js_fun_val;
ret = JS_CallFunctionValue(priv->js_ctx, hdl->evt_listen_obj ? (JSObject *)hdl->evt_listen_obj: priv->js_obj, funval, 1, argv, &rval);
} else {
ret = JS_CallFunctionName(priv->js_ctx, hdl->evt_listen_obj, "handleEvent", 1, argv, &rval);
event->is_vrml = prev_type;
JS_SetPrivate(priv->js_ctx, priv->event, prev_event);
- gf_sg_lock_javascript(0);
+ gf_sg_lock_javascript(priv->js_ctx, 0);
#endif
}
#endif
}
-void gf_sg_lock_javascript(Bool LockIt)
+Bool gf_sg_javascript_initialized()
{
#ifdef GPAC_HAS_SPIDERMONKEY
- if (js_rt) {
- if (LockIt) gf_mx_p(js_rt->mx);
- else gf_mx_v(js_rt->mx);
+ if (js_rt) return 1;
+#endif
+ return 0;
+}
+
+#ifdef GPAC_HAS_SPIDERMONKEY
+
+void gf_sg_lock_javascript(struct JSContext *cx, Bool LockIt)
+{
+ if (!js_rt) return;
+ if (LockIt) {
+ gf_mx_p(js_rt->mx);
+#ifdef JS_THREADSAFE
+ if (cx) {
+#if (JS_VERSION>=185)
+ JS_SetContextThread(cx);
+#endif
+ JS_BeginRequest(cx);
+ }
+#endif
+ } else {
+#ifdef JS_THREADSAFE
+ if (cx) {
+ JS_EndRequest(cx);
+#if (JS_VERSION>=185)
+ JS_ClearContextThread(cx);
+#endif
+ }
+#endif
+ gf_mx_v(js_rt->mx);
}
+}
+
+Bool gf_sg_try_lock_javascript(struct JSContext *cx)
+{
+ if (gf_mx_try_lock(js_rt->mx)) {
+#ifdef JS_THREADSAFE
+ if (cx) {
+#if (JS_VERSION>=185)
+ JS_SetContextThread(cx);
#endif
+ JS_BeginRequest(cx);
+ }
+#endif
+ return 1;
+ }
+ return 0;
}
+#endif /* GPAC_HAS_SPIDERMONKEY */
static void xbl_text_content(void *sax_cbck, const char *text_content, Bool is_cdata)
{
+ /* FIXME : this function does nothing
GF_XBL_Parser *parser = (GF_XBL_Parser *)sax_cbck;
XBL_NodeStack *top = (XBL_NodeStack *)gf_list_last(parser->node_stack);
- /* TODO */
+ */
}
static void xbl_node_end(void *sax_cbck, const char *name, const char *name_space)
{ "cursorManager", TAG_LSR_cursorManager, GF_XMLNS_LASER },
{ "selector", TAG_LSR_selector, GF_XMLNS_LASER },
{ "simpleLayout", TAG_LSR_simpleLayout, GF_XMLNS_LASER },
+ { "updates", TAG_LSR_updates, GF_XMLNS_LASER },
/*XBL*/
{ "bindings", TAG_XBL_bindings, GF_XMLNS_XBL },
offset+=read;
}
fclose(f);
+ f = NULL;
/*same file*/
if (!fsize) return 2;
}
- fclose(f);
+ if (f)
+ fclose(f);
return 1;
}
if (!ch->first_au_fetched && !ch->AU_buffer_first) {
u32 now = gf_term_get_time(ch->odm->term);
/*data timeout (no data sent)*/
- if (now > ch->last_au_time + ch->odm->term->net_data_timeout) {
+ if (now > ch->last_au_time + ch->clock->data_timeout) {
gf_term_message(ch->odm->term, ch->service->url, "Data timeout - aborting buffering", GF_OK);
ch->MinBuffer = ch->MaxBuffer = 0;
ch->au_duration = 0;
gf_scene_buffering_info(ch->odm->parentscene ? ch->odm->parentscene : ch->odm->subscene);
return 0;
} else {
- now = ch->odm->term->net_data_timeout + ch->last_au_time - now;
+ now = ch->clock->data_timeout + ch->last_au_time - now;
now /= 1000;
if (now != ch->au_duration) {
char szMsg[500];
gf_es_lock(ch, 0);
}
-void Channel_ReceiveSkipSL(GF_ClientService *serv, GF_Channel *ch, char *StreamBuf, u32 StreamLength)
+void Channel_ReceiveSkipSL(GF_ClientService *serv, GF_Channel *ch, const char *StreamBuf, u32 StreamLength)
{
GF_DBUnit *au;
if (!StreamLength) return;
}
ch->clock->clock_init = 0;
gf_clock_set_time(ch->clock, OCR_TS);
- GF_LOG(GF_LOG_INFO, GF_LOG_SYNC, ("[SyncLayer] ES%d: initializing clock at STB %d from OCR TS %d - %d buffering - OTB %d\n", ch->esd->ESID, gf_term_get_time(ch->odm->term), OCR_TS, ch->clock->Buffering, gf_clock_time(ch->clock) ));
+ GF_LOG(GF_LOG_INFO, GF_LOG_SYNC, ("[SyncLayer] ES%d: initializing clock at STB %d from OCR TS %d (origial TS "LLD") - %d buffering - OTB %d\n", ch->esd->ESID, gf_term_get_time(ch->odm->term), OCR_TS, hdr.objectClockReference, ch->clock->Buffering, gf_clock_time(ch->clock) ));
if (ch->clock->clock_init) ch->IsClockInit = 1;
}
}
#if 0
+ /*adjust clock if M2TS PCR discontinuity*/
+ else if (hdr.m2ts_pcr==2) {
+ u32 ck;
+ u32 OCR_TS = (u32) ( hdr.objectClockReference / 27000);
+ ck = gf_clock_time(ch->clock);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ES%d: At OTB %d - OCR Discontinuity OCR: adjusting to %d (origial TS "LLD") - original clock %d\n", ch->esd->ESID, gf_clock_real_time(ch->clock), OCR_TS, hdr.objectClockReference, ck));
+// gf_clock_set_time(ch->clock, (u32) OCR_TS);
+ }
/*compute clock drift*/
else {
u32 ck;
OCR_TS = (u32) ( (s64) (hdr.objectClockReference) * ch->ocr_scale);
}
ck = gf_clock_time(ch->clock);
- GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ES%d: At OTB %d adjusting OCR to %d (diff %d)\n", ch->esd->ESID, gf_clock_real_time(ch->clock), OCR_TS, (s32) OCR_TS - (s32) ck));
- gf_clock_set_time(ch->clock, (u32) OCR_TS);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ES%d: At OTB %d adjusting OCR to %d (origial TS "LLD") - diff %d\n", ch->esd->ESID, gf_clock_real_time(ch->clock), OCR_TS, hdr.objectClockReference, (s32) OCR_TS - (s32) ck));
+// gf_clock_set_time(ch->clock, (u32) OCR_TS);
}
#endif
if (!payload_size) return;
}
/*carousel for repeated AUs.*/
if (ch->carousel_type) {
- Bool use_rap = hdr.randomAccessPointFlag;
+/* not used : Bool use_rap = hdr.randomAccessPointFlag; */
if (ch->carousel_type==GF_ESM_CAROUSEL_MPEG2) {
AUSeqNum = hdr.m2ts_version_number_plus_one-1;
}
/*regular AU but waiting for RAP*/
else if (ch->stream_state) {
+#if 0
ch->skip_carousel_au = 1;
GF_LOG(GF_LOG_INFO, GF_LOG_SYNC, ("[SyncLayer] ES%d: Waiting for RAP Carousel - skipping\n", ch->esd->ESID));
return;
+#else
+ GF_LOG(GF_LOG_INFO, GF_LOG_SYNC, ("[SyncLayer] ES%d: Tuning in before RAP\n", ch->esd->ESID));
+#endif
}
/*previous packet(s) loss: check for critical or non-critical AUs*/
else if (reception_status == GF_REMOTE_SERVICE_ERROR) {
tmp->term = term;
tmp->speed = FIX_ONE;
if (term->play_state) tmp->Paused = 1;
+ tmp->data_timeout = term->net_data_timeout;
return tmp;
}
#include "media_control.h"
#include "input_sensor.h"
-#define TIME_CHECK 3
-
-
GF_Err Codec_Load(GF_Codec *codec, GF_ESD *esd, u32 PL);
GF_Codec *gf_codec_new(GF_ObjectManager *odm, GF_ESD *base_layer, s32 PL, GF_Err *e)
*e = Codec_Load(tmp, base_layer, PL);
if (*e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[Codec] Cannot find decoder for stream type %s\n", gf_esd_get_textual_description(base_layer) ));
gf_free(tmp);
return NULL;
}
tmp->type = base_layer->decoderConfig->streamType;
tmp->inChannels = gf_list_new();
tmp->Status = GF_ESM_CODEC_STOP;
+
+ if (tmp->type==GF_STREAM_PRIVATE_MEDIA) tmp->type = GF_STREAM_VISUAL;
+
+ GF_LOG(GF_LOG_INFO, GF_LOG_CODEC, ("[Codec] Found decoder %s for stream type %s\n", tmp->decio->module_name, gf_esd_get_textual_description(base_layer) ));
return tmp;
}
ch->esd->decoderConfig->decoderSpecificInfo->dataLength = com.get_dsi.dsi_len;
}
}
-
GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("[Codec] Attaching stream %d to codec %s\n", ch->esd->ESID, codec->decio->module_name));
/*lock the channel before setup in case we are using direct_decode */
e = codec->decio->AttachStream(codec->decio, ch->esd);
gf_mx_v(ch->mx);
+ if (ch->esd->decoderConfig && ch->esd->decoderConfig->rvc_config) {
+ gf_odf_desc_del((GF_Descriptor *)ch->esd->decoderConfig->rvc_config);
+ ch->esd->decoderConfig->rvc_config = NULL;
+ }
if (e) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("[Codec] Attach Stream failed %s\n", gf_error_to_string(e) ));
Bool gf_codec_remove_channel(GF_Codec *codec, struct _es_channel *ch)
{
- s32 i;
+ s32 i;
+ assert( codec );
+ assert( codec->inChannels);
+ assert(ch);
i = gf_list_find(codec->inChannels, ch);
if (i>=0) {
if (codec->decio) codec->decio->DetachStream(codec->decio, ch->esd->ESID);
/*lock scene*/
if (!scene_locked) {
scene_locked = codec->odm->subscene ? codec->odm->subscene : codec->odm->parentscene;
- if (!gf_mx_try_lock(scene_locked->mx)) return GF_OK;
- if (scene_locked==scene_locked->root_od->term->root_scene) {
- if (!gf_mx_try_lock(scene_locked->root_od->term->compositor->mx)) {
- gf_mx_v(scene_locked->mx);
- return GF_OK;
- }
- }
+ if (!gf_mx_try_lock(scene_locked->root_od->term->compositor->mx))
+ return GF_OK;
/*if terminal is paused, force step-mode: it won't hurt in regular pause/play and ensures proper frame dumping*/
if (codec->odm->term->play_state) codec->odm->term->compositor->step_mode=1;
}
gf_es_drop_au(ch);
if (e) {
- GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[SysDec] Codec %s AU CTS %d Decode error %s\n", sdec->module_name , AU->CTS, gf_error_to_string(e) ));
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC, ("[SysDec] Codec %s AU CTS %d Decode error %s\n", sdec->module_name , cts, gf_error_to_string(e) ));
if (e<0) ch->stream_state = 2;
goto exit;
}
exit:
if (scene_locked) {
- gf_mx_v(scene_locked->mx);
- if (scene_locked==scene_locked->root_od->term->root_scene) {
- gf_mx_v(scene_locked->root_od->term->compositor->mx);
- }
+ gf_mx_v(scene_locked->root_od->term->compositor->mx);
}
return e;
}
if (!ch->IsClockInit) {
Bool started;
/*signal seek*/
- if (!gf_mx_try_lock(scene_locked->mx)) return GF_OK;
+ if (!gf_mx_try_lock(scene_locked->root_od->term->compositor->mx)) return GF_OK;
gf_es_init_dummy(ch);
sdec->ProcessData(sdec, NULL, 0, ch->esd->ESID, -1, GF_CODEC_LEVEL_NORMAL);
- gf_mx_v(scene_locked->mx);
+ gf_mx_v(scene_locked->root_od->term->compositor->mx);
started = gf_clock_is_started(ch->clock);
/*let's be nice to the scene loader (that usually involves quite some parsing), pause clock while
parsing*/
/*lock scene*/
GF_LOG(GF_LOG_DEBUG, GF_LOG_CODEC, ("[PrivateDec] Codec %s Processing at %d\n", sdec->module_name , codec->odm->current_time));
- if (!gf_mx_try_lock(scene_locked->mx)) return GF_OK;
+ if (!gf_mx_try_lock(scene_locked->root_od->term->compositor->mx)) return GF_OK;
now = gf_term_get_time(codec->odm->term);
e = sdec->ProcessData(sdec, NULL, 0, ch->esd->ESID, codec->odm->current_time, GF_CODEC_LEVEL_NORMAL);
now = gf_term_get_time(codec->odm->term) - now;
codec_update_stats(codec, 0, now);
- gf_mx_v(scene_locked->mx);
+ gf_mx_v(scene_locked->root_od->term->compositor->mx);
if (e==GF_EOS) {
/*first end of stream, evaluate duration*/
- if (!codec->odm->duration) gf_odm_set_duration(codec->odm, ch, codec->odm->current_time);
+ //if (!codec->odm->duration) gf_odm_set_duration(codec->odm, ch, codec->odm->current_time);
gf_es_on_eos(ch);
return GF_OK;
}
u32 first, entryTime, now, obj_time, unit_size;
GF_MediaDecoder *mdec = (GF_MediaDecoder*)codec->decio;
GF_Err e = GF_OK;
+ CU = NULL;
/*if video codec muted don't decode (try to saves ressources)
if audio codec muted we dispatch to keep sync in place*/
if (codec->is_reordering) {
if ( LockCompositionUnit(codec, codec->last_unit_cts+1, &CU, &unit_size) == GF_OUT_OF_MEM)
return GF_OK;
+ assert( CU );
e = mdec->ProcessData(mdec, NULL, 0, 0, CU->data, &unit_size, 0, 0);
if (e==GF_OK) e = UnlockCompositionUnit(codec, CU, unit_size);
}
now = gf_term_get_time(codec->odm->term);
+ assert( CU );
if (!CU->data && unit_size)
e = GF_OUT_OF_MEM;
else
}
#ifndef GPAC_DISABLE_LOGS
if (codec->odm->flags & GF_ODM_PREFETCH) {
- GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[ODM%d] At %d decoding frame TS %d in prefetch mode\n", codec->odm->OD->objectDescriptorID, gf_clock_real_time(ch->clock) ));
+ GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[%s] ODM%d At %d decoding frame TS %d in prefetch mode\n", codec->decio->module_name, codec->odm->OD->objectDescriptorID, gf_clock_real_time(ch->clock) ));
}
#endif
break;
unit_size = 0;
/*error - if the object is in intitial buffering resume it!!*/
gf_cm_abort_buffering(codec->CB);
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[ODM%d] At %d (frame TS %d - %d ms ): decoded error %s\n", codec->odm->OD->objectDescriptorID, gf_clock_real_time(ch->clock), AU->CTS, now, gf_error_to_string(e) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[%s] ODM%d At %d (frame TS %d - %d ms ): decoded error %s\n", codec->decio->module_name, codec->odm->OD->objectDescriptorID, gf_clock_real_time(ch->clock), AU->CTS, now, gf_error_to_string(e) ));
e = GF_OK;
break;
}
/*escape from decoding loop only if above critical limit - this is to avoid starvation on audio*/
if (!ch->esd->dependsOnESID && (codec->CB->UnitCount > codec->CB->Min)) {
now = gf_term_get_time(codec->odm->term);
- if (0 && now - entryTime + TIME_CHECK >= TimeAvailable) {
+ if (now - entryTime >= TimeAvailable) {
return GF_OK;
}
}
}
+GF_Err gf_codec_process_ocr(GF_Codec *codec, u32 TimeAvailable)
+{
+ /*OCR: needed for OCR in pull mode (dummy streams used to sync various sources)*/
+ GF_DBUnit *AU;
+ GF_Channel *ch;
+ /*fetch next AU on OCR (empty AUs)*/
+ Decoder_GetNextAU(codec, &ch, &AU);
+
+ /*no active channel return*/
+ if (!AU || !ch) {
+ /*if the codec is in EOS state, move to STOP*/
+ if (codec->Status == GF_ESM_CODEC_EOS) {
+ gf_term_stop_codec(codec);
+#ifndef GPAC_DISABLE_VRML
+ /*if a mediacontrol is ruling this OCR*/
+ if (codec->odm->media_ctrl && codec->odm->media_ctrl->control->loop) mediacontrol_restart(codec->odm);
+#endif
+ }
+ }
+ return GF_OK;
+}
GF_Err gf_codec_process(GF_Codec *codec, u32 TimeAvailable)
{
codec->Muted = 0;
#endif
- /*OCR: needed for OCR in pull mode (dummy streams used to sync various sources)*/
- if (codec->type==GF_STREAM_OCR) {
- GF_DBUnit *AU;
- GF_Channel *ch;
- /*fetch next AU on OCR (empty AUs)*/
- Decoder_GetNextAU(codec, &ch, &AU);
-
- /*no active channel return*/
- if (!AU || !ch) {
- /*if the codec is in EOS state, move to STOP*/
- if (codec->Status == GF_ESM_CODEC_EOS) {
- gf_term_stop_codec(codec);
-#ifndef GPAC_DISABLE_VRML
- /*if a mediacontrol is ruling this OCR*/
- if (codec->odm->media_ctrl && codec->odm->media_ctrl->control->loop) mediacontrol_restart(codec->odm);
-#endif
- }
- }
- }
- /*special case here (we tweak a bit the timing)*/
- else if (codec->type==GF_STREAM_PRIVATE_SCENE) {
- return PrivateScene_Process(codec, TimeAvailable);
- } else if (codec->decio->InterfaceType==GF_MEDIA_DECODER_INTERFACE) {
- return MediaCodec_Process(codec, TimeAvailable);
- } else if (codec->decio->InterfaceType==GF_SCENE_DECODER_INTERFACE) {
- return SystemCodec_Process(codec, TimeAvailable);
- }
- return GF_OK;
+ return codec->process(codec, TimeAvailable);
}
cfg_size = 0;
}
- ifce_type = GF_SCENE_DECODER_INTERFACE;
- if ((esd->decoderConfig->streamType==GF_STREAM_AUDIO)
- || (esd->decoderConfig->streamType==GF_STREAM_VISUAL)
- || (esd->decoderConfig->streamType==GF_STREAM_ND_SUBPIC)
- )
+ switch (esd->decoderConfig->streamType) {
+ case GF_STREAM_AUDIO:
+ case GF_STREAM_VISUAL:
+ case GF_STREAM_ND_SUBPIC:
ifce_type = GF_MEDIA_DECODER_INTERFACE;
+ codec->process = MediaCodec_Process;
+ break;
+ case GF_STREAM_PRIVATE_MEDIA:
+ ifce_type = GF_PRIVATE_MEDIA_DECODER_INTERFACE;
+ codec->process = MediaCodec_Process;
+ break;
+ case GF_STREAM_PRIVATE_SCENE:
+ ifce_type = GF_SCENE_DECODER_INTERFACE;
+ codec->process = PrivateScene_Process;
+ break;
+ default:
+ ifce_type = GF_SCENE_DECODER_INTERFACE;
+ codec->process = SystemCodec_Process;
+ if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_AFX) {
+ ifce_type = GF_NODE_DECODER_INTERFACE;
+ }
+ break;
+ }
/*a bit dirty, if FFMPEG is used for demuxer load it for decoder too*/
if (0 && !stricmp(codec->odm->net_service->ifce->module_name, "FFMPEG demuxer")) {
if (sOpt) {
ifce = (GF_BaseDecoder *) gf_modules_load_interface_by_name(term->user->modules, sOpt, ifce_type);
if (ifce) {
- if (ifce->CanHandleStream && ifce->CanHandleStream(ifce, esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication, cfg, cfg_size, PL) ) {
+ if (ifce->CanHandleStream && ifce->CanHandleStream(ifce, esd->decoderConfig->streamType, esd, PL) ) {
codec->decio = ifce;
return GF_OK;
}
if (sOpt) {
ifce = (GF_BaseDecoder *) gf_modules_load_interface_by_name(term->user->modules, sOpt, ifce_type);
if (ifce) {
- if (ifce->CanHandleStream && ifce->CanHandleStream(ifce, esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication, cfg, cfg_size, PL) ) {
+ if (ifce->CanHandleStream && ifce->CanHandleStream(ifce, esd->decoderConfig->streamType, esd, PL) ) {
codec->decio = ifce;
return GF_OK;
}
for (i = 0; i < plugCount ; i++) {
ifce = (GF_BaseDecoder *) gf_modules_load_interface(term->user->modules, i, ifce_type);
if (!ifce) continue;
- if (ifce->CanHandleStream && ifce->CanHandleStream(ifce, esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication, cfg, cfg_size, PL) ) {
+ if (ifce->CanHandleStream && ifce->CanHandleStream(ifce, esd->decoderConfig->streamType, esd, PL) ) {
codec->decio = ifce;
sprintf(szPrefDec, "codec_%02X_%02X", esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication);
gf_cfg_set_key(term->user->config, "Systems", szPrefDec, ifce->module_name);
/*OCR has no codec, just a channel*/
case GF_STREAM_OCR:
codec->decio = NULL;
+ codec->process = gf_codec_process_ocr;
return GF_OK;
#ifndef GPAC_DISABLE_VRML
/*InteractionStream */
case GF_STREAM_INTERACT:
codec->decio = (GF_BaseDecoder *) gf_isdec_new(esd, PL);
assert(codec->decio->InterfaceType == GF_SCENE_DECODER_INTERFACE);
+ codec->process = SystemCodec_Process;
return GF_OK;
#endif
void gf_codec_del(GF_Codec *codec)
{
+ if (!codec || !codec->inChannels)
+ return;
if (gf_list_count(codec->inChannels)) return;
if (!(codec->flags & GF_ESM_CODEC_IS_USE)) {
}
}
if (codec->CB) gf_cm_del(codec->CB);
- gf_list_del(codec->inChannels);
+ codec->CB = NULL;
+ if (codec->inChannels) gf_list_del(codec->inChannels);
+ codec->inChannels = NULL;
gf_free(codec);
}
return GF_OK;
}
-static GF_Err IS_ProcessData(GF_SceneDecoder *plug, char *inBuffer, u32 inBufferLength,
+static GF_Err IS_ProcessData(GF_SceneDecoder *plug, const char *inBuffer, u32 inBufferLength,
u16 ES_ID, u32 AU_time, u32 mmlevel)
{
u32 i, j, count;
ptr = priv->enteredText;
len = gf_utf8_wcstombs(tmp_utf8, 5000, &ptr);
if (outText->buffer) gf_free(outText->buffer);
- outText->buffer = (char*)gf_malloc(sizeof(char) * (len+1));
- memcpy(outText->buffer, tmp_utf8, sizeof(char) * len);
- outText->buffer[len] = 0;
+ outText->buffer = (char*)gf_malloc(sizeof(char) * (len));
+ memcpy(outText->buffer, tmp_utf8, sizeof(char) * len-1);
+ outText->buffer[len-1] = 0;
if (inText->buffer) gf_free(inText->buffer);
inText->buffer = NULL;
priv->text_len = 0;
st->mo = NULL;
if (st->registered) {
st->registered = 0;
- if (is_dec->io_dev && is_dec->io_dev->Stop) is_dec->io_dev->Start(is_dec->io_dev);
+ if (is_dec->io_dev && is_dec->io_dev->Stop) is_dec->io_dev->Stop(is_dec->io_dev);
}
}
/*get IS dec*/
is_dec = (ISPriv*)odm->codec->decio->privateStack;
- gf_list_add(is_dec->is_nodes, st);
+ if ( gf_list_find(is_dec->is_nodes, st) == -1 )
+ gf_list_add(is_dec->is_nodes, st);
/*start stream*/
gf_mo_play(st->mo, 0, -1, 0);
if (odm->flags & GF_ODM_NO_TIME_CTRL) return;
- /*otherwise locate all objects sharing the clock*/
+ /*locate all objects sharing the clock*/
ck = gf_odm_get_media_clock(odm);
if (!ck) return;
in_scene = odm->parentscene;
if (odm->subscene) {
assert(odm->subscene->root_od==odm);
- assert( gf_odm_shares_clock(odm, ck) );
+// assert( gf_odm_shares_clock(odm, ck) );
gf_odm_set_speed(odm, speed);
in_scene = odm->subscene;
}
MediaControlStack *stack = (MediaControlStack *) gf_node_get_private(node);
/*reset ODM using this control*/
- if (stack->stream && stack->stream->odm) {
- odm = stack->stream->odm;
- gf_odm_remove_mediacontrol(odm, stack);
+ if (stack->stream) {
+ if (stack->stream->odm) {
+ odm = stack->stream->odm;
+ gf_odm_remove_mediacontrol(odm, stack);
+ }
+ /*also removes the association ck<->MC if the object has been destroyed before the node*/
+ if (stack->ck) stack->ck->mc = NULL;
}
- /*also removes the association ck<->MC if the object has been destroyed before the node*/
- if (stack->ck) stack->ck->mc = NULL;
-
gf_list_del(stack->seg);
gf_sg_vrml_mf_reset(&stack->url, GF_SG_VRML_MFURL);
gf_free(stack);
need_restart = 0;
}
- if (!stack->changed || !stack->control->enabled) return;
+ if (!stack->changed || !stack->control->enabled || !stack->stream) return;
/*if not previously enabled and now enabled, switch all other controls off and reactivate*/
switch (threading_mode) {
case GF_TERM_THREAD_SINGLE: term->flags |= GF_TERM_SINGLE_THREAD;
break;
- case GF_TERM_THREAD_MULTI: term->flags |= GF_TERM_MULTI_THREAD;
+ case GF_TERM_THREAD_MULTI:
+ term->flags |= GF_TERM_MULTI_THREAD;
break;
default:
break;
}
- if (term->user->init_flags & GF_TERM_NO_THREAD) return GF_OK;
+ if (term->user->init_flags & GF_TERM_NO_DECODER_THREAD)
+ return GF_OK;
term->mm_thread = gf_th_new("MediaManager");
term->flags |= GF_TERM_RUNNING;
return 0;
}
-static u32 MM_SimulationStep(GF_Terminal *term)
+static u32 MM_SimulationStep_Decoder(GF_Terminal *term)
{
CodecEntry *ce;
GF_Err e;
term->compositor->networks_time = gf_sys_clock();
#endif
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Media Manager] Entering simultion step\n"));
+// GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Media Manager] Entering simultion step\n"));
gf_term_handle_services(term);
#ifndef GF_DISABLE_LOG
term->compositor->decoders_time = gf_sys_clock() - term->compositor->decoders_time;
#endif
- if (term->flags & GF_TERM_DRAW_FRAME) {
- time_taken = gf_sys_clock();
- gf_sc_draw_frame(term->compositor);
- time_taken = gf_sys_clock() - time_taken;
- if (time_left>time_taken)
- time_left -= time_taken;
- else
- time_left = 0;
- } /*else {
- GF_LOG(GF_LOG_DEBUG, GF_LOG_RTI, ("(RTI] Terminal Cycle Log\t%d\t%d\t%d\n", term->compositor->networks_time, term->compositor->decoders_time, 0));
- }*/
- if (!(term->user->init_flags & GF_TERM_NO_REGULATION)) {
- gf_sleep(time_left);
- }
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Media Manager] Simulation step done in %d / %d ms\n", term->frame_duration-time_left, term->frame_duration));
+
+ return time_left;
+}
+
+u32 MM_SimulationStep_Compositor(GF_Terminal *term, u32 time_left)
+{
+ u32 time_taken = gf_sys_clock();
+ gf_sc_draw_frame(term->compositor);
+ time_taken = gf_sys_clock() - time_taken;
+ if (time_left>time_taken)
+ time_left -= time_taken;
+ else
+ time_left = 0;
+
return time_left;
}
u32 MM_Loop(void *par)
{
GF_Terminal *term = (GF_Terminal *) par;
+ Bool do_scene = (term->flags & GF_TERM_NO_VISUAL_THREAD) ? 1 : 0;
+ Bool do_codec = (term->flags & GF_TERM_NO_DECODER_THREAD) ? 0 : 1;
+ Bool do_regulate = (term->user->init_flags & GF_TERM_NO_REGULATION) ? 0 : 1;
gf_th_set_priority(term->mm_thread, term->priority);
GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[MediaManager] Entering thread ID %d\n", gf_th_id() ));
// GF_LOG(GF_LOG_DEBUG, GF_LOG_RTI, ("(RTI] Terminal Cycle Log\tServices\tDecoders\tCompositor\tSleep\n"));
while (term->flags & GF_TERM_RUNNING) {
- MM_SimulationStep(term);
+ u32 left;
+ if (do_codec) left = MM_SimulationStep_Decoder(term);
+ else left = term->frame_duration;
+
+ if (do_scene) left = MM_SimulationStep_Compositor(term, left);
+
+ if (do_regulate)
+ gf_sleep(left);
}
term->flags |= GF_TERM_DEAD;
return 0;
GF_EXPORT
GF_Err gf_term_process_step(GF_Terminal *term)
{
- if (!(term->flags & GF_TERM_DRAW_FRAME)) return GF_BAD_PARAM;
- MM_SimulationStep(term);
+ u32 left = 0;
+
+ if (term->flags & GF_TERM_NO_DECODER_THREAD) {
+ left = MM_SimulationStep_Decoder(term);
+ } else {
+ left = term->frame_duration;
+ }
+
+ if (term->flags & GF_TERM_NO_COMPOSITOR_THREAD) {
+ left = MM_SimulationStep_Compositor(term, left);
+ }
+ if (term->user->init_flags & GF_TERM_NO_REGULATION) return GF_OK;
+
+ gf_sleep(left);
return GF_OK;
}
{
u32 i;
CodecEntry *ce;
- if (!(term->flags & GF_TERM_DRAW_FRAME) ) return GF_BAD_PARAM;
+ if (!(term->flags & GF_TERM_NO_COMPOSITOR_THREAD) ) return GF_BAD_PARAM;
/*update till frame mature*/
while (1) {
- gf_term_handle_services(term);
- gf_mx_p(term->mm_mx);
-
- i=0;
- while ((ce = (CodecEntry*)gf_list_enum(term->codecs, &i))) {
- gf_codec_process(ce->dec, 10000);
+
+ if (term->flags & GF_TERM_NO_DECODER_THREAD) {
+ gf_term_handle_services(term);
+ gf_mx_p(term->mm_mx);
+ i=0;
+ while ((ce = (CodecEntry*)gf_list_enum(term->codecs, &i))) {
+ gf_codec_process(ce->dec, 10000);
+ }
+ gf_mx_v(term->mm_mx);
}
- gf_mx_v(term->mm_mx);
if (!gf_sc_draw_frame(term->compositor))
break;
{
GF_DBUnit *tmp;
GF_SAFEALLOC(tmp, GF_DBUnit)
+ if (tmp) memset(tmp, 0, sizeof(GF_DBUnit));
return tmp;
}
{
if (!db) return;
if (db->next) gf_db_unit_del(db->next);
- if (db->data) gf_free(db->data);
+ db->next = NULL;
+ if (db->data) {
+ /* memset(db->data, 0, db->dataLength); */
+ gf_free(db->data);
+ }
+ db->dataLength = 0;
+ db->data = NULL;
gf_free(db);
}
{
GF_CMUnit *tmp;
GF_SAFEALLOC(tmp, GF_CMUnit)
+ if (tmp) memset(tmp, 0, sizeof(GF_CMUnit));
return tmp;
}
static void gf_cm_unit_del(GF_CMUnit *cb)
{
+ if (!cb)
+ return;
if (cb->next) gf_cm_unit_del(cb->next);
cb->next = NULL;
if (cb->data) {
gf_clock_buffer_off(cb->odm->codec->ck);
GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ODM%d: buffering off at %d (nb buffering on clock: %d)\n", cb->odm->OD->objectDescriptorID, gf_term_get_time(cb->odm->term), cb->odm->codec->ck->Buffering));
}
-
- /*break the loop and destroy*/
- cb->input->prev->next = NULL;
- gf_cm_unit_del(cb->input);
+ if (cb->input){
+ /*break the loop and destroy*/
+ cb->input->prev->next = NULL;
+ gf_cm_unit_del(cb->input);
+ cb->input = NULL;
+ }
gf_odm_lock(cb->odm, 0);
gf_free(cb);
}
/*done with buffering, signal to the clock (ONLY ONCE !)*/
cb->Status = CB_BUFFER_DONE;
gf_clock_buffer_off(cb->odm->codec->ck);
+ cb->odm->codec->ck->data_timeout = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ODM%d: buffering off at %d (nb buffering on clock: %d)\n", cb->odm->OD->objectDescriptorID, gf_term_get_time(cb->odm->term), cb->odm->codec->ck->Buffering));
}
if (!Capacity || !UnitSize) return;
gf_odm_lock(cb->odm, 1);
- /*break the loop and destroy*/
- cb->input->prev->next = NULL;
- gf_cm_unit_del(cb->input);
+ if (cb->input){
+ /*break the loop and destroy*/
+ cb->input->prev->next = NULL;
+ gf_cm_unit_del(cb->input);
+ cb->input = NULL;
+ }
cu = NULL;
cb->Capacity = Capacity;
if (cb->Status == CB_BUFFER) {
cb->Status = CB_BUFFER_DONE;
gf_clock_buffer_off(cb->odm->codec->ck);
+ cb->odm->codec->ck->data_timeout = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ODM%d: buffering off at %d (nb buffering on clock: %d)\n", cb->odm->OD->objectDescriptorID, gf_term_get_time(cb->odm->term), cb->odm->codec->ck->Buffering));
}
cb->HasSeenEOS = 1;
if (cb->Status == CB_BUFFER) {
cb->Status = CB_BUFFER_DONE;
gf_clock_buffer_off(cb->odm->codec->ck);
+ cb->odm->codec->ck->data_timeout = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_SYNC, ("[SyncLayer] ODM%d: buffering off at %d (nb buffering on clock: %d)\n", cb->odm->OD->objectDescriptorID, gf_term_get_time(cb->odm->term), cb->odm->codec->ck->Buffering));
}
}
#include <gpac/internal/terminal_dev.h>
#include <gpac/internal/compositor_dev.h>
#include <gpac/internal/scenegraph_dev.h>
+#include <gpac/modules/codec.h>
#include <gpac/nodes_x3d.h>
#include "media_memory.h"
#include "media_control.h"
#endif
obj_type = GF_MEDIA_OBJECT_AUDIO;
break;
+ case TAG_MPEG4_SBVCAnimation:
case TAG_MPEG4_AnimationStream:
obj_type = GF_MEDIA_OBJECT_UPDATES;
break;
case TAG_SVG_animation:
obj_type = GF_MEDIA_OBJECT_SCENE;
break;
+ case TAG_LSR_updates:
+ obj_type = GF_MEDIA_OBJECT_UPDATES;
+ break;
#endif
default: obj_type = GF_MEDIA_OBJECT_UNDEF; break;
gf_codec_process(mo->odm->codec, 1);
gf_term_lock_codec(mo->odm->codec, 0);
}
- gf_odm_lock(mo->odm, 1);
+ if (!gf_odm_lock_mo(mo)) return NULL;
}
/*new frame to fetch, lock*/
Bool is_restart = 0;
/*remove object from media queue*/
- gf_term_lock_net(mo->odm->term, 1);
+ gf_term_lock_media_queue(mo->odm->term, 1);
res = gf_list_del_item(mo->odm->term->media_queue, mo->odm);
- gf_term_lock_net(mo->odm->term, 0);
+ gf_term_lock_media_queue(mo->odm->term, 0);
if (mo->odm->action_type!=GF_ODM_ACTION_PLAY) {
mo->odm->action_type = GF_ODM_ACTION_PLAY;
}
GF_EXPORT
-void gf_mo_stop(GF_MediaObject *mo)
+Bool gf_mo_stop(GF_MediaObject *mo)
{
- if (!mo || !mo->num_open) return;
+ Bool ret = 0;
+ if (!mo || !mo->num_open) return 0;
mo->num_open--;
if (!mo->num_open && mo->odm) {
/*do not stop directly, this can delete channel data currently being decoded (BIFS anim & co)*/
- gf_mx_p(mo->odm->term->net_mx);
+ gf_term_lock_media_queue(mo->odm->term, 1);
/*if object not in media queue, add it*/
if (gf_list_find(mo->odm->term->media_queue, mo->odm)<0)
gf_list_add(mo->odm->term->media_queue, mo->odm);
/*signal STOP request*/
- mo->odm->action_type = GF_ODM_ACTION_STOP;
+ if ((mo->OD_ID==GF_MEDIA_EXTERNAL_ID) || (mo->odm && mo->odm->OD && (mo->odm->OD->objectDescriptorID==GF_MEDIA_EXTERNAL_ID))) {
+ mo->odm->action_type = GF_ODM_ACTION_DELETE;
+ ret = 1;
+ }
+ else
+ mo->odm->action_type = GF_ODM_ACTION_STOP;
- gf_mx_v(mo->odm->term->net_mx);
+ gf_term_lock_media_queue(mo->odm->term, 0);
} else {
if (!mo->num_to_restart) {
mo->num_restart = mo->num_to_restart = mo->num_open + 1;
}
}
+ return ret;
}
GF_EXPORT
}
j++;
}
- j = sscanf(s_url, "%d", &tmpid);
+ j = sscanf(s_url, "%u", &tmpid);
/*be carefull, an url like "11-regression-test.mp4" will return 1 on sscanf :)*/
if (j==1) {
char szURL[20];
- sprintf(szURL, "%d", tmpid);
+ sprintf(szURL, "%u", tmpid);
if (stricmp(szURL, s_url)) j = 0;
}
gf_free(s_url);
GF_EXPORT
Fixed gf_mo_get_current_speed(GF_MediaObject *mo)
{
- return (mo && mo->odm && mo->odm->codec) ? mo->odm->codec->ck->speed : FIX_ONE;
+ return (mo && mo->odm && mo->odm->codec && mo->odm->codec->ck) ? mo->odm->codec->ck->speed : FIX_ONE;
}
if (gf_odm_shares_clock(mo->odm, ck)) {
in_loop = 0;
#ifndef GPAC_DISABLE_VRML
- if (ctrl && ctrl->stream->odm && ctrl->stream->odm->subscene)
+/*
+ if (ctrl && ctrl->stream->odm && ctrl->stream->odm->subscene)
gf_term_invalidate_compositor(mo->odm->term);
+*/
#endif
}
gf_odm_lock(mo->odm, 0);
return mo ? mo->timestamp : 0;
}
+GF_EXPORT
+Bool gf_mo_is_private_media(GF_MediaObject *mo)
+{
+ if (mo->odm && mo->odm->codec && mo->odm->codec->decio && (mo->odm->codec->decio->InterfaceType==GF_PRIVATE_MEDIA_DECODER_INTERFACE)) return 1;
+ return 0;
+}
+
+GF_EXPORT
+void gf_mo_set_position(GF_MediaObject *mo, GF_Window *src, GF_Window *dst)
+{
+ GF_PrivateMediaDecoder *dec;
+ if (!mo->odm || !mo->odm->codec || !mo->odm->codec->decio || (mo->odm->codec->decio->InterfaceType!=GF_PRIVATE_MEDIA_DECODER_INTERFACE)) return;
+
+ dec = (GF_PrivateMediaDecoder*)mo->odm->codec->decio;
+ dec->Control(dec, 0, src, dst);
+}
GF_EXPORT
Bool gf_mo_has_audio(GF_MediaObject *mo)
/*dynamic scene*/
else ck = st->stream->odm->subscene->dyn_ck;
/*since audio may be used alone through an inline scene, we need to refresh the graph*/
- if (st->stream->odm->state) gf_term_invalidate_compositor(st->stream->odm->term);
+ if (ck && !ck->has_seen_eos && st->stream->odm->state) gf_term_invalidate_compositor(st->stream->odm->term);
}
/*check anim streams*/
else if (st->stream->odm->codec && (st->stream->odm->codec->type==GF_STREAM_SCENE)) ck = st->stream->odm->codec->ck;
while (gf_list_count(st->seg)) gf_list_rem(st->seg, 0);
- /*unlink from OD*/
- if (st->stream && st->stream->odm && st->stream->odm->ms_stack)
- gf_list_del_item(st->stream->odm->ms_stack, st);
+ if (st->stream) {
+ /*unlink from OD*/
+ if (st->stream->odm && st->stream->odm->ms_stack)
+ gf_list_del_item(st->stream->odm->ms_stack, st);
- gf_mo_unregister(node, st->stream);
+ gf_mo_unregister(node, st->stream);
+ if (st->sensor->isActive) {
+ st->sensor->isActive = 0;
+ gf_node_event_out_str((GF_Node *) st->sensor, "isActive");
+ }
+ }
st->stream = gf_mo_register(node, &st->sensor->url, 0, 0);
st->is_init = 0;
gf_term_invalidate_compositor(st->parent->root_od->term);
/*full object controled*/
if (!media_sens->active_seg && !count) {
+ /*check for end of scene (MediaSensor on inline)*/
+ if (odm->subscene && odm->subscene->duration) {
+ GF_Clock *ck = gf_odm_get_media_clock(odm);
+ if (ck->has_seen_eos && (1000*time>=(Double) (s64)odm->subscene->duration)) {
+ if (media_sens->sensor->isActive) {
+ media_sens->sensor->isActive = 0;
+ gf_node_event_out_str((GF_Node *) media_sens->sensor, "isActive");
+
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_INTERACT, ("[ODM%d] Deactivating media sensor\n", odm->OD->objectDescriptorID));
+ }
+ continue;
+ }
+ }
+
if (!is_eos && !media_sens->sensor->isActive) {
media_sens->sensor->isActive = 1;
gf_node_event_out_str((GF_Node *) media_sens->sensor, "isActive");
media_sens->sensor->mediaCurrentTime = time;
gf_node_event_out_str((GF_Node *) media_sens->sensor, "mediaCurrentTime");
}
- /*check for end of scene (MediaSensor on inline)*/
- if (odm->subscene && odm->subscene->duration) {
- GF_Clock *ck = gf_odm_get_media_clock(odm);
- if (ck->has_seen_eos && media_sens->sensor->isActive && (1000*time>=(Double) (s64)odm->subscene->duration)) {
- media_sens->sensor->isActive = 0;
- gf_node_event_out_str((GF_Node *) media_sens->sensor, "isActive");
-
- GF_LOG(GF_LOG_DEBUG, GF_LOG_INTERACT, ("[ODM%d] Deactivating media sensor\n", odm->OD->objectDescriptorID));
- }
- }
if (is_eos && media_sens->sensor->isActive) {
media_sens->sensor->isActive = 0;
gf_node_event_out_str((GF_Node *) media_sens->sensor, "isActive");
if (mo->num_open) {
if (!changed) return;
- gf_scene_notify_event(scene, GF_EVENT_UNLOAD, node, NULL);
+ gf_scene_notify_event(scene, GF_EVENT_UNLOAD, node, NULL, GF_OK);
gf_node_dirty_parents(node);
gf_list_del_item(mo->nodes, node);
+ /*reset the scene pointer as it may get destroyed*/
switch (gf_node_get_tag(node)) {
case TAG_MPEG4_Inline:
#ifndef GPAC_DISABLE_X3D
gf_node_set_private(node, NULL);
break;
}
-
+
mo->num_open --;
if (!mo->num_open) {
if (ODID == GF_MEDIA_EXTERNAL_ID) {
}
}
} else {
- gf_term_lock_net(scene->root_od->term, 1);
+ gf_term_lock_media_queue(scene->root_od->term, 1);
/*external media are completely unloaded*/
if (scene->root_od->OD->objectDescriptorID==GF_MEDIA_EXTERNAL_ID) {
if (gf_list_find(scene->root_od->term->media_queue, scene->root_od)<0)
gf_list_add(scene->root_od->term->media_queue, scene->root_od);
- gf_term_lock_net(scene->root_od->term, 0);
+ gf_term_lock_media_queue(scene->root_od->term, 0);
}
}
}
}
- }
+ } else {
+ gf_node_dirty_parents(node);
+ }
if (ODID) gf_inline_set_scene(pInline);
}
}
}
+void gf_scene_mpeg4_inline_restart(GF_Scene *scene)
+{
+ u32 current_seg = 0;
+
+ if (scene->root_od->media_ctrl) current_seg = scene->root_od->media_ctrl->current_seg;
+
+ if (scene->is_dynamic_scene) {
+ u32 from = 0;
+ if (scene->root_od->media_ctrl) {
+ scene->root_od->media_ctrl->current_seg = current_seg;
+ from = (u32) (scene->root_od->media_ctrl->media_start * 1000);
+ }
+ gf_scene_restart_dynamic(scene, from);
+ } else {
+ /*we cannot use gf_mo_restart since it only sets the needs_restart for inline scenes.
+ The rational is that gf_mo_restart can be called from the parent scene (OK) or from the scene itself, in
+ which case shutting down the graph would crash the compositor. We therefore need two render passes to
+ safely restart an inline scene*/
+
+ /*1- stop main object from playing but don't disconnect channels*/
+ gf_odm_stop(scene->root_od, 1);
+ /*2- close all ODs inside the scene and reset the graph*/
+ gf_scene_disconnect(scene, 0);
+ if (scene->root_od->media_ctrl) scene->root_od->media_ctrl->current_seg = current_seg;
+ /*3- restart the scene*/
+ gf_odm_start(scene->root_od, 0);
+ }
+}
+
static void gf_inline_traverse(GF_Node *n, void *rs, Bool is_destroy)
{
MFURL *current_url;
if (!scene) return;
mo = scene->root_od ? scene->root_od->mo : NULL;
- gf_scene_notify_event(scene, GF_EVENT_UNLOAD, n, NULL);
+ gf_scene_notify_event(scene, GF_EVENT_UNLOAD, n, NULL, GF_OK);
if (!mo) return;
gf_list_del_item(mo->nodes, n);
if (mo->num_open) {
mo->num_open --;
if (!mo->num_open) {
+ gf_term_lock_media_queue(scene->root_od->term, 1);
+
/*this is unspecified in the spec: whenever an inline not using the
OD framework is destroyed, destroy the associated resource*/
if (mo->OD_ID == GF_MEDIA_EXTERNAL_ID) {
- gf_odm_disconnect(scene->root_od, 1);
-
/*get parent scene and remove MediaObject in case the ressource
gets re-requested later on*/
- scene = (GF_Scene *)gf_sg_get_private(gf_node_get_graph((GF_Node *) n) );
- if (gf_list_del_item(scene->scene_objects, mo)>=0) {
+ GF_Scene *parent_scene = (GF_Scene *)gf_sg_get_private(gf_node_get_graph((GF_Node *) n) );
+ if (gf_list_del_item(parent_scene->scene_objects, mo)>=0) {
gf_sg_vrml_mf_reset(&mo->URLs, GF_SG_VRML_MFURL);
gf_list_del(mo->nodes);
+ if (mo->odm) mo->odm->mo = NULL;
gf_free(mo);
}
+ scene->root_od->action_type = GF_ODM_ACTION_DELETE;
+ gf_list_add(scene->root_od->term->media_queue, scene->root_od);
} else {
- gf_odm_stop(scene->root_od, 1);
- gf_scene_disconnect(scene, 1);
- assert(gf_list_count(scene->resources) == 0);
+ scene->root_od->action_type = GF_ODM_ACTION_SCENE_DISCONNECT;
+ gf_list_add(scene->root_od->term->media_queue, scene->root_od);
}
+ gf_term_lock_media_queue(scene->root_od->term, 0);
}
}
return;
scene = (GF_Scene *)gf_node_get_private(n);
if (!scene) {
/*just like protos, we must invalidate parent graph until attached*/
- if (inl->url.count)
- gf_node_dirty_set(n, 0, 1);
+ if (inl->url.count) {
+ if (!inl->url.vals[0].OD_ID && (!inl->url.vals[0].url || !strlen(inl->url.vals[0].url) ) ) {
+ gf_sg_vrml_mf_reset(&inl->url, GF_SG_VRML_MFURL);
+ } else {
+ gf_node_dirty_set(n, 0, 1);
+ }
+ }
return;
}
}
/*if we need to restart, shutdown graph and do it*/
if (scene->needs_restart) {
- u32 current_seg = 0;
/*special case: scene change*/
if (scene->needs_restart==2) {
scene->needs_restart = 0;
return;
}
- if (scene->root_od->media_ctrl) current_seg = scene->root_od->media_ctrl->current_seg;
scene->needs_restart = 0;
-
- gf_mx_p(scene->mx);
- if (scene->is_dynamic_scene) {
- u32 from = 0;
- if (scene->root_od->media_ctrl) {
- scene->root_od->media_ctrl->current_seg = current_seg;
- from = (u32) (scene->root_od->media_ctrl->media_start * 1000);
- }
- gf_scene_restart_dynamic(scene, from);
- } else {
- /*we cannot use gf_mo_restart since it only sets the needs_restart for inline scenes.
- The rational is that gf_mo_restart can be called from the parent scene (OK) or from the scene itself, in
- which case shutting down the graph would crash the compositor. We therefore need two render passes to
- safely restart an inline scene*/
-
- /*1- stop main object from playing but don't disconnect channels*/
- gf_odm_stop(scene->root_od, 1);
- /*2- close all ODs inside the scene and reset the graph*/
- gf_scene_disconnect(scene, 0);
- if (scene->root_od->media_ctrl) scene->root_od->media_ctrl->current_seg = current_seg;
- /*3- restart the scene*/
- gf_odm_start(scene->root_od, 0);
- }
- gf_mx_v(scene->mx);
+ gf_term_lock_media_queue(scene->root_od->term, 1);
+ scene->root_od->action_type = GF_ODM_ACTION_SCENE_INLINE_RESTART;
+ gf_list_add(scene->root_od->term->media_queue, scene->root_od);
+ gf_term_lock_media_queue(scene->root_od->term, 0);
gf_node_dirty_set(n, 0, 1);
return;
if (gf_sg_vrml_is_sf_field(info.fieldType)) {
val = storage_serialize_sf(info.far_ptr, info.fieldType);
} else {
- u32 sftype = gf_sg_vrml_get_sf_type(info.fieldType);
+ //u32 sftype = gf_sg_vrml_get_sf_type(info.fieldType);
char *slotval;
void *slot;
val = NULL;
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/internal/terminal_dev.h>
#include <gpac/network.h>
+#include <gpac/cache.h>
#include "media_memory.h"
gf_term_service_media_event(service->owner, GF_EVENT_MEDIA_END_SESSION_SETUP);
if (err) {
char msg[5000];
- sprintf(msg, "Cannot open %s", service->url);
+ snprintf(msg, sizeof(msg), "Cannot open %s", service->url);
gf_term_message(term, service->url, msg, err);
gf_term_service_media_event(service->owner, GF_EVENT_MEDIA_ERROR);
gf_term_lock_net(term, 1);
service->ifce->CloseService(service->ifce);
root->net_service = NULL;
+ if (service->owner && service->nb_odm_users) service->nb_odm_users--;
service->owner = NULL;
/*depends on module: some module could forget to call gf_term_on_disconnect */
if ( gf_list_del_item(term->net_services, service) >= 0) {
evt.connect.is_connected = 0;
gf_term_send_event(term, &evt);
} else {
+ if (root->subscene) gf_scene_notify_event(root->subscene, GF_EVENT_SCENE_ATTACHED, NULL, NULL, err);
/*try to reinsert OD for VRML/X3D with multiple URLs:
1- first remove from parent scene without destroying object, this will trigger a re-setup
if other URLs are present
/*channel service connect*/
u32 i;
GF_ChannelSetup *cs;
- GF_List *ODs = gf_list_new();
+ GF_List *ODs;
+
+ if (!gf_list_count(term->channels_pending)) {
+ return;
+ }
+ ODs = gf_list_new();
gf_term_lock_net(term, 1);
i=0;
while ((cs = (GF_ChannelSetup*)gf_list_enum(term->channels_pending, &i))) {
sprintf(szMsg, "Channel %d connection failure", ch->esd->ESID);
gf_term_message(term, service->url, szMsg, err);
ch->es_state = GF_ESM_ES_UNAVAILABLE;
-// return;
+/* return;*/
}
- /*Plays request are skiped until all channels are connected. We send a PLAY on the objecy in case
- 1-OD user has requested a play
+ /*Plays request are skiped until all channels are connected. We send a PLAY on the objecy in case
+ 1-OD user has requested a play
2-this is a channel of the root OD
*/
- if ( (ch->odm->mo && ch->odm->mo->num_open)
+ if ( (ch->odm->mo && ch->odm->mo->num_open)
|| !ch->odm->parentscene
) {
gf_odm_start(ch->odm, 0);
GET_TERM();
ch = gf_term_get_channel(service, netch);
- if (!ch)
+ if (!ch)
return;
-
+
if (reception_status==GF_EOS) {
gf_es_on_eos(ch);
return;
GET_TERM();
root = service->owner;
+ if (!root){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[Service %s] has not root, aborting !\n", service->url));
+ return;
+ }
scene = root->subscene ? root->subscene : root->parentscene;
GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[Service %s] %s\n", service->url, media_desc ? "Adding new media object" : "Regenerating scene graph"));
gf_term_lock_net(term, 1);
/*object declared this way are not part of an OD stream and are considered as dynamic*/
-// od->objectDescriptorID = GF_MEDIA_EXTERNAL_ID;
+/* od->objectDescriptorID = GF_MEDIA_EXTERNAL_ID; */
/*check if we have a mediaObject in the scene not attached and matching this object*/
the_mo = NULL;
GF_ESD *esd;
GF_MediaObject *mo = gf_list_get(scene->scene_objects, i);
if (!mo->odm) continue;
- /*already assigned object - this may happen since the compositor has no control on when objects are declared by the service,
+ /*already assigned object - this may happen since the compositor has no control on when objects are declared by the service,
therefore opening file#video and file#audio may result in the objects being declared twice if the service doesn't
keep track of declared objects*/
if (mo->odm->OD) {
case GF_STREAM_AUDIO:
if (mo->type != GF_MEDIA_OBJECT_AUDIO) continue;
break;
+ case GF_STREAM_PRIVATE_MEDIA:
+ if ((mo->type != GF_MEDIA_OBJECT_AUDIO) && (mo->type != GF_MEDIA_OBJECT_VIDEO)) continue;
+ break;
+ case GF_STREAM_SCENE:
+ if (mo->type != GF_MEDIA_OBJECT_UPDATES) continue;
+ break;
default:
continue;
}
com->buffer.occupancy = 0;
return;
}
-
+
/*browse all channels in the scene, running on this service, and get buffer info*/
od_list = NULL;
- if (service->owner->parentscene) {
- od_list = service->owner->parentscene->resources;
- } else if (service->owner->subscene) {
+ if (service->owner->subscene) {
od_list = service->owner->subscene->resources;
+ } else if (service->owner->parentscene) {
+ od_list = service->owner->parentscene->resources;
}
if (!od_list) {
com->buffer.occupancy = 0;
if (ch->MaxBuffer>com->buffer.max) com->buffer.max = ch->MaxBuffer;
if (ch->MinBuffer<com->buffer.min) com->buffer.min = ch->MinBuffer;
if (ch->IsClockInit && (u32) ch->BufferTime < com->buffer.occupancy) {
- if ((ch->AU_Count<=2) || (odm->codec->CB->UnitCount <= odm->codec->CB->Min)) {
+ if (odm->codec->CB->UnitCount <= odm->codec->CB->Min) {
com->buffer.occupancy = 0;
} else {
com->buffer.occupancy = ch->BufferTime;
return;
}
-
+
if (!com->base.on_channel) return;
static void fetch_mime_io(void *dnld, GF_NETIO_Parameter *parameter)
{
- /*this is correct, however some shoutcast servers don't understand HEAD and don't reply at all
- so don't use HEAD*/
-#if 0
- /*only get the content type*/
+ /*
+ * souchay :
+ * NOTE for shoutcast servers and dumb servers
+ * if HEAD method is not undertood, it will be handled into HTTP 501 : method not implemented
+ */
if (parameter->msg_type==GF_NETIO_GET_METHOD) parameter->name = "HEAD";
-#endif
-
-
}
+
static char *get_mime_type(GF_Terminal *term, const char *url, GF_Err *ret_code)
{
- char *mime_type;
+ char * ret = NULL;
GF_DownloadSession * sess;
-
(*ret_code) = GF_OK;
if (strnicmp(url, "http", 4)) return NULL;
-
- sess = gf_dm_sess_new(term->downloader, (char *) url, GF_NETIO_SESSION_NOT_THREADED, fetch_mime_io, NULL, ret_code);
+ sess = gf_dm_sess_new(term->downloader, (char *) url, GF_NETIO_SESSION_NOT_THREADED | GF_NETIO_SESSION_FORCE_NO_CACHE, fetch_mime_io, NULL, ret_code);
if (!sess) {
if (strstr(url, "rtsp://") || strstr(url, "rtp://") || strstr(url, "udp://") || strstr(url, "tcp://") ) (*ret_code) = GF_OK;
return NULL;
+ } else {
+ const char * mime = gf_dm_sess_mime_type(sess);
+ if (mime){
+ ret = gf_strdup(mime);
+ }
}
- mime_type = (char *) gf_dm_sess_mime_type(sess);
- if (mime_type) mime_type = gf_strdup(mime_type);
- else *ret_code = gf_dm_sess_last_error(sess);
gf_dm_sess_del(sess);
- return mime_type;
+ return ret;
}
char *sURL, *qm, *frag, *ext, *mime_type, *url_res;
char szExt[50];
GF_InputService *ifce;
+ memset(szExt, 0, sizeof(szExt));
+ (*ret_code) = GF_OK;
+ ifce = NULL;
+ mime_type = NULL;
GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] Looking for plugin for URL %s\n", url));
*out_url = NULL;
- if (!url) {
+ sURL = NULL;
+ if (!url || !strncmp(url, "\\\\", 2) ) {
(*ret_code) = GF_URL_ERROR;
- return NULL;
+ goto exit;
}
- sURL = NULL;
- if (parent_url) sURL = gf_url_concatenate(parent_url, url);
+ /*used by GUIs scripts to skip URL concatenation*/
+ if (!strncmp(url, "gpac://", 7)) sURL = gf_strdup(url+7);
+ else if (parent_url) sURL = gf_url_concatenate(parent_url, url);
/*path absolute*/
if (!sURL) sURL = gf_strdup(url);
- if (gf_url_is_local(sURL))
+ if (gf_url_is_local(sURL))
gf_url_to_fs_path(sURL);
if (no_mime_check) {
*/
mime_type = get_mime_type(term, sURL, &e);
if (e) {
- gf_free(sURL);
(*ret_code) = e;
- return NULL;
+ goto exit;
}
}
-
- if (mime_type &&
- (!stricmp(mime_type, "text/plain")
+
+ if (mime_type &&
+ (!stricmp(mime_type, "text/plain")
|| !stricmp(mime_type, "video/quicktime")
|| !stricmp(mime_type, "application/octet-stream")
- )
+ )
) {
gf_free(mime_type);
mime_type = NULL;
if (sPlug) sPlug = strrchr(sPlug, '"');
if (sPlug) {
sPlug += 2;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("%s:%d FOUND matching module %s\n", __FILE__, __LINE__, sPlug));
ifce = (GF_InputService *) gf_modules_load_interface_by_name(term->user->modules, sPlug, GF_NET_CLIENT_INTERFACE);
if (ifce && !net_check_interface(ifce) ) {
gf_modules_close_interface((GF_BaseInterface *) ifce);
/*no mime type: either local or streaming. If streaming discard extension checking*/
if (!ifce && !mime_type && strstr(sURL, "://") && strnicmp(sURL, "file://", 7)) ext = NULL;
- if (mime_type) {
- gf_free(mime_type);
- if (!ifce) return NULL;
- }
-
/*browse extensions for prefered module*/
if (!ifce && ext) {
u32 keyCount;
if (ext) ext[0] = 0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] No mime type found - checking by extension %s\n", szExt));
+ assert( term && term->user && term->user->modules);
keyCount = gf_cfg_get_key_count(term->user->config, "MimeTypes");
for (i=0; i<keyCount; i++) {
- char *sMime, *sPlug;
+ char *sPlug;
const char *sKey;
- sMime = (char *) gf_cfg_get_key_name(term->user->config, "MimeTypes", i);
+ const char *sMime;
+ sMime = gf_cfg_get_key_name(term->user->config, "MimeTypes", i);
if (!sMime) continue;
sKey = gf_cfg_get_key(term->user->config, "MimeTypes", sMime);
if (!sKey) continue;
if (!sPlug) continue; /*bad format entry*/
sPlug += 2;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] Trying module[%i]=%s, mime=%s\n", i, sPlug, sMime));
ifce = (GF_InputService *) gf_modules_load_interface_by_name(term->user->modules, sPlug, GF_NET_CLIENT_INTERFACE);
- if (!ifce) continue;
+ if (!ifce){
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] module[%i]=%s, mime=%s, cannot be loaded for GF_NET_CLIENT_INTERFACE.\n", i, sPlug, sMime));
+ continue;
+ }
if (!net_check_interface(ifce)) {
gf_modules_close_interface((GF_BaseInterface *) ifce);
ifce = NULL;
/*browse all modules*/
if (!ifce) {
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] Not found any interface, trying browsing all modules...\n"));
for (i=0; i< gf_modules_get_count(term->user->modules); i++) {
ifce = (GF_InputService *) gf_modules_load_interface(term->user->modules, i, GF_NET_CLIENT_INTERFACE);
if (!ifce) continue;
ifce = NULL;
}
}
-
- if (!ifce) {
- gf_free(sURL);
- (*ret_code) = GF_NOT_SUPPORTED;
- return NULL;
+exit:
+ if (!ifce){
+ GF_LOG(GF_LOG_WARNING, GF_LOG_MEDIA, ("[Terminal] Did not find any input plugin for URL %s (%s)\n", sURL ? sURL : url, mime_type ? mime_type : "no mime type"));
+ if (sURL) gf_free(sURL);
+ if ( (*ret_code) == GF_OK) (*ret_code) = GF_NOT_SUPPORTED;
+ *out_url = NULL;
+ } else {
+ *out_url = sURL;
+ GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Found input plugin %s for URL %s (%s)\n", ifce->module_name, sURL, mime_type ? mime_type : "no mime type"));
}
- GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] Found input plugin %s for URL %s\n", ifce->module_name, sURL));
- *out_url = sURL;
+ if (mime_type)
+ gf_free(mime_type);
+ mime_type = NULL;
return ifce;
}
return ns->ifce->CanHandleURLInService(ns->ifce, url);
}
-GF_Err gf_term_service_command(GF_ClientService *ns, GF_NetworkCommand *com)
-{
- return ns->ifce->ServiceCommand(ns->ifce, com);
+GF_Err gf_term_service_command(GF_ClientService *ns, GF_NetworkCommand *com)
+{
+ return ns->ifce->ServiceCommand(ns->ifce, com);
}
GF_Err gf_term_channel_get_sl_packet(GF_ClientService *ns, LPNETCHANNEL channel, char **out_data_ptr, u32 *out_data_size, GF_SLHeader *out_sl_hdr, Bool *sl_compressed, GF_Err *out_reception_status, Bool *is_new_data)
{
GF_EXPORT
void gf_term_add_media(GF_ClientService *service, GF_Descriptor *media_desc, Bool no_scene_check)
{
+ assert(service);
term_on_media_add(service->term, service, media_desc, no_scene_check);
}
{
const char *sOpt = gf_cfg_get_key(ns->term->user->config, "StreamingCache", "AutoSave");
if (ns->cache) gf_term_service_cache_close(ns, (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0);
- gf_modules_close_interface((GF_BaseInterface *)ns->ifce);
- gf_free(ns->url);
assert(!ns->nb_odm_users);
assert(!ns->nb_ch_users);
assert(!ns->owner);
+ gf_modules_close_interface((GF_BaseInterface *)ns->ifce);
+ gf_free(ns->url);
+
+
/*delete all the clocks*/
while (gf_list_count(ns->Clocks)) {
GF_Clock *ck = (GF_Clock *)gf_list_get(ns->Clocks, 0);
GF_Err e;
GF_DownloadSession * sess;
char *sURL;
- if (!service) return NULL;
+ if (!service){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] service is null, cannot create new download session for %s.\n", url));
+ return NULL;
+ }
sURL = gf_url_concatenate(service->url, url);
/*path was absolute*/
if (!sURL) sURL = gf_strdup(url);
+ assert( service->term );
sess = gf_dm_sess_new(service->term->downloader, sURL, flags, user_io, cbk, &e);
+ if (!sess){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] session could not be created for %s : %s. service url=%s, url=%s.\n", sURL, gf_error_to_string(e), service->url, url));
+ gf_free(sURL);
+ sURL = NULL;
+ return NULL;
+ }
gf_free(sURL);
- if (!sess) return NULL;
+ sURL = NULL;
gf_dm_sess_set_private(sess, service);
gf_list_add(service->dnloads, sess);
return sess;
GF_ClientService *serv;
const char *szURI;
u32 total_size, bytes_done, net_status, bytes_per_sec;
-
+
if (!sess) return;
gf_dm_sess_get_stats(sess, NULL, &szURI, &total_size, &bytes_done, &bytes_per_sec, &net_status);
evt.progress.service = szURI;
evt.progress.total = total_size;
evt.progress.done = bytes_done;
+ evt.progress.bytes_per_seconds = bytes_per_sec;
gf_term_send_event(serv->term, &evt);
}
GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[HTTP] %s received %d / %d\n", szURI, bytes_done, total_size));
}
GF_EXPORT
-void gf_term_register_mime_type(GF_InputService *ifce, const char *mimeType, const char *extList, const char *description)
+void gf_term_register_mime_type(const GF_InputService *ifce, const char *mimeType, const char *extList, const char *description)
{
u32 len;
char *buf;
const char *szExtList;
char *ext, szExt[500];
if (!ifce || !mimeType || !extList || !description || !fileExt) return 0;
+ memset(szExt, 0, sizeof(szExt));
/*this is a URL*/
if ( (strlen(fileExt)>20) || strchr(fileExt, '/')) return 0;
if (sep) sep[0] = 0;
for (i=0; i<strlen(szURL); i++) {
switch (szURL[i]) {
- case '/': case '\\': case '.': case ':': case '?':
+ case '/': case '\\': case '.': case ':': case '?':
szURL[i] = '_';
break;
}
#endif
/*make sure we are not in the media queue*/
- gf_mx_p(odm->term->net_mx);
+ gf_term_lock_media_queue(odm->term, 1);
gf_list_del_item(odm->term->media_queue, odm);
- gf_mx_v(odm->term->net_mx);
+ gf_term_lock_media_queue(odm->term, 0);
lock = gf_mx_try_lock(odm->mx);
while ((media_sens = (MediaSensorStack *)gf_list_enum(odm->ms_stack, &i))) {
MS_Stop(media_sens);
/*and detach from stream object*/
- media_sens->is_init = 0;
+ media_sens->stream = NULL;
}
gf_list_del(odm->ms_stack);
gf_list_del(odm->channels);
+ odm->channels = NULL;
gf_odf_desc_del((GF_Descriptor *)odm->OD);
+ odm->OD = NULL;
assert (!odm->net_service);
if (lock) gf_mx_v(odm->mx);
gf_mx_del(odm->mx);
{
GF_Channel *ch;
+ if (do_remove) odm->state = GF_ODM_STATE_DESTROYED;
gf_odm_stop(odm, 1);
+ if (do_remove) odm->state = GF_ODM_STATE_DESTROYED;
/*disconnect sub-scene*/
if (odm->subscene) gf_scene_disconnect(odm->subscene, do_remove);
gf_odm_lock(odm, 1);
/*unload the decoders before deleting the channels to prevent any access fault*/
- if (odm->codec) gf_term_remove_codec(odm->term, odm->codec);
+ if (odm->codec) {
+ if (odm->codec->type==GF_STREAM_INTERACT) {
+ u32 i, count;
+ // Remove all Registered InputSensor nodes -> shut down the InputSensor threads -> prevent illegal access on deleted pointers
+ GF_MediaObject *obj = odm->mo;
+ count = gf_list_count(obj->nodes);
+ for (i=0; i<count; i++) {
+ GF_Node *n = (GF_Node *)gf_list_get(obj->nodes, i);
+ switch (gf_node_get_tag(n)) {
+#ifndef GPAC_DISABLE_VRML
+ case TAG_MPEG4_InputSensor:
+ ((M_InputSensor*)n)->enabled = 0;
+ InputSensorModified(n);
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+ }
+ gf_term_remove_codec(odm->term, odm->codec);
+ }
if (odm->ocr_codec) gf_term_remove_codec(odm->term, odm->ocr_codec);
#ifndef GPAC_MINIMAL_ODF
if (odm->oci_codec) gf_term_remove_codec(odm->term, odm->oci_codec);
/*detach from network service */
if (odm->net_service) {
GF_ClientService *ns = odm->net_service;
- if (odm->flags & GF_ODM_SERVICE_ENTRY) {
- if (ns->nb_odm_users) ns->nb_odm_users--;
+ if (ns->nb_odm_users) ns->nb_odm_users--;
+ //if (odm->flags & GF_ODM_SERVICE_ENTRY)
+ {
if (ns->owner == odm) {
/*detach it!!*/
ns->owner = NULL;
/*delete from the parent scene.*/
if (odm->parentscene) {
+ GF_Event evt;
+ evt.type = GF_EVENT_CONNECT;
+ evt.connect.is_connected = 0;
+ gf_term_forward_event(odm->term, &evt, 0, 1);
+
gf_scene_remove_object(odm->parentscene, odm, do_remove);
if (odm->subscene) gf_scene_del(odm->subscene);
gf_odm_del(odm);
/*create empty service descriptor, this will automatically create a dynamic scene*/
desc = gf_odf_desc_new(GF_ODF_OD_TAG);
}
- odm->net_service->nb_odm_users++;
odm->flags |= GF_ODM_SERVICE_ENTRY;
if (!gf_list_count( ((GF_ObjectDescriptor*)desc)->ESDescriptors)) {
return NULL;
}
+#ifdef UNUSED_FUNC
static void ODM_SelectAlternateStream(GF_ObjectManager *odm, u32 lang_code, u8 stream_type)
{
u32 i;
}
}
}
+#endif /* UNUSED_FUNC */
/*Validate the streams in this OD, and check if we have to setup an inline scene*/
switch (esd->decoderConfig->streamType) {
case GF_STREAM_OD: nb_od++; break;
case GF_STREAM_OCR: nb_ocr++; break;
- case GF_STREAM_SCENE: nb_scene++; break;
+ case GF_STREAM_SCENE:
+ switch (esd->decoderConfig->objectTypeIndication) {
+ case GPAC_OTI_SCENE_AFX:
+ case GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE:
+ break;
+ default:
+ nb_scene++;
+ break;
+ }
+ break;
case GF_STREAM_MPEG7: nb_mp7++; break;
case GF_STREAM_IPMP: nb_ipmp++; break;
case GF_STREAM_OCI: nb_oci++; break;
GF_ESD *esd;
GF_MediaObject *syncRef;
- if (!odm->net_service) odm->net_service = serv;
-
+ if (!odm->net_service) {
+ odm->net_service = serv;
+ if (!odm->OD->URLString)
+ odm->net_service->nb_odm_users++;
+ }
/*if this is a remote OD, we need a new manager and a new service...*/
if (odm->OD->URLString) {
GF_ClientService *parent = odm->net_service;
/*setup mediaobject info except for top-level OD*/
if (odm->parentscene) {
+ GF_Event evt;
+
gf_scene_setup_object(odm->parentscene, odm);
+
+ /*setup node decoder*/
+ if (odm->mo && odm->codec && odm->codec->decio && (odm->codec->decio->InterfaceType==GF_NODE_DECODER_INTERFACE) ) {
+ GF_NodeDecoder *ndec = (GF_NodeDecoder *) odm->codec->decio;
+ GF_Node *n = gf_list_get(odm->mo->nodes, 0);
+ if (n) ndec->AttachNode(ndec, n);
+
+ /*not clear in the spec how the streams attached to AFC are started - default to "right now"*/
+ gf_odm_start(odm, 0);
+ }
+
+
+ evt.type = GF_EVENT_CONNECT;
+ evt.connect.is_connected = 1;
+ gf_term_forward_event(odm->term, &evt, 0, 1);
} else {
/*othewise send a connect ack for top level*/
GF_Event evt;
have to wait for an entire image carousel period to start filling the buffers, which is sub-optimal*/
else if (!odm->state && (odm->flags & GF_ODM_NO_TIME_CTRL)) {
GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[ODM%d] Inserted from broadcast - forcing play\n", odm->OD->objectDescriptorID));
- gf_odm_start(odm, 0);
+ gf_odm_start(odm, 2);
odm->flags |= GF_ODM_PREFETCH;
}
if (ch->esd->URLString) {
strcpy(szURL, ch->esd->URLString);
} else {
- sprintf(szURL, "ES_ID=%d", ch->esd->ESID);
+ sprintf(szURL, "ES_ID=%ud", ch->esd->ESID);
}
/*connect before setup: this is needed in case the decoder cfg is wrong, we may need to get it from
// || (dec && (dec->flags & GF_ESM_CODEC_IS_STATIC_OD))
) {
- gf_term_lock_net(ch->odm->term, 1);
+ gf_term_lock_media_queue(ch->odm->term, 1);
gf_list_del_item(ch->odm->term->media_queue, ch->odm);
+ gf_term_lock_media_queue(ch->odm->term, 1);
+
+ gf_term_lock_net(ch->odm->term, 1);
gf_es_start(ch);
com.command_type = GF_NET_CHAN_PLAY;
com.base.on_channel = ch;
GF_Clock *ck;
if (!ch) return;
+ assert( odm );
+ assert( odm->channels );
//find a clock with this stream ES_ID
ck = gf_clock_find(odm->net_service->Clocks, ch->esd->ESID, 0);
/*this is the tricky part: make sure the net is locked before doing anything since an async service
reply could destroy the object we're queuing for play*/
-void gf_odm_start(GF_ObjectManager *odm, Bool was_in_media_queue)
+void gf_odm_start(GF_ObjectManager *odm, u32 media_queue_state)
{
Bool skip_register = 1;
- gf_term_lock_net(odm->term, 1);
+ gf_term_lock_media_queue(odm->term, 1);
odm->flags &= ~GF_ODM_PREFETCH;
}
/*object is already started - only reinsert in media queue if this function was called on an object already in the queue*/
else {
- skip_register = was_in_media_queue ? 0 : 1;
+ skip_register = media_queue_state ? 0 : 1;
}
- if (!skip_register && (gf_list_find(odm->term->media_queue, odm)<0)) {
+ if (media_queue_state==2) {
+ odm->action_type = GF_ODM_ACTION_PLAY;
+ gf_odm_play(odm);
+ } else if (!skip_register && (gf_list_find(odm->term->media_queue, odm)<0)) {
odm->action_type = GF_ODM_ACTION_PLAY;
gf_list_add(odm->term->media_queue, odm);
}
}
#endif
- gf_term_lock_net(odm->term, 0);
+ gf_term_lock_media_queue(odm->term, 0);
}
void gf_odm_play(GF_ObjectManager *odm)
#endif
- gf_term_lock_net(odm->term, 1);
+ gf_term_lock_media_queue(odm->term, 1);
gf_list_del_item(odm->term->media_queue, odm);
- gf_term_lock_net(odm->term, 0);
+ gf_term_lock_media_queue(odm->term, 0);
/*little opt for image codecs: don't actually stop the OD*/
if (!force_close && odm->codec && odm->codec->CB) {
GF_SAFEALLOC(tmp, GF_Scene);
if (! tmp) return NULL;
- tmp->mx = gf_mx_new("SceneMutex");
tmp->resources = gf_list_new();
tmp->scene_objects = gf_list_new();
tmp->extra_scenes = gf_list_new();
if (scene->dims_url.url) gf_free(scene->dims_url.url);
if (scene->fragment_uri) gf_free(scene->fragment_uri);
if (scene->redirect_xml_base) gf_free(scene->redirect_xml_base);
- gf_mx_del(scene->mx);
gf_free(scene);
}
-void gf_scene_notify_event(GF_Scene *scene, u32 event_type, GF_Node *n, void *_event)
+void gf_scene_notify_event(GF_Scene *scene, u32 event_type, GF_Node *n, void *_event, GF_Err code)
{
/*fire resize event*/
#ifndef GPAC_DISABLE_SVG
if (!scene) return;
root = gf_sg_get_root_node(scene->graph);
- if (!root) return;
if (!event) {
memset(&evt, 0, sizeof(GF_DOM_Event));
}
#endif
}
+
+ evt.error_state = code;
}
if (n) {
gf_dom_event_fire(n, event);
} else {
- gf_dom_event_fire(root, event);
+ if (root) gf_dom_event_fire(root, event);
count=scene->root_od->mo ? gf_list_count(scene->root_od->mo->nodes) : 0;
for (i=0;i<count; i++) {
gf_sc_set_size(scene->root_od->term->compositor, w, h);
}
/*trigger a scene attach event*/
- gf_scene_notify_event(scene, GF_EVENT_SCENE_ATTACHED, NULL, NULL);
+ gf_scene_notify_event(scene, GF_EVENT_SCENE_ATTACHED, NULL, NULL, GF_OK);
}
}
obj = NULL;
i=0;
while ((obj = (GF_MediaObject *)gf_list_enum(scene->scene_objects, &i))) {
+ if (obj->odm && ((obj->odm->state == GF_ODM_STATE_DESTROYED) || (obj->odm->action_type == GF_ODM_ACTION_DELETE)) )
+ continue;
+
if (
/*regular OD scheme*/
(OD_ID != GF_MEDIA_EXTERNAL_ID && (obj->OD_ID==OD_ID))
/*locate sub-url in given one and handle fragments (viewpoint/segments/...)*/
&& gf_mo_is_same_url(obj, url, &keep_fragment, obj_type_hint)
)
- ) {
-
+ ) {
if (!first_pass && !force_new_if_not_attached) {
if (node && (gf_list_find(obj->nodes, node)<0))
gf_list_add(obj->nodes, node);
/*safety check!!!*/
if (gf_list_find(scene->scene_objects, obj)<0)
return NULL;
+
+ if (obj->odm==NULL) {
+ gf_list_del_item(scene->scene_objects, obj);
+ if (obj->nodes) gf_list_del(obj->nodes);
+ gf_free(obj);
+ return NULL;
+ }
}
return obj;
}
if (!gf_mo_get_visual_info(mo, w, h, NULL, &pixel_ar, NULL)) return;
if (pixel_ar) {
u32 n, d;
- n = (pixel_ar>>16) & 0xFF;
- d = (pixel_ar) & 0xFF;
+ n = (pixel_ar>>16) & 0x0000FFFF;
+ d = (pixel_ar) & 0x0000FFFF;
*w = (*w * n) / d;
}
}
if (odm->mo && (type==GF_STREAM_VISUAL)) {
gf_scene_get_video_size(odm->mo, &w, &h);
- if (w&&h) gf_sg_set_scene_size_info(scene->graph, w, h, 1);
+ gf_sg_set_scene_size_info(scene->graph, w, h, 1);
}
break;
}
IS_UpdateVideoPos(scene);
} else {
scene->graph_attached = 1;
- gf_scene_notify_event(scene, GF_EVENT_SCENE_ATTACHED, NULL, NULL);
+ gf_scene_notify_event(scene, GF_EVENT_SCENE_ATTACHED, NULL, NULL, GF_OK);
gf_term_invalidate_compositor(scene->root_od->term);
}
}
if (scene->root_od->term->root_scene == scene)
gf_sc_set_scene(scene->root_od->term->compositor, scene->graph);
- gf_scene_notify_event(scene, GF_EVENT_SCENE_ATTACHED, NULL, NULL);
+ gf_scene_notify_event(scene, GF_EVENT_SCENE_ATTACHED, NULL, NULL, GF_OK);
#ifndef GPAC_DISABLE_VRML
IS_UpdateVideoPos(scene);
if (scene) return scene->root_od->net_service->url;
return NULL;
}
-Bool gf_scene_lock(GF_SceneGraph *sg, Bool do_lock)
+
+Bool gf_scene_is_over(GF_SceneGraph *sg)
{
+ u32 i, count;
GF_Scene *scene = gf_sg_get_private(sg);
if (!scene) return 0;
- if (do_lock) return gf_mx_try_lock(scene->mx);
- else gf_mx_v(scene->mx);
+ if (scene->scene_codec)
+ return (scene->scene_codec->Status==GF_ESM_CODEC_EOS) ? 1 : 0;
+
+ count = gf_list_count(scene->resources);
+ for (i=0; i<count; i++) {
+ GF_ObjectManager *odm = gf_list_get(scene->resources, i);
+ if (odm->codec && (odm->codec->Status != GF_ESM_CODEC_EOS) && (odm->codec->Status!=GF_ESM_CODEC_STOP)) return 0;
+ if (odm->subscene && !gf_scene_is_over(odm->subscene->graph) ) return 0;
+ }
return 1;
}
-
#include <gpac/options.h>
#include <gpac/network.h>
#include <gpac/xml.h>
+#include "../utils/module_wrap.h"
/*textual command processing*/
#include <gpac/scene_manager.h>
}
result = gf_term_relocate_url(term, url, scene->root_od->net_service->url, new_url, localized_url);
- if (result && new_url) param->uri.url = gf_strdup(new_url);
+ if (result) param->uri.url = gf_strdup(new_url);
else param->uri.url = gf_url_concatenate(scene->root_od->net_service->url, url);
return 1;
}
GF_TermLocales *loc = (GF_TermLocales*)__self;
/* Checks if the rel_path argument really contains a relative path (no ':', no '/' at the beginning) */
- if (strstr(rel_path, "://") || (rel_path[0]=='/') || strstr(rel_path, ":\\")) {
+ if (strstr(rel_path, "://") || (rel_path[0]=='/') || strstr(rel_path, ":\\") || !strncmp(rel_path, "\\\\", 2)) {
return 0;
}
term->frame_duration = (u32) (1000/fps);
gf_sc_set_fps(term->compositor, fps);
- if (term->user->init_flags & GF_TERM_NO_THREAD){
- //gf_term_set_threading(term->mediaman, 1);
- } else {
+ if (!(term->user->init_flags & GF_TERM_NO_DECODER_THREAD) ){
prio = GF_THREAD_PRIORITY_NORMAL;
sOpt = gf_cfg_get_key(term->user->config, "Systems", "Priority");
if (sOpt) {
{
GF_Event evt;
GF_Terminal *term = (GF_Terminal *)usr_cbk;
+ evt.type = GF_EVENT_AUTHORIZATION;
evt.auth.site_url = site_url;
evt.auth.user = usr_name;
evt.auth.password = password;
GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[Terminal] Creating terminal\n"));
tmp = (GF_Terminal*)gf_malloc(sizeof(GF_Terminal));
- if (!tmp) return NULL;
+ if (!tmp){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[Terminal] Failed to allocate GF_Terminal : OUT OF MEMORY ?\n"));
+ return NULL;
+ }
memset(tmp, 0, sizeof(GF_Terminal));
/*just for safety*/
tmp->user = user;
+ if (user->init_flags & GF_TERM_NO_DECODER_THREAD) {
+ if (user->init_flags & GF_TERM_NO_VISUAL_THREAD) {
+ user->init_flags |= GF_TERM_NO_COMPOSITOR_THREAD;
+ user->init_flags &= ~GF_TERM_NO_VISUAL_THREAD;
+ }
+ }
+
/*this is not changeable at runtime*/
- if (user->init_flags & GF_TERM_NO_THREAD) {
- tmp->flags |= GF_TERM_DRAW_FRAME;
- } else if (user->init_flags & GF_TERM_DRAW_FRAME) {
- tmp->flags |= GF_TERM_DRAW_FRAME;
+ if (user->init_flags & GF_TERM_NO_DECODER_THREAD)
+ tmp->flags |= GF_TERM_NO_DECODER_THREAD;
+
+ if (user->init_flags & GF_TERM_NO_COMPOSITOR_THREAD) {
+ tmp->flags |= GF_TERM_NO_COMPOSITOR_THREAD;
+ } else if (user->init_flags & GF_TERM_NO_VISUAL_THREAD) {
+ tmp->flags |= GF_TERM_NO_VISUAL_THREAD;
} else {
cf = gf_cfg_get_key(user->config, "Systems", "NoVisualThread");
if (!cf || !stricmp(cf, "no")) {
- tmp->flags &= ~GF_TERM_DRAW_FRAME;
+ tmp->flags &= ~GF_TERM_NO_VISUAL_THREAD;
} else {
- tmp->flags |= GF_TERM_DRAW_FRAME;
+ tmp->flags |= GF_TERM_NO_VISUAL_THREAD;
}
}
/*setup scene compositor*/
- tmp->compositor = gf_sc_new(user, !(tmp->flags & GF_TERM_DRAW_FRAME) , tmp);
+ tmp->compositor = gf_sc_new(user, !(tmp->flags & (GF_TERM_NO_VISUAL_THREAD|GF_TERM_NO_COMPOSITOR_THREAD)) , tmp);
if (!tmp->compositor) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[Terminal] Failed to create Compositor.\n"));
gf_free(tmp);
return NULL;
}
tmp->net_services_to_remove = gf_list_new();
tmp->channels_pending = gf_list_new();
tmp->media_queue = gf_list_new();
-
+ tmp->media_queue_mx = gf_mx_new("MediaQueue");
tmp->net_mx = gf_mx_new("GlobalNetwork");
tmp->input_streams = gf_list_new();
tmp->x3d_sensors = gf_list_new();
}
tmp->unthreaded_extensions = gf_list_new();
tmp->evt_mx = gf_mx_new("Event Filter");
- tmp->event_filters = gf_list_new();
+
for (i=0; i< gf_list_count(tmp->extensions); i++) {
GF_TermExt *ifce = gf_list_get(tmp->extensions, i);
if (!ifce->process(ifce, GF_TERM_EXT_START, tmp)) {
if (ifce->caps & GF_TERM_EXTENSION_NOT_THREADED)
gf_list_add(tmp->unthreaded_extensions, ifce);
-
- if (ifce->caps & GF_TERM_EXTENSION_FILTER_EVENT)
- gf_list_add(tmp->event_filters, ifce);
}
if (!gf_list_count(tmp->unthreaded_extensions)) {
gf_list_del(tmp->unthreaded_extensions);
tmp->unthreaded_extensions = NULL;
}
- if (!gf_list_count(tmp->event_filters)) {
- gf_list_del(tmp->event_filters);
- tmp->event_filters = NULL;
+ if (0 == gf_cfg_get_key_count(user->config, "MimeTypes")){
+ GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Initializing Mime Types..."));
+ /* No mime-types detected, probably the first launch */
+ for (i=0; i< gf_modules_get_count(user->modules); i++) {
+ GF_BaseInterface *ifce = gf_modules_load_interface(user->modules, i, GF_NET_CLIENT_INTERFACE);
+ if (ifce) {
+ GF_InputService * service = (GF_InputService*) ifce;
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Asking mime types supported for new module %s...\n", ifce->module_name));
+ if (service->RegisterMimeTypes){
+ u32 num = service->RegisterMimeTypes(service);
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] module %s has registered %u new mime-types.\n", ifce->module_name, num));
+ } else {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("[Core] Module %s has not declared any RegisterMimeTypes method, cannot guess its supported mime-types.\n", ifce->module_name));
+ }
+ gf_modules_close_interface(ifce);
+ }
+ }
+ GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Finished Initializing Mime Types."));
+
}
+
tmp->uri_relocators = gf_list_new();
tmp->locales.relocate_uri = term_check_locales;
tmp->locales.term = tmp;
gf_list_del(term->extensions);
if (term->unthreaded_extensions) gf_list_del(term->unthreaded_extensions);
+ while (term->in_event_filter) gf_sleep(1);
gf_mx_p(term->evt_mx);
if (term->event_filters) {
gf_list_del(term->event_filters);
assert(!term->nodes_pending);
gf_list_del(term->media_queue);
if (term->downloader) gf_dm_del(term->downloader);
+
+ gf_mx_del(term->media_queue_mx);
if (term->locales.szAbsRelocatedPath) gf_free(term->locales.szAbsRelocatedPath);
gf_list_del(term->uri_relocators);
GF_ClientService *ns;
/*we could run into a deadlock if some thread has requested opening of a URL. If we cannot
- grab the network now, we'll do our management at the next cycle*/
- if (!gf_mx_try_lock(term->net_mx))
+ grab the media queue now, we'll do our management at the next cycle*/
+ if (!gf_mx_try_lock(term->media_queue_mx))
return;
/*play ODs that need it*/
while (gf_list_count(term->media_queue)) {
Bool destroy = 0;
+ u32 act_type;
GF_ObjectManager *odm = (GF_ObjectManager *)gf_list_get(term->media_queue, 0);
gf_list_rem(term->media_queue, 0);
- /*unlock net before sending play/pause*/
- gf_mx_v(term->net_mx);
+ /*unlock media queue before sending play/pause*/
+ gf_mx_v(term->media_queue_mx);
- switch (odm->action_type) {
+ act_type = odm->action_type;
+ odm->action_type = GF_ODM_ACTION_PLAY;
+ switch (act_type) {
case GF_ODM_ACTION_STOP:
- if (odm->codec && odm->codec->CB && (odm->codec->CB->Capacity==1)) {
+ if (odm->mo /*&& odm->codec && odm->codec->CB && (odm->codec->CB->Capacity==1)*/)
+ {
if (odm->mo->OD_ID==GF_MEDIA_EXTERNAL_ID) destroy = 1;
else if (odm->OD && (odm->OD->objectDescriptorID==GF_MEDIA_EXTERNAL_ID)) destroy = 1;
}
case GF_ODM_ACTION_DELETE:
gf_odm_disconnect(odm, 2);
break;
+ case GF_ODM_ACTION_SCENE_DISCONNECT:
+ assert(odm->subscene);
+ gf_odm_stop(odm, 1);
+ gf_scene_disconnect(odm->subscene, 1);
+ break;
+ case GF_ODM_ACTION_SCENE_RECONNECT:
+ assert(odm->subscene);
+ gf_scene_disconnect(odm->subscene, 0);
+ break;
+ case GF_ODM_ACTION_SCENE_INLINE_RESTART:
+ gf_scene_mpeg4_inline_restart(odm->subscene);
+ break;
}
- odm->action_type = GF_ODM_ACTION_PLAY;
- /*relock net before sending play/pause*/
- gf_mx_p(term->net_mx);
+ /*relock before sending play/pause*/
+ gf_mx_p(term->media_queue_mx);
}
- gf_mx_v(term->net_mx);
+ gf_mx_v(term->media_queue_mx);
/*lock to avoid any start attemps from compositor*/
if (!gf_mx_try_lock(term->compositor->mx))
gf_sc_lock(term->compositor, LockIt);
}
+/*locks media quaue*/
+void gf_term_lock_media_queue(GF_Terminal *term, Bool LockIt)
+{
+ if (LockIt) {
+ gf_mx_p(term->media_queue_mx);
+ } else {
+ gf_mx_v(term->media_queue_mx);
+ }
+}
void gf_term_lock_net(GF_Terminal *term, Bool LockIt)
{
GF_ObjectManager *an_od;
GF_Scene *scene;
- if (!odm) return;
+ if (!odm || !odm->net_service) return;
if (odm->mo) {
count = gf_list_count(odm->mo->nodes);
if (!count) return;
gf_odm_disconnect(odm, 1);
return;
}
+ odm->net_service->nb_odm_users++;
gf_term_lock_net(term, 0);
/*OK connect*/
}
}
- e = gf_sm_load_string(&load, com, 1);
+ e = gf_sm_load_init(&load);
+ if (!e) e = gf_sm_load_string(&load, com, 1);
+ gf_sm_load_done(&load);
if (!e) {
u32 j, au_count, st_count;
st_count = gf_list_count(load.ctx->streams);
return gf_sc_paste_text(term->compositor, txt);
}
-Bool gf_term_forward_event(GF_Terminal *term, GF_Event *evt, Bool consumed)
+Bool gf_term_forward_event(GF_Terminal *term, GF_Event *evt, Bool consumed, Bool forward_only)
{
if (!term) return 0;
if (term->event_filters) {
- GF_TermExt *ext;
+ GF_TermEventFilter *ef;
u32 i=0;
+
gf_mx_p(term->evt_mx);
- while ((ext=gf_list_enum(term->event_filters, &i))) {
- if (ext->process(ext, GF_TERM_EXT_EVENT, evt)) {
- gf_mx_v(term->evt_mx);
- return 0;
+ term->in_event_filter ++;
+ gf_mx_v(term->evt_mx);
+ while ((ef=gf_list_enum(term->event_filters, &i))) {
+ if (ef->on_event(ef->udta, evt, consumed)) {
+ term->in_event_filter --;
+ return 1;
}
}
- gf_mx_v(term->evt_mx);
+ term->in_event_filter --;
}
- if (!consumed && term->user->EventProc)
+ if (!forward_only && !consumed && term->user->EventProc)
return term->user->EventProc(term->user->opaque, evt);
return 0;
}
-GF_EXPORT
-Bool gf_term_send_event(GF_Terminal *term, GF_Event *evt)
+GF_Err gf_term_add_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef)
{
- return gf_term_forward_event(term, evt, 0);
+ GF_Err e;
+ if (!terminal || !ef || !ef->on_event) return GF_BAD_PARAM;
+ while (terminal->in_event_filter) gf_sleep(1);
+ gf_mx_p(terminal->evt_mx);
+ if (!terminal->event_filters) terminal->event_filters = gf_list_new();
+ e = gf_list_add(terminal->event_filters, ef);
+ gf_mx_v(terminal->evt_mx);
+ return e;
}
-void gf_term_register_event_filter(GF_Terminal *term, GF_TermExt *filter)
+GF_Err gf_term_remove_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef)
{
- if (!term || !filter) return;
- if (!term->event_filters) {
- term->event_filters = gf_list_new();
- }
- gf_mx_p(term->evt_mx);
- if (gf_list_find(term->event_filters, filter)<0) {
- gf_list_add(term->event_filters, filter);
+ if (!terminal || !ef || !terminal->event_filters) return GF_BAD_PARAM;
+
+ while (terminal->in_event_filter) gf_sleep(1);
+ gf_mx_p(terminal->evt_mx);
+ gf_list_del_item(terminal->event_filters, ef);
+ if (!gf_list_count(terminal->event_filters)) {
+ gf_list_del(terminal->event_filters);
+ terminal->event_filters=NULL;
}
- gf_mx_v(term->evt_mx);
+ gf_mx_v(terminal->evt_mx);
+ return GF_OK;
}
-void gf_term_unregister_event_filter(GF_Terminal *term, GF_TermExt *filter)
-{
- if (!term || !filter) return;
- if (!term->event_filters) return;
-
- gf_mx_p(term->evt_mx);
- gf_list_del_item(term->event_filters, filter);
- if (!gf_list_count(term->event_filters)) {
- gf_list_del(term->event_filters);
- term->event_filters = NULL;
- }
- gf_mx_v(term->evt_mx);
+GF_EXPORT
+Bool gf_term_send_event(GF_Terminal *term, GF_Event *evt)
+{
+ return gf_term_forward_event(term, evt, 0, 0);
}
enum
scene->scene_codec->decio->SetCapabilities(scene->scene_codec->decio, caps);
}
i=0;
- while (odm = gf_list_enum(scene->resources, &i) ) {
+ while (NULL != (odm = gf_list_enum(scene->resources, &i))) {
if (odm->codec)
odm->codec->decio->SetCapabilities(odm->codec->decio, caps);
if (odm->subscene)
void gf_term_switch_quality(GF_Terminal *term, Bool up)
{
gf_scene_switch_quality(term->root_scene, up);
-}
\ No newline at end of file
+}
+
--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Authors: Romain Bouqueau - Jean Le Feuvre\r
+ * Copyright (c) Telecom ParisTech 2010-20XX \r
+ * \r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / common tools sub-project\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#if !defined(WIN32) && !defined(_WIN32_WCE)\r
+/* This is needed for asprintf */\r
+#define _GNU_SOURCE\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+#endif\r
+\r
+#include <string.h>\r
+\r
+\r
+#define STD_MALLOC 0\r
+#define GOOGLE_MALLOC 1\r
+#define INTEL_MALLOC 2\r
+#define DL_MALLOC 3\r
+\r
+#ifdef WIN32\r
+#define USE_MALLOC STD_MALLOC\r
+#else\r
+#define USE_MALLOC STD_MALLOC\r
+#endif\r
+\r
+\r
+#if defined(_WIN32_WCE) && !defined(strdup)\r
+#define strdup _strdup\r
+#endif\r
+\r
+/*\r
+ WARNING - you must enable C++ style compilation of this file (error.c) to be able to compile\r
+ with google malloc. This is not set by default in the project settings.\r
+*/\r
+#if (USE_MALLOC==GOOGLE_MALLOC)\r
+#include <config.h>\r
+#include <base/commandlineflags.h>\r
+#include <google/malloc_extension.h>\r
+\r
+#ifdef WIN32\r
+#pragma comment(lib, "libtcmalloc_minimal")\r
+#endif\r
+\r
+#define MALLOC malloc\r
+#define CALLOC calloc\r
+#define REALLOC realloc\r
+#define FREE free\r
+#define STRDUP(a) return strdup(a);\r
+\r
+/*we must use c++ compiler for google malloc :( */\r
+#define CDECL extern "C"\r
+#endif\r
+\r
+#if (USE_MALLOC==INTEL_MALLOC)\r
+#define CDECL \r
+CDECL void * scalable_malloc(size_t size);\r
+CDECL void * scalable_realloc(void* ptr, size_t size);\r
+CDECL void * scalable_calloc(size_t num, size_t size);\r
+CDECL void scalable_free(void* ptr);\r
+\r
+#ifdef WIN32\r
+#pragma comment(lib, "tbbmalloc.lib")\r
+#endif\r
+\r
+#define MALLOC scalable_malloc\r
+#define CALLOC scalable_calloc\r
+#define REALLOC scalable_realloc\r
+#define FREE scalable_free\r
+#define STRDUP(_a) if (_a) { unsigned int len = strlen(_a)+1; char *ptr = (char *) scalable_malloc(len); strcpy(ptr, _a); return ptr; } else { return NULL; }\r
+\r
+#endif\r
+\r
+#ifndef CDECL \r
+#define CDECL \r
+#endif\r
+\r
+#if (USE_MALLOC==DL_MALLOC)\r
+\r
+CDECL void * dlmalloc(size_t size);\r
+CDECL void * dlrealloc(void* ptr, size_t size);\r
+CDECL void * dlcalloc(size_t num, size_t size);\r
+CDECL void dlfree(void* ptr);\r
+\r
+#define MALLOC dlmalloc\r
+#define CALLOC dlcalloc\r
+#define REALLOC dlrealloc\r
+#define FREE dlfree\r
+#define STRDUP(_a) if (_a) { unsigned int len = strlen(_a)+1; char *ptr = (char *) dlmalloc(len); strcpy(ptr, _a); return ptr; } else { return NULL; }\r
+\r
+#endif\r
+\r
+#if (USE_MALLOC==STD_MALLOC)\r
+\r
+#include <stdlib.h>\r
+\r
+#define MALLOC malloc\r
+#define CALLOC calloc\r
+#define REALLOC realloc\r
+#define FREE free\r
+#define STRDUP(a) return strdup(a);\r
+\r
+#endif\r
+\r
+\r
+\r
+#ifndef _WIN32_WCE\r
+#include <assert.h>\r
+#endif\r
+\r
+/*This is to handle cases where config.h is generated at the root of the gpac build tree (./configure)\r
+This is only needed when building libgpac and modules when libgpac is not installed*/\r
+#ifdef GPAC_HAVE_CONFIG_H\r
+# include "config.h"\r
+#else\r
+# include <gpac/configuration.h>\r
+#endif\r
+\r
+/*GPAC memory tracking*/\r
+#ifndef GPAC_MEMORY_TRACKING\r
+\r
+CDECL\r
+void *gf_malloc(size_t size)\r
+{\r
+ return MALLOC(size);\r
+}\r
+CDECL\r
+void *gf_calloc(size_t num, size_t size_of)\r
+{\r
+ return CALLOC(num, size_of);\r
+}\r
+CDECL\r
+void *gf_realloc(void *ptr, size_t size)\r
+{\r
+ return REALLOC(ptr, size);\r
+}\r
+CDECL\r
+void gf_free(void *ptr)\r
+{\r
+ FREE(ptr);\r
+}\r
+CDECL\r
+char *gf_strdup(const char *str)\r
+{\r
+ STRDUP(str);\r
+}\r
+\r
+#else\r
+\r
+\r
+CDECL\r
+size_t gpac_allocated_memory = 0;\r
+size_t gpac_nb_alloc_blocs = 0;\r
+\r
+#ifdef _WIN32_WCE\r
+#define assert(p)\r
+#endif\r
+\r
+static void register_address(void *ptr, size_t size, char *filename, int line);\r
+static int unregister_address(void *ptr, char *filename, int line);\r
+\r
+static void gf_memory_log(unsigned int level, const char *fmt, ...);\r
+enum\r
+{\r
+ /*! Log message describes an error*/\r
+ GF_MEMORY_ERROR = 1,\r
+ /*! Log message describes a warning*/\r
+ GF_MEMORY_WARNING,\r
+ /*! Log message is informational (state, etc..)*/\r
+ GF_MEMORY_INFO,\r
+ /*! Log message is a debug info*/\r
+ GF_MEMORY_DEBUG,\r
+};\r
+\r
+static void *gf_mem_malloc_basic(size_t size, char *filename, int line)\r
+{\r
+ return MALLOC(size);\r
+}\r
+static void *gf_mem_calloc_basic(size_t num, size_t size_of, char *filename, int line)\r
+{\r
+ return CALLOC(num, size_of);\r
+}\r
+static void *gf_mem_realloc_basic(void *ptr, size_t size, char *filename, int line)\r
+{\r
+ return REALLOC(ptr, size);\r
+}\r
+static void gf_mem_free_basic(void *ptr, char *filename, int line)\r
+{\r
+ FREE(ptr);\r
+}\r
+static char *gf_mem_strdup_basic(const char *str, char *filename, int line)\r
+{\r
+ STRDUP(str);\r
+}\r
+\r
+void *gf_mem_malloc_tracker(size_t size, char *filename, int line)\r
+{\r
+ void *ptr = MALLOC(size);\r
+ if (!ptr) {\r
+ gf_memory_log(GF_MEMORY_ERROR, "[MemTracker] malloc() has returned a NULL pointer\n");\r
+ assert(0);\r
+ } else {\r
+ register_address(ptr, size, filename, line);\r
+ }\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] malloc %3d bytes at 0x%08X\n in file %s at line %d\n", size, ptr, filename, line);\r
+ return ptr;\r
+}\r
+\r
+void *gf_mem_calloc_tracker(size_t num, size_t size_of, char *filename, int line)\r
+{\r
+ size_t size = num*size_of;\r
+ void *ptr = CALLOC(num, size_of);\r
+ if (!ptr) {\r
+ gf_memory_log(GF_MEMORY_ERROR, "[MemTracker] calloc() has returned a NULL pointer\n");\r
+ assert(0);\r
+ } else {\r
+ register_address(ptr, size, filename, line);\r
+ }\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] calloc %3d bytes at 0x%08X\n in file %s at line %d\n", size, ptr, filename, line);\r
+ return ptr;\r
+}\r
+\r
+void gf_mem_free_tracker(void *ptr, char *filename, int line)\r
+{\r
+ int size_prev;\r
+ if (ptr && (size_prev=unregister_address(ptr, filename, line))) {\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] free %3d bytes at 0x%08X\n in file %s at line %d\n", size_prev, ptr, filename, line);\r
+ FREE(ptr);\r
+ }\r
+}\r
+\r
+void *gf_mem_realloc_tracker(void *ptr, size_t size, char *filename, int line)\r
+{\r
+ void *ptr_g;\r
+ int size_prev;\r
+ if (!ptr) {\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] realloc() from a null pointer: calling malloc() instead\n");\r
+ return gf_mem_malloc_tracker(size, filename, line);\r
+ }\r
+ /*a) The return value is NULL if the size is zero and the buffer argument is not NULL. In this case, the original block is freed.*/\r
+ if (!size) {\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] realloc() with a null size: calling free() instead\n");\r
+ gf_mem_free_tracker(ptr, filename, line);\r
+ return NULL;\r
+ }\r
+ ptr_g = REALLOC(ptr, size);\r
+ if (!ptr_g) {\r
+ /*b) The return value is NULL if there is not enough available memory to expand the block to the given size. In this case, the original block is unchanged.*/\r
+ gf_memory_log(GF_MEMORY_ERROR, "[MemTracker] realloc() has returned a NULL pointer\n");\r
+ assert(0);\r
+ } else {\r
+ size_prev = unregister_address(ptr, filename, line);\r
+ register_address(ptr_g, size, filename, line);\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] realloc %3d (instead of %3d) bytes at 0x%08X (instead of 0x%08X)\n in file %s at line %d\n", size, size_prev, ptr_g, ptr, filename, line);\r
+ }\r
+ return ptr_g;\r
+}\r
+\r
+char *gf_mem_strdup_tracker(const char *str, char *filename, int line)\r
+{\r
+ char *ptr;\r
+ if (!str) return NULL;\r
+ ptr = (char*)gf_mem_malloc_tracker(strlen(str)+1, filename, line);\r
+ strcpy(ptr, str);\r
+ return ptr;\r
+}\r
+\r
+static void *(*gf_mem_malloc_proto)(size_t size, char *filename, int line) = gf_mem_malloc_basic;\r
+static void *(*gf_mem_calloc_proto)(size_t num, size_t size_of, char *filename, int line) = gf_mem_calloc_basic;\r
+static void *(*gf_mem_realloc_proto)(void *ptr, size_t size, char *filename, int line) = gf_mem_realloc_basic;\r
+static void (*gf_mem_free_proto)(void *ptr, char *filename, int line) = gf_mem_free_basic;\r
+static char *(*gf_mem_strdup_proto)(const char *str, char *filename, int line) = gf_mem_strdup_basic;\r
+\r
+CDECL\r
+void *gf_mem_malloc(size_t size, char *filename, int line)\r
+{\r
+ return gf_mem_malloc_proto(size, filename, line);\r
+}\r
+CDECL\r
+void *gf_mem_calloc(size_t num, size_t size_of, char *filename, int line)\r
+{\r
+ return gf_mem_calloc_proto(num, size_of, filename, line);\r
+}\r
+CDECL\r
+void *gf_mem_realloc(void *ptr, size_t size, char *filename, int line)\r
+{\r
+ return gf_mem_realloc_proto(ptr, size, filename, line);\r
+}\r
+CDECL\r
+void gf_mem_free(void *ptr, char *filename, int line)\r
+{\r
+ gf_mem_free_proto(ptr, filename, line);\r
+}\r
+CDECL\r
+char *gf_mem_strdup(const char *str, char *filename, int line)\r
+{\r
+ return gf_mem_strdup_proto(str, filename, line);\r
+}\r
+\r
+CDECL\r
+void gf_mem_enable_tracker()\r
+{\r
+ gf_mem_malloc_proto = gf_mem_malloc_tracker;\r
+ gf_mem_calloc_proto = gf_mem_calloc_tracker;\r
+ gf_mem_realloc_proto = gf_mem_realloc_tracker;\r
+ gf_mem_free_proto = gf_mem_free_tracker;\r
+ gf_mem_strdup_proto = gf_mem_strdup_tracker;\r
+}\r
+\r
+\r
+#define GPAC_MEMORY_TRACKING_HASH_TABLE 1\r
+#if GPAC_MEMORY_TRACKING_HASH_TABLE\r
+\r
+#define HASH_ENTRIES 4096\r
+\r
+typedef struct s_memory_element\r
+{\r
+ void *ptr;\r
+ int size;\r
+ struct s_memory_element *next;\r
+ int line;\r
+ char *filename;\r
+} memory_element;\r
+\r
+/*pointer to the first element of the list*/\r
+typedef memory_element** memory_list;\r
+\r
+static unsigned int gf_memory_hash(void *ptr)\r
+{\r
+ return (((unsigned int)ptr>>4)+(unsigned int)ptr)%HASH_ENTRIES;\r
+}\r
+\r
+#else\r
+\r
+typedef struct s_memory_element\r
+{\r
+ void *ptr;\r
+ int size;\r
+ struct s_memory_element *next;\r
+ int line;\r
+ char *filename;\r
+} memory_element;\r
+\r
+/*pointer to the first element of the list*/\r
+typedef memory_element* memory_list;\r
+\r
+#endif\r
+\r
+\r
+/*base functions (add, find, del_item, del) are implemented upon a stack model*/\r
+static void gf_memory_add_stack(memory_element **p, void *ptr, int size, char *filename, int line)\r
+{\r
+ memory_element *element = (memory_element*)MALLOC(sizeof(memory_element)+strlen(filename)+1);\r
+ element->ptr = ptr;\r
+ element->size = size;\r
+ element->line = line;\r
+ element->next = *p;\r
+ element->filename = (char*)&(element->filename)+sizeof(element->filename);\r
+ strcpy(element->filename, filename);\r
+ *p = element;\r
+}\r
+\r
+/*returns the position of a ptr from a memory_element, 0 if not found*/\r
+static int gf_memory_find_stack(memory_element *p, void *ptr)\r
+{\r
+ int i = 1;\r
+ memory_element *element = p;\r
+ while (element) {\r
+ if (element->ptr == ptr) {\r
+ return i;\r
+ }\r
+ element = element->next;\r
+ i++;\r
+ }\r
+ return 0;\r
+}\r
+\r
+/*returns the size of the deleted item*/\r
+static int gf_memory_del_item_stack(memory_element **p, void *ptr)\r
+{\r
+ int size;\r
+ memory_element *curr_element=*p, *prev_element=NULL;\r
+ while (curr_element) {\r
+ if (curr_element->ptr == ptr) {\r
+ if (prev_element) prev_element->next = curr_element->next;\r
+ else *p = curr_element->next;\r
+ size = curr_element->size;\r
+ FREE(curr_element);\r
+ return size;\r
+ }\r
+ prev_element = curr_element;\r
+ curr_element = curr_element->next;\r
+ }\r
+ return 0;\r
+}\r
+\r
+static void gf_memory_del_stack(memory_element **p)\r
+{\r
+ memory_element *curr_element=*p, *next_element;\r
+ while (curr_element) {\r
+ next_element = curr_element->next;\r
+ FREE(curr_element);\r
+ curr_element = next_element;\r
+ }\r
+ *p = NULL;\r
+}\r
+\r
+\r
+#if GPAC_MEMORY_TRACKING_HASH_TABLE\r
+\r
+/*this list is implemented as a stack to minimise the cost of freeing recent allocations*/\r
+static void gf_memory_add(memory_list *p, void *ptr, int size, char *filename, int line)\r
+{\r
+ unsigned int hash;\r
+ if (!*p) *p = (memory_list) CALLOC(HASH_ENTRIES, sizeof(memory_element*));\r
+ assert(*p);\r
+\r
+ hash = gf_memory_hash(ptr);\r
+ gf_memory_add_stack(&((*p)[hash]), ptr, size, filename, line);\r
+}\r
+\r
+\r
+static int gf_memory_find(memory_list p, void *ptr)\r
+{\r
+ unsigned int hash;\r
+ assert(p);\r
+ if (!p) return 0;\r
+ hash = gf_memory_hash(ptr);\r
+ return gf_memory_find_stack(p[hash], ptr);\r
+}\r
+\r
+static int gf_memory_del_item(memory_list *p, void *ptr)\r
+{\r
+ unsigned int hash;\r
+ int ret;\r
+ memory_element **sub_list;\r
+ if (!*p) *p = (memory_list) CALLOC(HASH_ENTRIES, sizeof(memory_element*));\r
+ assert(*p);\r
+ hash = gf_memory_hash(ptr);\r
+ sub_list = &((*p)[hash]);\r
+ if (!sub_list) return 0;\r
+ ret = gf_memory_del_item_stack(sub_list, ptr);\r
+ if (ret && !((*p)[hash])) {\r
+ /*check for deletion*/\r
+ int i;\r
+ for (i=0; i<HASH_ENTRIES; i++)\r
+ if (&((*p)[i])) break;\r
+ if (i==HASH_ENTRIES) {\r
+ FREE(*p);\r
+ p = NULL;\r
+ }\r
+ }\r
+ return ret;\r
+}\r
+\r
+static void gf_memory_del(memory_list *p)\r
+{\r
+ int i;\r
+ for (i=0; i<HASH_ENTRIES; i++)\r
+ gf_memory_del_stack(&((*p)[i]));\r
+ FREE(*p);\r
+ p = NULL;\r
+}\r
+\r
+#else\r
+\r
+#define gf_memory_add gf_memory_add_stack\r
+#define gf_memory_del gf_memory_del_stack\r
+#define gf_memory_del_item gf_memory_del_item_stack\r
+#define gf_memory_find gf_memory_find_stack\r
+\r
+#endif\r
+\r
+\r
+#endif /*GPAC_MEMORY_TRACKING*/\r
+\r
+\r
+#include <gpac/tools.h>\r
+\r
+\r
+/*GPAC memory tracking*/\r
+#ifdef GPAC_MEMORY_TRACKING\r
+\r
+#include <gpac/thread.h>\r
+\r
+/*global lists of allocations and deallocations*/\r
+memory_list memory_add = NULL, memory_rem = NULL;\r
+GF_Mutex *gpac_allocations_lock = NULL;\r
+\r
+static void register_address(void *ptr, size_t size, char *filename, int line)\r
+{\r
+ /*mutex initialization*/\r
+ if (gpac_allocations_lock == 0) {\r
+ assert(!memory_add);\r
+ assert(!memory_rem);\r
+ gpac_allocations_lock = (GF_Mutex*)1; /*must be non-null to avoid a recursive infinite call*/\r
+ gpac_allocations_lock = gf_mx_new("gpac_allocations_lock");\r
+ }\r
+ else if (gpac_allocations_lock == (void*)1) {\r
+ /*we're initializing the mutex (ie called by the gf_mx_new() above)*/\r
+ return;\r
+ }\r
+\r
+ /*lock*/\r
+ gf_mx_p(gpac_allocations_lock);\r
+\r
+ gf_memory_add(&memory_add, ptr, size, filename, line);\r
+ gf_memory_del_item(&memory_rem, ptr); /*the same block can be reallocated, so remove it from the deallocation list*/\r
+\r
+ /*update stats*/\r
+ gpac_allocated_memory += size;\r
+ gpac_nb_alloc_blocs++;\r
+ \r
+ /*gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] register %6d bytes at 0x%08X (%8d Bytes in %4d Blocks allocated)\n", size, ptr, gpac_allocated_memory, gpac_nb_alloc_blocs);*/\r
+\r
+ /*unlock*/\r
+ gf_mx_v(gpac_allocations_lock);\r
+}\r
+\r
+/*returns the size of the unregistered block*/\r
+static int unregister_address(void *ptr, char *filename, int line)\r
+{\r
+ int size = 0; /*default: failure*/\r
+\r
+ /*lock*/\r
+ gf_mx_p(gpac_allocations_lock);\r
+\r
+ if (!memory_add) {\r
+ if (!memory_rem) {\r
+ /*assume we're rather destroying the mutex (ie calling the gf_mx_del() below)\r
+ than being called by free() before the first allocation occured*/\r
+ return 1;\r
+ /*gf_memory_log(GF_MEMORY_ERROR, "[MemTracker] calling free() before the first allocation occured\n");\r
+ assert(0); */\r
+ }\r
+ } else {\r
+ if (!gf_memory_find(memory_add, ptr)) {\r
+ int pos;\r
+ if (!(pos=gf_memory_find(memory_rem, ptr))) {\r
+ gf_memory_log(GF_MEMORY_ERROR, "[MemTracker] trying to free a never allocated block (0x%08X)\n", ptr);\r
+ /* assert(0); */ /*don't assert since this is often due to allocations that occured out of gpac (fonts, etc.)*/\r
+ } else {\r
+ int i;\r
+ unsigned int hash = gf_memory_hash(ptr);\r
+ memory_element *element = memory_rem[hash];\r
+ assert(element);\r
+ for (i=1; i<pos; i++)\r
+ element = element->next;\r
+ assert(element);\r
+ gf_memory_log(GF_MEMORY_ERROR, "[MemTracker] the block 0x%08X trying to be deleted\n in file %s at line %d\n has already been freed\n in file %s at line %d\n", ptr, filename, line, element->filename, element->line);\r
+ assert(0);\r
+ }\r
+ } else {\r
+ size = gf_memory_del_item(&memory_add, ptr);\r
+ assert(size>=0);\r
+\r
+ /*update stats*/\r
+ gpac_allocated_memory -= size;\r
+ gpac_nb_alloc_blocs--;\r
+\r
+ /*gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] unregister %6d bytes at 0x%08X (%8d bytes in %4d blocks remaining)\n", size, ptr, gpac_allocated_memory, gpac_nb_alloc_blocs); */\r
+\r
+ /*the allocation list is empty: free the lists to avoid a leak (we should be exiting)*/\r
+ if (!memory_add) {\r
+ assert(!gpac_allocated_memory);\r
+ assert(!gpac_nb_alloc_blocs);\r
+\r
+ /*we destroy the mutex we own, then we return*/\r
+ gf_mx_del(gpac_allocations_lock);\r
+ gpac_allocations_lock = NULL;\r
+\r
+ gf_memory_log(GF_MEMORY_DEBUG, "[MemTracker] the allocated-blocks-list is empty: the freed-blocks-list will be emptied too.\n");\r
+ gf_memory_del(&memory_rem);\r
+\r
+ return size;\r
+ } else {\r
+ gf_memory_add(&memory_rem, ptr, size, filename, line);\r
+ }\r
+ }\r
+ }\r
+\r
+ /*unlock*/\r
+ gf_mx_v(gpac_allocations_lock);\r
+\r
+ return size;\r
+}\r
+\r
+static void gf_memory_log(unsigned int level, const char *fmt, ...)\r
+{\r
+ va_list vl;\r
+ char msg[1024];\r
+ assert(strlen(fmt) < 200);\r
+ va_start(vl, fmt);\r
+ vsprintf(msg, fmt, vl);\r
+ GF_LOG(level, GF_LOG_MEMORY, (msg));\r
+ va_end(vl);\r
+}\r
+\r
+/*prints allocations sum-up*/\r
+void gf_memory_size()\r
+{\r
+ unsigned int level = gpac_nb_alloc_blocs ? GF_MEMORY_WARNING : GF_MEMORY_INFO;\r
+ gf_memory_log(level, "[MemTracker] Total: %d bytes allocated on %d blocks\n", gpac_allocated_memory, gpac_nb_alloc_blocs);\r
+}\r
+\r
+/*prints the state of current allocations*/\r
+void gf_memory_print()\r
+{\r
+ /*if lists are empty, the mutex is also NULL*/\r
+ if (!memory_add) {\r
+ assert(!gpac_allocations_lock);\r
+ gf_memory_log(GF_MEMORY_INFO, "[MemTracker] gf_memory_print(): the memory tracker is not initialized.\n");\r
+ } else {\r
+ int i=0;\r
+ assert(gpac_allocations_lock);\r
+\r
+ gf_memory_log(GF_MEMORY_INFO, "\n[MemTracker] Printing the current state of allocations:\n");\r
+\r
+ /*lock*/\r
+ gf_mx_p(gpac_allocations_lock);\r
+#if GPAC_MEMORY_TRACKING_HASH_TABLE\r
+ for (i=0; i<HASH_ENTRIES; i++) {\r
+ memory_element *curr_element = memory_add[i], *next_element;\r
+#else\r
+ {\r
+ memory_element *curr_element = memory_add, *next_element;\r
+#endif\r
+ while (curr_element) {\r
+ next_element = curr_element->next;\r
+ gf_memory_log(GF_MEMORY_INFO, "[MemTracker] Memory Block 0x%08X (size %d) allocated\n in file %s at line %d\n", curr_element->ptr, curr_element->size, curr_element->filename, curr_element->line);\r
+ curr_element = next_element;\r
+ }\r
+ }\r
+ gf_memory_size();\r
+\r
+ /*unlock*/\r
+ gf_mx_v(gpac_allocations_lock);\r
+ }\r
+}\r
+\r
+#endif /*GPAC_MEMORY_TRACKING*/\r
+\r
+\r
+/*gf_asprintf(): as_printf portable implementation*/\r
+#if defined(WIN32) || defined(_WIN32_WCE)\r
+static GFINLINE int gf_vasprintf (char **strp, const char *fmt, va_list ap)\r
+{\r
+ int vsn_ret, size;\r
+ char *buffer, *realloc_buffer;\r
+\r
+ size = 2*strlen(fmt); /*first guess for the size*/\r
+ buffer = (char*)gf_malloc(size);\r
+ if (buffer == NULL)\r
+ return -1;\r
+\r
+ while (1) {\r
+ vsn_ret = _vsnprintf(buffer, size, fmt, ap);\r
+\r
+ /* If that worked, return the string. */\r
+ if (vsn_ret>-1 && vsn_ret<size) {\r
+ *strp = buffer;\r
+ return vsn_ret;\r
+ }\r
+\r
+ /*else double the allocated size*/\r
+ size *= 2;\r
+ realloc_buffer = (char*)gf_realloc(buffer, size);\r
+ if (!realloc_buffer) {\r
+ gf_free(buffer);\r
+ return -1;\r
+ } else {\r
+ buffer = realloc_buffer;\r
+ }\r
+\r
+ }\r
+}\r
+#endif\r
+\r
+int gf_asprintf(char **strp, const char *fmt, ...)\r
+{\r
+ s32 size;\r
+ va_list args;\r
+ va_start(args, fmt);\r
+#if defined(WIN32) || defined(_WIN32_WCE)\r
+ size = gf_vasprintf(strp, fmt, args);\r
+#else\r
+ size = asprintf(strp, fmt, args);\r
+#endif \r
+ va_end(args);\r
+ return size;\r
+}\r
return j;
}
+
+#include <zlib.h>
+
+#define ZLIB_COMPRESS_SAFE 4
+
+GF_Err gf_gz_compress_payload(char **data, u32 data_len, u32 *max_size)
+{
+ z_stream stream;
+ int err;
+ char *dest = (char *)gf_malloc(sizeof(char)*data_len*ZLIB_COMPRESS_SAFE);
+ stream.next_in = (Bytef*)(*data) ;
+ stream.avail_in = (uInt)data_len ;
+ stream.next_out = ( Bytef*)dest;
+ stream.avail_out = (uInt)data_len*ZLIB_COMPRESS_SAFE;
+ stream.zalloc = (alloc_func)NULL;
+ stream.zfree = (free_func)NULL;
+ stream.opaque = (voidpf)NULL;
+
+ err = deflateInit(&stream, 9);
+ if (err != Z_OK) {
+ gf_free(dest);
+ return GF_IO_ERR;
+ }
+
+ err = deflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ deflateEnd(&stream);
+ gf_free(dest);
+ return GF_IO_ERR;
+ }
+ if (data_len <stream.total_out) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("[GZ] compressed data (%d) larger than input (%d)\n", (u32) stream.total_out, (u32) data_len ));
+ }
+
+ if (*max_size < stream.total_out) {
+ *max_size = data_len*ZLIB_COMPRESS_SAFE;
+ *data = gf_realloc(*data, *max_size * sizeof(char));
+ }
+
+ memcpy((*data) , dest, sizeof(char)*stream.total_out);
+ *max_size = stream.total_out;
+ gf_free(dest);
+
+ deflateEnd(&stream);
+ return GF_OK;
+}
+
+GF_Err gf_gz_decompress_payload(char *data, u32 data_len, char **uncompressed_data, u32 *out_size)
+{
+ z_stream d_stream;
+ GF_Err e = GF_OK;
+ int err;
+ u32 size = 4096;
+
+ *uncompressed_data = gf_malloc(sizeof(char)*4096);
+ if (!*uncompressed_data) return GF_OUT_OF_MEM;
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+ d_stream.next_in = (Bytef*)data;
+ d_stream.avail_in = data_len;
+ d_stream.next_out = (Bytef*) *uncompressed_data;
+ d_stream.avail_out = 4096;
+
+ err = inflateInit(&d_stream);
+ if (err == Z_OK) {
+ while (d_stream.total_in < data_len) {
+ err = inflate(&d_stream, Z_NO_FLUSH);
+ if (err < Z_OK) {
+ e = GF_NON_COMPLIANT_BITSTREAM;
+ break;
+ }
+ if (err==Z_STREAM_END) break;
+
+ size *= 2;
+ *uncompressed_data = gf_realloc(*uncompressed_data, sizeof(char)*size);
+ if (!*uncompressed_data) return GF_OUT_OF_MEM;
+ d_stream.avail_out = (size - d_stream.total_out);
+ d_stream.next_out = (Bytef*) ( *uncompressed_data + d_stream.total_out);
+ }
+ *out_size = d_stream.total_out;
+ inflateEnd(&d_stream);
+ return GF_OK;
+ }
+ if (e!=GF_OK) {
+ gf_free(*uncompressed_data);
+ *uncompressed_data = NULL;
+ }
+ return e;
+}
\ No newline at end of file
GF_EXPORT
-GF_BitStream *gf_bs_new(char *buffer, u64 BufferSize, u32 mode)
+GF_BitStream *gf_bs_new(const char *buffer, u64 BufferSize, u32 mode)
{
GF_BitStream *tmp;
if ( (buffer && ! BufferSize)) return NULL;
Used only in WRITE mode, as we don't know the real size during allocation...
return -1 for bad param or gf_malloc failed
return nbBytes cut*/
-static u32 BS_CutBuffer(GF_BitStream *bs)
+static s32 BS_CutBuffer(GF_BitStream *bs)
{
- u32 nbBytes;
+ s32 nbBytes;
if ( (bs->bsmode != GF_BITSTREAM_WRITE_DYN) && (bs->bsmode != GF_BITSTREAM_WRITE)) return (u32) -1;
/*Align our buffer or we're dead!*/
gf_bs_align(bs);
*outSize = 0;
gf_free(bs->original);
} else {
- BS_CutBuffer(bs);
- *output = bs->original;
+ s32 copy = BS_CutBuffer(bs);
+ if (copy < 0){
+ *output = NULL;
+ } else
+ *output = bs->original;
*outSize = (u32) bs->size;
}
bs->original = NULL;
--- /dev/null
+/*
+ * GPAC Multimedia Framework
+ *
+ * Authors: Jean Le Feuvre
+ * Copyright (c) 2005-2005 ENST
+ * All rights reserved
+ *
+ * This file is part of GPAC / common tools sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <gpac/cache.h>
+#include <gpac/network.h>
+#include <gpac/download.h>
+#include <gpac/token.h>
+#include <gpac/thread.h>
+#include <gpac/list.h>
+#include <gpac/base_coding.h>
+#include <gpac/crypt.h>
+#include <gpac/tools.h>
+#include <gpac/config_file.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined(_BSD_SOURCE) || _XOPEN_SOURCE >= 500
+#include <unistd.h>
+#endif
+
+static const char * CACHE_SECTION_NAME = "cache";
+
+static const char * CACHE_SECTION_NAME_URL = "url";
+
+static const char * CACHE_SECTION_NAME_ETAG = "ETag";
+
+static const char * CACHE_SECTION_NAME_MIME_TYPE = "Content-Type";
+
+static const char * CACHE_SECTION_NAME_CONTENT_SIZE = "Content-Length";
+
+static const char * CACHE_SECTION_NAME_LAST_MODIFIED = "Last-Modified";
+
+enum CacheValid
+{
+ NO_VALIDATION = 0,
+ MUST_REVALIDATE = 1,
+ IS_HTTPS = 2,
+ CORRUPTED = 4,
+ NO_CACHE = 8
+};
+
+struct __CacheReaderStruct {
+ FILE * readPtr;
+ s64 readPosition;
+};
+
+typedef struct __DownloadedRangeStruc {
+ u32 start;
+ u32 end;
+ const char * filename;
+} * DownloadedRange;
+
+
+/**
+ * This opaque structure handles the data from the cache
+ */
+struct __DownloadedCacheEntryStruct
+{
+ /**
+ * URL of the cache (never NULL)
+ */
+ char * url;
+ /**
+ * Hash of the cache (never NULL)
+ */
+ char * hash;
+ /**
+ * Name of the cache filename, (can be NULL)
+ */
+ char * cache_filename;
+ /**
+ * Name of the cached properties filename , (can be NULL)
+ */
+ GF_Config * properties;
+ /**
+ * Theorical size of cache if any
+ */
+ u32 contentLength;
+ /**
+ * Real size of cache
+ */
+ u32 cacheSize;
+ /**
+ * GMT timestamp for revalidation
+ */
+ u32 validity;
+ /**
+ * The last modification time on the server
+ */
+ char * serverLastModified;
+ /**
+ * The last modification time of the cache if any
+ */
+ char * diskLastModified;
+ /**
+ * ETag if any
+ */
+ char * serverETag;
+ /**
+ * ETag if any
+ */
+ char * diskETag;
+ /**
+ * Mime-type (never NULL)
+ */
+ char * mimeType;
+ /**
+ * Write pointer for the cache
+ */
+ FILE * writeFilePtr;
+ /**
+ * Bytes written during this cache session
+ */
+ u32 written_in_cache;
+ /**
+ * Flag indicating whether we have to revalidate
+ */
+ enum CacheValid flags;
+
+ const GF_DownloadSession * write_session;
+
+ GF_Mutex * write_mutex;
+
+ GF_List * sessions;
+
+ Bool deletableFilesOnDelete;
+
+ GF_DownloadManager * dm;
+};
+
+Bool enum_cache_files(void *cbck, char *item_name, char *item_path) {
+ const char * startPattern;
+ int sz;
+ assert( cbck );
+ assert( item_name );
+ assert( item_path);
+ startPattern = (const char *) cbck;
+ sz = strlen( startPattern );
+ if (!strncmp(startPattern, item_name, sz)) {
+ if (GF_OK != gf_delete_file(item_path))
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[CACHE] : failed to cleanup file %s\n", item_path));
+ }
+ return 0;
+}
+
+static const char * cache_file_prefix = "gpac_cache_";
+
+GF_Err gf_cache_delete_all_cached_files(const char * directory) {
+ gf_enum_dir_item item = &enum_cache_files;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("Deleting cached files in %s...\n", directory));
+ return gf_enum_directory( directory, 0, item, (void*)cache_file_prefix, NULL);
+}
+
+void gf_cache_entry_set_delete_files_when_deleted(const DownloadedCacheEntry entry) {
+ if (entry)
+ entry->deletableFilesOnDelete = 1;
+}
+
+Bool gf_cache_entry_is_delete_files_when_deleted(const DownloadedCacheEntry entry)
+{
+ if (!entry)
+ return 0;
+ return entry->deletableFilesOnDelete;
+}
+
+#define CHECK_ENTRY if (!entry) { GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] entry is null at " __FILE__ ":%d\n", __LINE__)); return GF_BAD_PARAM; }
+
+/*
+ * Getters functions
+ */
+
+const char * gf_cache_get_etag_on_server ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->serverETag : NULL;
+}
+
+const char * gf_cache_get_etag_on_disk ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->serverETag : NULL;
+}
+
+const char * gf_cache_get_mime_type ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->mimeType : NULL;
+}
+
+GF_Err gf_cache_set_etag_on_server(const DownloadedCacheEntry entry, const char * eTag ) {
+ if (!entry)
+ return GF_BAD_PARAM;
+ if (entry->serverETag)
+ gf_free(entry->serverETag);
+ entry->serverETag = eTag ? gf_strdup(eTag) : NULL;
+ return GF_OK;
+}
+
+GF_Err gf_cache_set_etag_on_disk(const DownloadedCacheEntry entry, const char * eTag ) {
+ if (!entry)
+ return GF_BAD_PARAM;
+ if (entry->diskETag)
+ gf_free(entry->diskETag);
+ entry->diskETag = eTag ? gf_strdup(eTag) : NULL;
+ return GF_OK;
+}
+
+GF_Err gf_cache_set_mime_type(const DownloadedCacheEntry entry, const char * mime_type ) {
+ if (!entry)
+ return GF_BAD_PARAM;
+ if (entry->mimeType)
+ gf_free(entry->mimeType);
+ entry->mimeType = mime_type? gf_strdup( mime_type) : NULL;
+ return GF_OK;
+}
+
+Bool gf_cache_is_cached_on_disk(const DownloadedCacheEntry entry ) {
+ if (entry == NULL)
+ return 0;
+ return entry->flags & NO_CACHE;
+}
+
+const char * gf_cache_get_url ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->url : NULL;
+}
+
+const char * gf_cache_get_hash ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->hash : NULL;
+}
+
+const char * gf_cache_get_last_modified_on_server ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->serverLastModified : NULL;
+}
+
+const char * gf_cache_get_last_modified_on_disk ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->diskLastModified : NULL;
+}
+
+GF_Err gf_cache_set_last_modified_on_server ( const DownloadedCacheEntry entry, const char * newLastModified )
+{
+ if (!entry)
+ return GF_BAD_PARAM;
+ if (entry->serverLastModified)
+ gf_free(entry->serverLastModified);
+ entry->serverLastModified = newLastModified ? gf_strdup(newLastModified) : NULL;
+ return GF_OK;
+}
+
+GF_Err gf_cache_set_last_modified_on_disk ( const DownloadedCacheEntry entry, const char * newLastModified )
+{
+ if (!entry)
+ return GF_BAD_PARAM;
+ if (entry->diskLastModified)
+ gf_free(entry->diskLastModified);
+ entry->diskLastModified = newLastModified ? gf_strdup(newLastModified) : NULL;
+ return GF_OK;
+}
+
+#define _CACHE_TMP_SIZE 4096
+
+GF_Err gf_cache_flush_disk_cache ( const DownloadedCacheEntry entry )
+{
+ CHECK_ENTRY;
+ if ( !entry->properties)
+ return GF_OK;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[CACHE] gf_cache_flush_disk_cache:%d for entry=%p\n", __LINE__, entry));
+ gf_cfg_set_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_URL, entry->url);
+ if (entry->mimeType)
+ gf_cfg_set_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_MIME_TYPE, entry->mimeType);
+ if (entry->diskETag)
+ gf_cfg_set_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_ETAG, entry->diskETag);
+ if (entry->diskLastModified)
+ gf_cfg_set_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_LAST_MODIFIED, entry->diskLastModified);
+ {
+ char buff[16];
+ snprintf(buff, 16, "%d", entry->contentLength);
+ gf_cfg_set_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_CONTENT_SIZE, buff);
+ }
+ return gf_cfg_save ( entry->properties );
+}
+
+u32 gf_cache_get_cache_filesize ( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->cacheSize : -1;
+}
+
+const char * gf_cache_get_cache_filename( const DownloadedCacheEntry entry )
+{
+ return entry ? entry->cache_filename : NULL;
+}
+
+GF_Err appendHttpCacheHeaders(const DownloadedCacheEntry entry, char * httpRequest) {
+ if (!entry || !httpRequest)
+ return GF_BAD_PARAM;
+ if (entry->flags)
+ return GF_OK;
+ if (gf_cache_check_if_cache_file_is_corrupted(entry))
+ return GF_OK;
+ /* OK, this is potentially bad if httpRequest is not big enough */
+ if (entry->diskETag) {
+ strcat(httpRequest, "If-None-Match: ");
+ strcat(httpRequest, entry->diskETag);
+ strcat(httpRequest, "\r\n");
+ }
+ if (entry->diskLastModified) {
+ strcat(httpRequest, "If-Modified-Since: ");
+ strcat(httpRequest, entry->diskLastModified);
+ strcat(httpRequest, "\r\n");
+ }
+ return GF_OK;
+}
+
+#define _CACHE_HASH_SIZE 20
+
+#define _CACHE_MAX_EXTENSION_SIZE 6
+
+static const char * default_cache_file_suffix = ".dat";
+
+static const char * cache_file_info_suffix = ".txt";
+
+DownloadedCacheEntry gf_cache_create_entry ( GF_DownloadManager * dm, const char * cache_directory, const char * url )
+{
+ char tmp[_CACHE_TMP_SIZE];
+ u8 hash[_CACHE_HASH_SIZE];
+ int sz;
+ char ext[_CACHE_MAX_EXTENSION_SIZE];
+ DownloadedCacheEntry entry = NULL;
+ if ( !dm || !url || !cache_directory) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK,
+ ("[CACHE] gf_cache_create_entry :%d, dm=%p, url=%s cache_directory=%s, aborting.\n", __LINE__, dm, url, cache_directory));
+ return entry;
+ }
+ sz = strlen ( url );
+ if ( sz > _CACHE_TMP_SIZE )
+ {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK,
+ ("[CACHE] gf_cache_create_entry:%d : ERROR, URL is too long (%d chars), more than %d chars.\n", __LINE__, sz, _CACHE_TMP_SIZE ));
+ return entry;
+ }
+ tmp[0] = '\0';
+ /*generate hash of the full url*/
+ strcpy ( tmp, url );
+ gf_sha1_csum ( tmp, strlen ( tmp ), hash );
+ tmp[0] = 0;
+ {
+ int i;
+ for ( i=0; i<20; i++ )
+ {
+ char t[3];
+ t[2] = 0;
+ sprintf ( t, "%02X", hash[i] );
+ strcat ( tmp, t );
+ }
+ }
+ assert ( strlen ( tmp ) == (_CACHE_HASH_SIZE * 2) );
+
+ entry = gf_malloc ( sizeof ( struct __DownloadedCacheEntryStruct ) );
+ if ( !entry ) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("gf_cache_create_entry:%d : OUT of memory !\n", __LINE__));
+ return NULL;
+ }
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK,
+ ("[CACHE] gf_cache_create_entry:%d, entry=%p\n", __LINE__, entry));
+ entry->properties = NULL;
+ entry->writeFilePtr = NULL;
+ entry->url = gf_strdup ( url );
+ entry->hash = gf_strdup ( tmp );
+ entry->mimeType = NULL;
+ /* Sizeof cache directory + hash + possible extension */
+ entry->cache_filename = gf_malloc ( strlen ( cache_directory ) + strlen(cache_file_prefix) + strlen(tmp) + _CACHE_MAX_EXTENSION_SIZE + 1);
+
+ entry->cacheSize = 0;
+ entry->contentLength = 0;
+ entry->serverETag = NULL;
+ entry->diskETag = NULL;
+ entry->flags = NO_VALIDATION;
+ entry->validity = 0;
+ entry->diskLastModified = NULL;
+ entry->serverLastModified = NULL;
+ entry->dm = dm;
+ {
+ char name[1024];
+ snprintf(name, 1024, "CachedEntryWriteMx=%p, url=%s", (void*) entry, url);
+ entry->write_mutex = gf_mx_new(name);
+ assert( entry->write_mutex);
+ }
+ entry->deletableFilesOnDelete = 0;
+ entry->write_session = NULL;
+ entry->sessions = gf_list_new();
+ if ( !entry->hash || !entry->url || !entry->cache_filename || !entry->sessions)
+ {
+ GF_Err err;
+ /* Probably out of memory */
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] gf_cache_create_entry:%d, aborting due to OUT of MEMORY !\n", __LINE__));
+ err = gf_cache_delete_entry ( entry );
+ assert ( err == GF_OK );
+ return NULL;
+ }
+ tmp[0] = '\0';
+ strcpy ( entry->cache_filename, cache_directory );
+ strcat( entry->cache_filename, cache_file_prefix );
+ strcat ( entry->cache_filename, entry->hash );
+ strcpy ( tmp, url );
+
+ {
+ char * parser;
+ parser = strrchr ( tmp, '?' );
+ if ( parser )
+ parser[0] = '\0';
+ parser = strrchr ( tmp, '#' );
+ if ( parser )
+ parser[0] = '\0';
+ parser = strrchr ( tmp, '.' );
+ if ( parser && ( strlen ( parser ) < _CACHE_MAX_EXTENSION_SIZE ) )
+ strncpy(ext, parser, _CACHE_MAX_EXTENSION_SIZE);
+ else
+ strncpy(ext, default_cache_file_suffix, _CACHE_MAX_EXTENSION_SIZE);
+ assert (strlen(ext));
+ strcat( entry->cache_filename, ext);
+ }
+ tmp[0] = '\0';
+ strcpy( tmp, cache_file_prefix);
+ strcat( tmp, entry->hash );
+ strcat( tmp , ext);
+ strcat ( tmp, cache_file_info_suffix );
+ entry->properties = gf_cfg_force_new ( cache_directory, tmp );
+ if ( !entry->properties )
+ {
+ GF_Err err;
+ /* OUT of memory ? */
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] gf_cache_create_entry:%d, aborting due to OUT of MEMORY !\n", __LINE__));
+ err = gf_cache_delete_entry ( entry );
+ assert ( err == GF_OK );
+ return NULL;
+ }
+ gf_cache_set_etag_on_disk(entry, gf_cfg_get_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_ETAG));
+ gf_cache_set_etag_on_server(entry, gf_cfg_get_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_ETAG));
+ gf_cache_set_mime_type(entry, gf_cfg_get_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_MIME_TYPE));
+ gf_cache_set_last_modified_on_disk(entry, gf_cfg_get_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_LAST_MODIFIED));
+ gf_cache_set_last_modified_on_server(entry, gf_cfg_get_key(entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_LAST_MODIFIED));
+ {
+ const char * keyValue = gf_cfg_get_key ( entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_URL );
+ if ( keyValue == NULL || stricmp ( url, keyValue ) )
+ entry->flags |= CORRUPTED;
+ }
+ gf_cache_check_if_cache_file_is_corrupted(entry);
+
+ return entry;
+}
+
+GF_Err gf_cache_set_content_length( const DownloadedCacheEntry entry, u32 length ) {
+ CHECK_ENTRY;
+ entry->contentLength = length;
+ return GF_OK;
+}
+
+u32 gf_cache_get_content_length( const DownloadedCacheEntry entry) {
+ return entry ? entry->contentLength : 0;
+}
+
+GF_Err gf_cache_close_write_cache( const DownloadedCacheEntry entry, const GF_DownloadSession * sess, Bool success ) {
+ GF_Err e = GF_OK;
+ CHECK_ENTRY;
+ if (!sess || !entry->write_session || entry->write_session != sess)
+ return GF_OK;
+ assert( sess == entry->write_session );
+ if (entry->writeFilePtr) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK,
+ ("[CACHE] Closing file %s, %d bytes written.\n", entry->cache_filename, entry->written_in_cache));
+ if (fflush( entry->writeFilePtr ) || fclose( entry->writeFilePtr ))
+ e = GF_IO_ERR;
+ e|= gf_cache_flush_disk_cache(entry);
+ if (e == GF_OK && success) {
+ e|= gf_cache_set_last_modified_on_disk( entry, gf_cache_get_last_modified_on_server(entry));
+ e|= gf_cache_set_etag_on_disk( entry, gf_cache_get_etag_on_server(entry));
+ }
+ e|= gf_cache_flush_disk_cache(entry);
+#if defined(_BSD_SOURCE) || _XOPEN_SOURCE >= 500
+ /* On UNIX, be sure to flush all the data */
+ sync();
+#endif
+ entry->writeFilePtr = NULL;
+ if (GF_OK != e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[CACHE] Failed to fully write file on cache, e=%d\n", e));
+ }
+ }
+ entry->write_session = NULL;
+ gf_mx_v(entry->write_mutex);
+ return e;
+}
+
+
+GF_Err gf_cache_open_write_cache( const DownloadedCacheEntry entry, const GF_DownloadSession * sess ) {
+ CHECK_ENTRY;
+ if (!sess)
+ return GF_BAD_PARAM;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK,("[CACHE] Locking write mutex %p for entry=%s\n", (void*) (entry->write_mutex), entry->url) );
+ gf_mx_p(entry->write_mutex);
+ entry->write_session = sess;
+ assert( ! entry->writeFilePtr);
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK,
+ ("[CACHE] Opening cache file %s for write (%s)...", entry->cache_filename, entry->url));
+ entry->writeFilePtr = gf_f64_open(entry->cache_filename, "wb");
+ if (!entry->writeFilePtr) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK,
+ ("[CACHE] Error while opening cache file %s for writting.", entry->cache_filename));
+ entry->write_session = NULL;
+ gf_mx_v(entry->write_mutex);
+ return GF_IO_ERR;
+ }
+ entry->written_in_cache = 0;
+ return GF_OK;
+}
+
+GF_Err gf_cache_write_to_cache( const DownloadedCacheEntry entry, const GF_DownloadSession * sess, const char * data, const u32 size) {
+ u32 readen;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[CACHE] gf_cache_write_to_cache:%d\n", __LINE__));
+ CHECK_ENTRY;
+ if (!data || !entry->writeFilePtr || sess != entry->write_session) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("Incorrect parameter : data=%p, entry->writeFilePtr=%p at "__FILE__, data, entry->writeFilePtr));
+ return GF_BAD_PARAM;
+ }
+ readen = fwrite(data, sizeof(char), size, entry->writeFilePtr);
+ if (readen > 0)
+ entry->written_in_cache+= readen;
+ if (readen != size) {
+ /* Something bad happened */
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK,
+ ("[CACHE] Error while writting %d bytes of data to cache : has written only %d bytes.", size, readen));
+ gf_cache_close_write_cache(entry, sess, 0);
+ gf_delete_file(entry->cache_filename);
+ return GF_IO_ERR;
+ }
+ if (fflush(entry->writeFilePtr)) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK,
+ ("[CACHE] Error while flushing data bytes to cache file : %s.", entry->cache_filename));
+ gf_cache_close_write_cache(entry, sess, 0);
+ gf_delete_file(entry->cache_filename);
+ return GF_IO_ERR;
+ }
+ return GF_OK;
+}
+
+GF_CacheReader gf_cache_reader_new(const DownloadedCacheEntry entry) {
+ GF_CacheReader reader;
+ if (entry == NULL)
+ return NULL;
+ reader = gf_malloc(sizeof(struct __CacheReaderStruct));
+ if (reader == NULL)
+ return NULL;
+ reader->readPtr = gf_f64_open( entry->cache_filename, "rb" );
+ reader->readPosition = 0;
+ if (!reader->readPtr) {
+ gf_cache_reader_del(reader);
+ return NULL;
+ }
+ return reader;
+}
+
+GF_Err gf_cache_reader_del( GF_CacheReader handle ) {
+ if (!handle)
+ return GF_BAD_PARAM;
+ if (handle->readPtr)
+ fclose(handle->readPtr);
+ handle->readPtr = NULL;
+ handle->readPosition = -1;
+ return GF_OK;
+}
+
+s64 gf_cache_reader_seek_at( GF_CacheReader reader, u64 seekPosition) {
+ if (!reader)
+ return -1;
+ reader->readPosition = gf_f64_seek(reader->readPtr, seekPosition, SEEK_SET);
+ return reader->readPosition;
+}
+
+s64 gf_cache_reader_get_position( const GF_CacheReader reader) {
+ if (!reader)
+ return -1;
+ return reader->readPosition;
+}
+
+s64 gf_cache_reader_get_currentSize( GF_CacheReader reader );
+
+s64 gf_cache_reader_full_size( GF_CacheReader reader );
+
+s32 gf_cache_reader_read( GF_CacheReader reader, char * buff, s32 length) {
+ s32 readen;
+ if (!reader || !buff || length < 0 || !reader->readPtr)
+ return -1;
+ readen = fread(buff, sizeof(char), length, reader->readPtr);
+ if (readen > 0)
+ reader->readPosition+= readen;
+ return readen;
+}
+
+GF_Err gf_cache_delete_entry ( const DownloadedCacheEntry entry )
+{
+ if ( !entry )
+ return GF_OK;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[CACHE] gf_cache_delete_entry:%d, entry=%p\n", __LINE__, entry));
+ if (entry->writeFilePtr) {
+ /** Cache should have been close before, abornormal situation */
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] gf_cache_delete_entry:%d, entry=%p, cache has not been closed properly\n", __LINE__, entry));
+ fclose(entry->writeFilePtr);
+ }
+ if (entry->write_mutex) {
+ gf_mx_del(entry->write_mutex);
+ }
+ if (entry->deletableFilesOnDelete) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[CACHE] url %s cleanup, deleting %s...\n", entry->url, entry->cache_filename));
+ if (GF_OK != gf_delete_file(entry->cache_filename))
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] gf_cache_delete_entry:%d, failed to delete file %s\n", __LINE__, entry->cache_filename));
+ }
+ entry->write_mutex = NULL;
+ entry->write_session = NULL;
+ entry->writeFilePtr = NULL;
+ if (entry->serverETag)
+ gf_free(entry->serverETag);
+ entry->serverETag = NULL;
+
+ if (entry->diskETag)
+ gf_free(entry->diskETag);
+ entry->diskETag = NULL;
+
+ if (entry->serverLastModified)
+ gf_free(entry->serverLastModified);
+ entry->serverLastModified = NULL;
+
+ if (entry->diskLastModified)
+ gf_free(entry->diskLastModified);
+ entry->diskLastModified = NULL;
+
+ if ( entry->hash )
+ {
+ gf_free ( entry->hash );
+ entry->hash = NULL;
+ }
+ if ( entry->url )
+ {
+ gf_free ( entry->url );
+ entry->url = NULL;
+ }
+ if ( entry->mimeType )
+ {
+ gf_free ( entry->mimeType );
+ entry->mimeType = NULL;
+ }
+ if ( entry->cache_filename )
+ {
+ gf_free ( entry->cache_filename );
+ entry->cache_filename = NULL;
+ }
+ if ( entry->properties )
+ {
+ char * propfile;
+ if (entry->deletableFilesOnDelete)
+ propfile = gf_cfg_get_filename(entry->properties);
+ else
+ propfile = NULL;
+ gf_cfg_del ( entry->properties );
+ entry->properties = NULL;
+ if (propfile) {
+ if (GF_OK != gf_delete_file( propfile ))
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] gf_cache_delete_entry:%d, failed to delete file %s\n", __LINE__, propfile));
+ gf_free ( propfile );
+ }
+ }
+ entry->dm = NULL;
+ if (entry->sessions) {
+ assert( gf_list_count(entry->sessions) == 0);
+ gf_list_del(entry->sessions);
+ entry->sessions = NULL;
+ }
+ gf_free (entry);
+ return GF_OK;
+}
+
+Bool gf_cache_check_if_cache_file_is_corrupted(const DownloadedCacheEntry entry) {
+
+ FILE *the_cache = gf_f64_open ( entry->cache_filename, "rb" );
+ if ( the_cache )
+ {
+ char * endPtr;
+ const char * keyValue = gf_cfg_get_key ( entry->properties, CACHE_SECTION_NAME, CACHE_SECTION_NAME_CONTENT_SIZE );
+
+ gf_f64_seek ( the_cache, 0, SEEK_END );
+ entry->cacheSize = ( u32 ) gf_f64_tell ( the_cache );
+ fclose ( the_cache );
+ if (keyValue) {
+ entry->contentLength = strtoul( keyValue, &endPtr, 10);
+ if (*endPtr!='\0' || entry->contentLength != entry->cacheSize) {
+ entry->flags |= CORRUPTED;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[CACHE] gf_cache_create_entry:%d, cached file and cache info size mismatch.\n", __LINE__));
+ }
+ } else
+ entry->flags |= CORRUPTED;
+
+ } else {
+ entry->flags |= CORRUPTED;
+ }
+ if (entry->flags & CORRUPTED)
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[CACHE] gf_cache_create_entry:%d, CACHE is corrupted !\n", __LINE__));
+
+ return entry->flags & CORRUPTED;
+}
+
+s32 gf_cache_remove_session_from_cache_entry(DownloadedCacheEntry entry, GF_DownloadSession * sess) {
+ u32 i;
+ s32 count;
+ if (!entry || !sess || !entry->sessions)
+ return -1;
+ count = gf_list_count(entry->sessions);
+ for (i = 0 ; i < (u32)count; i++) {
+ GF_DownloadSession * s = gf_list_get(entry->sessions, i);
+ if (s == sess) {
+ gf_list_rem(entry->sessions, i);
+ count --;
+ break;
+ }
+ }
+ if (entry->write_session == sess) {
+ /* OK, this is not optimal to close it since we are in a mutex,
+ * but we don't want to risk to have another session opening
+ * a not fully closed cache entry */
+ if (entry->writeFilePtr){
+ if (fclose(entry->writeFilePtr)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[CACHE] gf_cache_remove_session_from_cache_entry:%d, Failed to properly fclose cache file '%s' of url '%s', cache may be corrupted !\n", __LINE__, entry->cache_filename, entry->url));
+ }
+ }
+ entry->writeFilePtr = NULL;
+ entry->write_session = NULL;
+ gf_mx_v(entry->write_mutex);
+ }
+ return count;
+}
+
+u32 gf_cache_get_sessions_count_for_cache_entry(const DownloadedCacheEntry entry)
+{
+ if (!entry)
+ return 0;
+ return gf_list_count(entry->sessions);
+}
+
+
+s32 gf_cache_add_session_to_cache_entry(DownloadedCacheEntry entry, GF_DownloadSession * sess) {
+ u32 i;
+ s32 count;
+ if (!entry || !sess || !entry->sessions)
+ return -1;
+ count = gf_list_count(entry->sessions);
+ for (i = 0 ; i < (u32)count; i++) {
+ GF_DownloadSession * s = gf_list_get(entry->sessions, i);
+ if (s == sess) {
+ return count;
+ }
+ }
+ gf_list_add(entry->sessions, sess);
+ return count + 1;
+}
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
*/
static s32 is_init = 0;
/**/
-static void yuv2rgb_init(void)
+static void yuv2rgb_init(void)
{
s32 i;
if (is_init) return;
unsigned char *dst2 = dst + dststride;
unsigned char *y_src2 = y_src + y_stride;
unsigned char *a_src2 = a_src + y_stride;
-
+
yuv2rgb_init();
hw = width / 2;
s32 pos;
u16 *dst = (u16 *)_dst;
u8 a, r, g, b;
+ x_pitch /= 2;
pos = 0x10000;
while (dst_w) {
while ( pos >= 0x10000L ) {
s32 pos;
u16 *dst = (u16 *)_dst;
u8 a, r, g, b;
+ x_pitch /= 2;
pos = 0x10000;
while (dst_w) {
while ( pos >= 0x10000L ) {
}
}
-static void copy_row_rgb_32(u8 *src, u32 src_w, u8 *_dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+static void copy_row_bgrx(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
{
u8 a, r, g, b;
s32 pos = 0x10000L;
- u32 *dst = (u32 *)_dst;
-
+
while (dst_w) {
while ( pos >= 0x10000L ) {
r = *src++; g = *src++; b = *src++; a = *src++;
pos -= 0x10000L;
}
- if (a) *dst = GF_COL_ARGB(a, r, g, b);
+ if (a) {
+ dst[0] = b;
+ dst[1] = g;
+ dst[2] = r;
+ dst[3] = 0xFF;
+ }
dst += x_pitch;
pos += h_inc;
dst_w--;
}
}
-static void copy_row_bgr_32(u8 *src, u32 src_w, u8 *_dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+static void copy_row_rgbx(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
{
u8 a, r, g, b;
s32 pos = 0x10000L;
- u32 *dst = (u32 *)_dst;
-
+
+ while ( dst_w) {
+ while ( pos >= 0x10000L ) {
+ r = *src++; g = *src++; b = *src++; a = *src++;
+ pos -= 0x10000L;
+ }
+ if (a) {
+ dst[0] = r;
+ dst[1] = g;
+ dst[2] = b;
+ dst[3] = 0xFF;
+ }
+ dst+=x_pitch;
+ pos += h_inc;
+ dst_w--;
+ }
+}
+
+static void copy_row_rgbd(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+{
+ u8 a, r, g, b;
+ s32 pos = 0x10000L;
+
while ( dst_w) {
while ( pos >= 0x10000L ) {
r = *src++; g = *src++; b = *src++; a = *src++;
pos -= 0x10000L;
}
- if (a) *dst = GF_COL_ARGB(b, g, r, a);
+ dst[0] = r;
+ dst[1] = g;
+ dst[2] = b;
+ dst[3] = a;
+
dst+=x_pitch;
pos += h_inc;
dst_w--;
u32 _r, _g, _b, a, r, g, b;
s32 pos;
u16 col, *dst = (u16 *)_dst;
-
-
+ x_pitch /= 2;
pos = 0x10000;
while (dst_w) {
while ( pos >= 0x10000L ) {
u32 _r, _g, _b, a, r, g, b;
s32 pos;
u16 col, *dst = (u16 *)_dst;
-
-
+ x_pitch /= 2;
pos = 0x10000;
while (dst_w) {
while ( pos >= 0x10000L ) {
}
if (a && alpha) {
- _r = dst[0]; _g = dst[0]; _b = dst[0];
+ _b = dst[0];
+ _g = dst[1];
+ _r = dst[2];
a = mul255(a, alpha);
- dst[2] = mul255(a, r - _r) + _r;
- dst[1] = mul255(a, g - _g) + _g;
dst[0] = mul255(a, b - _b) + _b;
-
+ dst[1] = mul255(a, g - _g) + _g;
+ dst[2] = mul255(a, r - _r) + _r;
}
dst += x_pitch;
pos += h_inc;
}
-static void merge_row_rgb_32(u8 *src, u32 src_w, u8 *_dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+static void merge_row_bgrx(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
{
- u32 _r, _g, _b, a, r, g, b, col;
+ u32 _r, _g, _b, a, r, g, b;
s32 pos;
- u32 *dst = (u32 *)_dst;
-
+
pos = 0x10000;
while (dst_w) {
while ( pos >= 0x10000L ) {
}
if (a) {
- col = *dst;
- _r = GF_COL_R(col);
- _g = GF_COL_G(col);
- _b = GF_COL_B(col);
+ _b = dst[0];
+ _g = dst[1];
+ _r = dst[2];
+
_r = mul255(a, r - _r) + _r;
_g = mul255(a, g - _g) + _g;
_b = mul255(a, b - _b) + _b;
- *dst = GF_COL_ARGB(0xFF, _r, _g, _b);
+
+ dst[0] = _b;
+ dst[1] = _g;
+ dst[2] = _r;
+ dst[3] = 0xFF;
}
dst += x_pitch;
pos += h_inc;
}
}
+static void merge_row_rgbx(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+{
+ u32 _r, _g, _b, a, r, g, b;
+ s32 pos;
+
+ pos = 0x10000;
+ while (dst_w) {
+ while ( pos >= 0x10000L ) {
+ r = *src++; g = *src++; b = *src++; a = *src++;
+ a = mul255(a, alpha);
+ pos -= 0x10000L;
+ }
-static void merge_row_argb_32(u8 *src, u32 src_w, u8 *_dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+ if (a) {
+ _r = dst[0];
+ _g = dst[1];
+ _b = dst[2];
+ _r = mul255(a, r - _r) + _r;
+ _g = mul255(a, g - _g) + _g;
+ _b = mul255(a, b - _b) + _b;
+ dst[0] = _r;
+ dst[1] = _g;
+ dst[2] = _b;
+ dst[3] = 0xFF;
+ }
+ dst += x_pitch;
+ pos += h_inc;
+ dst_w--;
+ }
+}
+
+
+static void merge_row_bgra(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
{
- u32 _a, _r, _g, _b, a, r, g, b, col;
+ u32 _a, _r, _g, _b, a, r, g, b;
s32 pos;
- u32 *dst = (u32 *)_dst;
-
+
pos = 0x10000;
while (dst_w) {
while ( pos >= 0x10000L ) {
}
if (a) {
- col = *dst;
- _r = GF_COL_R(col);
- _g = GF_COL_G(col);
- _b = GF_COL_B(col);
- if (GF_COL_A(col)) {
+ _b = dst[0];
+ _g = dst[1];
+ _r = dst[2];
+ if (dst[3]) {
_a = mul255(a, a) + mul255(0xFF-a, 0xFF);
_r = mul255(a, r - _r) + _r;
_g = mul255(a, g - _g) + _g;
_b = mul255(a, b - _b) + _b;
- *dst = GF_COL_ARGB(_a, _r, _g, _b);
+ dst[0] = _b;
+ dst[1] = _g;
+ dst[2] = _r;
+ dst[3] = _a;
} else {
- *dst = GF_COL_ARGB(a, r, g, b);
+ dst[0] = b;
+ dst[1] = g;
+ dst[2] = r;
+ dst[3] = a;
+ }
+ }
+ dst += x_pitch;
+ pos += h_inc;
+ dst_w--;
+ }
+}
+
+static void merge_row_rgba(u8 *src, u32 src_w, u8 *dst, u32 dst_w, s32 h_inc, s32 x_pitch, u8 alpha)
+{
+ u32 _a, _r, _g, _b, a, r, g, b;
+ s32 pos;
+ pos = 0x10000;
+ while (dst_w) {
+ while ( pos >= 0x10000L ) {
+ r = *src++; g = *src++; b = *src++; a = *src++;
+ pos -= 0x10000L;
+ a = mul255(a, alpha);
+ }
+
+ if (a) {
+ _r = dst[0];
+ _g = dst[1];
+ _b = dst[2];
+ if (dst[3]) {
+ _a = mul255(a, a) + mul255(0xFF-a, 0xFF);
+ _r = mul255(a, r - _r) + _r;
+ _g = mul255(a, g - _g) + _g;
+ _b = mul255(a, b - _b) + _b;
+ dst[0] = _r;
+ dst[1] = _g;
+ dst[2] = _b;
+ dst[3] = _a;
+ } else {
+ dst[0] = r;
+ dst[1] = g;
+ dst[2] = b;
+ dst[3] = a;
}
}
dst += x_pitch;
load_line = load_line_rgb_565;
break;
case GF_PIXEL_RGB_24:
+ case GF_PIXEL_RGBS:
load_line = load_line_rgb_24;
break;
case GF_PIXEL_BGR_24:
load_line = load_line_argb;
break;
case GF_PIXEL_RGBA:
+ case GF_PIXEL_RGBAS:
has_alpha = 1;
case GF_PIXEL_RGB_32:
load_line = load_line_rgb_32;
has_alpha = 1;
case GF_PIXEL_YUVD:
yuv_type = 2;
+ yuv2rgb_init();
break;
default:
return GF_NOT_SUPPORTED;
break;
case GF_PIXEL_RGB_32:
dst_bpp = sizeof(unsigned char)*4;
- copy_row = has_alpha ? merge_row_rgb_32: copy_row_rgb_32;
+ copy_row = has_alpha ? merge_row_bgrx : copy_row_bgrx;
break;
case GF_PIXEL_ARGB:
dst_bpp = sizeof(unsigned char)*4;
- copy_row = has_alpha ? merge_row_argb_32: copy_row_rgb_32;
+ copy_row = has_alpha ? merge_row_bgra : copy_row_bgrx;
+ break;
+ case GF_PIXEL_RGBD:
+ dst_bpp = sizeof(unsigned char)*4;
+ copy_row = has_alpha ? merge_row_bgrx : copy_row_rgbd;
break;
case GF_PIXEL_RGBA:
dst_bpp = sizeof(unsigned char)*4;
- copy_row = has_alpha ? merge_row_argb_32: copy_row_bgr_32;
+ copy_row = has_alpha ? merge_row_rgba : copy_row_rgbx;
break;
case GF_PIXEL_BGR_32:
dst_bpp = sizeof(unsigned char)*4;
- copy_row = has_alpha ? merge_row_rgb_32: copy_row_bgr_32;
+ copy_row = has_alpha ? merge_row_rgbx : copy_row_rgbx;
break;
default:
return GF_NOT_SUPPORTED;
}
- /*x_pitch 0 means linear framebuffer*/
+ /*x_pitch 0 means linear framebuffer*/
if (!dst_x_pitch) dst_x_pitch = dst_bpp;
-
+
src_w = src_wnd ? src_wnd->w : src->width;
src_h = src_wnd ? src_wnd->h : src->height;
dst_w = dst_wnd ? dst_wnd->w : dst->width;
dst_w_size = dst_bpp*dst_w;
- /*small opt here: if we need to fetch data from destination, and if destination is
+ /*small opt here: if we need to fetch data from destination, and if destination is
hardware memory, we work on a copy of the destination line*/
if (has_alpha && dst->is_hardware_memory)
dst_temp_bits = (u8 *) gf_malloc(sizeof(u8) * dst_bpp * dst_w);
-
- /*for 2 and 4 bytes colors, precompute pitch for u16 and u32 type casting*/
- if ((dst_bpp==2) || (dst_bpp==4) ) dst_x_pitch /= (s32) dst_bpp;
-
kl = kh = ka = kr = kg = kb = 0;
if (key) {
ka = key->alpha;
}
yuv_init = 1;
rows = flip ? tmp + src_w * 4 : tmp;
-
+
if (cmat) {
for (i=0; i<2*src_w; i++) {
- u32 idx = 4*i;
+ u32 idx = 4*i;
gf_cmx_apply_argb(cmat, &tmp[idx+3], &tmp[idx], &tmp[idx+1], &tmp[idx+2]);
}
}
if (key) {
for (i=0; i<2*src_w; i++) {
- u32 idx = 4*i;
+ u32 idx = 4*i;
s32 thres, v;
v = tmp[idx]-kr; thres = ABS(v);
v = tmp[idx+1]-kg; thres += ABS(v);
rows = tmp;
if (cmat) {
for (i=0; i<src_w; i++) {
- u32 idx = 4*i;
+ u32 idx = 4*i;
gf_cmx_apply_argb(cmat, &tmp[idx+3], &tmp[idx], &tmp[idx+1], &tmp[idx+2]);
}
}
if (key) {
for (i=0; i<src_w; i++) {
- u32 idx = 4*i;
+ u32 idx = 4*i;
s32 thres;
thres = (255 + (tmp[idx]-kr)) % 255;
thres += (255 + (tmp[idx+1]-kg)) % 255;
} else {
memcpy(dst_bits, dst_bits_prev, dst_w_size);
}
-
+
pos_y += inc_y;
prev_row = src_row;
}
GF_EXPORT
-void gf_cmx_set(GF_ColorMatrix *_this,
+void gf_cmx_set(GF_ColorMatrix *_this,
Fixed c1, Fixed c2, Fixed c3, Fixed c4, Fixed c5,
Fixed c6, Fixed c7, Fixed c8, Fixed c9, Fixed c10,
Fixed c11, Fixed c12, Fixed c13, Fixed c14, Fixed c15,
res[2] = gf_mulfix(_this->m[0], w->m[2]) + gf_mulfix(_this->m[1], w->m[7]) + gf_mulfix(_this->m[2], w->m[12]) + gf_mulfix(_this->m[3], w->m[17]);
res[3] = gf_mulfix(_this->m[0], w->m[3]) + gf_mulfix(_this->m[1], w->m[8]) + gf_mulfix(_this->m[2], w->m[13]) + gf_mulfix(_this->m[3], w->m[18]);
res[4] = gf_mulfix(_this->m[0], w->m[4]) + gf_mulfix(_this->m[1], w->m[9]) + gf_mulfix(_this->m[2], w->m[14]) + gf_mulfix(_this->m[3], w->m[19]) + _this->m[4];
-
+
res[5] = gf_mulfix(_this->m[5], w->m[0]) + gf_mulfix(_this->m[6], w->m[5]) + gf_mulfix(_this->m[7], w->m[10]) + gf_mulfix(_this->m[8], w->m[15]);
res[6] = gf_mulfix(_this->m[5], w->m[1]) + gf_mulfix(_this->m[6], w->m[6]) + gf_mulfix(_this->m[7], w->m[11]) + gf_mulfix(_this->m[8], w->m[16]);
res[7] = gf_mulfix(_this->m[5], w->m[2]) + gf_mulfix(_this->m[6], w->m[7]) + gf_mulfix(_this->m[7], w->m[12]) + gf_mulfix(_this->m[8], w->m[17]);
res[8] = gf_mulfix(_this->m[5], w->m[3]) + gf_mulfix(_this->m[6], w->m[8]) + gf_mulfix(_this->m[7], w->m[13]) + gf_mulfix(_this->m[8], w->m[18]);
res[9] = gf_mulfix(_this->m[5], w->m[4]) + gf_mulfix(_this->m[6], w->m[9]) + gf_mulfix(_this->m[7], w->m[14]) + gf_mulfix(_this->m[8], w->m[19]) + _this->m[9];
-
+
res[10] = gf_mulfix(_this->m[10], w->m[0]) + gf_mulfix(_this->m[11], w->m[5]) + gf_mulfix(_this->m[12], w->m[10]) + gf_mulfix(_this->m[13], w->m[15]);
res[11] = gf_mulfix(_this->m[10], w->m[1]) + gf_mulfix(_this->m[11], w->m[6]) + gf_mulfix(_this->m[12], w->m[11]) + gf_mulfix(_this->m[13], w->m[16]);
res[12] = gf_mulfix(_this->m[10], w->m[2]) + gf_mulfix(_this->m[11], w->m[7]) + gf_mulfix(_this->m[12], w->m[12]) + gf_mulfix(_this->m[13], w->m[17]);
res[13] = gf_mulfix(_this->m[10], w->m[3]) + gf_mulfix(_this->m[11], w->m[8]) + gf_mulfix(_this->m[12], w->m[13]) + gf_mulfix(_this->m[13], w->m[18]);
res[14] = gf_mulfix(_this->m[10], w->m[4]) + gf_mulfix(_this->m[11], w->m[9]) + gf_mulfix(_this->m[12], w->m[14]) + gf_mulfix(_this->m[13], w->m[19]) + _this->m[14];
-
+
res[15] = gf_mulfix(_this->m[15], w->m[0]) + gf_mulfix(_this->m[16], w->m[5]) + gf_mulfix(_this->m[17], w->m[10]) + gf_mulfix(_this->m[18], w->m[15]);
res[16] = gf_mulfix(_this->m[15], w->m[1]) + gf_mulfix(_this->m[16], w->m[6]) + gf_mulfix(_this->m[17], w->m[11]) + gf_mulfix(_this->m[18], w->m[16]);
res[17] = gf_mulfix(_this->m[15], w->m[2]) + gf_mulfix(_this->m[16], w->m[7]) + gf_mulfix(_this->m[17], w->m[12]) + gf_mulfix(_this->m[18], w->m[17]);
Bool hasChanged;
};
-GF_EXPORT
-GF_Config *gf_cfg_new(const char *filePath, const char* file_name)
+/*!
+ * \brief Build a full absolute path from a directory and a file_name
+ * \param dest The destination absolute file name properly allocated
+ * \param directory The directory file path
+ * \param file_name The filename
+ * \return NULL if bad parameters specified, dest otherwise
+ */
+static const char * gf_build_full_path( char * dest, const char * directory, const char * file_name){
+ if (!dest || !file_name)
+ return NULL;
+ if (directory) {
+ if (directory[strlen(directory)-1] == GF_PATH_SEPARATOR) {
+ strcpy(dest, directory);
+ strcat(dest, file_name);
+ } else {
+ sprintf(dest, "%s%c%s", directory, GF_PATH_SEPARATOR, file_name);
+ }
+ } else {
+ strcpy(dest, file_name);
+ }
+ return dest;
+}
+
+static void DelSection(IniSection *ptr)
{
+ IniKey *k;
+ if (!ptr) return;
+ if (ptr->keys) {
+ while (gf_list_count(ptr->keys)) {
+ k = (IniKey *) gf_list_get(ptr->keys, 0);
+ if (k->value) gf_free(k->value);
+ if (k->name) gf_free(k->name);
+ gf_free(k);
+ gf_list_rem(ptr->keys, 0);
+ }
+ gf_list_del(ptr->keys);
+ }
+ if (ptr->section_name) gf_free(ptr->section_name);
+ gf_free(ptr);
+}
+
+/*!
+ * \brief Clear the structure
+ * \param iniFile The structure to clear
+ */
+static void gf_cfg_clear(GF_Config * iniFile){
IniSection *p;
+ if (!iniFile) return;
+ if (iniFile->sections){
+ while (gf_list_count(iniFile->sections)) {
+ p = (IniSection *) gf_list_get(iniFile->sections, 0);
+ DelSection(p);
+ gf_list_rem(iniFile->sections, 0);
+ }
+ gf_list_del(iniFile->sections);
+ }
+ if (iniFile->fileName)
+ gf_free(iniFile->fileName);
+ if (iniFile->filePath)
+ gf_free(iniFile->filePath);
+ memset((void *)iniFile, 0, sizeof(GF_Config));
+}
+
+/*!
+ * \brief Parses the config file if any and clears the existing structure
+ */
+static GF_Err gf_cfg_parse_config_file(GF_Config * tmp, const char * filePath, const char * file_name){
+ IniSection *p;
IniKey *k;
FILE *file;
char *ret;
- char fileName[GF_MAX_PATH];
char *line;
u32 line_alloc = MAX_INI_LINE;
- GF_Config *tmp;
-
- if (filePath) {
- if (filePath[strlen(filePath)-1] == GF_PATH_SEPARATOR) {
- strcpy(fileName,filePath);
- strcat(fileName, file_name);
- } else {
- sprintf(fileName, "%s%c%s", filePath, GF_PATH_SEPARATOR, file_name);
- }
- } else {
- strcpy(fileName,file_name);
- }
- file = gf_f64_open(fileName, "rt");
- if (!file) return NULL;
-
- tmp = (GF_Config *)gf_malloc(sizeof(GF_Config));
- memset((void *)tmp, 0, sizeof(GF_Config));
-
+ char fileName[GF_MAX_PATH];
+ gf_build_full_path(fileName, filePath, file_name);
+ gf_cfg_clear(tmp);
tmp->filePath = gf_strdup(filePath);
tmp->fileName = gf_strdup(fileName);
tmp->sections = gf_list_new();
-
- //load the file
+ file = gf_f64_open(fileName, "rt");
+ if (!file)
+ return GF_IO_ERR;
+ /* load the file */
p = NULL;
line = gf_malloc(sizeof(char)*line_alloc);
memset(line, 0, sizeof(char)*line_alloc);
}
if (!ret) continue;
- //get rid of the end of line stuff
+ /* get rid of the end of line stuff */
while (1) {
u32 len = strlen(line);
if (!len) break;
if (line[0] == '#') continue;
- //new section
+ /* new section */
if (line[0] == '[') {
p = (IniSection *) gf_malloc(sizeof(IniSection));
p->keys = gf_list_new();
gf_free(tmp);
fclose(file);
gf_free(line);
- return NULL;
+ return GF_IO_ERR;
}
-// GF_SAFEALLOC(k, IniKey)
+
k = (IniKey *) gf_malloc(sizeof(IniKey));
memset((void *)k, 0, sizeof(IniKey));
ret = strchr(line, '=');
if (ret) {
ret[0] = 0;
k->name = gf_strdup(line);
+ while (k->name[strlen(k->name) - 1] == ' ') k->name[strlen(k->name) - 1] = 0;
ret[0] = '=';
ret += 1;
while (ret[0] == ' ') ret++;
- k->value = gf_strdup(ret);
- while (k->name[strlen(k->name) - 1] == ' ') k->name[strlen(k->name) - 1] = 0;
- while (k->value[strlen(k->value) - 1] == ' ') k->value[strlen(k->value) - 1] = 0;
+ if ( ret[0] != 0) {
+ k->value = gf_strdup(ret);
+ while (k->value[strlen(k->value) - 1] == ' ') k->value[strlen(k->value) - 1] = 0;
+ } else {
+ k->value = gf_strdup("");
+ }
}
gf_list_add(p->keys, k);
}
}
gf_free(line);
fclose(file);
+ return GF_OK;
+}
+
+GF_EXPORT
+GF_Config *gf_cfg_force_new(const char *filePath, const char* file_name){
+ GF_Config *tmp = (GF_Config *)gf_malloc(sizeof(GF_Config));
+ memset((void *)tmp, 0, sizeof(GF_Config));
+ gf_cfg_parse_config_file(tmp, filePath, file_name);
return tmp;
}
-static void DelSection(IniSection *ptr)
+
+GF_EXPORT
+GF_Config *gf_cfg_new(const char *filePath, const char* file_name)
{
- IniKey *k;
- if (!ptr) return;
- if (ptr->keys) {
- while (gf_list_count(ptr->keys)) {
- k = (IniKey *) gf_list_get(ptr->keys, 0);
- if (k->value) gf_free(k->value);
- if (k->name) gf_free(k->name);
- gf_free(k);
- gf_list_rem(ptr->keys, 0);
- }
- gf_list_del(ptr->keys);
+ GF_Config *tmp = (GF_Config *)gf_malloc(sizeof(GF_Config));
+ memset((void *)tmp, 0, sizeof(GF_Config));
+ if (gf_cfg_parse_config_file(tmp, filePath, file_name)){
+ gf_free( tmp );
+ tmp = NULL;
}
- if (ptr->section_name) gf_free(ptr->section_name);
- gf_free(ptr);
+ return tmp;
}
+GF_EXPORT
+char * gf_cfg_get_filename(GF_Config *iniFile)
+{
+ if (!iniFile)
+ return NULL;
+ return iniFile->fileName ? gf_strdup(iniFile->fileName) : NULL;
+}
GF_EXPORT
GF_Err gf_cfg_save(GF_Config *iniFile)
i=0;
while ( (sec = (IniSection *) gf_list_enum(iniFile->sections, &i)) ) {
+ /*Temporary sections are not saved*/
+ if (!strnicmp(sec->section_name, "Temp", 4)) continue;
+
fprintf(file, "[%s]\n", sec->section_name);
j=0;
while ( (key = (IniKey *) gf_list_enum(sec->keys, &j)) ) {
fprintf(file, "%s=%s\n", key->name, key->value);
}
- //end of section
+ /* end of section */
fprintf(file, "\n");
}
fclose(file);
GF_EXPORT
void gf_cfg_del(GF_Config *iniFile)
{
- IniSection *p;
if (!iniFile) return;
-
gf_cfg_save(iniFile);
- while (gf_list_count(iniFile->sections)) {
- p = (IniSection *) gf_list_get(iniFile->sections, 0);
- DelSection(p);
- gf_list_rem(iniFile->sections, 0);
- }
- gf_list_del(iniFile->sections);
- gf_free(iniFile->fileName);
- gf_free(iniFile->filePath);
+ gf_cfg_clear(iniFile);
+ gf_free(iniFile);
+}
+
+void gf_cfg_remove(GF_Config *iniFile)
+{
+ if (!iniFile) return;
+ gf_delete_file(iniFile->fileName);
+ gf_cfg_clear(iniFile);
gf_free(iniFile);
}
GF_Err gf_cfg_set_key(GF_Config *iniFile, const char *secName, const char *keyName, const char *keyValue)
{
u32 i;
+ Bool has_changed = 1;
IniSection *sec;
IniKey *key;
if (!iniFile || !secName || !keyName) return GF_BAD_PARAM;
+ if (!strnicmp(secName, "temp", 4)) has_changed = 0;
+
i=0;
while ((sec = (IniSection *) gf_list_enum(iniFile->sections, &i)) ) {
if (!strcmp(secName, sec->section_name)) goto get_key;
}
- //need a new key
+ /* need a new key */
sec = (IniSection *) gf_malloc(sizeof(IniSection));
sec->section_name = gf_strdup(secName);
sec->keys = gf_list_new();
- iniFile->hasChanged = 1;
+ if (has_changed) iniFile->hasChanged = 1;
gf_list_add(iniFile->sections, sec);
get_key:
if (!strcmp(key->name, keyName)) goto set_value;
}
if (!keyValue) return GF_OK;
- //need a new key
+ /* need a new key */
key = (IniKey *) gf_malloc(sizeof(IniKey));
key->name = gf_strdup(keyName);
key->value = gf_strdup("");
- iniFile->hasChanged = 1;
+ if (has_changed) iniFile->hasChanged = 1;
gf_list_add(sec->keys, key);
set_value:
if (key->name) gf_free(key->name);
if (key->value) gf_free(key->value);
gf_free(key);
- iniFile->hasChanged = 1;
+ if (has_changed) iniFile->hasChanged = 1;
return GF_OK;
}
- //same value, don't update
+ /* same value, don't update */
if (!strcmp(key->value, keyValue)) return GF_OK;
if (key->value) gf_free(key->value);
key->value = gf_strdup(keyValue);
- iniFile->hasChanged = 1;
+ if (has_changed) iniFile->hasChanged = 1;
return GF_OK;
}
#include <gpac/base_coding.h>
#include <gpac/crypt.h>
#include <gpac/tools.h>
+#include <gpac/cache.h>
#ifdef GPAC_HAS_SSL
#include <openssl/rand.h>
#endif
+#ifdef __USE_POSIX
+#include <unistd.h>
+#endif
+
+#define SIZE_IN_STREAM ( 2 << 29 )
static void gf_dm_connect(GF_DownloadSession *sess);
/*internal flags*/
enum
{
- GF_DOWNLOAD_SESSION_USE_SSL = 1<<10,
- GF_DOWNLOAD_SESSION_THREAD_DEAD = 1<<11,
- GF_DOWNLOAD_IS_ICY = 1<<12,
+ GF_DOWNLOAD_SESSION_USE_SSL = 1<<10,
+ GF_DOWNLOAD_SESSION_THREAD_DEAD = 1<<11
};
-
-struct __gf_download_session
+typedef struct __gf_user_credentials
{
- /*this is always 0 and helps differenciating downloads from other interfaces (interfaceType != 0)*/
- u32 reserved;
+ char site[1024];
+ char username[50];
+ char digest[1024];
+ Bool valid;
+} gf_user_credentials_struct;
+
+enum REQUEST_TYPE {
+ GET = 0,
+ HEAD = 1,
+ OTHER = 2
+};
- struct __gf_download_manager *dm;
- GF_Thread *th;
- GF_Mutex *mx;
+/**
+ * This structure handles partial downloads
+ */
+typedef struct __partialDownloadStruct {
+ char * url;
+ u64 startOffset;
+ u64 endOffset;
+ char * filename;
+} GF_PartialDownload ;
- Bool in_callback, destroy;
- u32 proxy_enabled;
+struct __gf_download_session
+{
+ /*this is always 0 and helps differenciating downloads from other interfaces (interfaceType != 0)*/
+ u32 reserved;
- char *server_name;
- u16 port;
+ struct __gf_download_manager *dm;
+ GF_Thread *th;
+ GF_Mutex *mx;
- char *orig_url;
- char *remote_path;
- char *user;
- char *passwd;
- char cookie[GF_MAX_PATH];
+ Bool in_callback, destroy;
+ u32 proxy_enabled;
- /* Used when a cache file is forced, when the download session is used standalone */
- Bool use_cache_extension;
+ char *server_name;
+ u16 port;
- FILE *cache;
- char *cache_name;
- /*cache size if existing*/
- u32 cache_start_size;
+ char *orig_url;
+ char *remote_path;
+ gf_user_credentials_struct * creds;
+ char cookie[GF_MAX_PATH];
+ DownloadedCacheEntry cache_entry;
- GF_Socket *sock;
- u32 num_retry, status;
+ GF_Socket *sock;
+ u32 num_retry, status;
- char *mime_type;
- u32 flags;
+ u32 flags;
- u32 total_size, bytes_done, start_time, icy_metaint, icy_count, icy_bytes;
- u32 bytes_per_sec, window_start, bytes_in_wnd;
- u32 limit_data_rate;
+ u32 total_size, bytes_done, start_time, icy_metaint, icy_count, icy_bytes;
+ u32 bytes_per_sec, window_start, bytes_in_wnd;
+ u32 limit_data_rate;
/* Range information if needed for the download (cf flag) */
Bool needs_range;
u32 range_start, range_end;
- /*0: GET
- 1: HEAD
- 2: all the rest
- */
- u32 http_read_type;
+ /*0: GET
+ 1: HEAD
+ 2: all the rest
+ */
+ enum REQUEST_TYPE http_read_type;
- GF_Err last_error;
- char *init_data;
- u32 init_data_size;
+ GF_Err last_error;
+ char *init_data;
+ u32 init_data_size;
+ Bool server_only_understand_get;
+ /* True if cache file must be stored on disk */
+ Bool use_cache_file;
#ifdef GPAC_HAS_SSL
- SSL *ssl;
+ SSL *ssl;
#endif
- void (*do_requests)(struct __gf_download_session *);
+ void (*do_requests)(struct __gf_download_session *);
- /*callback for data reception - may not be NULL*/
- gf_dm_user_io user_proc;
- void *usr_cbk;
+ /*callback for data reception - may not be NULL*/
+ gf_dm_user_io user_proc;
+ void *usr_cbk;
- /*private extension*/
- void *ext;
+ /*private extension*/
+ void *ext;
};
struct __gf_download_manager
{
- char *cache_directory;
- char szCookieDir[GF_MAX_PATH];
-
- Bool (*GetUserPassword)(void *usr_cbk, const char *site_url, char *usr_name, char *password);
- void *usr_cbk;
-
- GF_Config *cfg;
- GF_List *sessions;
-
- GF_List *skip_proxy_servers;
-
+ GF_Mutex *cache_mx;
+ char *cache_directory;
+ char szCookieDir[GF_MAX_PATH];
+
+ Bool (*GetUserPassword)(void *usr_cbk, const char *site_url, char *usr_name, char *password);
+ void *usr_cbk;
+
+ u32 head_timeout;
+ GF_Config *cfg;
+ GF_List *sessions;
+
+ GF_List *skip_proxy_servers;
+ GF_List *credentials;
+ GF_List *cache_entries;
+ /* FIXME : should be placed in DownloadedCacheEntry maybe... */
+ GF_List * partial_downloads;
#ifdef GPAC_HAS_SSL
- SSL_CTX *ssl_ctx;
+ SSL_CTX *ssl_ctx;
#endif
};
static void init_prng (void)
{
- char namebuf[256];
- const char *random_file;
+ char namebuf[256];
+ const char *random_file;
- if (RAND_status ()) return;
+ if (RAND_status ()) return;
- namebuf[0] = '\0';
- random_file = RAND_file_name (namebuf, sizeof (namebuf));
+ namebuf[0] = '\0';
+ random_file = RAND_file_name (namebuf, sizeof (namebuf));
- if (random_file && *random_file)
- RAND_load_file(random_file, 16384);
+ if (random_file && *random_file)
+ RAND_load_file(random_file, 16384);
- if (RAND_status ()) return;
+ if (RAND_status ()) return;
#ifdef WIN32
- RAND_screen ();
- if (RAND_status ())
- return;
+ RAND_screen ();
+ if (RAND_status ())
+ return;
+#endif
+}
+
#endif
+
+/*
+ * Private methods of cache.c
+ */
+
+/**
+ * \brief Write data to cache
+ * Writes data to the cache. A call to gf_cache_open_write_cache should have been issued before calling this function.
+ * \param entry The entry to use
+ * \param data data to write
+ * \param size number of elements to write
+ * \return GF_OK is everything went fine, GF_BAD_PARAM if cache has not been opened, GF_IO_ERR if a failure occurs
+ */
+GF_Err gf_cache_write_to_cache( const DownloadedCacheEntry entry, const GF_DownloadSession * sess, const char * data, const u32 size);
+
+/**
+ * \brief Close the write file pointer of cache
+ * This function also flushes all buffers, so cache will always be consistent after
+ * \param entry The entry to use
+ * \param success 1 if cache write is success, false otherwise
+ * \return GF_OK is everything went fine, GF_BAD_PARAM if entry is NULL, GF_IO_ERR if a failure occurs
+ */
+GF_Err gf_cache_close_write_cache( const DownloadedCacheEntry entry, const GF_DownloadSession * sess, Bool success);
+
+/**
+ * \brief Open the write file pointer of cache
+ * This function prepares calls for gf_cache_write_to_cache
+ * \param entry The entry to use
+ * \return GF_OK is everything went fine, GF_BAD_PARAM if entry is NULL, GF_IO_ERR if a failure occurs
+ */
+GF_Err gf_cache_open_write_cache( const DownloadedCacheEntry entry, const GF_DownloadSession * sess );
+
+/**
+ * Find a User's credentials for a given site
+ */
+static
+gf_user_credentials_struct * gf_find_user_credentials_for_site(GF_DownloadManager *dm, const char * server_name) {
+ u32 count, i;
+ if (!dm || !dm->credentials || !server_name || !strlen(server_name))
+ return NULL;
+ count = gf_list_count( dm->credentials);
+ for (i = 0 ; i < count; i++) {
+ gf_user_credentials_struct * cred = gf_list_get(dm->credentials, i );
+ assert( cred );
+ if (!strcmp(cred->site, server_name))
+ return cred;
+ }
+ return NULL;
+}
+
+/**
+ * \brief Saves the digest for authentication of password and username
+ * \param dm The download manager
+ * \param creds The credentials to fill
+ * \return GF_OK if info has been filled, GF_BAD_PARAM if creds == NULL or dm == NULL, GF_AUTHENTICATION_FAILURE if user did not filled the info.
+ */
+static
+GF_Err gf_user_credentials_save_digest( GF_DownloadManager * dm, gf_user_credentials_struct * creds, const char * password) {
+ int size;
+ char pass_buf[1024], range_buf[1024];
+ if (!dm || !creds || !password)
+ return GF_BAD_PARAM;
+ sprintf(pass_buf, "%s:%s", creds->username, password);
+ size = gf_base64_encode(pass_buf, strlen(pass_buf), range_buf, 1024);
+ range_buf[size] = 0;
+ strcpy(creds->digest, range_buf);
+ creds->valid = 1;
+ return GF_OK;
+}
+
+/**
+ * \brief Asks the user for credentials for given site
+ * \param dm The download manager
+ * \param creds The credentials to fill
+ * \return GF_OK if info has been filled, GF_BAD_PARAM if creds == NULL or dm == NULL, GF_AUTHENTICATION_FAILURE if user did not filled the info.
+ */
+static
+GF_Err gf_user_credentials_ask_password( GF_DownloadManager * dm, gf_user_credentials_struct * creds)
+{
+ char szPASS[50];
+ if (!dm || !creds)
+ return GF_BAD_PARAM;
+ memset(szPASS, 0, 50);
+ if (!dm->GetUserPassword || !dm->GetUserPassword(dm->usr_cbk, creds->site, creds->username, szPASS)) {
+ return GF_AUTHENTICATION_FAILURE;
+ }
+ return gf_user_credentials_save_digest(dm, creds, szPASS);
+ return GF_OK;
+}
+
+
+static
+gf_user_credentials_struct * gf_user_credentials_register(GF_DownloadManager * dm, const char * server_name, const char * username, const char * password, Bool valid)
+{
+ gf_user_credentials_struct * creds;
+ if (!dm)
+ return NULL;
+ assert( server_name );
+ creds = gf_find_user_credentials_for_site(dm, server_name);
+ /* If none found, we create one */
+ if (!creds) {
+ creds = (gf_user_credentials_struct*)gf_malloc(sizeof( gf_user_credentials_struct));
+ if (!creds)
+ return NULL;
+ gf_list_insert(dm->credentials, creds, 0);
+ }
+ creds->valid = valid;
+ strncpy(creds->username, username ? username : "", 50);
+ strcpy(creds->site, server_name);
+ if (username && password && valid)
+ gf_user_credentials_save_digest(dm, creds, password);
+ else {
+ if (GF_OK != gf_user_credentials_ask_password(dm, creds)) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK,
+ ("[HTTP] Failed to get password information.\n"));
+ gf_list_rem( dm->credentials, 0);
+ gf_free( creds );
+ creds = NULL;
+ }
+ }
+ return creds;
+}
+
+#ifdef GPAC_HAS_SSL
+
+static Bool _ssl_is_initialized = 0;
+
+/*!
+ * initialize the SSL library once for all download managers
+ * \return 0 if everyhing is OK, 1 otherwise
+ */
+static Bool init_ssl_lib() {
+ if (_ssl_is_initialized)
+ return 0;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[HTTPS] Initializing SSL library...\n"));
+ init_prng();
+ if (RAND_status() != 1) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTPS] Error while initializing Random Number generator, failed to init SSL !\n"));
+ return 1;
+ }
+ SSL_library_init();
+ SSL_load_error_strings();
+ SSLeay_add_all_algorithms();
+ SSLeay_add_ssl_algorithms();
+ _ssl_is_initialized = 1;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[HTTPS] Initalization of SSL library complete.\n"));
+ return 0;
}
static int ssl_init(GF_DownloadManager *dm, u32 mode)
{
- SSL_METHOD *meth;
+#if OPENSSL_VERSION_NUMBER > 0x00909000
+ const
+#endif
+ SSL_METHOD *meth;
- if (!dm) return 0;
+ if (!dm) return 0;
+ gf_mx_p(dm->cache_mx);
/* The SSL has already been initialized. */
- if (dm->ssl_ctx) return 1;
- /* Init the PRNG. If that fails, bail out. */
- init_prng();
- if (RAND_status() != 1) goto error;
- SSL_library_init();
- SSL_load_error_strings();
- SSLeay_add_all_algorithms();
- SSLeay_add_ssl_algorithms();
-
- switch (mode) {
- case 0:
- meth = SSLv23_client_method();
- break;
- case 1:
- meth = SSLv2_client_method();
- break;
- case 2:
- meth = SSLv3_client_method();
- break;
- case 3:
- meth = TLSv1_client_method();
- break;
- default:
- goto error;
- }
+ if (dm->ssl_ctx) {
+ gf_mx_v(dm->cache_mx);
+ return 1;
+ }
+ /* Init the PRNG. If that fails, bail out. */
+ if (init_ssl_lib()) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTPS] Failed to properly initialize SSL library\n"));
+ goto error;
+ }
- dm->ssl_ctx = SSL_CTX_new(meth);
- if (!dm->ssl_ctx) goto error;
- SSL_CTX_set_default_verify_paths(dm->ssl_ctx);
- SSL_CTX_load_verify_locations (dm->ssl_ctx, NULL, NULL);
- /* SSL_VERIFY_NONE instructs OpenSSL not to abort SSL_connect if the
+ switch (mode) {
+ case 0:
+ meth = SSLv23_client_method();
+ break;
+ case 1:
+ meth = SSLv2_client_method();
+ break;
+ case 2:
+ meth = SSLv3_client_method();
+ break;
+ case 3:
+ meth = TLSv1_client_method();
+ break;
+ default:
+ goto error;
+ }
+
+ dm->ssl_ctx = SSL_CTX_new(meth);
+ if (!dm->ssl_ctx) goto error;
+ SSL_CTX_set_default_verify_paths(dm->ssl_ctx);
+ SSL_CTX_load_verify_locations (dm->ssl_ctx, NULL, NULL);
+ /* SSL_VERIFY_NONE instructs OpenSSL not to abort SSL_connect if the
certificate is invalid. We verify the certificate separately in
ssl_check_certificate, which provides much better diagnostics
than examining the error stack after a failed SSL_connect. */
- SSL_CTX_set_verify(dm->ssl_ctx, SSL_VERIFY_NONE, NULL);
+ SSL_CTX_set_verify(dm->ssl_ctx, SSL_VERIFY_NONE, NULL);
- /* Since fd_write unconditionally assumes partial writes (and handles them correctly),
- allow them in OpenSSL. */
- SSL_CTX_set_mode(dm->ssl_ctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
- return 1;
+ /* Since fd_write unconditionally assumes partial writes (and handles them correctly),
+ allow them in OpenSSL. */
+ SSL_CTX_set_mode(dm->ssl_ctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
+ gf_mx_v(dm->cache_mx);
+ return 1;
error:
- if (dm->ssl_ctx) SSL_CTX_free(dm->ssl_ctx);
- dm->ssl_ctx = NULL;
- return 0;
+ if (dm->ssl_ctx) SSL_CTX_free(dm->ssl_ctx);
+ dm->ssl_ctx = NULL;
+ gf_mx_v(dm->cache_mx);
+ return 0;
}
-#endif
+#endif /* GPAC_HAS_SSL */
static Bool gf_dm_is_local(GF_DownloadManager *dm, const char *url)
{
- if (!strnicmp(url, "file://", 7)) return 1;
- if (!strnicmp(url, "file:///", 8)) return 1;
- if (!strstr(url, "://")) return 1;
- return 0;
+ if (!strnicmp(url, "file://", 7)) return 1;
+ if (!strstr(url, "://")) return 1;
+ return 0;
}
static Bool gf_dm_can_handle_url(GF_DownloadManager *dm, const char *url)
{
- if (!strnicmp(url, "http://", 7)) return 1;
+ if (!strnicmp(url, "http://", 7)) return 1;
#ifdef GPAC_HAS_SSL
- if (!strnicmp(url, "https://", 8)) return 1;
+ if (!strnicmp(url, "https://", 8)) return 1;
#endif
- return 0;
+ return 0;
}
+/*!
+ * Finds an existing entry in the cache for a given URL
+ * \param sess The session configured with the URL
+ * \return NULL if none found, the DownloadedCacheEntry otherwise
+ */
+DownloadedCacheEntry gf_dm_find_cached_entry_by_url(GF_DownloadSession * sess) {
+ u32 i, count;
+ assert( sess && sess->dm && sess->dm->cache_entries );
+ gf_mx_p( sess->dm->cache_mx );
+ count = gf_list_count(sess->dm->cache_entries);
+ for (i = 0 ; i < count; i++) {
+ const char * url;
+ DownloadedCacheEntry e = gf_list_get(sess->dm->cache_entries, i);
+ assert(e);
+ url = gf_cache_get_url(e);
+ assert( url );
+ if (!strcmp(url, sess->orig_url)) {
+ gf_mx_v( sess->dm->cache_mx );
+ return e;
+ }
+ }
+ gf_mx_v( sess->dm->cache_mx );
+ return NULL;
+}
+
+/**
+ * Creates a new cache entry
+ * \param cache_directory The path to the directory containing cache files
+ * \param url The full URL
+ * \return The DownloadedCacheEntry
+ */
+DownloadedCacheEntry gf_cache_create_entry( GF_DownloadManager * dm, const char * cache_directory, const char * url);
+
+/*!
+ * Removes a session for a DownloadedCacheEntry
+ * \param entry The entry
+ * \param sess The session to remove
+ * \return the number of sessions left in the cached entry, -1 if one of the parameters is wrong
+ */
+s32 gf_cache_remove_session_from_cache_entry(DownloadedCacheEntry entry, GF_DownloadSession * sess);
+
+/**
+ * Removes a cache entry from cache and performs a cleanup if possible.
+ * If the cache entry is marked for deletion and has no sessions associated with it, it will be
+ * removed (so some modules using a streaming like cache will still work).
+ */
+void gf_dm_remove_cache_entry_from_session(GF_DownloadSession * sess) {
+ if (sess && sess->cache_entry) {
+ gf_cache_remove_session_from_cache_entry(sess->cache_entry, sess);
+ if (sess->dm
+ /*JLF - not sure what the rationale of this test is, and it prevents cleanup of cache entry
+ which then results to crash when restarting the session (entry->writeFilePtr i snot set back to NULL)*/
+ && gf_cache_entry_is_delete_files_when_deleted(sess->cache_entry)
+ && (0 == gf_cache_get_sessions_count_for_cache_entry(sess->cache_entry)))
+ {
+ u32 i, count;
+ gf_mx_p( sess->dm->cache_mx );
+ count = gf_list_count( sess->dm->cache_entries );
+ for (i = 0; i < count; i++) {
+ DownloadedCacheEntry ex = gf_list_get(sess->dm->cache_entries, i);
+ if (ex == sess->cache_entry) {
+ gf_list_rem(sess->dm->cache_entries, i);
+ gf_cache_delete_entry( sess->cache_entry );
+ break;
+ }
+ }
+ gf_mx_v( sess->dm->cache_mx );
+ }
+ }
+}
+
+/*!
+ * Adds a session to a DownloadedCacheEntry.
+ * implemented in cache.c
+ * \param entry The entry
+ * \param sess The session to add
+ * \return the number of sessions in the cached entry, -1 if one of the parameters is wrong
+ */
+s32 gf_cache_add_session_to_cache_entry(DownloadedCacheEntry entry, GF_DownloadSession * sess);
void gf_dm_configure_cache(GF_DownloadSession *sess)
{
- u32 i, len;
- char *tmp, *ext;
- u8 hash[20];
- const char *opt;
-
- if (sess->use_cache_extension) return;
- if (!sess->dm->cache_directory) return;
- if (sess->flags & GF_NETIO_SESSION_NOT_CACHED) return;
- if (sess->flags & GF_NETIO_SESSION_REUSE_APPEND) return;
-
- len = strlen(sess->server_name) + strlen(sess->remote_path) + 10;
- if (len<50) len = 50;
- tmp = gf_malloc(sizeof(char) * len);
- tmp[0] = 0;
-
- /*generate hash of the full url*/
- strcpy(tmp, sess->server_name);
- strcat(tmp, sess->remote_path);
-
- gf_sha1_csum(tmp, strlen(tmp), hash);
- tmp[0] = 0;
- for (i=0; i<20; i++) {
- char t[3];
- t[2] = 0;
- sprintf(t, "%02X", hash[i]);
- strcat(tmp, t);
- }
+ DownloadedCacheEntry entry;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[Downloader] gf_dm_configure_cache(%p), cached=%s\n", sess, sess->flags&GF_NETIO_SESSION_NOT_CACHED?"no":"yes" ));
+ gf_dm_remove_cache_entry_from_session(sess);
+ entry = gf_dm_find_cached_entry_by_url(sess);
+ if (!entry) {
+ entry = gf_cache_create_entry(sess->dm, sess->dm->cache_directory, sess->orig_url);
+ gf_mx_p( sess->dm->cache_mx );
+ gf_list_add(sess->dm->cache_entries, entry);
+ gf_mx_v( sess->dm->cache_mx );
+ }
+ assert( entry );
+ sess->cache_entry = entry;
+ gf_cache_add_session_to_cache_entry(sess->cache_entry, sess);
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[CACHE] Cache setup to %p %s\n", sess, gf_cache_get_cache_filename(sess->cache_entry)));
+}
- len += strlen(sess->dm->cache_directory) + 6;
- sess->cache_name = gf_malloc(sizeof(char)*len);
- sess->cache_name[0] = 0;
-
- strcpy(sess->cache_name, sess->dm->cache_directory);
- strcat(sess->cache_name, tmp);
-
- /*try to locate an extension*/
- strcpy(tmp, sess->remote_path);
- ext = strchr(tmp, '?');
- if (ext) ext[0] = 0;
- ext = strchr(tmp, '.');
- if (ext && (strlen(ext)<6) ) strcat(sess->cache_name, ext);
- gf_free(tmp);
-
- /*first try, check cached file*/
- if (!sess->cache_start_size && !(sess->flags&GF_NETIO_SESSION_FORCE_RESTART) ) {
- /*if file present figure out how much of the file is downloaded - we assume 2^31 byte file max*/
- FILE *the_cache = gf_f64_open(sess->cache_name, "rb");
- if (the_cache) {
- gf_f64_seek(the_cache, 0, SEEK_END);
- sess->cache_start_size = (u32) gf_f64_tell(the_cache);
- fclose(the_cache);
- }
- }
- /*second try, disable cached file*/
- else {
- sess->cache_start_size = 0;
- }
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Cache setup to %s\n", sess->cache_name));
+void gf_dm_delete_cached_file_entry(const GF_DownloadManager * dm, const char * url)
+{
+ GF_Err e;
+ u32 count, i;
+ char * realURL;
+ GF_URL_Info info;
+ if (!url || !dm)
+ return;
+ gf_mx_p( dm->cache_mx );
+ gf_dm_url_info_init(&info);
+ e = gf_dm_get_url_info(url, &info, NULL);
+ if (e != GF_OK) {
+ gf_mx_p( dm->cache_mx );
+ gf_dm_url_info_del(&info);
+ return;
+ }
+ realURL = gf_strdup(info.canonicalRepresentation);
+ gf_dm_url_info_del(&info);
+ assert( realURL );
+ count = gf_list_count(dm->cache_entries);
+ for (i = 0 ; i < count; i++) {
+ const char * e_url;
+ DownloadedCacheEntry e = gf_list_get(dm->cache_entries, i);
+ assert(e);
+ e_url = gf_cache_get_url(e);
+ assert( e_url );
+ if (!strcmp(e_url, realURL)) {
+ /* We found the existing session */
+ gf_cache_entry_set_delete_files_when_deleted(e);
+ if (0 == gf_cache_get_sessions_count_for_cache_entry( e )) {
+ /* No session attached anymore... we can delete it */
+ gf_list_rem(dm->cache_entries, i);
+ gf_cache_delete_entry(e);
+ }
+ /* If deleted or not, we don't search further */
+ gf_mx_v( dm->cache_mx );
+ gf_free(realURL);
+ return;
+ }
+ }
+ /* If we are heren it means we did not found this URL in cache */
+ gf_mx_v( dm->cache_mx );
+ gf_free(realURL);
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] Cannot find URL %s, cache file won't be deleted.\n", url));
+}
- /*are we using existing cached files ?*/
- if (sess->dm) {
- opt = gf_cfg_get_key(sess->dm->cfg, "Downloader", "RestartFiles");
- if (opt && !stricmp(opt, "yes")) sess->cache_start_size = 0;
- } else {
- sess->cache_start_size = 0;
+void gf_dm_delete_cached_file_entry_session(const GF_DownloadSession * sess, const char * url) {
+ if (sess && sess->dm && url) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[CACHE] Requesting deletion for %s\n", url));
+ gf_dm_delete_cached_file_entry(sess->dm, url);
}
}
+
static void gf_dm_disconnect(GF_DownloadSession *sess)
{
- if (sess->mx)
- gf_mx_p(sess->mx);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Downloader] gf_dm_disconnect(%p)\n", sess ));
+ if (sess->mx)
+ gf_mx_p(sess->mx);
#ifdef GPAC_HAS_SSL
- if (sess->ssl) {
- SSL_shutdown(sess->ssl);
- SSL_free(sess->ssl);
- sess->ssl = NULL;
- }
+ if (sess->ssl) {
+ SSL_shutdown(sess->ssl);
+ SSL_free(sess->ssl);
+ sess->ssl = NULL;
+ }
#endif
- if (sess->sock) {
- gf_sk_del(sess->sock);
- sess->sock = NULL;
- }
- if (sess->cache) fclose(sess->cache);
- sess->cache = NULL;
- sess->status = GF_NETIO_DISCONNECTED;
- if (sess->num_retry) sess->num_retry--;
- if (sess->mx)
- gf_mx_v(sess->mx);
+ if (sess->sock) {
+ gf_sk_del(sess->sock);
+ sess->sock = NULL;
+ }
+ sess->status = GF_NETIO_DISCONNECTED;
+ if (sess->num_retry) sess->num_retry--;
+ if (sess->mx)
+ gf_mx_v(sess->mx);
}
void gf_dm_sess_del(GF_DownloadSession *sess)
{
- const char *opt;
-
- /*self-destruction, let the download manager destroy us*/
- if (sess->th && sess->in_callback) {
- sess->destroy = 1;
- return;
- }
- gf_dm_disconnect(sess);
-
- /*if threaded wait for thread exit*/
- if (sess->th) {
- while (!(sess->flags & GF_DOWNLOAD_SESSION_THREAD_DEAD))
- gf_sleep(1);
- gf_th_del(sess->th);
- gf_mx_del(sess->mx);
- }
-
- if (sess->dm) gf_list_del_item(sess->dm->sessions, sess);
-
- if (sess->cache_name && !sess->use_cache_extension && !(sess->flags & GF_NETIO_SESSION_KEEP_CACHE) ) {
- if (sess->dm)
- opt = gf_cfg_get_key(sess->dm->cfg, "Downloader", "CleanCache");
- else
- opt = NULL;
- if (!opt || !stricmp(opt, "yes")) gf_delete_file(sess->cache_name);
- gf_free(sess->cache_name);
- }
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[Downloader] gf_dm_sess_del(%p)\n", sess ));
+ if (!sess)
+ return;
+ /*self-destruction, let the download manager destroy us*/
+ if (sess->th && sess->in_callback) {
+ sess->destroy = 1;
+ return;
+ }
+ gf_dm_disconnect(sess);
+
+ /*if threaded wait for thread exit*/
+ if (sess->th) {
+ while (!(sess->flags & GF_DOWNLOAD_SESSION_THREAD_DEAD))
+ gf_sleep(1);
+ gf_th_stop(sess->th);
+ gf_th_del(sess->th);
+ if (sess->mx)
+ gf_mx_del(sess->mx);
+ sess->th = NULL;
+ sess->mx = NULL;
+ }
- if (sess->orig_url) gf_free(sess->orig_url);
- if (sess->server_name) gf_free(sess->server_name);
- if (sess->remote_path) gf_free(sess->remote_path);
- if (sess->user) gf_free(sess->user);
- if (sess->passwd) gf_free(sess->passwd);
- if (sess->mime_type) gf_free(sess->mime_type);
- if (sess->cache) fclose(sess->cache);
- if (sess->init_data) gf_free(sess->init_data);
- gf_free(sess);
+ if (sess->dm) gf_list_del_item(sess->dm->sessions, sess);
+ /*
+ TODO: something to clean an cache files ?
+ if (sess->cache_name && !sess->use_cache_extension && !(sess->flags & GF_NETIO_SESSION_KEEP_CACHE) ) {
+ if (sess->dm)
+ opt = gf_cfg_get_key(sess->dm->cfg, "Downloader", "CleanCache");
+ else
+ opt = NULL;
+ if (!opt || !stricmp(opt, "yes")) gf_delete_file(sess->cache_name);
+ gf_free(sess->cache_name);
+ }
+ */
+ gf_dm_remove_cache_entry_from_session(sess);
+ sess->cache_entry = NULL;
+ if (sess->orig_url) gf_free(sess->orig_url);
+ if (sess->server_name) gf_free(sess->server_name);
+ sess->server_name = NULL;
+ if (sess->remote_path) gf_free(sess->remote_path);
+ /* Credentials are stored into the sess->dm */
+ if (sess->creds) sess->creds = NULL;
+ if (sess->init_data) gf_free(sess->init_data);
+ sess->orig_url = sess->server_name = sess->remote_path;
+ sess->creds = NULL;
+ gf_free(sess);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[Downloader] gf_dm_sess_del(%p) : DONE\n", sess ));
}
void http_do_requests(GF_DownloadSession *sess);
static void gf_dm_sess_notify_state(GF_DownloadSession *sess, u32 dnload_status, GF_Err error)
{
- if (sess->user_proc) {
- GF_NETIO_Parameter par;
- sess->in_callback = 1;
- memset(&par, 0, sizeof(GF_NETIO_Parameter));
- par.msg_type = dnload_status;
- par.error = error;
- sess->user_proc(sess->usr_cbk, &par);
- sess->in_callback = 0;
- }
+ if (sess->user_proc) {
+ GF_NETIO_Parameter par;
+ sess->in_callback = 1;
+ memset(&par, 0, sizeof(GF_NETIO_Parameter));
+ par.msg_type = dnload_status;
+ par.error = error;
+ sess->user_proc(sess->usr_cbk, &par);
+ sess->in_callback = 0;
+ }
}
static void gf_dm_sess_user_io(GF_DownloadSession *sess, GF_NETIO_Parameter *par)
{
- if (sess->user_proc) {
- sess->in_callback = 1;
- sess->user_proc(sess->usr_cbk, par);
- sess->in_callback = 0;
- }
+ if (sess->user_proc) {
+ sess->in_callback = 1;
+ sess->user_proc(sess->usr_cbk, par);
+ sess->in_callback = 0;
+ }
+}
+
+GF_EXPORT
+Bool gf_dm_is_thread_dead(GF_DownloadSession *sess)
+{
+ if (!sess) return 1;
+ return (sess->flags & GF_DOWNLOAD_SESSION_THREAD_DEAD) ? 1 : 0;
}
GF_Err gf_dm_sess_last_error(GF_DownloadSession *sess)
{
- if (!sess) return GF_BAD_PARAM;
- return sess->last_error;
+ if (!sess) return GF_BAD_PARAM;
+ return sess->last_error;
}
+GF_EXPORT
+void gf_dm_url_info_init(GF_URL_Info * info) {
+ info->password = NULL;
+ info->userName = NULL;
+ info->canonicalRepresentation = NULL;
+ info->protocol = NULL;
+ info->port = 0;
+ info->remotePath = NULL;
+ info->server_name = NULL;
+}
-GF_Err gf_dm_setup_from_url(GF_DownloadSession *sess, char *url)
-{
- char *tmp, *tmp_url;
- const char *opt;
- sess->orig_url = gf_strdup(url);
-
- if (!strnicmp(url, "http://", 7)) {
- url += 7;
- sess->port = 80;
- sess->do_requests = http_do_requests;
- }
- else if (!strnicmp(url, "https://", 8)) {
- url += 8;
- sess->port = 443;
+GF_EXPORT
+void gf_dm_url_info_del(GF_URL_Info * info) {
+ if (!info)
+ return;
+ if (info->canonicalRepresentation)
+ gf_free(info->canonicalRepresentation);
+ if (info->password)
+ gf_free(info->password);
+ if (info->userName)
+ gf_free(info->userName);
+ if (info->remotePath)
+ gf_free(info->remotePath);
+ if (info->server_name)
+ gf_free(info->server_name);
+ gf_dm_url_info_init(info);
+}
+
+/**
+ * \param url The url to parse for protocol
+ * \param info The info to fill
+ * \return Returns the offset in url of the protocol found -1 if not found
+ */
+static s32 gf_dm_parse_protocol(const char * url, GF_URL_Info * info){
+ assert(info);
+ assert(url);
+ if (!strnicmp(url, "http://", 7)) {
+ info->port = 80;
+ info->protocol = "http://";
+ return 7;
+ }
+ else if (!strnicmp(url, "https://", 8)) {
+ info->port = 443;
#ifndef GPAC_HAS_SSL
- return GF_NOT_SUPPORTED;
+ return -1;
#endif
- sess->flags |= GF_DOWNLOAD_SESSION_USE_SSL;
- sess->do_requests = http_do_requests;
- }
- else if (!strnicmp(url, "ftp://", 6)) {
- url += 6;
- sess->port = 21;
- sess->do_requests = NULL;
- return GF_NOT_SUPPORTED;
- }
- /*relative URL*/
- else if (!strstr(url, "://")) {
- u32 i;
- if (!sess->remote_path) return GF_BAD_PARAM;
- tmp = gf_url_concatenate(sess->remote_path, url);
- gf_free(sess->remote_path);
- sess->remote_path = gf_url_percent_encode(tmp);
- gf_free(tmp);
- if (!sess->remote_path) sess->remote_path = gf_strdup(url);
- for (i=0; i<strlen(sess->remote_path); i++)
- if (sess->remote_path[i]=='\\') sess->remote_path[i]='/';
-
- } else {
- return GF_BAD_PARAM;
- }
+ info->protocol = "https://";
+ return 8;
+ }
+ else if (!strnicmp(url, "ftp://", 6)) {
+ info->port = 21;
+ info->protocol = "ftp://";
+ return -1;
+ }
+ return -1;
+}
+GF_EXPORT
+GF_Err gf_dm_get_url_info(const char * url, GF_URL_Info * info, const char * baseURL) {
+ char *tmp, *tmp_url, *current_pos, *urlConcatenateWithBaseURL;
+ char * copyOfUrl;
+ s32 proto_offset;
+ gf_dm_url_info_del(info);
+ urlConcatenateWithBaseURL = NULL;
+ proto_offset = gf_dm_parse_protocol(url, info);
+ if (proto_offset > 0){
+ url += proto_offset;
+ } else {
+ /*relative URL*/
+ if (!strstr(url, "://")) {
+ u32 i;
+ info->protocol = "file:/";
+ if (baseURL){
+ urlConcatenateWithBaseURL = gf_url_concatenate(baseURL, url);
+ proto_offset = gf_dm_parse_protocol(urlConcatenateWithBaseURL, info);
+ } else
+ proto_offset = -1;
+ if (proto_offset < 0){
+ tmp = urlConcatenateWithBaseURL;
+ assert( ! info->remotePath );
+ info->remotePath = gf_url_percent_encode(tmp);
+ gf_free( urlConcatenateWithBaseURL );
+ urlConcatenateWithBaseURL = NULL;
+ for (i=0; i<strlen(info->remotePath); i++)
+ if (info->remotePath[i]=='\\') info->remotePath[i]='/';
+ info->canonicalRepresentation = gf_malloc(strlen(info->protocol) + strlen(info->remotePath) + 1);
+ strcpy(info->canonicalRepresentation, info->protocol);
+ strcat(info->canonicalRepresentation, info->remotePath);
+ if (urlConcatenateWithBaseURL)
+ gf_free(urlConcatenateWithBaseURL);
+ return GF_OK;
+ } else {
+ /* We continue the parsing as usual */
+ url = urlConcatenateWithBaseURL + proto_offset;
+ }
+ } else {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[PROTOCOL] : cannot find any protocol in url %s\n", url));
+ return GF_BAD_PARAM;
+ }
+ }
+ assert( proto_offset >= 0 );
+ tmp = strchr(url, '/');
+ assert( !info->remotePath );
+ info->remotePath = gf_url_percent_encode(tmp ? tmp : "/");
+ if (tmp) {
+ tmp[0] = 0;
+ copyOfUrl = gf_strdup(url);
+ tmp[0] = '/';
+ } else {
+ copyOfUrl = gf_strdup(url);
+ }
+ tmp_url = copyOfUrl;
+ current_pos = tmp_url;
+ tmp = strrchr(tmp_url, '@');
+ if (tmp) {
+ current_pos = tmp + 1;
+ assert( ! info->server_name );
+ info->server_name = gf_strdup(current_pos);
+ tmp[0] = 0;
+ tmp = strchr(tmp_url, ':');
+
+ if (tmp) {
+ tmp[0] = 0;
+ info->password = gf_strdup(tmp+1);
+ }
+ info->userName = gf_strdup(tmp_url);
+ } else {
+ assert( ! info->server_name );
+ info->server_name = gf_strdup(tmp_url);
+ }
- tmp = strchr(url, '/');
- sess->remote_path = gf_url_percent_encode(tmp ? tmp : "/");
- if (tmp) {
- tmp[0] = 0;
- tmp_url = gf_strdup(url);
- tmp[0] = '/';
- } else {
- tmp_url = gf_strdup(url);
- }
+ tmp = strrchr(current_pos, ':');
+ if (tmp) {
+ info->port = atoi(tmp+1);
+ tmp[0] = 0;
+ if (info->server_name) {
+ gf_free(info->server_name);
+ }
+ info->server_name = gf_strdup(current_pos);
+ }
- tmp = strrchr(tmp_url, ':');
- if (tmp) {
- sess->port = atoi(tmp+1);
- tmp[0] = 0;
- }
- tmp = strrchr(tmp_url, '@');
- if (tmp) {
- sess->server_name = gf_strdup(tmp+1);
- tmp[0] = 0;
- tmp = strchr(tmp_url, ':');
- if (sess->user) gf_free(sess->user);
- sess->user = NULL;
- if (sess->passwd) gf_free(sess->passwd);
- sess->passwd = NULL;
-
- if (tmp) {
- sess->passwd = gf_strdup(tmp+1);
- tmp[0] = 0;
- }
- sess->user = gf_strdup(tmp_url);
- } else {
- sess->server_name = gf_strdup(tmp_url);
- }
- gf_free(tmp_url);
-
- /*setup BW limiter*/
- sess->limit_data_rate = 0;
- if (sess->dm) {
- opt = gf_cfg_get_key(sess->dm->cfg, "Downloader", "MaxRate");
- if (opt) {
- /*use it in in BYTES per second*/
- sess->limit_data_rate = 1024 * atoi(opt) / 8;
- }
+ /* builds orig_url */
+ /* We dont't want orig_url to contain user/passwords for security reasons or mismatch in cache hit */
+ {
+ char port[7];
+ snprintf(port, 7, ":%d", info->port);
+ info->canonicalRepresentation = gf_malloc(strlen(info->protocol)+strlen(info->server_name)+1+strlen(port)+strlen(info->remotePath));
+ strcpy(info->canonicalRepresentation, info->protocol);
+ strcat(info->canonicalRepresentation, info->server_name);
+ strcat(info->canonicalRepresentation, port);
+ strcat(info->canonicalRepresentation, info->remotePath);
}
- return GF_OK;
+ gf_free(copyOfUrl);
+ if (urlConcatenateWithBaseURL)
+ gf_free(urlConcatenateWithBaseURL);
+ return GF_OK;
}
-
-#define GF_WAIT_REPLY_SLEEP 20
-static u32 gf_dm_session_thread(void *par)
+GF_Err gf_dm_setup_from_url(GF_DownloadSession *sess, const char *url)
{
- GF_DownloadSession *sess = (GF_DownloadSession *)par;
-
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Downloader] Entering thread ID %d\n", gf_th_id() ));
-
- sess->flags &= ~GF_DOWNLOAD_SESSION_THREAD_DEAD;
- while (!sess->destroy) {
- gf_mx_p(sess->mx);
- if (sess->status >= GF_NETIO_DISCONNECTED) {
- gf_mx_v(sess->mx);
- break;
- }
+ GF_Err e;
+ GF_URL_Info info;
+ gf_dm_url_info_init(&info);
+ e = gf_dm_get_url_info(url, &info, sess->remote_path);
+ sess->port = info.port;
+ if (!strcmp("http://", info.protocol) || !strcmp("https://", info.protocol)) {
+ sess->do_requests = http_do_requests;
+ if (!strcmp("https://", info.protocol))
+ sess->flags |= GF_DOWNLOAD_SESSION_USE_SSL;
+ } else {
+ sess->do_requests = NULL;
+ }
+ if (sess->orig_url)
+ gf_free(sess->orig_url);
+ sess->orig_url = NULL;
+ if (info.server_name && sess->server_name)
+ {
+ gf_free(sess->server_name);
+ sess->server_name = NULL;
+ }
+ if (e == GF_OK) {
+ const char *opt;
+ sess->orig_url = gf_strdup(info.canonicalRepresentation);
+ if (sess->remote_path)
+ gf_free(sess->remote_path);
+ sess->remote_path = NULL;
+ sess->remote_path = gf_strdup(info.remotePath);
+ sess->server_name = info.server_name ? gf_strdup(info.server_name) : NULL;
+ if (info.userName) {
+ if (! sess->dm) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] Did not found any download manager, credentials not supported\n"));
+ } else
+ sess->creds = gf_user_credentials_register(sess->dm, sess->server_name, info.userName, info.password, info.userName && info.password);
+ }
+ /*setup BW limiter*/
+ sess->limit_data_rate = 0;
+ if (sess->dm && sess->dm->cfg) {
+ opt = gf_cfg_get_key(sess->dm->cfg, "Downloader", "MaxRate");
+ if (opt) {
+ /*use it in in BYTES per second*/
+ sess->limit_data_rate = 1024 * atoi(opt) / 8;
+ }
+ }
- if (sess->status < GF_NETIO_CONNECTED) {
- gf_dm_connect(sess);
- } else {
- if (sess->status == GF_NETIO_WAIT_FOR_REPLY) gf_sleep(GF_WAIT_REPLY_SLEEP);
- sess->do_requests(sess);
- }
- gf_mx_v(sess->mx);
- gf_sleep(2);
- }
- /*destroy all sessions*/
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_STATE_ERROR;
- sess->last_error = 0;
- sess->flags |= GF_DOWNLOAD_SESSION_THREAD_DEAD;
- return 1;
+ }
+ gf_dm_url_info_del(&info);
+ return e;
}
-#define SESSION_RETRY_COUNT 20
-void gf_dm_sess_dash_reset(GF_DownloadSession *sess)
+#define GF_WAIT_REPLY_SLEEP 20
+static u32 gf_dm_session_thread(void *par)
{
- sess->flags |= GF_NETIO_SESSION_REUSE_APPEND;
- sess->status = GF_NETIO_SETUP;
- sess->needs_range = 0;
- sess->range_start = sess->range_end = 0;
-
+ GF_DownloadSession *sess = (GF_DownloadSession *)par;
+
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Downloader] Entering thread ID %d\n", gf_th_id() ));
+ sess->flags &= ~GF_DOWNLOAD_SESSION_THREAD_DEAD;
+ while (!sess->destroy) {
+ gf_mx_p(sess->mx);
+ if (sess->status >= GF_NETIO_DISCONNECTED) {
+ gf_mx_v(sess->mx);
+ break;
+ }
+ if (sess->status < GF_NETIO_CONNECTED) {
+ gf_dm_connect(sess);
+ } else {
+ if (sess->status == GF_NETIO_WAIT_FOR_REPLY) gf_sleep(GF_WAIT_REPLY_SLEEP);
+ sess->do_requests(sess);
+ }
+ gf_mx_v(sess->mx);
+ gf_sleep(2);
+ }
+ /*destroy all sessions*/
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = 0;
+ sess->flags |= GF_DOWNLOAD_SESSION_THREAD_DEAD;
+ return 1;
}
-GF_Err gf_dm_sess_set_range(GF_DownloadSession *sess, u32 start, u32 end)
-{
- if (!sess) return GF_BAD_PARAM;
- sess->needs_range = 1;
- sess->range_start = start;
- sess->range_end = end;
- return GF_OK;
-}
+#define SESSION_RETRY_COUNT 20
-GF_DownloadSession *gf_dm_sess_new_simple(char *url, u32 dl_flags,
- gf_dm_user_io user_io,
- void *usr_cbk,
- char *cache_name,
- GF_Err *e)
+GF_DownloadSession *gf_dm_sess_new_simple(GF_DownloadManager * dm, const char *url, u32 dl_flags,
+ gf_dm_user_io user_io,
+ void *usr_cbk,
+ GF_Err *e)
{
- GF_DownloadSession *sess;
- sess = (GF_DownloadSession *)gf_malloc(sizeof(GF_DownloadSession));
- memset((void *)sess, 0, sizeof(GF_DownloadSession));
- sess->flags = dl_flags;
- sess->user_proc = user_io;
- sess->usr_cbk = usr_cbk;
- if (cache_name) {
- sess->cache_name = cache_name;
- sess->use_cache_extension = 1;
- }
-
-
- *e = gf_dm_setup_from_url(sess, url);
- if (*e) {
- gf_dm_sess_del(sess);
- return NULL;
- }
- if (!(sess->flags & GF_NETIO_SESSION_NOT_THREADED) ) {
- sess->th = gf_th_new(url);
- sess->mx = gf_mx_new(url);
- gf_th_run(sess->th, gf_dm_session_thread, sess);
- }
- sess->num_retry = SESSION_RETRY_COUNT;
- return sess;
+ GF_DownloadSession *sess;
+ GF_SAFEALLOC(sess, GF_DownloadSession);
+ if (!sess){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("%s:%d Cannot allocate session for URL %s: OUT OF MEMORY!\n", __FILE__, __LINE__, url));
+ return NULL;
+ }
+ sess->flags = dl_flags;
+ if (dm && !dm->head_timeout) sess->server_only_understand_get = 1;
+ sess->user_proc = user_io;
+ sess->usr_cbk = usr_cbk;
+ sess->creds = NULL;
+ sess->dm = dm;
+ assert( dm );
+
+ *e = gf_dm_setup_from_url(sess, url);
+ if (*e) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("%s:%d gf_dm_sess_new_simple: error=%s at setup for '%s'\n", __FILE__, __LINE__, gf_error_to_string(*e), url));
+ gf_dm_sess_del(sess);
+ return NULL;
+ }
+ assert( sess );
+ if (!(sess->flags & GF_NETIO_SESSION_NOT_THREADED) ) {
+ sess->th = gf_th_new(url);
+ sess->mx = gf_mx_new(url);
+ gf_th_run(sess->th, gf_dm_session_thread, sess);
+ }
+ if (!(sess->flags & GF_NETIO_SESSION_FORCE_NO_CACHE))
+ sess->use_cache_file = 0;
+ sess->num_retry = SESSION_RETRY_COUNT;
+ return sess;
}
-GF_DownloadSession *gf_dm_sess_new(GF_DownloadManager *dm, char *url, u32 dl_flags,
- gf_dm_user_io user_io,
- void *usr_cbk,
- GF_Err *e)
+GF_DownloadSession *gf_dm_sess_new(GF_DownloadManager *dm, const char *url, u32 dl_flags,
+ gf_dm_user_io user_io,
+ void *usr_cbk,
+ GF_Err *e)
{
- GF_DownloadSession *sess;
-
- *e = GF_OK;
- if (gf_dm_is_local(dm, url)) return NULL;
-
- if (!gf_dm_can_handle_url(dm, url)) {
- *e = GF_NOT_SUPPORTED;
- return NULL;
- }
- sess = gf_dm_sess_new_simple(url, dl_flags, user_io, usr_cbk, NULL, e);
+ GF_DownloadSession *sess;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("%s:%d gf_dm_sess_new(%s)\n", __FILE__, __LINE__, url));
+ *e = GF_OK;
+ if (gf_dm_is_local(dm, url)) return NULL;
+
+ if (!gf_dm_can_handle_url(dm, url)) {
+ *e = GF_NOT_SUPPORTED;
+ return NULL;
+ }
+ sess = gf_dm_sess_new_simple(dm, url, dl_flags, user_io, usr_cbk, e);
if (sess) {
sess->dm = dm;
- gf_list_add(dm->sessions, sess);
+ gf_list_add(dm->sessions, sess);
}
return sess;
}
static GF_Err gf_dm_read_data(GF_DownloadSession *sess, char *data, u32 data_size, u32 *out_read)
{
- GF_Err e;
-
+ GF_Err e;
+ if (!sess)
+ return GF_BAD_PARAM;
#ifdef GPAC_HAS_SSL
- if (sess->ssl) {
- u32 size = SSL_read(sess->ssl, data, data_size);
- e = GF_OK;
- data[size] = 0;
- if (!size) e = GF_IP_NETWORK_EMPTY;
- *out_read = size;
- } else
+ if (sess->ssl) {
+ u32 size = SSL_read(sess->ssl, data, data_size);
+ e = GF_OK;
+ data[size] = 0;
+ if (!size) e = GF_IP_NETWORK_EMPTY;
+ *out_read = size;
+ } else
#endif
- e = gf_sk_receive(sess->sock, data, data_size, 0, out_read);
+ if (!sess->sock)
+ return GF_NETIO_DISCONNECTED;
+ e = gf_sk_receive(sess->sock, data, data_size, 0, out_read);
- return e;
+ return e;
}
static Bool pattern_match(const char *pattern, const char *string)
{
- const char *p = pattern, *n = string;
- char c;
- for (; (c = TOLOWER (*p++)) != '\0'; n++) {
- if (c == '*') {
- for (c = TOLOWER (*p); c == '*'; c = TOLOWER (*++p))
- ;
- for (; *n != '\0'; n++)
- if (TOLOWER (*n) == c && pattern_match (p, n))
- return 1;
+ const char *p = pattern, *n = string;
+ char c;
+ for (; (c = TOLOWER (*p++)) != '\0'; n++) {
+ if (c == '*') {
+ for (c = TOLOWER (*p); c == '*'; c = TOLOWER (*++p))
+ ;
+ for (; *n != '\0'; n++)
+ if (TOLOWER (*n) == c && pattern_match (p, n))
+ return 1;
#ifdef ASTERISK_EXCLUDES_DOT
- else if (*n == '.')
- return 0;
+ else if (*n == '.')
+ return 0;
#endif
- return c == '\0';
- } else {
- if (c != TOLOWER (*n))
- return 0;
- }
- }
- return *n == '\0';
+ return c == '\0';
+ } else {
+ if (c != TOLOWER (*n))
+ return 0;
+ }
+ }
+ return *n == '\0';
}
#undef TOLOWER
static void gf_dm_connect(GF_DownloadSession *sess)
{
- GF_Err e;
- u16 proxy_port = 0;
- const char *proxy, *ip;
- if (!sess->sock) {
- sess->num_retry = 40;
- sess->sock = gf_sk_new(GF_SOCK_TYPE_TCP);
- //gf_sk_set_block_mode(sess->sock, 1);
- }
+ GF_Err e;
+ u16 proxy_port = 0;
+ const char *proxy, *ip;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("gf_dm_connect"":%d\n", __LINE__));
+ if (!sess->sock) {
+ sess->num_retry = 40;
+ sess->sock = gf_sk_new(GF_SOCK_TYPE_TCP);
+ }
- /*connect*/
- sess->status = GF_NETIO_SETUP;
- gf_dm_sess_notify_state(sess, sess->status, GF_OK);
-
- /*PROXY setup*/
- if (sess->proxy_enabled!=2 && sess->dm) {
- proxy = gf_cfg_get_key(sess->dm->cfg, "HTTPProxy", "Enabled");
- if (proxy && !strcmp(proxy, "yes")) {
- u32 i;
- Bool use_proxy=1;
- for (i=0; i<gf_list_count(sess->dm->skip_proxy_servers); i++) {
- char *skip = gf_list_get(sess->dm->skip_proxy_servers, i);
- if (!strcmp(skip, sess->server_name)) {
- use_proxy=0;
- break;
- }
- }
- if (use_proxy) {
- proxy = gf_cfg_get_key(sess->dm->cfg, "HTTPProxy", "Port");
- proxy_port = proxy ? atoi(proxy) : 80;
- proxy = gf_cfg_get_key(sess->dm->cfg, "HTTPProxy", "Name");
- sess->proxy_enabled = 1;
- } else {
- proxy = NULL;
- }
- } else {
- proxy = NULL;
- sess->proxy_enabled = 0;
- }
- } else {
- proxy = NULL;
- }
+ /*connect*/
+ sess->status = GF_NETIO_SETUP;
+ gf_dm_sess_notify_state(sess, sess->status, GF_OK);
+
+ /*PROXY setup*/
+ if (sess->proxy_enabled!=2 && sess->dm && sess->dm->cfg) {
+ proxy = gf_cfg_get_key(sess->dm->cfg, "HTTPProxy", "Enabled");
+ if (proxy && !strcmp(proxy, "yes")) {
+ u32 i;
+ Bool use_proxy=1;
+ for (i=0; i<gf_list_count(sess->dm->skip_proxy_servers); i++) {
+ char *skip = gf_list_get(sess->dm->skip_proxy_servers, i);
+ if (!strcmp(skip, sess->server_name)) {
+ use_proxy=0;
+ break;
+ }
+ }
+ if (use_proxy) {
+ proxy = gf_cfg_get_key(sess->dm->cfg, "HTTPProxy", "Port");
+ proxy_port = proxy ? atoi(proxy) : 80;
+ proxy = gf_cfg_get_key(sess->dm->cfg, "HTTPProxy", "Name");
+ sess->proxy_enabled = 1;
+ } else {
+ proxy = NULL;
+ }
+ } else {
+ proxy = NULL;
+ sess->proxy_enabled = 0;
+ }
+ } else {
+ proxy = NULL;
+ }
- if (sess->dm) {
+ if (sess->dm && sess->dm->cfg) {
ip = gf_cfg_get_key(sess->dm->cfg, "Network", "MobileIPEnabled");
- if (ip && !strcmp(ip, "yes")) {
- ip = gf_cfg_get_key(sess->dm->cfg, "Network", "MobileIP");
- } else {
- ip = NULL;
- }
+ if (ip && !strcmp(ip, "yes")) {
+ ip = gf_cfg_get_key(sess->dm->cfg, "Network", "MobileIP");
+ } else {
+ ip = NULL;
+ }
} else {
ip = NULL;
}
- if (!proxy) {
- proxy = sess->server_name;
- proxy_port = sess->port;
- }
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Connecting to %s:%d\n", proxy, proxy_port));
+ if (!proxy) {
+ proxy = sess->server_name;
+ proxy_port = sess->port;
+ }
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Connecting to %s:%d\n", proxy, proxy_port));
- e = gf_sk_connect(sess->sock, (char *) proxy, proxy_port, (char *)ip);
+ e = gf_sk_connect(sess->sock, (char *) proxy, proxy_port, (char *)ip);
- /*retry*/
- if ((e == GF_IP_SOCK_WOULD_BLOCK) && sess->num_retry) {
- sess->status = GF_NETIO_SETUP;
- sess->num_retry--;
- return;
- }
+ /*retry*/
+ if ((e == GF_IP_SOCK_WOULD_BLOCK) && sess->num_retry) {
+ sess->status = GF_NETIO_SETUP;
+ sess->num_retry--;
+ return;
+ }
- /*failed*/
- if (e) {
- sess->status = GF_NETIO_STATE_ERROR;
- sess->last_error = e;
- gf_dm_sess_notify_state(sess, sess->status, e);
- return;
- }
+ /*failed*/
+ if (e) {
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ return;
+ }
- sess->status = GF_NETIO_CONNECTED;
- gf_dm_sess_notify_state(sess, GF_NETIO_CONNECTED, GF_OK);
- //gf_sk_set_block_mode(sess->sock, 1);
- gf_sk_set_buffer_size(sess->sock, 0, GF_DOWNLOAD_BUFFER_SIZE);
- gf_dm_configure_cache(sess);
+ sess->status = GF_NETIO_CONNECTED;
+ gf_dm_sess_notify_state(sess, GF_NETIO_CONNECTED, GF_OK);
+ gf_sk_set_buffer_size(sess->sock, 0, GF_DOWNLOAD_BUFFER_SIZE);
+ gf_dm_configure_cache(sess);
#ifdef GPAC_HAS_SSL
- /*socket is connected, configure SSL layer*/
- if (!sess->ssl && sess->dm->ssl_ctx && (sess->flags & GF_DOWNLOAD_SESSION_USE_SSL)) {
- int ret;
- long vresult;
- char common_name[256];
- X509 *cert;
- Bool success = 1;
-
- sess->ssl = SSL_new(sess->dm->ssl_ctx);
- SSL_set_fd(sess->ssl, gf_sk_get_handle(sess->sock));
- SSL_set_connect_state(sess->ssl);
- ret = SSL_connect(sess->ssl);
- assert(ret>0);
-
- cert = SSL_get_peer_certificate(sess->ssl);
- /*if we have a cert, check it*/
- if (cert) {
- vresult = SSL_get_verify_result(sess->ssl);
- if (vresult != X509_V_OK) success = 0;
- else {
- common_name[0] = 0;
- X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, common_name, sizeof (common_name));
- if (!pattern_match(common_name, sess->server_name)) success = 0;
- }
- X509_free(cert);
-
- if (!success) {
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_STATE_ERROR;
- sess->last_error = GF_AUTHENTICATION_FAILURE;
- gf_dm_sess_notify_state(sess, sess->status, sess->last_error);
- }
- }
- }
+ if (!sess->ssl && (sess->flags & GF_DOWNLOAD_SESSION_USE_SSL)) {
+ if (!sess->dm->ssl_ctx)
+ ssl_init(sess->dm, 0);
+ /*socket is connected, configure SSL layer*/
+ if (sess->dm->ssl_ctx) {
+ int ret;
+ long vresult;
+ char common_name[256];
+ X509 *cert;
+ Bool success = 1;
+
+ sess->ssl = SSL_new(sess->dm->ssl_ctx);
+ SSL_set_fd(sess->ssl, gf_sk_get_handle(sess->sock));
+ SSL_set_connect_state(sess->ssl);
+ ret = SSL_connect(sess->ssl);
+ assert(ret>0);
+
+ cert = SSL_get_peer_certificate(sess->ssl);
+ /*if we have a cert, check it*/
+ if (cert) {
+ vresult = SSL_get_verify_result(sess->ssl);
+ if (vresult != X509_V_OK) success = 0;
+ else {
+ common_name[0] = 0;
+ X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, common_name, sizeof (common_name));
+ if (!pattern_match(common_name, sess->server_name)) success = 0;
+ }
+ X509_free(cert);
+
+ if (!success) {
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = GF_AUTHENTICATION_FAILURE;
+ gf_dm_sess_notify_state(sess, sess->status, sess->last_error);
+ }
+ }
+ }
+ }
#endif
}
+DownloadedCacheEntry gf_dm_refresh_cache_entry(GF_DownloadSession *sess) {
+ Bool go;
+ u32 timer = 0;
+ u32 flags = sess->flags;
+ sess->flags |= GF_NETIO_SESSION_NOT_CACHED;
+ go = 1;
+ while (go) {
+ switch (sess->status) {
+ /*setup download*/
+ case GF_NETIO_SETUP:
+ gf_dm_connect(sess);
+ if (sess->status == GF_NETIO_SETUP)
+ gf_sleep(16);
+ break;
+ case GF_NETIO_WAIT_FOR_REPLY:
+ if (timer == 0)
+ timer = gf_sys_clock();
+ gf_sleep(16);
+ {
+ u32 timer2 = gf_sys_clock();
+ if (timer2 - timer > 5000) {
+ GF_Err e;
+ /* Since HEAD is not understood by this server, we use a GET instead */
+ sess->http_read_type = GET;
+ sess->flags |= GF_NETIO_SESSION_NOT_CACHED;
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_SETUP;
+ sess->server_only_understand_get = 1;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("gf_dm_refresh_cache_entry() : Timeout with HEAD, try with GET\n"));
+ e = gf_dm_setup_from_url(sess, sess->orig_url);
+ if (e) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("gf_dm_refresh_cache_entry() : Error with GET %d\n", e));
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ } else {
+ timer = 0;
+ continue;
+ }
+ }
+ }
+ case GF_NETIO_CONNECTED:
+ sess->do_requests(sess);
+ break;
+ case GF_NETIO_DATA_EXCHANGE:
+ case GF_NETIO_DISCONNECTED:
+ case GF_NETIO_STATE_ERROR:
+ go = 0;
+ break;
+ }
+ }
+ sess->flags = flags;
+ if (sess->status==GF_NETIO_STATE_ERROR) return NULL;
+ return sess->cache_entry;
+}
+
+
const char *gf_dm_sess_mime_type(GF_DownloadSession *sess)
{
- Bool go;
- u32 flags = sess->flags;
- sess->flags |= GF_NETIO_SESSION_NOT_CACHED;
-
- go = 1;
- while (go) {
- switch (sess->status) {
- /*setup download*/
- case GF_NETIO_SETUP:
- gf_dm_connect(sess);
- if (sess->status == GF_NETIO_SETUP)
- gf_sleep(200);
- break;
- case GF_NETIO_WAIT_FOR_REPLY:
- gf_sleep(20);
- case GF_NETIO_CONNECTED:
- sess->do_requests(sess);
- break;
- case GF_NETIO_DATA_EXCHANGE:
- case GF_NETIO_DISCONNECTED:
- case GF_NETIO_STATE_ERROR:
- go = 0;
- break;
- }
- }
- sess->flags = flags;
- if (sess->status==GF_NETIO_STATE_ERROR) return NULL;
- return sess->mime_type;
+ DownloadedCacheEntry entry;
+ if (sess->cache_entry) {
+ const char * oldMimeIfAny = gf_cache_get_mime_type(sess->cache_entry);
+ if (oldMimeIfAny)
+ return oldMimeIfAny;
+ }
+ entry = gf_dm_refresh_cache_entry (sess);
+ if (!entry)
+ return NULL;
+ assert( entry == sess->cache_entry && entry);
+ return gf_cache_get_mime_type( sess->cache_entry );
}
GF_Err gf_dm_sess_process(GF_DownloadSession *sess)
{
- Bool go;
- go = 1;
- while (go) {
- switch (sess->status) {
- /*setup download*/
- case GF_NETIO_SETUP:
- gf_dm_connect(sess);
- if (sess->status == GF_NETIO_SETUP)
- gf_sleep(200);
- break;
- case GF_NETIO_WAIT_FOR_REPLY:
- gf_sleep(20);
- case GF_NETIO_CONNECTED:
- case GF_NETIO_DATA_EXCHANGE:
- sess->do_requests(sess);
- if (!sess->cache_name && !sess->th)
- return sess->last_error;
- break;
- case GF_NETIO_DISCONNECTED:
- case GF_NETIO_STATE_ERROR:
- go = 0;
- break;
- }
- }
- return sess->last_error;
+ Bool go;
+ go = 1;
+ while (go) {
+ switch (sess->status) {
+ /*setup download*/
+ case GF_NETIO_SETUP:
+ gf_dm_connect(sess);
+ if (sess->status == GF_NETIO_SETUP)
+ gf_sleep(16);
+ break;
+ case GF_NETIO_WAIT_FOR_REPLY:
+ gf_sleep(16);
+ case GF_NETIO_CONNECTED:
+ case GF_NETIO_DATA_EXCHANGE:
+ sess->do_requests(sess);
+ break;
+ case GF_NETIO_DISCONNECTED:
+ case GF_NETIO_STATE_ERROR:
+ go = 0;
+ break;
+ }
+ }
+ return sess->last_error;
+}
+
+static Bool gf_dm_needs_to_delete_cache(GF_DownloadManager * dm) {
+ const char * opt;
+ if (!dm || !dm->cfg)
+ return 0;
+ opt = gf_cfg_get_key(dm->cfg, "Downloader", "CleanCache");
+ return opt && (!strncmp("yes", opt, 3) || !strncmp("true", opt, 4) || !strncmp("1", opt, 1));
}
+#ifdef BUGGY_gf_cache_cleanup_cache
+/*!
+ * Cleans up the cache at start and stop.
+ * Note that this method will perform any cleanup if
+ * Configuration section [Downloader]/CleanCache is not set, meaning
+ * that methods that create a "fake" GF_DownloadManager such as
+ * gf_dm_wget() are not impacted and won't cleanup the cache
+ *
+ * FIXME: should be probably threaded to avoid too long start time
+ * \param dm The GF_DownloadManager
+ */
+static void gf_cache_cleanup_cache(GF_DownloadManager * dm) {
+ if (gf_dm_needs_to_delete_cache(dm)) {
+ gf_cache_delete_all_cached_files(dm->cache_directory);
+ }
+}
+#endif
GF_DownloadManager *gf_dm_new(GF_Config *cfg)
{
- const char *opt;
- GF_DownloadManager *dm;
- if (!cfg) return NULL;
- GF_SAFEALLOC(dm, GF_DownloadManager);
- dm->sessions = gf_list_new();
- dm->skip_proxy_servers = gf_list_new();
- dm->cfg = cfg;
-
- opt = gf_cfg_get_key(cfg, "General", "CacheDirectory");
- if (opt) {
- if (opt[strlen(opt)-1] != GF_PATH_SEPARATOR) {
- dm->cache_directory = (char *) gf_malloc(sizeof(char)* (strlen(opt)+2));
- sprintf(dm->cache_directory, "%s%c", opt, GF_PATH_SEPARATOR);
- } else {
- dm->cache_directory = gf_strdup(opt);
+ const char *opt;
+ char * default_cache_dir;
+ GF_DownloadManager *dm;
+ GF_SAFEALLOC(dm, GF_DownloadManager);
+ dm->sessions = gf_list_new();
+ dm->cache_entries = gf_list_new();
+ dm->credentials = gf_list_new();
+ dm->skip_proxy_servers = gf_list_new();
+ dm->partial_downloads = gf_list_new();
+ dm->cfg = cfg;
+ dm->cache_mx = gf_mx_new("download_manager_cache_mx");
+ default_cache_dir = NULL;
+ gf_mx_p( dm->cache_mx );
+ if (cfg)
+ opt = gf_cfg_get_key(cfg, "General", "CacheDirectory");
+ else
+ opt = NULL;
+ if (!opt) {
+ default_cache_dir = gf_get_default_cache_directory();
+ opt = default_cache_dir;
+ }
+ if (opt[strlen(opt)-1] != GF_PATH_SEPARATOR) {
+ dm->cache_directory = (char *) gf_malloc(sizeof(char)* (strlen(opt)+2));
+ sprintf(dm->cache_directory, "%s%c", opt, GF_PATH_SEPARATOR);
+ } else {
+ dm->cache_directory = gf_strdup(opt);
+ }
+
+ dm->head_timeout = 5000;
+ if (cfg) {
+ opt = gf_cfg_get_key(cfg, "Downloader", "HTTPHeadTimeout");
+ if (opt) {
+ dm->head_timeout = atoi(opt);
}
}
+ gf_mx_v( dm->cache_mx );
+ if (default_cache_dir)
+ gf_free(default_cache_dir);
#ifdef GPAC_HAS_SSL
- ssl_init(dm, 0);
+ dm->ssl_ctx = NULL;
#endif
- return dm;
+ /* TODO: Not ready for now, we should find a locking strategy between several GPAC instances...
+ * gf_cache_cleanup_cache(dm);
+ */
+ return dm;
}
void gf_dm_set_auth_callback(GF_DownloadManager *dm,
- Bool (*GetUserPassword)(void *usr_cbk, const char *site_url, char *usr_name, char *password),
- void *usr_cbk)
+ Bool (*GetUserPassword)(void *usr_cbk, const char *site_url, char *usr_name, char *password),
+ void *usr_cbk)
{
- if (dm) {
- dm->GetUserPassword = GetUserPassword;
- dm->usr_cbk = usr_cbk;
- }
+ if (dm) {
+ dm->GetUserPassword = GetUserPassword;
+ dm->usr_cbk = usr_cbk;
+ }
}
void gf_dm_del(GF_DownloadManager *dm)
{
- /*destroy all pending sessions*/
- while (gf_list_count(dm->sessions)) {
- GF_DownloadSession *sess = (GF_DownloadSession *) gf_list_get(dm->sessions, 0);
- gf_dm_sess_del(sess);
- }
- gf_list_del(dm->sessions);
+ if (!dm)
+ return;
+ assert( dm->sessions);
+ assert( dm->cache_mx );
+ gf_mx_p( dm->cache_mx );
+
+ while (gf_list_count(dm->partial_downloads)) {
+ GF_PartialDownload * entry = gf_list_get( dm->partial_downloads, 0);
+ gf_list_rem( dm->partial_downloads, 0);
+ assert( entry->filename );
+ gf_delete_file( entry->filename );
+ gf_free(entry->filename );
+ entry->filename = NULL;
+ entry->url = NULL;
+ gf_free( entry );
+ }
- while (gf_list_count(dm->skip_proxy_servers)) {
- char *serv = gf_list_get(dm->skip_proxy_servers, 0);
- gf_list_rem(dm->skip_proxy_servers, 0);
- gf_free(serv);
- }
- gf_list_del(dm->skip_proxy_servers);
+ /*destroy all pending sessions*/
+ while (gf_list_count(dm->sessions)) {
+ GF_DownloadSession *sess = (GF_DownloadSession *) gf_list_get(dm->sessions, 0);
+ gf_dm_sess_del(sess);
+ }
+ gf_list_del(dm->sessions);
+ dm->sessions = NULL;
+ assert( dm->skip_proxy_servers );
+ while (gf_list_count(dm->skip_proxy_servers)) {
+ char *serv = gf_list_get(dm->skip_proxy_servers, 0);
+ gf_list_rem(dm->skip_proxy_servers, 0);
+ gf_free(serv);
+ }
+ gf_list_del(dm->skip_proxy_servers);
+ dm->skip_proxy_servers = NULL;
+ assert( dm->credentials);
+ while (gf_list_count(dm->credentials)) {
+ gf_user_credentials_struct * cred = gf_list_get( dm->credentials, 0);
+ gf_list_rem( dm->credentials, 0);
+ gf_free( cred );
+ }
+ gf_list_del( dm->credentials);
+ dm->credentials = NULL;
+ assert( dm->cache_entries );
+ {
+ /* Deletes DownloadedCacheEntry and associated files if required */
+ Bool delete_my_files = gf_dm_needs_to_delete_cache(dm);
+ while (gf_list_count(dm->cache_entries)) {
+ const DownloadedCacheEntry entry = gf_list_get( dm->cache_entries, 0);
+ gf_list_rem( dm->cache_entries, 0);
+ if (delete_my_files)
+ gf_cache_entry_set_delete_files_when_deleted(entry);
+ gf_cache_delete_entry(entry);
+ }
+ gf_list_del( dm->cache_entries );
+ dm->cache_entries = NULL;
+ }
- gf_free(dm->cache_directory);
+ gf_list_del( dm->partial_downloads );
+ dm->partial_downloads = NULL;
+ /* TODO: Not ready for now, we should find a locking strategy between several GPAC instances...
+ * gf_cache_cleanup_cache(dm);
+ */
+ if (dm->cache_directory)
+ gf_free(dm->cache_directory);
+ dm->cache_directory = NULL;
#ifdef GPAC_HAS_SSL
- if (dm->ssl_ctx) SSL_CTX_free(dm->ssl_ctx);
+ if (dm->ssl_ctx) SSL_CTX_free(dm->ssl_ctx);
#endif
+ /* Stored elsewhere, no need to free */
+ dm->cfg = NULL;
+ gf_mx_v( dm->cache_mx );
+ gf_mx_del( dm->cache_mx);
+ dm->cache_mx = NULL;
+ gf_free(dm);
+}
- gf_free(dm);
+/*!
+ * Skip ICY metadata from SHOUTCAST or ICECAST streams.
+ * Data will be skipped and parsed and sent as a GF_NETIO_Parameter to the user_io,
+ * so modules interrested by those streams may use the data
+ * \param sess The GF_DownloadSession
+ * \param icy_metaint The number of bytes of data before reaching possible meta data
+ * \param data last data received
+ * \param nbBytes The number of bytes contained into data
+ */
+static void gf_icy_skip_data(GF_DownloadSession * sess, u32 icy_metaint, const char * data, u32 nbBytes) {
+ assert( icy_metaint > 0 );
+ while (nbBytes) {
+ if (sess->icy_bytes == icy_metaint) {
+ sess->icy_count = 1 + 16* (u8) data[0];
+ /*skip icy metadata*/
+ if (sess->icy_count > nbBytes) {
+ sess->icy_count -= nbBytes;
+ nbBytes = 0;
+ } else {
+ if (sess->icy_count > 1) {
+ GF_NETIO_Parameter par;
+ char szData[4096];
+ memset(szData, 0, 4096);
+ memcpy(szData, data+1, sess->icy_count-1);
+ szData[sess->icy_count] = 0;
+
+ par.error = 0;
+ par.msg_type = GF_NETIO_PARSE_HEADER;
+ par.name = "icy-meta";
+ par.value = szData;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK,
+ ("[ICY] Found metainfo in stream=%s, (every %d bytes)\n", szData, icy_metaint));
+ gf_dm_sess_user_io(sess, &par);
+ }
+ nbBytes -= sess->icy_count;
+ data += sess->icy_count;
+ sess->icy_count = 0;
+ sess->icy_bytes = 0;
+ }
+ } else {
+ GF_NETIO_Parameter par;
+ u32 left = icy_metaint - sess->icy_bytes;
+ if (left > nbBytes) {
+ left = nbBytes;
+ sess->icy_bytes += left;
+ nbBytes = 0;
+ } else {
+ sess->icy_bytes = icy_metaint;
+ nbBytes -= left;
+ }
+
+ par.msg_type = GF_NETIO_DATA_EXCHANGE;
+ par.error = GF_OK;
+ par.data = data;
+ par.size = left;
+ gf_dm_sess_user_io(sess, &par);
+
+ data += left;
+ }
+ }
}
-static GFINLINE void gf_dm_data_received(GF_DownloadSession *sess, char *data, u32 nbBytes)
+static GFINLINE void gf_dm_data_received(GF_DownloadSession *sess, const char *data, u32 nbBytes)
{
- GF_NETIO_Parameter par;
- u32 runtime, rcv;
-
- rcv = nbBytes;
-
- if (! (sess->flags & GF_NETIO_SESSION_NOT_CACHED)) {
- if (sess->cache) {
- fwrite(data, nbBytes, 1, sess->cache);
- fflush(sess->cache);
- }
- sess->bytes_done += nbBytes;
- /*if not threaded don't signal data to user*/
-// if (sess->th)
- {
- par.msg_type = GF_NETIO_DATA_EXCHANGE;
- par.error = GF_OK;
- par.data = data;
- par.size = nbBytes;
- gf_dm_sess_user_io(sess, &par);
- }
- } else if (sess->icy_metaint) {
- while (nbBytes) {
- if (sess->icy_bytes == sess->icy_metaint) {
- sess->icy_count = 1 + 16* (u8) data[0];
-
- /*skip icy metadata*/
- if (sess->icy_count >= nbBytes) {
- sess->icy_count -= nbBytes;
- nbBytes = 0;
- } else {
- if (sess->icy_count > 1) {
- GF_NETIO_Parameter par;
- char szData[4096];
- memcpy(szData, data+1, sess->icy_count-1);
- szData[sess->icy_count] = 0;
-
- par.error = 0;
- par.msg_type = GF_NETIO_PARSE_HEADER;
- par.name = "icy-meta";
- par.value = szData;
- gf_dm_sess_user_io(sess, &par);
- }
- nbBytes -= sess->icy_count;
- data += sess->icy_count;
- sess->icy_count = 0;
- sess->icy_bytes = 0;
- }
- } else {
- u32 left = sess->icy_metaint - sess->icy_bytes;
- if (left > nbBytes) {
- left = nbBytes;
- sess->icy_bytes += left;
- nbBytes = 0;
- } else {
- sess->icy_bytes = sess->icy_metaint;
- nbBytes -= left;
- }
-
- par.msg_type = GF_NETIO_DATA_EXCHANGE;
- par.error = GF_OK;
- par.data = data;
- par.size = left;
- gf_dm_sess_user_io(sess, &par);
-
- data += left;
- }
- }
- } else {
- sess->bytes_done += nbBytes;
- /*if not threaded or cached, don't signal data to user*/
- if (sess->th || !sess->cache_name) {
- par.msg_type = GF_NETIO_DATA_EXCHANGE;
- par.error = GF_OK;
- par.data = data;
- par.size = nbBytes;
- gf_dm_sess_user_io(sess, &par);
- }
- }
+ GF_NETIO_Parameter par;
+ u32 runtime, rcv;
+ rcv = nbBytes;
+ sess->bytes_done += nbBytes;
+ if (sess->icy_metaint > 0)
+ gf_icy_skip_data(sess, sess->icy_metaint, data, nbBytes);
+ else {
+ if (sess->use_cache_file)
+ gf_cache_write_to_cache( sess->cache_entry, sess, data, nbBytes);
+ {
+ par.msg_type = GF_NETIO_DATA_EXCHANGE;
+ par.error = GF_OK;
+ par.data = data;
+ par.size = nbBytes;
+ gf_dm_sess_user_io(sess, &par);
+ }
+ }
- if (sess->total_size && (sess->bytes_done == sess->total_size)) {
- gf_dm_disconnect(sess);
- par.msg_type = GF_NETIO_DATA_TRANSFERED;
- par.error = GF_OK;
- gf_dm_sess_user_io(sess, &par);
- return;
- }
- /*update state if not done*/
- if (rcv) {
- sess->bytes_in_wnd += rcv;
- runtime = gf_sys_clock() - sess->window_start;
- if (!runtime) {
- sess->bytes_per_sec = 0;
- } else {
- sess->bytes_per_sec = (1000 * (sess->bytes_in_wnd)) / runtime;
- if (runtime>1000) {
- sess->window_start += runtime/2;
- sess->bytes_in_wnd = sess->bytes_per_sec / 2;
- }
- }
- }
+ if (sess->total_size && (sess->bytes_done == sess->total_size)) {
+ gf_dm_disconnect(sess);
+ par.msg_type = GF_NETIO_DATA_TRANSFERED;
+ par.error = GF_OK;
+ gf_dm_sess_user_io(sess, &par);
+ if (sess->use_cache_file) {
+ gf_cache_close_write_cache(sess->cache_entry, sess, 1);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK,
+ ("[CACHE] url %s saved as %s\n", gf_cache_get_url(sess->cache_entry), gf_cache_get_cache_filename(sess->cache_entry)));
+ }
+ return;
+ }
+ /*update state if not done*/
+ if (rcv) {
+ sess->bytes_in_wnd += rcv;
+ runtime = gf_sys_clock() - sess->window_start;
+ if (!runtime) {
+ sess->bytes_per_sec = 0;
+ } else {
+ sess->bytes_per_sec = (1000 * (sess->bytes_in_wnd)) / runtime;
+ if (runtime>1000) {
+ sess->window_start += runtime/2;
+ sess->bytes_in_wnd = sess->bytes_per_sec / 2;
+ }
+ }
+ }
}
GF_EXPORT
GF_Err gf_dm_sess_fetch_data(GF_DownloadSession *sess, char *buffer, u32 buffer_size, u32 *read_size)
{
- GF_Err e;
-// if (sess->cache || !buffer || !buffer_size) return GF_BAD_PARAM;
- if (/*sess->cache || */ !buffer || !buffer_size) return GF_BAD_PARAM;
- if (sess->th) return GF_BAD_PARAM;
- if (sess->status == GF_NETIO_DISCONNECTED) return GF_EOS;
- if (sess->status > GF_NETIO_DATA_TRANSFERED) return GF_BAD_PARAM;
-
- *read_size = 0;
- if (sess->status == GF_NETIO_DATA_TRANSFERED) return GF_EOS;
-
- if (sess->status == GF_NETIO_SETUP) {
- gf_dm_connect(sess);
- return GF_OK;
- } else if (sess->status < GF_NETIO_DATA_EXCHANGE) {
- sess->do_requests(sess);
- if (sess->status > GF_NETIO_DATA_TRANSFERED) return GF_SERVICE_ERROR;
- return GF_OK;
- }
- /*we're running but we had data previously*/
- if (sess->init_data) {
- if (sess->init_data_size<=buffer_size) {
- memcpy(buffer, sess->init_data, sizeof(char)*sess->init_data_size);
- *read_size = sess->init_data_size;
- gf_free(sess->init_data);
- sess->init_data = NULL;
- sess->init_data_size = 0;
- } else {
- memcpy(buffer, sess->init_data, sizeof(char)*buffer_size);
- *read_size = buffer_size;
- sess->init_data_size -= buffer_size;
- memcpy(sess->init_data, sess->init_data+buffer_size, sizeof(char)*sess->init_data_size);
- }
- return GF_OK;
- }
+ GF_Err e;
+ if (/*sess->cache || */ !buffer || !buffer_size) return GF_BAD_PARAM;
+ if (sess->th) return GF_BAD_PARAM;
+ if (sess->status == GF_NETIO_DISCONNECTED) return GF_EOS;
+ if (sess->status > GF_NETIO_DATA_TRANSFERED) return GF_BAD_PARAM;
+
+ *read_size = 0;
+ if (sess->status == GF_NETIO_DATA_TRANSFERED) return GF_EOS;
+
+ if (sess->status == GF_NETIO_SETUP) {
+ gf_dm_connect(sess);
+ return GF_OK;
+ } else if (sess->status < GF_NETIO_DATA_EXCHANGE) {
+ sess->do_requests(sess);
+ if (sess->status > GF_NETIO_DATA_TRANSFERED) return GF_SERVICE_ERROR;
+ return GF_OK;
+ }
+ /*we're running but we had data previously*/
+ if (sess->init_data) {
+ if (sess->init_data_size<=buffer_size) {
+ memcpy(buffer, sess->init_data, sizeof(char)*sess->init_data_size);
+ *read_size = sess->init_data_size;
+ gf_free(sess->init_data);
+ sess->init_data = NULL;
+ sess->init_data_size = 0;
+ } else {
+ memcpy(buffer, sess->init_data, sizeof(char)*buffer_size);
+ *read_size = buffer_size;
+ sess->init_data_size -= buffer_size;
+ memcpy(sess->init_data, sess->init_data+buffer_size, sizeof(char)*sess->init_data_size);
+ }
+ return GF_OK;
+ }
- e = gf_dm_read_data(sess, buffer, buffer_size, read_size);
- if (e) return e;
- gf_dm_data_received(sess, buffer, *read_size);
- return GF_OK;
+ e = gf_dm_read_data(sess, buffer, buffer_size, read_size);
+ if (e) return e;
+ gf_dm_data_received(sess, buffer, *read_size);
+ return GF_OK;
}
GF_EXPORT
GF_Err gf_dm_sess_get_stats(GF_DownloadSession * sess, const char **server, const char **path, u32 *total_size, u32 *bytes_done, u32 *bytes_per_sec, u32 *net_status)
{
- if (!sess) return GF_BAD_PARAM;
- if (server) *server = sess->server_name;
- if (path) *path = sess->remote_path;
- if (total_size) *total_size = sess->total_size;
- if (bytes_done) *bytes_done = sess->bytes_done;
- if (bytes_per_sec) *bytes_per_sec = sess->bytes_per_sec;
- if (net_status) *net_status = sess->status;
- if (sess->status == GF_NETIO_DISCONNECTED) return GF_EOS;
- else if (sess->status == GF_NETIO_STATE_ERROR) return GF_SERVICE_ERROR;
- return GF_OK;
+ if (!sess) return GF_BAD_PARAM;
+ if (server) *server = sess->server_name;
+ if (path) *path = sess->remote_path;
+ if (total_size) *total_size = sess->total_size;
+ if (bytes_done) *bytes_done = sess->bytes_done;
+ if (bytes_per_sec) *bytes_per_sec = sess->bytes_per_sec;
+ if (net_status) *net_status = sess->status;
+ if (sess->status == GF_NETIO_DISCONNECTED) return GF_EOS;
+ else if (sess->status == GF_NETIO_STATE_ERROR) return GF_SERVICE_ERROR;
+ return GF_OK;
}
GF_EXPORT
const char *gf_dm_sess_get_cache_name(GF_DownloadSession * sess)
{
- if (!sess) return NULL;
- return sess->cache_name;
+ if (!sess) return NULL;
+ assert( sess->cache_entry );
+ return gf_cache_get_cache_filename(sess->cache_entry);
+}
+
+GF_EXPORT
+Bool gf_dm_sess_can_be_cached_on_disk(const GF_DownloadSession *sess)
+{
+ if (!sess) return 0;
+ return gf_cache_get_content_length(sess->cache_entry) != 0;
}
void gf_dm_sess_abort(GF_DownloadSession * sess)
{
- if (sess->mx) {
- gf_mx_p(sess->mx);
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_STATE_ERROR;
- gf_mx_v(sess->mx);
- } else {
- gf_dm_disconnect(sess);
- }
+ if (sess->mx) {
+ gf_mx_p(sess->mx);
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_STATE_ERROR;
+ gf_mx_v(sess->mx);
+ } else {
+ gf_dm_disconnect(sess);
+ }
}
void *gf_dm_sess_get_private(GF_DownloadSession * sess)
{
- return sess ? sess->ext : NULL;
+ return sess ? sess->ext : NULL;
}
void gf_dm_sess_set_private(GF_DownloadSession * sess, void *private_data)
{
- if (sess) sess->ext = private_data;
+ if (sess) sess->ext = private_data;
}
/* HTTP(S) stuff*/
static GFINLINE u32 http_skip_space(char *val)
{
- u32 ret = 0;
- while (val[ret] == ' ') ret+=1;
- return ret;
+ u32 ret = 0;
+ while (val[ret] == ' ') ret+=1;
+ return ret;
}
static GFINLINE char *http_is_header(char *line, char *header_name)
{
- char *res;
- if (strnicmp(line, header_name, strlen(header_name))) return NULL;
- res = line + strlen(header_name);
- while ((res[0] == ':') || (res[0] == ' ')) res+=1;
- return res;
+ char *res;
+ if (strnicmp(line, header_name, strlen(header_name))) return NULL;
+ res = line + strlen(header_name);
+ while ((res[0] == ':') || (res[0] == ' ')) res+=1;
+ return res;
}
-void http_do_requests(GF_DownloadSession *sess)
-{
- GF_Err e;
- Bool is_ice;
- GF_NETIO_Parameter par;
- char sHTTP[GF_DOWNLOAD_BUFFER_SIZE];
- char buf[1024];
- char comp[400];
- char *new_location;
- char *hdr, *hdr_val;
- u32 res;
- s32 bytesRead;
- s32 LinePos, Pos;
- u32 rsp_code, ContentLength, first_byte, last_byte, total_size, range, no_range, no_cache;
- s32 BodyStart;
-
- /*sent HTTP request*/
- if (sess->status==GF_NETIO_CONNECTED) {
- char range_buf[1024];
- char pass_buf[1024];
- const char *user_agent;
- const char *url;
- const char *user_profile;
- const char *param_string;
- u32 size;
- Bool has_accept, has_connection, has_range, has_agent, has_language, send_profile;
-
- /*setup authentification*/
- strcpy(pass_buf, "");
- if (sess->user) {
- if (!sess->passwd) {
- char szUSR[50], szPASS[50];
- strcpy(szUSR, sess->user);
- strcpy(szPASS, "");
- /*failed getting pass*/
- if (!sess->dm->GetUserPassword || !sess->dm->GetUserPassword(sess->dm->usr_cbk, sess->server_name, szUSR, szPASS)) {
- sess->status = GF_NETIO_STATE_ERROR;
- return;
- }
- sess->passwd = gf_strdup(szPASS);
- }
- sprintf(pass_buf, "%s:%s", sess->user, sess->passwd);
- size = gf_base64_encode(pass_buf, strlen(pass_buf), range_buf, 1024);
- range_buf[size] = 0;
- sprintf(pass_buf, "Authorization: Basic %s", range_buf);
- }
-
+/*!
+ * Sends the HTTP headers
+ * \param sess The GF_DownloadSession
+ * \param the buffer containing the request
+ * \return GF_OK if everything went fine, the error otherwise
+ */
+static GF_Err http_send_headers(GF_DownloadSession *sess, char * sHTTP) {
+ GF_Err e;
+ GF_NETIO_Parameter par;
+ char range_buf[1024];
+ char pass_buf[1024];
+ const char *user_agent;
+ const char *url;
+ const char *user_profile;
+ const char *param_string;
+ Bool has_accept, has_connection, has_range, has_agent, has_language, send_profile;
+ assert (sess->status == GF_NETIO_CONNECTED);
+ /*setup authentification*/
+ strcpy(pass_buf, "");
+ sess->creds = gf_find_user_credentials_for_site( sess->dm, sess->server_name );
+ if (sess->creds && sess->creds->valid) {
+ sprintf(pass_buf, "Authorization: Basic %s", sess->creds->digest);
+ }
+ if (sess->dm && sess->dm->cfg)
+ user_agent = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserAgent");
+ else
+ user_agent = NULL;
+ if (!user_agent) user_agent = GF_DOWNLOAD_AGENT_NAME;
+
+
+ par.error = 0;
+ par.msg_type = GF_NETIO_GET_METHOD;
+ par.name = NULL;
+ gf_dm_sess_user_io(sess, &par);
+ if (!par.name || sess->server_only_understand_get) {
+ par.name = "GET";
+ }
- /*MIX2005 KMS project*/
-#if 0
- if (strstr(sess->remote_path, "getKey.php?")) {
- char *sLogin, *sPass;
- sLogin = gf_cfg_get_key(sess->dm->cfg, "General", "KMS_User");
- sPass = gf_cfg_get_key(sess->dm->cfg, "General", "KMS_Password");
- if (!sLogin) sLogin = "mix";
- if (!sPass) sPass = "mix";
- sprintf(https_get_buffer, "%s&login=%s&password=%s", sess->remote_path, sLogin, sPass);
- }
-#endif
+ if (par.name) {
+ if (!strcmp(par.name, "GET")) sess->http_read_type = GET;
+ else if (!strcmp(par.name, "HEAD")) sess->http_read_type = HEAD;
+ else sess->http_read_type = OTHER;
+ } else {
+ sess->http_read_type = GET;
+ }
- if (sess->dm)
- user_agent = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserAgent");
- else
- user_agent = NULL;
- if (!user_agent) user_agent = GF_DOWNLOAD_AGENT_NAME;
+ url = (sess->proxy_enabled==1) ? sess->orig_url : sess->remote_path;
+ if (sess->dm && sess->dm->cfg)
+ param_string = gf_cfg_get_key(sess->dm->cfg, "Downloader", "ParamString");
+ else
+ param_string = NULL;
+ if (param_string) {
+ if (strchr(sess->remote_path, '?')) {
+ sprintf(sHTTP, "%s %s&%s HTTP/1.0\r\nHost: %s\r\n" ,
+ par.name ? par.name : "GET", url, param_string, sess->server_name);
+ } else {
+ sprintf(sHTTP, "%s %s?%s HTTP/1.0\r\nHost: %s\r\n" ,
+ par.name ? par.name : "GET", url, param_string, sess->server_name);
+ }
+ } else {
+ sprintf(sHTTP, "%s %s HTTP/1.0\r\nHost: %s\r\n" ,
+ par.name ? par.name : "GET", url, sess->server_name);
+ }
+ /*signal we support title streaming*/
+ if (!strcmp(sess->remote_path, "/")) strcat(sHTTP, "icy-metadata:1\r\n");
+
+ /*get all headers*/
+ has_agent = has_accept = has_connection = has_range = has_language = 0;
+ while (1) {
+ par.msg_type = GF_NETIO_GET_HEADER;
+ par.value = NULL;
+ gf_dm_sess_user_io(sess, &par);
+ if (!par.value) break;
+ strcat(sHTTP, par.name);
+ strcat(sHTTP, ": ");
+ strcat(sHTTP, par.value);
+ strcat(sHTTP, "\r\n");
+ if (!strcmp(par.name, "Accept")) has_accept = 1;
+ else if (!strcmp(par.name, "Connection")) has_connection = 1;
+ else if (!strcmp(par.name, "Range")) has_range = 1;
+ else if (!strcmp(par.name, "User-Agent")) has_agent = 1;
+ else if (!strcmp(par.name, "Accept-Language")) has_language = 1;
+ if (!par.msg_type) break;
+ }
+ if (!has_agent) {
+ strcat(sHTTP, "User-Agent: ");
+ strcat(sHTTP, user_agent);
+ strcat(sHTTP, "\r\n");
+ }
+ if (!has_accept) strcat(sHTTP, "Accept: */*\r\n");
+ if (sess->proxy_enabled==1) strcat(sHTTP, "Proxy-Connection: Keep-alive\r\n");
+ else if (!has_connection) strcat(sHTTP, "Connection: Keep-Alive\r\n");
+ if (!has_range && sess->needs_range) {
+ if (!sess->range_end) sprintf(range_buf, "Range: bytes=%d-\r\n", sess->range_start);
+ else sprintf(range_buf, "Range: bytes=%d-%d\r\n", sess->range_start, sess->range_end);
+ /* FIXME : cache should not be used here */
+ strcat(sHTTP, range_buf);
+ }
+ if (!has_language) {
+ const char *opt;
- par.error = 0;
- par.msg_type = GF_NETIO_GET_METHOD;
- par.name = NULL;
- gf_dm_sess_user_io(sess, &par);
+ if (sess->dm && sess->dm->cfg)
+ opt = gf_cfg_get_key(sess->dm->cfg, "Systems", "Language2CC");
+ else
+ opt = NULL;
+ if (opt) {
+ strcat(sHTTP, "Accept-Language: ");
+ strcat(sHTTP, opt);
+ strcat(sHTTP, "\r\n");
+ }
+ }
- if (par.name) {
- if (!strcmp(par.name, "GET")) sess->http_read_type = 0;
- else if (!strcmp(par.name, "HEAD")) sess->http_read_type = 1;
- else sess->http_read_type = 2;
- } else {
- sess->http_read_type = 0;
- }
- url = (sess->proxy_enabled==1) ? sess->orig_url : sess->remote_path;
- if (sess->dm)
- param_string = gf_cfg_get_key(sess->dm->cfg, "Downloader", "ParamString");
- else
- param_string = NULL;
- if (param_string) {
- if (strchr(sess->remote_path, '?')) {
- sprintf(sHTTP, "%s %s&%s HTTP/1.0\r\nHost: %s\r\n" ,
- par.name ? par.name : "GET", url, param_string, sess->server_name);
- } else {
- sprintf(sHTTP, "%s %s?%s HTTP/1.0\r\nHost: %s\r\n" ,
- par.name ? par.name : "GET", url, param_string, sess->server_name);
- }
- } else {
- sprintf(sHTTP, "%s %s HTTP/1.0\r\nHost: %s\r\n" ,
- par.name ? par.name : "GET", url, sess->server_name);
- }
+ if (strlen(pass_buf)) {
+ strcat(sHTTP, pass_buf);
+ strcat(sHTTP, "\r\n");
+ }
- /*signal we support title streaming*/
- if (!strcmp(sess->remote_path, "/")) strcat(sHTTP, "icy-metadata:1\r\n");
-
- /*get all headers*/
- has_agent = has_accept = has_connection = has_range = has_language = 0;
- while (1) {
- par.msg_type = GF_NETIO_GET_HEADER;
- par.value = NULL;
- gf_dm_sess_user_io(sess, &par);
- if (!par.value) break;
- strcat(sHTTP, par.name);
- strcat(sHTTP, ": ");
- strcat(sHTTP, par.value);
- strcat(sHTTP, "\r\n");
- if (!strcmp(par.name, "Accept")) has_accept = 1;
- else if (!strcmp(par.name, "Connection")) has_connection = 1;
- else if (!strcmp(par.name, "Range")) has_range = 1;
- else if (!strcmp(par.name, "User-Agent")) has_agent = 1;
- else if (!strcmp(par.name, "Accept-Language")) has_language = 1;
- if (!par.msg_type) break;
- }
- if (!has_agent) {
- strcat(sHTTP, "User-Agent: ");
- strcat(sHTTP, user_agent);
- strcat(sHTTP, "\r\n");
- }
- if (!has_accept) strcat(sHTTP, "Accept: */*\r\n");
- if (sess->proxy_enabled==1) strcat(sHTTP, "Proxy-Connection: Keep-alive\r\n");
- else if (!has_connection) strcat(sHTTP, "Connection: Keep-Alive\r\n");
- if (!has_range && sess->cache_start_size) {
- sprintf(range_buf, "Range: bytes=%d-\r\n", sess->cache_start_size);
- strcat(sHTTP, range_buf);
- } else if (!has_range && sess->needs_range) {
- if (!sess->range_end) sprintf(range_buf, "Range: bytes=%d-\r\n", sess->range_start);
- else sprintf(range_buf, "Range: bytes=%d-%d\r\n", sess->range_start, sess->range_end);
- strcat(sHTTP, range_buf);
+ par.msg_type = GF_NETIO_GET_CONTENT;
+ par.data = NULL;
+ par.size = 0;
+
+ /*check if we have personalization info*/
+ send_profile = 0;
+ if (sess->dm && sess->dm->cfg)
+ user_profile = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserProfileID");
+ else
+ user_profile = NULL;
+ if (user_profile) {
+ strcat(sHTTP, "X-UserProfileID: ");
+ strcat(sHTTP, user_profile);
+ strcat(sHTTP, "\r\n");
+ } else {
+ if (sess->dm && sess->dm->cfg)
+ user_profile = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserProfile");
+ else
+ user_profile = NULL;
+ if (user_profile) {
+ FILE *profile = gf_f64_open(user_profile, "rt");
+ if (profile) {
+ gf_f64_seek(profile, 0, SEEK_END);
+ par.size = (u32) gf_f64_tell(profile);
+ fclose(profile);
+ sprintf(range_buf, "Content-Length: %d\r\n", par.size);
+ strcat(sHTTP, range_buf);
+ strcat(sHTTP, "Content-Type: text/xml\r\n");
+ send_profile = 1;
+ }
}
- if (!has_language) {
- const char *opt;
- if (sess->dm)
- opt = gf_cfg_get_key(sess->dm->cfg, "Systems", "Language2CC");
- else
- opt = NULL;
- if (opt) {
- strcat(sHTTP, "Accept-Language: ");
- strcat(sHTTP, opt);
- strcat(sHTTP, "\r\n");
- }
- }
-
+ }
- if (strlen(pass_buf)) {
- strcat(sHTTP, pass_buf);
- strcat(sHTTP, "\r\n");
- }
- if (sess->flags & GF_DOWNLOAD_IS_ICY) strcat(sHTTP, "Icy-Metadata: 1\r\n");
- par.msg_type = GF_NETIO_GET_CONTENT;
- par.data = NULL;
- par.size = 0;
+ if (!send_profile) {
+ gf_dm_sess_user_io(sess, &par);
+ if (par.data && par.size) {
+ sprintf(range_buf, "Content-Length: %d\r\n", par.size);
+ strcat(sHTTP, range_buf);
+ }
+ }
+ /*{
+ const char * mime = gf_cache_get_mime_type(sess->cache_entry);
+ if (sess->server_only_understand_get || mime && !strcmp("audio/mpeg", mime)){*/
+ /* This will force the server to respond with Icy-Metaint */
+ strcat(sHTTP, "Icy-Metadata: 1\r\n");
+ /* }
+ }*/
+
+ if (GF_OK < appendHttpCacheHeaders( sess->cache_entry, sHTTP)) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("Cache Entry : %p, FAILED to append cache directives.", sess->cache_entry));
+ }
- /*check if we have personalization info*/
- send_profile = 0;
- if (sess->dm)
- user_profile = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserProfileID");
- else
- user_profile = NULL;
- if (user_profile) {
- strcat(sHTTP, "X-UserProfileID: ");
- strcat(sHTTP, user_profile);
- strcat(sHTTP, "\r\n");
- } else {
- if (sess->dm)
- user_profile = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserProfile");
- else
- user_profile = NULL;
- if (user_profile) {
- FILE *profile = gf_f64_open(user_profile, "rt");
- if (profile) {
- gf_f64_seek(profile, 0, SEEK_END);
- par.size = (u32) gf_f64_tell(profile);
- fclose(profile);
- sprintf(range_buf, "Content-Length: %d\r\n", par.size);
- strcat(sHTTP, range_buf);
- strcat(sHTTP, "Content-Type: text/xml\r\n");
- send_profile = 1;
- }
- }
- }
+ strcat(sHTTP, "\r\n");
+
+ if (send_profile || par.data) {
+ u32 len = strlen(sHTTP);
+ char *tmp_buf = gf_malloc(sizeof(char)*(len+par.size));
+ strcpy(tmp_buf, sHTTP);
+ if (par.data) {
+ memcpy(tmp_buf+len, par.data, par.size);
+ } else {
+ FILE *profile;
+ assert( sess->dm );
+ assert( sess->dm->cfg );
+ user_profile = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserProfile");
+ assert (user_profile);
+ profile = gf_f64_open(user_profile, "rt");
+ if (profile) {
+ u32 readen = fread(tmp_buf+len, sizeof(char), par.size, profile);
+ if (readen<par.size) {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK,
+ ("Error while loading Downloader/UserProfile, size=%d, should be %d.", readen, par.size));
+ for (; readen < par.size; readen++) {
+ tmp_buf[len + readen] = 0;
+ }
+ }
+ fclose(profile);
+ } else {
+ GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("Error while loading Profile file %s.", user_profile));
+ }
+ }
+#ifdef GPAC_HAS_SSL
+ if (sess->ssl) {
+ e = GF_IP_NETWORK_FAILURE;
+ if (!SSL_write(sess->ssl, tmp_buf, len+par.size)) e = GF_OK;
+ } else
+#endif
+ e = gf_sk_send(sess->sock, tmp_buf, len+par.size);
- if (!send_profile) {
- gf_dm_sess_user_io(sess, &par);
- if (par.data && par.size) {
- sprintf(range_buf, "Content-Length: %d\r\n", par.size);
- strcat(sHTTP, range_buf);
- }
- }
- strcat(sHTTP, "\r\n");
-
- if (send_profile || par.data) {
- u32 len = strlen(sHTTP);
- char *tmp_buf = gf_malloc(sizeof(char)*(len+par.size));
- strcpy(tmp_buf, sHTTP);
- if (par.data) {
- memcpy(tmp_buf+len, par.data, par.size);
- } else {
- FILE *profile;
- user_profile = gf_cfg_get_key(sess->dm->cfg, "Downloader", "UserProfile");
- assert (user_profile);
- profile = gf_f64_open(user_profile, "rt");
- if (profile){
- u32 readen = fread(tmp_buf+len, 1, par.size, profile);
- if (readen<size){
- GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK,
- ("Error while loading Downloader/UserProfile, size=%d, should be %d.", readen, par.size));
- for (; readen < size; readen++){
- tmp_buf[len + readen] = 0;
- }
- }
- fclose(profile);
- } else {
- GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("Error while loading Profile file %s.", user_profile));
- }
- }
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Sending request %s\n\n", tmp_buf));
+ gf_free(tmp_buf);
+ } else {
#ifdef GPAC_HAS_SSL
- if (sess->ssl) {
- e = GF_IP_NETWORK_FAILURE;
- if (!SSL_write(sess->ssl, tmp_buf, len+par.size)) e = GF_OK;
- } else
+ if (sess->ssl) {
+ e = GF_IP_NETWORK_FAILURE;
+ if (!SSL_write(sess->ssl, sHTTP, strlen(sHTTP))) e = GF_OK;
+ } else
#endif
- e = gf_sk_send(sess->sock, tmp_buf, len+par.size);
+ e = gf_sk_send(sess->sock, sHTTP, strlen(sHTTP));
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Sending request %s\n\n", tmp_buf));
- gf_free(tmp_buf);
- } else {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Sending request %s\n ; Error Code=%d\n", sHTTP, e));
+ }
-#ifdef GPAC_HAS_SSL
- if (sess->ssl) {
- e = GF_IP_NETWORK_FAILURE;
- if (!SSL_write(sess->ssl, sHTTP, strlen(sHTTP))) e = GF_OK;
- } else
+ if (e) {
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, GF_NETIO_STATE_ERROR, e);
+ return e;
+ }
+
+ sess->status = GF_NETIO_WAIT_FOR_REPLY;
+ gf_dm_sess_notify_state(sess, GF_NETIO_WAIT_FOR_REPLY, GF_OK);
+ return GF_OK;
+}
+
+
+/*!
+ * Parse the remaining part of body
+ * \param sess The session
+ * \param sHTTP the data buffer
+ * \return The error code if any
+ */
+static GF_Err http_parse_remaining_body(GF_DownloadSession * sess, char * sHTTP) {
+ u32 size;
+ GF_Err e;
+ while (1) {
+ if (sess->status>=GF_NETIO_DISCONNECTED)
+ return GF_REMOTE_SERVICE_ERROR;
+
+#if 1
+ if (sess->limit_data_rate && sess->bytes_per_sec) {
+ if (sess->bytes_per_sec>sess->limit_data_rate) {
+ /*update state*/
+ u32 runtime = gf_sys_clock() - sess->window_start;
+ sess->bytes_per_sec = (1000 * (sess->bytes_in_wnd)) / runtime;
+ if (sess->bytes_per_sec > sess->limit_data_rate) return GF_OK;
+ }
+ }
#endif
- e = gf_sk_send(sess->sock, sHTTP, strlen(sHTTP));
+ e = gf_dm_read_data(sess, sHTTP, GF_DOWNLOAD_BUFFER_SIZE, &size);
+ if (e!= GF_IP_CONNECTION_CLOSED && (!size || e == GF_IP_NETWORK_EMPTY)) {
+ if (e == GF_IP_CONNECTION_CLOSED || (!sess->total_size && (gf_sys_clock() - sess->window_start > 5000))) {
+ sess->total_size = sess->bytes_done;
+ gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
+ assert(sess->server_name);
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] Disconnected from %s: %s\n", sess->server_name, gf_error_to_string(e)));
+ sess->status = GF_NETIO_DISCONNECTED;
+ }
+ return GF_OK;
+ }
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Sending request %s\n\n", sHTTP));
+ if (e) {
+ if (e == GF_IP_CONNECTION_CLOSED){
+ u32 len = gf_cache_get_content_length(sess->cache_entry);
+ if (size > 0)
+ gf_dm_data_received(sess, sHTTP, size);
+ if (len == 0){
+ sess->total_size = sess->bytes_done;
+ // HTTP 1.1 without content length...
+ gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
+ assert(sess->server_name);
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] Disconnected from %s: %s\n", sess->server_name, gf_error_to_string(e)));
+ sess->status = GF_NETIO_DISCONNECTED;
+ gf_cache_set_content_length(sess->cache_entry, sess->bytes_done);
+ e = GF_OK;
}
+ }
+ gf_dm_disconnect(sess);
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ return e;
+ }
+ gf_dm_data_received(sess, sHTTP, size);
- if (e) {
- sess->status = GF_NETIO_STATE_ERROR;
- sess->last_error = e;
- gf_dm_sess_notify_state(sess, GF_NETIO_STATE_ERROR, e);
- return;
- }
+ /*socket empty*/
+ if (size < GF_DOWNLOAD_BUFFER_SIZE) return GF_OK;
+ }
+}
- sess->status = GF_NETIO_WAIT_FOR_REPLY;
- gf_dm_sess_notify_state(sess, GF_NETIO_WAIT_FOR_REPLY, GF_OK);
- return;
- }
+/*!
+ * Waits for the response HEADERS, parse the information... and so on
+ * \param sess The session
+ * \param sHTTP the data buffer
+ */
+static GF_Err wait_for_header_and_parse(GF_DownloadSession *sess, char * sHTTP)
+{
+ GF_NETIO_Parameter par;
+ s32 bytesRead, BodyStart;
+ u32 res;
+ s32 LinePos, Pos;
+ u32 rsp_code, ContentLength, first_byte, last_byte, total_size, range, no_range;
+ char buf[1024];
+ char comp[400];
+ GF_Err e;
+ char * new_location;
+ assert( sess->status == GF_NETIO_WAIT_FOR_REPLY );
+ bytesRead = res = 0;
+ new_location = NULL;
+ sess->use_cache_file = 1;
+ while (1) {
+ e = gf_dm_read_data(sess, sHTTP + bytesRead, GF_DOWNLOAD_BUFFER_SIZE - bytesRead, &res);
+ switch (e) {
+ case GF_IP_NETWORK_EMPTY:
+ if (!bytesRead) return GF_OK;
+ continue;
+ /*socket has been closed while configuring, retry (not sure if the server got the GET)*/
+ case GF_IP_CONNECTION_CLOSED:
+ gf_dm_disconnect(sess);
+ if (!strncmp("HEAD", sHTTP, 4)) {
+ /* Some servers such as shoutcast directly close connection if HEAD or an unknown method is issued */
+ sess->server_only_understand_get = 1;
+ }
+ if (sess->num_retry)
+ sess->status = GF_NETIO_SETUP;
+ else {
+ sess->last_error = e;
+ sess->status = GF_NETIO_STATE_ERROR;
+ }
+ return e;
+ case GF_OK:
+ if (!res) return GF_OK;
+ break;
+ default:
+ goto exit;
+ }
+ bytesRead += res;
- /*process HTTP request*/
- if (sess->status == GF_NETIO_WAIT_FOR_REPLY) {
- bytesRead = res = 0;
- new_location = NULL;
- while (1) {
- e = gf_dm_read_data(sess, sHTTP + bytesRead, GF_DOWNLOAD_BUFFER_SIZE - bytesRead, &res);
-
- switch (e) {
- case GF_IP_NETWORK_EMPTY:
- if (!bytesRead) return;
- continue;
- /*socket has been closed while configuring, retry (not sure if the server got the GET)*/
- case GF_IP_CONNECTION_CLOSED:
- gf_dm_disconnect(sess);
- if (sess->num_retry)
- sess->status = GF_NETIO_SETUP;
- else {
- sess->last_error = e;
- sess->status = GF_NETIO_STATE_ERROR;
- }
- return;
- case GF_OK:
- if (!res) return;
- break;
- default:
- goto exit;
- }
- bytesRead += res;
-
- /*locate body start*/
- BodyStart = gf_token_find(sHTTP, 0, bytesRead, "\r\n\r\n");
- if (BodyStart <= 0) {
- BodyStart=0;
- continue;
- }
+ /*locate body start*/
+ BodyStart = gf_token_find(sHTTP, 0, bytesRead, "\r\n\r\n");
+ if (BodyStart > 0) {
BodyStart += 4;
break;
}
- if (bytesRead < 0) {
- e = GF_REMOTE_SERVICE_ERROR;
- goto exit;
- }
- if (!BodyStart)
- BodyStart = bytesRead;
-
- sHTTP[BodyStart-1] = 0;
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] %s\n\n", sHTTP));
-
- LinePos = gf_token_get_line(sHTTP, 0, bytesRead, buf, 1024);
- Pos = gf_token_get(buf, 0, " \t\r\n", comp, 400);
-
- if (sess->mime_type) gf_free(sess->mime_type);
- sess->mime_type = NULL;
-
- is_ice = 0;
- if (!strncmp("ICY", comp, 4)) {
- is_ice = 1;
- /*be prepared not to receive any mime type from ShoutCast servers*/
- sess->mime_type = gf_strdup("audio/mpeg");
- } else if ((strncmp("HTTP", comp, 4) != 0)) {
- e = GF_REMOTE_SERVICE_ERROR;
- goto exit;
- }
- Pos = gf_token_get(buf, Pos, " ", comp, 400);
- if (Pos <= 0) {
- e = GF_REMOTE_SERVICE_ERROR;
- goto exit;
- }
- rsp_code = (u32) atoi(comp);
- Pos = gf_token_get(buf, Pos, " \r\n", comp, 400);
-
- no_range = range = ContentLength = first_byte = last_byte = total_size = no_cache = 0;
- //parse header
- while (1) {
- char *sep, *hdr_sep;
- if ( (s32) LinePos + 4 > BodyStart) break;
- LinePos = gf_token_get_line(sHTTP, LinePos , bytesRead, buf, 1024);
- if (LinePos < 0) break;
-
- hdr_sep = NULL;
- hdr_val = NULL;
- hdr = buf;
- sep = strchr(buf, ':');
- if (sep) {
- sep[0]=0;
- hdr_val = sep+1;
- while (hdr_val[0]==' ') hdr_val++;
- hdr_sep = strrchr(hdr_val, '\r');
- if (hdr_sep) hdr_sep[0] = 0;
- }
-
- par.error = 0;
- par.msg_type = GF_NETIO_PARSE_HEADER;
- par.name = hdr;
- par.value = hdr_val;
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Processing header %s: %s\n", hdr, hdr_val));
- gf_dm_sess_user_io(sess, &par);
-
- if (!stricmp(hdr, "Content-Length") ) ContentLength = (u32) atoi(hdr_val);
- else if (!stricmp(hdr, "Content-Type")) {
- if (sess->mime_type) gf_free(sess->mime_type);
- sess->mime_type = gf_strdup(hdr_val);
- while (1) {
- u32 len = strlen(sess->mime_type);
- char c = len ? sess->mime_type[len-1] : 0;
- if ((c=='\r') || (c=='\n')) {
- sess->mime_type[len-1] = 0;
- } else {
- break;
- }
- }
- hdr = strchr(sess->mime_type, ';');
- if (hdr) hdr[0] = 0;
- }
- else if (!stricmp(hdr, "Content-Range")) {
- range = 1;
- if (!strncmp(hdr_val, "bytes", 5)) {
- hdr_val += 5;
- if (hdr_val[0] == ':') hdr_val += 1;
- hdr_val += http_skip_space(hdr_val);
- if (hdr_val[0] == '*') {
- sscanf(hdr_val, "*/%d", &total_size);
- } else {
- sscanf(hdr_val, "%d-%d/%d", &first_byte, &last_byte, &total_size);
- }
- }
- }
- else if (!stricmp(hdr, "Accept-Ranges")) {
- if (strstr(hdr_val, "none")) no_range = 1;
- }
- else if (!stricmp(hdr, "Location"))
- new_location = gf_strdup(hdr_val);
- else if (!stricmp(hdr, "icy-metaint"))
- sess->icy_metaint = atoi(hdr_val);
- else if (!stricmp(hdr, "ice") || !stricmp(hdr, "icy") ) {
- is_ice = 1;
- no_cache = 1;
- }
- else if (!stricmp(hdr, "Cache-Control")) {
- if (strstr(hdr_val, "no-cache")) no_cache = 1;
- }
- else if (!stricmp(hdr, "X-UserProfileID") )
- gf_cfg_set_key(sess->dm->cfg, "Downloader", "UserProfileID", hdr_val);
-/* else if (!stricmp(hdr, "Connection") )
- if (strstr(hdr_val, "close")) sess->http_read_type = 1; */
-
-
- if (sep) sep[0]=':';
- if (hdr_sep) hdr_sep[0] = '\r';
- }
- if (no_range) first_byte = 0;
-
- /*check if this code was useful ? */
-#if 0
- if (sess->cache_start_size && (rsp_code == 200) ) {
- if (total_size && (sess->cache_start_size >= total_size) ) {
- rsp_code = 200;
- ContentLength = total_size;
- }
- if (ContentLength && (sess->cache_start_size == ContentLength) ) rsp_code = 200;
- }
-#endif
-
- par.msg_type = GF_NETIO_PARSE_REPLY;
- par.error = GF_OK;
- par.reply = rsp_code;
- par.value = comp;
-
- switch (rsp_code) {
- case 200:
- case 201:
- case 202:
- case 206:
- gf_dm_sess_user_io(sess, &par);
- e = GF_OK;
- if (sess->proxy_enabled==2) {
- sess->proxy_enabled=0;
- if (sess->dm)
- gf_list_add(sess->dm->skip_proxy_servers, gf_strdup(sess->server_name));
- }
+ BodyStart = gf_token_find(sHTTP, 0, bytesRead, "\n\n");
+ if (BodyStart > 0) {
+ BodyStart += 2;
break;
- /*redirection: extract the new location*/
- case 301:
- case 302:
- if (!new_location || !strlen(new_location) ) {
- gf_dm_sess_user_io(sess, &par);
- e = GF_URL_ERROR;
- goto exit;
- }
- while (
- (new_location[strlen(new_location)-1] == '\n')
- || (new_location[strlen(new_location)-1] == '\r') )
- new_location[strlen(new_location)-1] = 0;
-
- /*reset and reconnect*/
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_SETUP;
- e = gf_dm_setup_from_url(sess, new_location);
- if (e) {
- sess->status = GF_NETIO_STATE_ERROR;
- sess->last_error = e;
- gf_dm_sess_notify_state(sess, sess->status, e);
- return;
- }
- return;
- case 404:
- case 416:
- /*try without cache (some servers screw up when content-length is specified)*/
- if (sess->cache_start_size) {
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_SETUP;
- return;
- } else if (is_ice && !(sess->flags & GF_DOWNLOAD_IS_ICY)) {
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_SETUP;
- sess->flags |= GF_DOWNLOAD_IS_ICY;
- return;
- }
- gf_dm_sess_user_io(sess, &par);
- e = GF_URL_ERROR;
- goto exit;
- case 503:
- /*retry without proxy*/
- if (sess->proxy_enabled==1) {
- sess->proxy_enabled=2;
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_SETUP;
- return;
- }
- default:
- gf_dm_sess_user_io(sess, &par);
- e = GF_REMOTE_SERVICE_ERROR;
- goto exit;
}
+ BodyStart=0;
+ }
+ if (bytesRead < 0) {
+ e = GF_REMOTE_SERVICE_ERROR;
+ goto exit;
+ }
+ if (!BodyStart)
+ BodyStart = bytesRead;
+
+ sHTTP[BodyStart-1] = 0;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] %s\n\n", sHTTP));
+
+ LinePos = gf_token_get_line(sHTTP, 0, bytesRead, buf, 1024);
+ Pos = gf_token_get(buf, 0, " \t\r\n", comp, 400);
+
+ if (!strncmp("ICY", comp, 3)) {
+ sess->use_cache_file = 0;
+ /*be prepared not to receive any mime type from ShoutCast servers*/
+ if (!gf_cache_get_mime_type(sess->cache_entry))
+ gf_cache_set_mime_type(sess->cache_entry, "audio/mpeg");
+ } else if ((strncmp("HTTP", comp, 4) != 0)) {
+ e = GF_REMOTE_SERVICE_ERROR;
+ goto exit;
+ }
+ Pos = gf_token_get(buf, Pos, " ", comp, 400);
+ if (Pos <= 0) {
+ e = GF_REMOTE_SERVICE_ERROR;
+ goto exit;
+ }
+ rsp_code = (u32) atoi(comp);
+ Pos = gf_token_get(buf, Pos, " \r\n", comp, 400);
+
+ no_range = range = ContentLength = first_byte = last_byte = total_size = 0;
+ /* parse header */
+ while (1) {
+ char *sep, *hdr_sep, *hdr, *hdr_val;
+ if ( (s32) LinePos + 4 > BodyStart) break;
+ LinePos = gf_token_get_line(sHTTP, LinePos , bytesRead, buf, 1024);
+ if (LinePos < 0) break;
+
+ hdr_sep = NULL;
+ hdr_val = NULL;
+ hdr = buf;
+ sep = strchr(buf, ':');
+ if (sep) {
+ sep[0]=0;
+ hdr_val = sep+1;
+ while (hdr_val[0]==' ') hdr_val++;
+ hdr_sep = strrchr(hdr_val, '\r');
+ if (hdr_sep) hdr_sep[0] = 0;
+ }
- /*head*/
- if (sess->http_read_type==1) {
- gf_dm_disconnect(sess);
- gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
- sess->status = GF_NETIO_DISCONNECTED;
- sess->http_read_type = 0;
- return;
- }
+ par.error = 0;
+ par.msg_type = GF_NETIO_PARSE_HEADER;
+ par.name = hdr;
+ par.value = hdr_val;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[HTTP] Processing header %s: %s\n", hdr, hdr_val));
+ gf_dm_sess_user_io(sess, &par);
- if (!ContentLength && sess->mime_type && strstr(sess->mime_type, "ogg")) is_ice = 1;
-
- GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Connected to %s - error %s\n", sess->server_name, gf_error_to_string(e) ));
-
- /*some servers may reply without content length, but we MUST have it*/
-// if (!is_ice && !ContentLength) e = GF_REMOTE_SERVICE_ERROR;
- if (e) goto exit;
-
- if (is_ice && no_cache && !sess->use_cache_extension) {
- sess->flags |= GF_NETIO_SESSION_NOT_CACHED;
- no_range = 1;
- first_byte = 0;
- if (sess->cache) {
- fclose(sess->cache);
- sess->cache = NULL;
- }
- if (sess->cache_name) {
- gf_delete_file(sess->cache_name);
- sess->cache = gf_f64_open(sess->cache_name, "wb");
- }
- sess->cache_start_size = 0;
- }
- /*force disabling cache (no content length)*/
- if (is_ice) {
- if (sess->mime_type && !stricmp(sess->mime_type, "video/nsv")) {
- gf_free(sess->mime_type);
- sess->mime_type = gf_strdup("audio/aac");
- }
- }
+ if (!stricmp(hdr, "Content-Length") ) {
+ ContentLength = (u32) atoi(hdr_val);
+ gf_cache_set_content_length(sess->cache_entry, ContentLength);
+ }
+ else if (!stricmp(hdr, "Content-Type")) {
+ char * mime_type = gf_strdup(hdr_val);
+ while (1) {
+ u32 len = strlen(mime_type);
+ char c = len ? mime_type[len-1] : 0;
+ if ((c=='\r') || (c=='\n')) {
+ mime_type[len-1] = 0;
+ } else {
+ break;
+ }
+ }
+ hdr = strchr(mime_type, ';');
+ if (hdr) hdr[0] = 0;
+ gf_cache_set_mime_type(sess->cache_entry, mime_type);
+ gf_free(mime_type);
+ }
+ else if (!stricmp(hdr, "Content-Range")) {
+ range = 1;
+ if (!strncmp(hdr_val, "bytes", 5)) {
+ hdr_val += 5;
+ if (hdr_val[0] == ':') hdr_val += 1;
+ hdr_val += http_skip_space(hdr_val);
+ if (hdr_val[0] == '*') {
+ sscanf(hdr_val, "*/%ud", &total_size);
+ } else {
+ /*do not use %ud here, broken on Win32 (sscanf returns 1)*/
+ sscanf(hdr_val, "%d-%d/%d", &first_byte, &last_byte, &total_size);
+ }
+ }
+ }
+ else if (!stricmp(hdr, "Accept-Ranges")) {
+ if (strstr(hdr_val, "none")) no_range = 1;
+ }
+ else if (!stricmp(hdr, "Location"))
+ new_location = gf_strdup(hdr_val);
+ else if (!strnicmp(hdr, "ice", 3) || !strnicmp(hdr, "icy", 3) ) {
+ /* For HTTP icy servers, we disable cache */
+ if (sess->icy_metaint == 0)
+ sess->icy_metaint = -1;
+ sess->use_cache_file = 0;
+ if (!stricmp(hdr, "icy-metaint")) {
+ sess->icy_metaint = atoi(hdr_val);
+ }
+ }
+ else if (!stricmp(hdr, "Cache-Control")) {
+ }
+ else if (!stricmp(hdr, "ETag")) {
+ gf_cache_set_etag_on_server(sess->cache_entry, hdr_val);
+ }
+ else if (!stricmp(hdr, "Last-Modified")) {
+ gf_cache_set_last_modified_on_server(sess->cache_entry, hdr_val);
+ }
+ else if (!stricmp(hdr, "X-UserProfileID") ) {
+ if (sess->dm && sess->dm->cfg)
+ gf_cfg_set_key(sess->dm->cfg, "Downloader", "UserProfileID", hdr_val);
+ }
+ /* else if (!stricmp(hdr, "Connection") )
+ if (strstr(hdr_val, "close")) sess->http_read_type = 1; */
- /*done*/
- if (sess->cache_start_size
- && ( (total_size && sess->cache_start_size >= total_size) || (sess->cache_start_size == ContentLength)) ) {
- sess->total_size = sess->bytes_done = sess->cache_start_size;
- /*disconnect*/
- gf_dm_disconnect(sess);
- BodyStart = bytesRead;
- gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
- }
- else if (sess->flags & GF_DOWNLOAD_IS_ICY) {
- sess->icy_bytes = 0;
- sess->status = GF_NETIO_DATA_EXCHANGE;
- }
- /*we don't expect anything*/
- else if (!ContentLength && sess->http_read_type) {
- gf_dm_disconnect(sess);
- gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
- sess->status = GF_NETIO_DISCONNECTED;
- sess->http_read_type = 0;
- }
- /*no range header, Accept-Ranges deny or dumb server : restart*/
- else if (!range || !first_byte || (first_byte != sess->cache_start_size) ) {
- sess->cache_start_size = sess->bytes_done = 0;
- sess->total_size = ContentLength;
- if (! (sess->flags & GF_NETIO_SESSION_NOT_CACHED) ) {
- if (sess->flags & GF_NETIO_SESSION_REUSE_APPEND)
- sess->cache = gf_f64_open(sess->cache_name, "ab");
- else
- sess->cache = gf_f64_open(sess->cache_name, "wb");
- if (!sess->cache) {
- e = GF_IO_ERR;
- goto exit;
- }
- }
- sess->status = GF_NETIO_DATA_EXCHANGE;
- }
- /*resume*/
- else {
- sess->total_size = ContentLength + sess->cache_start_size;
- if (! (sess->flags & GF_NETIO_SESSION_NOT_CACHED) ) {
- sess->cache = gf_f64_open(sess->cache_name, "ab");
- if (!sess->cache) {
- e = GF_IO_ERR;
- goto exit;
- }
- }
- sess->status = GF_NETIO_DATA_EXCHANGE;
- sess->bytes_done = sess->cache_start_size;
- }
- sess->window_start = sess->start_time = gf_sys_clock();
- sess->bytes_in_wnd = 0;
+ if (sep) sep[0]=':';
+ if (hdr_sep) hdr_sep[0] = '\r';
+ }
+ if (no_range) first_byte = 0;
+
+ par.msg_type = GF_NETIO_PARSE_REPLY;
+ par.error = GF_OK;
+ par.reply = rsp_code;
+ par.value = comp;
+ /*
+ * If response is correct, it means our credentials are correct
+ */
+ if (sess->creds && rsp_code != 304)
+ sess->creds->valid = 1;
+ switch (rsp_code) {
+ case 200:
+ case 201:
+ case 202:
+ case 206:
+ gf_dm_sess_user_io(sess, &par);
+ e = GF_OK;
+ if (sess->proxy_enabled==2) {
+ sess->proxy_enabled=0;
+ if (sess->dm)
+ gf_list_add(sess->dm->skip_proxy_servers, gf_strdup(sess->server_name));
+ }
+ break;
+ /*redirection: extract the new location*/
+ case 301:
+ case 302:
+ if (!new_location || !strlen(new_location) ) {
+ gf_dm_sess_user_io(sess, &par);
+ e = GF_URL_ERROR;
+ goto exit;
+ }
+ while (
+ (new_location[strlen(new_location)-1] == '\n')
+ || (new_location[strlen(new_location)-1] == '\r') )
+ new_location[strlen(new_location)-1] = 0;
+
+ /*reset and reconnect*/
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_SETUP;
+ e = gf_dm_setup_from_url(sess, new_location);
+ if (e) {
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ }
+ return e;
+ case 304:
+ {
+ sess->status = GF_NETIO_PARSE_REPLY;
+ gf_dm_sess_notify_state(sess, GF_NETIO_PARSE_REPLY, GF_OK);
+ gf_dm_disconnect(sess);
+ if (sess->user_proc) {
+ /* For modules that do not use cache and have problems with GF_NETIO_DATA_TRANSFERED ... */
+ const char * filename;
+ FILE * f;
+ filename = gf_cache_get_cache_filename(sess->cache_entry);
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Sending data to modules from %s...\n", filename));
+ f = gf_f64_open(filename, "rb");
+ assert(filename);
+ if (!f) {
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] FAILED to open cache file %s for reading contents !\n", filename));
+ /* Ooops, no cache, redowload everything ! */
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_SETUP;
+ e = gf_dm_setup_from_url(sess, sess->orig_url);
+ sess->total_size = gf_cache_get_cache_filesize(sess->cache_entry);
+ if (e) {
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ }
+ return e;
+ }
+ sess->status = GF_NETIO_DATA_EXCHANGE;
+ {
+ char file_cache_buff[16384];
+ int read = 0;
+ u32 total_size = gf_cache_get_cache_filesize(sess->cache_entry);
+ do {
+ read = fread(file_cache_buff, sizeof(char), 16384, f);
+ if (read > 0) {
+ sess->bytes_done += read;
+ sess->total_size = total_size;
+ par.size = read;
+ par.msg_type = GF_NETIO_DATA_EXCHANGE;
+ par.error = GF_OK;
+ par.reply = 200;
+ par.data = file_cache_buff;
+ gf_dm_sess_user_io(sess, &par);
+ }
+ } while ( read > 0);
+ }
+ fclose(f);
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] all data has been sent to modules from %s.\n", filename));
+ }
+ /* Cache file is the most recent */
+ sess->status = GF_NETIO_DATA_TRANSFERED;
+ gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
+ sess->status = GF_NETIO_DISCONNECTED;
+ par.msg_type = GF_NETIO_DATA_TRANSFERED;
+ par.error = GF_OK;
+ gf_dm_sess_user_io(sess, &par);
+ return GF_OK;
+ }
+ case 401:
+ {
+ /* Do we have a credentials struct ? */
+ sess->creds = gf_user_credentials_register(sess->dm, sess->server_name, NULL, NULL, 0);
+ if (!sess->creds) {
+ /* User credentials have not been filled properly, we have to abort */
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_STATE_ERROR;
+ par.error = GF_AUTHENTICATION_FAILURE;
+ par.msg_type = GF_NETIO_DISCONNECTED;
+ gf_dm_sess_user_io(sess, &par);
+ e = GF_AUTHENTICATION_FAILURE;
+ sess->last_error = e;
+ goto exit;
+ }
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_SETUP;
+ e = gf_dm_setup_from_url(sess, sess->orig_url);
+ if (e) {
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ }
+ return e;
+ }
+ case 404:
+ /* File not found */
+ gf_dm_sess_user_io(sess, &par);
+ e = GF_URL_ERROR;
+ goto exit;
+ break;
+ case 416:
+ /* Range not accepted */
+ gf_dm_sess_user_io(sess, &par);
+ e = GF_SERVICE_ERROR;
+ goto exit;
+ break;
+ case 400:
+ case 501:
+ /* Method not implemented ! */
+ if (sess->http_read_type != GET) {
+ /* Since HEAD is not understood by this server, we use a GET instead */
+ sess->http_read_type = GET;
+ sess->flags |= GF_NETIO_SESSION_NOT_CACHED;
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_SETUP;
+ sess->server_only_understand_get = 1;
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("Method not supported, try with GET.\n"));
+ e = gf_dm_setup_from_url(sess, sess->orig_url);
+ if (e) {
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ }
+ return e;
+ }
+ return GF_URL_ERROR;
+ case 503:
+ /*retry without proxy*/
+ if (sess->proxy_enabled==1) {
+ sess->proxy_enabled=2;
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_SETUP;
+ return GF_OK;
+ }
+ default:
+ gf_dm_sess_user_io(sess, &par);
+ e = GF_REMOTE_SERVICE_ERROR;
+ goto exit;
+ }
+ if (sess->http_read_type != GET)
+ sess->use_cache_file = 0;
- //we may have existing data in this buffer ...
- if (!e && (BodyStart < (s32) bytesRead)) {
- gf_dm_data_received(sess, sHTTP + BodyStart, bytesRead - BodyStart);
- /*store data if no callbacks or cache*/
-// if (sess->flags & GF_NETIO_SESSION_NOT_CACHED) {
- if (sess->init_data) gf_free(sess->init_data);
- sess->init_data_size = bytesRead - BodyStart;
- sess->init_data = (char *) gf_malloc(sizeof(char) * sess->init_data_size);
- memcpy(sess->init_data, sHTTP+BodyStart, sess->init_data_size);
-// }
- }
+ if (sess->http_read_type==HEAD) {
+ gf_dm_disconnect(sess);
+ gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
+ sess->status = GF_NETIO_DISCONNECTED;
+ sess->http_read_type = 0;
+ return GF_OK;
+ }
+ {
+ const char * mime_type = gf_cache_get_mime_type(sess->cache_entry);
+ if (!ContentLength && mime_type && ((strstr(mime_type, "ogg") || (!strcmp(mime_type, "audio/mpeg"))))) {
+ if (0 == sess->icy_metaint)
+ sess->icy_metaint = -1;
+ sess->use_cache_file = 0;
+ }
+
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] Connected to %s - error %s\n", sess->server_name, gf_error_to_string(e) ));
+
+ /*some servers may reply without content length, but we MUST have it*/
+ if (e) goto exit;
+ if (sess->icy_metaint != 0) {
+ assert( ! sess->use_cache_file );
+ GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[HTTP] ICY protocol detected\n"));
+ if (mime_type && !stricmp(mime_type, "video/nsv")) {
+ gf_cache_set_mime_type(sess->cache_entry, "audio/aac");
+ }
+ sess->icy_bytes = 0;
+ sess->total_size = SIZE_IN_STREAM;
+ sess->status = GF_NETIO_DATA_EXCHANGE;
+ } else if (!ContentLength) {
+ if (sess->http_read_type == GET) {
+ sess->total_size = SIZE_IN_STREAM;
+ sess->use_cache_file = 0;
+ sess->status = GF_NETIO_DATA_EXCHANGE;
+ sess->bytes_done = 0;
+ } else {
+ /*we don't expect anything*/
+ gf_dm_disconnect(sess);
+ gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
+ sess->status = GF_NETIO_DISCONNECTED;
+ return GF_OK;
+ }
+ } else {
+ sess->total_size = ContentLength;
+ if (sess->use_cache_file && sess->http_read_type == GET ) {
+ e = gf_cache_open_write_cache(sess->cache_entry, sess);
+ if (e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ( "[CACHE] Failed to open cache, error=%d\n", e));
+ goto exit;
+ }
+ }
+ sess->status = GF_NETIO_DATA_EXCHANGE;
+ sess->bytes_done = 0;
+ }
+ }
+
+ sess->window_start = sess->start_time = gf_sys_clock();
+ sess->bytes_in_wnd = 0;
+
+
+ /* we may have existing data in this buffer ... */
+ if (!e && (BodyStart < (s32) bytesRead)) {
+ gf_dm_data_received(sess, sHTTP + BodyStart, bytesRead - BodyStart);
+ if (sess->init_data) gf_free(sess->init_data);
+ sess->init_data_size = bytesRead - BodyStart;
+ sess->init_data = (char *) gf_malloc(sizeof(char) * sess->init_data_size);
+ memcpy(sess->init_data, sHTTP+BodyStart, sess->init_data_size);
+ }
exit:
- if (e) {
- GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] Error parsing reply: %s\n", gf_error_to_string(e) ));
- gf_dm_disconnect(sess);
- sess->status = GF_NETIO_STATE_ERROR;
- sess->last_error = e;
- gf_dm_sess_notify_state(sess, sess->status, e);
- }
- return;
- }
- /*fetch data*/
- while (1) {
- u32 size;
+ if (e) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTP] Error parsing reply: %s for URL %s\n", gf_error_to_string(e), sess->orig_url ));
+ gf_dm_disconnect(sess);
+ sess->status = GF_NETIO_STATE_ERROR;
+ sess->last_error = e;
+ gf_dm_sess_notify_state(sess, sess->status, e);
+ return e;
+ }
+ return http_parse_remaining_body(sess, sHTTP);
+}
- if (sess->status>=GF_NETIO_DISCONNECTED)
- return;
+/**
+ * Default performing behaviour
+ * \param sess The session
+ */
+void http_do_requests(GF_DownloadSession *sess)
+{
+ char sHTTP[GF_DOWNLOAD_BUFFER_SIZE];
+ switch (sess->status) {
+ case GF_NETIO_CONNECTED:
+ http_send_headers(sess, sHTTP);
+ break;
+ case GF_NETIO_WAIT_FOR_REPLY:
+ wait_for_header_and_parse(sess, sHTTP);
+ break;
+ case GF_NETIO_DATA_EXCHANGE:
+ http_parse_remaining_body(sess, sHTTP);
+ break;
+ }
+}
-#if 1
- if (sess->limit_data_rate && sess->bytes_per_sec) {
- if (sess->bytes_per_sec>sess->limit_data_rate) {
- /*update state*/
- u32 runtime = gf_sys_clock() - sess->window_start;
- sess->bytes_per_sec = (1000 * (sess->bytes_in_wnd)) / runtime;
- if (sess->bytes_per_sec > sess->limit_data_rate) return;
- }
- }
-#endif
- e = gf_dm_read_data(sess, sHTTP, GF_DOWNLOAD_BUFFER_SIZE, &size);
- if (!size || e == GF_IP_NETWORK_EMPTY) {
- if (!sess->total_size && (gf_sys_clock() - sess->window_start > 2000)) {
- sess->total_size = sess->bytes_done;
- gf_dm_sess_notify_state(sess, GF_NETIO_DATA_TRANSFERED, GF_OK);
- sess->status = GF_NETIO_DISCONNECTED;
- }
- return;
- }
+#define FILE_W_BUFFER_SZ 1024
+
+GF_Err gf_dm_copy(const char * file_source, const char * file_dest) {
+ FILE * source, * dest;
+ char buff[FILE_W_BUFFER_SZ];
+ u32 readen, written;
+ GF_Err e = GF_OK;
+ source = gf_f64_open(file_source, "rb");
+ dest = gf_f64_open( file_dest, "wb");
+ if (!source || !dest) {
+ e = GF_IO_ERR;
+ goto cleanup;
+ }
+ readen = fread(buff, sizeof(char), FILE_W_BUFFER_SZ, source);
+ while (readen > 1) {
+ written = fwrite(buff, sizeof(char), readen, dest);
+ if (written != readen) {
+ e = GF_IO_ERR;
+ goto cleanup;
+ }
+ readen = fread(buff, sizeof(char), FILE_W_BUFFER_SZ, source);
+ }
- if (e) {
- gf_dm_disconnect(sess);
- sess->last_error = e;
- gf_dm_sess_notify_state(sess, sess->status, e);
- return;
- }
- gf_dm_data_received(sess, sHTTP, size);
- /*socket empty*/
- if (size < GF_DOWNLOAD_BUFFER_SIZE) return;
- }
+cleanup:
+ if (source)
+ fclose(source);
+ if (dest)
+ fclose(dest);
+ return e;
}
-GF_Err gf_dm_wget(const char *url, const char *filename)
+
+GF_Err gf_dm_copy_or_link(const char * file_source, const char * file_dest) {
+#ifdef __USE_POSIX
+ if (link( file_source, file_dest)) {
+#endif /* __USE_POSIX */
+ return gf_dm_copy(file_source, file_dest);
+#ifdef __USE_POSIX
+ }
+ return GF_OK;
+#endif /* #ifdef __POSIX__ */
+}
+
+
+/**
+ * NET IO for MPD, we don't need this anymore since mime-type can be given by session
+ */
+static void wget_NetIO(void *cbk, GF_NETIO_Parameter *param)
{
+ FILE * f = (FILE*) cbk;
+
+ /*handle service message*/
+ if (param->msg_type == GF_NETIO_DATA_EXCHANGE) {
+ s32 written = fwrite( param->data, sizeof(char), param->size, f);
+ if (written != param->size) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("Failed to write data on disk\n"));
+ }
+ }
+}
+
+
+GF_Err gf_dm_wget(const char *url, const char *filename){
GF_Err e;
- GF_DownloadSession *dnload;
- dnload = gf_dm_sess_new_simple((char *)url, GF_NETIO_SESSION_NOT_THREADED, NULL, NULL, (char *)filename, &e);
- if (!dnload) return GF_BAD_PARAM;
+ GF_DownloadManager * dm = NULL;
+ dm = gf_dm_new(NULL);
+ if (!dm)
+ return GF_OUT_OF_MEM;
+ e = gf_dm_wget_with_cache(dm, url, filename);
+ gf_dm_del(dm);
+ return e;
+}
+GF_Err gf_dm_wget_with_cache(GF_DownloadManager * dm,
+ const char *url, const char *filename)
+{
+ GF_Err e;
+ FILE * f;
+ GF_DownloadSession *dnload;
+ if (!filename || !url || !dm)
+ return GF_BAD_PARAM;
+ f= fopen(filename, "w");
+ if (!f){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[WGET] Failed to open file %s for write.\n", filename));
+ return GF_IO_ERR;
+ }
+ dnload = gf_dm_sess_new_simple(dm, (char *)url, GF_NETIO_SESSION_NOT_THREADED, &wget_NetIO, f, &e);
+ if (!dnload) {
+ return GF_BAD_PARAM;
+ }
+ dnload->use_cache_file = 1;
if (e == GF_OK) {
e = gf_dm_sess_process(dnload);
}
+ e|= gf_cache_close_write_cache(dnload->cache_entry, dnload, e == GF_OK);
+ /* e|= gf_dm_copy_or_link( gf_cache_get_cache_filename(dnload->cache_entry), filename ); */
+ fclose(f);
gf_dm_sess_del(dnload);
return e;
}
const char *gf_dm_sess_get_resource_name(GF_DownloadSession *dnload)
{
- return dnload ? dnload->orig_url : NULL;
+ return dnload ? dnload->orig_url : NULL;
}
GF_Err gf_dm_sess_reset(GF_DownloadSession *sess)
{
- if (!sess) return GF_BAD_PARAM;
- sess->status = GF_NETIO_SETUP;
+ if (!sess) return GF_BAD_PARAM;
+ sess->status = GF_NETIO_SETUP;
sess->needs_range = 0;
sess->range_start = sess->range_end = 0;
- sess->bytes_done = sess->bytes_in_wnd = sess->bytes_per_sec = 0;
- if (sess->init_data) free(sess->init_data);
- sess->init_data = NULL;
- sess->init_data_size = 0;
- sess->last_error = GF_OK;
- if (sess->mime_type) free(sess->mime_type);
- sess->mime_type = NULL;
- sess->total_size = 0;
- sess->window_start = 0;
- sess->start_time = 0;
- return GF_OK;
+ sess->bytes_done = sess->bytes_in_wnd = sess->bytes_per_sec = 0;
+ if (sess->init_data) gf_free(sess->init_data);
+ sess->init_data = NULL;
+ sess->init_data_size = 0;
+ sess->last_error = GF_OK;
+ sess->total_size = 0;
+ sess->window_start = 0;
+ sess->start_time = 0;
+ return GF_OK;
+}
+
+const char * gf_cache_get_cache_filename_range( const GF_DownloadSession * sess, u64 startOffset, u64 endOffset ) {
+ u32 i, count;
+ if (!sess || !sess->dm || endOffset < startOffset)
+ return NULL;
+ count = gf_list_count(sess->dm->partial_downloads);
+ for (i = 0 ; i < count ; i++) {
+ GF_PartialDownload * pd = gf_list_get(sess->dm->partial_downloads, i);
+ assert( pd->filename && pd->url);
+ if (!strcmp(pd->url, sess->orig_url) && pd->startOffset == startOffset && pd->endOffset == endOffset) {
+ /* File already created, just return the file */
+ return pd->filename;
+ }
+ }
+ {
+ /* Not found, we are gonna create the file */
+ char * newFilename;
+ GF_PartialDownload * partial;
+ FILE * fw, *fr;
+ u32 maxLen;
+ const char * orig = gf_cache_get_cache_filename(sess->cache_entry);
+ if (orig == NULL)
+ return NULL;
+ /* 22 if 1G + 1G + 2 dashes */
+ maxLen = strlen(orig) + 22;
+ newFilename = (char*)gf_malloc( maxLen );
+ if (newFilename == NULL)
+ return NULL;
+ snprintf(newFilename, maxLen, "%s " LLU LLU, orig, startOffset, endOffset);
+ fw = gf_f64_open(newFilename, "wb");
+ if (!fw) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[CACHE] Cannot open partial cache file %s for write\n", newFilename));
+ gf_free( newFilename );
+ return NULL;
+ }
+ fr = gf_f64_open(orig, "rb");
+ if (!fr) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[CACHE] Cannot open full cache file %s\n", orig));
+ gf_free( newFilename );
+ fclose( fw );
+ }
+ /* Now, we copy ! */
+ {
+ char copyBuff[GF_DOWNLOAD_BUFFER_SIZE];
+ s64 read, write, total;
+ total = endOffset - startOffset;
+ read = gf_f64_seek(fr, startOffset, SEEK_SET);
+ if (read != startOffset) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[CACHE] Cannot seek at right start offset in %s\n", orig));
+ fclose( fr );
+ fclose( fw );
+ gf_free( newFilename );
+ return NULL;
+ }
+ do {
+ read = fread(copyBuff, sizeof(char), MIN(sizeof(copyBuff), (size_t) total), fr);
+ if (read > 0) {
+ total-= read;
+ write = fwrite(copyBuff, sizeof(char), (size_t) read, fw);
+ if (write != read) {
+ /* Something bad happened */
+ fclose( fw );
+ fclose (fr );
+ gf_free( newFilename );
+ return NULL;
+ }
+ } else {
+ if (read < 0) {
+ fclose( fw );
+ fclose( fr );
+ gf_free( newFilename );
+ return NULL;
+ }
+ }
+ } while (total > 0);
+ fclose( fr );
+ fclose (fw);
+ partial = gf_malloc( sizeof(GF_PartialDownload));
+ if (partial == NULL) {
+ gf_free(newFilename);
+ return NULL;
+ }
+ partial->filename = newFilename;
+ partial->url = sess->orig_url;
+ partial->endOffset = endOffset;
+ partial->startOffset = startOffset;
+ gf_list_add(sess->dm->partial_downloads, partial);
+ return newFilename;
+ }
+ }
}
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
-#include <string.h>
-
-#define STD_MALLOC 0
-#define GOOGLE_MALLOC 1
-#define INTEL_MALLOC 2
-#define DL_MALLOC 3
-
-#ifdef WIN32
-#define USE_MALLOC STD_MALLOC
-#else
-#define USE_MALLOC STD_MALLOC
-#endif
-
-
-#if defined(_WIN32_WCE) && !defined(strdup)
-#define strdup _strdup
-#endif
-
-/*
- WARNING - you must enable C++ style compilation of this file (error.c) to be able to compile
- with google malloc. This is not set by default in the project settings.
-*/
-#if (USE_MALLOC==GOOGLE_MALLOC)
-#include <config.h>
-#include <base/commandlineflags.h>
-#include <google/malloc_extension.h>
-
-#ifdef WIN32
-#pragma comment(lib, "libtcmalloc_minimal")
-#endif
-
-#define MALLOC malloc
-#define CALLOC calloc
-#define REALLOC realloc
-#define FREE free
-#define STRDUP(a) return strdup(a);
-
-/*we must use c++ compiler for google malloc :( */
-#define CDECL extern "C"
-#endif
-
-#if (USE_MALLOC==INTEL_MALLOC)
-#define CDECL
-CDECL void * scalable_malloc(size_t size);
-CDECL void * scalable_realloc(void* ptr, size_t size);
-CDECL void * scalable_calloc(size_t num, size_t size);
-CDECL void scalable_free(void* ptr);
-
-#ifdef WIN32
-#pragma comment(lib, "tbbmalloc.lib")
-#endif
-
-#define MALLOC scalable_malloc
-#define CALLOC scalable_calloc
-#define REALLOC scalable_realloc
-#define FREE scalable_free
-#define STRDUP(_a) if (_a) { unsigned int len = strlen(_a)+1; char *ptr = (char *) scalable_malloc(len); strcpy(ptr, _a); return ptr; } else { return NULL; }
-
-#endif
-
-#ifndef CDECL
-#define CDECL
-#endif
-
-#if (USE_MALLOC==DL_MALLOC)
-
-CDECL void * dlmalloc(size_t size);
-CDECL void * dlrealloc(void* ptr, size_t size);
-CDECL void * dlcalloc(size_t num, size_t size);
-CDECL void dlfree(void* ptr);
-
-#define MALLOC dlmalloc
-#define CALLOC dlcalloc
-#define REALLOC dlrealloc
-#define FREE dlfree
-#define STRDUP(_a) if (_a) { unsigned int len = strlen(_a)+1; char *ptr = (char *) dlmalloc(len); strcpy(ptr, _a); return ptr; } else { return NULL; }
-
-#endif
-
-#if (USE_MALLOC==STD_MALLOC)
-
-#include <stdlib.h>
-
-#define MALLOC malloc
-#define CALLOC calloc
-#define REALLOC realloc
-#define FREE free
-#define STRDUP(a) return strdup(a);
-
-#endif
-
-
-
-#ifndef _WIN32_WCE
-#include <assert.h>
-#endif
-
-/*This is to handle cases where config.h is generated at the root of the gpac build tree (./configure)
-This is only needed when building libgpac and modules when libgpac is not installed*/
-#ifdef GPAC_HAVE_CONFIG_H
-# include "config.h"
-#else
-# include <gpac/configuration.h>
-#endif
-
-/*GPAC memory tracking*/
-#ifndef GPAC_MEMORY_TRACKING
-
-CDECL
-void *gf_malloc(size_t size)
-{
- return MALLOC(size);
-}
-CDECL
-void *gf_calloc(size_t num, size_t size_of)
-{
- return CALLOC(num, size_of);
-}
-CDECL
-void *gf_realloc(void *ptr, size_t size)
-{
- return REALLOC(ptr, size);
-}
-CDECL
-void gf_free(void *ptr)
-{
- FREE(ptr);
-}
-CDECL
-char *gf_strdup(const char *str)
-{
- STRDUP(str);
-}
-
-#else
-
-
-CDECL
-size_t gpac_allocated_memory = 0;
-size_t gpac_nb_alloc_blocs = 0;
-
-#ifdef _WIN32_WCE
-#define assert(p)
-#endif
-
-static void register_address(void *ptr, size_t size, char *filename, int line);
-static int unregister_address(void *ptr, char *filename, int line);
-
-static void gf_memory_log(unsigned int level, const char *fmt, ...);
-enum
-{
- /*! Log message describes an error*/
- GF_MEMORY_ERROR = 1,
- /*! Log message describes a warning*/
- GF_MEMORY_WARNING,
- /*! Log message is informational (state, etc..)*/
- GF_MEMORY_INFO,
- /*! Log message is a debug info*/
- GF_MEMORY_DEBUG,
-};
-
-static void *gf_mem_malloc_basic(size_t size, char *filename, int line)
-{
- return MALLOC(size);
-}
-static void *gf_mem_calloc_basic(size_t num, size_t size_of, char *filename, int line)
-{
- return CALLOC(num, size_of);
-}
-static void *gf_mem_realloc_basic(void *ptr, size_t size, char *filename, int line)
-{
- return REALLOC(ptr, size);
-}
-static void gf_mem_free_basic(void *ptr, char *filename, int line)
-{
- FREE(ptr);
-}
-static char *gf_mem_strdup_basic(const char *str, char *filename, int line)
-{
- STRDUP(str);
-}
-
-void *gf_mem_malloc_tracker(size_t size, char *filename, int line)
-{
- void *ptr = MALLOC(size);
- if (!ptr) {
- gf_memory_log(GF_MEMORY_ERROR, "malloc() has returned a NULL pointer\n");
- assert(0);
- } else {
- register_address(ptr, size, filename, line);
- }
- gf_memory_log(GF_MEMORY_DEBUG, "malloc %3d bytes at 0x%08X in file %s at line %d\n", size, ptr, filename, line);
- return ptr;
-}
-
-void *gf_mem_calloc_tracker(size_t num, size_t size_of, char *filename, int line)
-{
- size_t size = num*size_of;
- void *ptr = CALLOC(num, size_of);
- if (!ptr) {
- gf_memory_log(GF_MEMORY_ERROR, "calloc() has returned a NULL pointer\n");
- assert(0);
- } else {
- register_address(ptr, size, filename, line);
- }
- gf_memory_log(GF_MEMORY_DEBUG, "calloc %3d bytes at 0x%08X in file %s at line %d\n", size, ptr, filename, line);
- return ptr;
-}
-
-void gf_mem_free_tracker(void *ptr, char *filename, int line)
-{
- int size_prev;
- if (ptr && (size_prev=unregister_address(ptr, filename, line))) {
- gf_memory_log(GF_MEMORY_DEBUG, "free %3d bytes at 0x%08X in file %s at line %d\n", size_prev, ptr, filename, line);
- FREE(ptr);
- }
-}
-
-void *gf_mem_realloc_tracker(void *ptr, size_t size, char *filename, int line)
-{
- void *ptr_g;
- int size_prev;
- if (!ptr) {
- gf_memory_log(GF_MEMORY_DEBUG, "realloc() from a null pointer: calling malloc() instead\n");
- return gf_mem_malloc_tracker(size, filename, line);
- }
- /*a) The return value is NULL if the size is zero and the buffer argument is not NULL. In this case, the original block is freed.*/
- if (!size) {
- gf_memory_log(GF_MEMORY_DEBUG, "realloc() with a null size: calling free() instead\n");
- gf_mem_free_tracker(ptr, filename, line);
- return NULL;
- }
- ptr_g = REALLOC(ptr, size);
- if (!ptr_g) {
- /*b) The return value is NULL if there is not enough available memory to expand the block to the given size. In this case, the original block is unchanged.*/
- gf_memory_log(GF_MEMORY_ERROR, "realloc() has returned a NULL pointer\n");
- assert(0);
- } else {
- size_prev = unregister_address(ptr, filename, line);
- register_address(ptr_g, size, filename, line);
- gf_memory_log(GF_MEMORY_DEBUG, "realloc %3d (instead of %3d) bytes at 0x%08X in file %s at line %d\n", size, size_prev, ptr, filename, line);
- }
- return ptr_g;
-}
-
-char *gf_mem_strdup_tracker(const char *str, char *filename, int line)
-{
- char *ptr;
- if (!str) return NULL;
- ptr = (char*)gf_mem_malloc_tracker(strlen(str)+1, filename, line);
- strcpy(ptr, str);
- return ptr;
-}
-
-static void *(*gf_mem_malloc_proto)(size_t size, char *filename, int line) = gf_mem_malloc_basic;
-static void *(*gf_mem_calloc_proto)(size_t num, size_t size_of, char *filename, int line) = gf_mem_calloc_basic;
-static void *(*gf_mem_realloc_proto)(void *ptr, size_t size, char *filename, int line) = gf_mem_realloc_basic;
-static void (*gf_mem_free_proto)(void *ptr, char *filename, int line) = gf_mem_free_basic;
-static char *(*gf_mem_strdup_proto)(const char *str, char *filename, int line) = gf_mem_strdup_basic;
-
-CDECL
-void *gf_mem_malloc(size_t size, char *filename, int line)
-{
- return gf_mem_malloc_proto(size, filename, line);
-}
-CDECL
-void *gf_mem_calloc(size_t num, size_t size_of, char *filename, int line)
-{
- return gf_mem_calloc_proto(num, size_of, filename, line);
-}
-CDECL
-void *gf_mem_realloc(void *ptr, size_t size, char *filename, int line)
-{
- return gf_mem_realloc_proto(ptr, size, filename, line);
-}
-CDECL
-void gf_mem_free(void *ptr, char *filename, int line)
-{
- gf_mem_free_proto(ptr, filename, line);
-}
-CDECL
-char *gf_mem_strdup(const char *str, char *filename, int line)
-{
- return gf_mem_strdup_proto(str, filename, line);
-}
-
-CDECL
-void gf_mem_enable_tracker()
-{
- gf_mem_malloc_proto = gf_mem_malloc_tracker;
- gf_mem_calloc_proto = gf_mem_calloc_tracker;
- gf_mem_realloc_proto = gf_mem_realloc_tracker;
- gf_mem_free_proto = gf_mem_free_tracker;
- gf_mem_strdup_proto = gf_mem_strdup_tracker;
-}
-
-
-#define GPAC_MEMORY_TRACKING_HASH_TABLE 1
-#if GPAC_MEMORY_TRACKING_HASH_TABLE
-
-#define HASH_ENTRIES 4096
-
-typedef struct s_memory_element
-{
- void *ptr;
- int size;
- struct s_memory_element *next;
- int line;
- char *filename;
-} memory_element;
-
-/*pointer to the first element of the list*/
-typedef memory_element** memory_list;
-
-static unsigned int gf_memory_hash(void *ptr)
-{
- return (((unsigned int)ptr>>4)+(unsigned int)ptr)%HASH_ENTRIES;
-}
-
-#else
-
-typedef struct s_memory_element
-{
- void *ptr;
- int size;
- struct s_memory_element *next;
- int line;
- char *filename;
-} memory_element;
-
-/*pointer to the first element of the list*/
-typedef memory_element* memory_list;
-
-#endif
-
-
-/*base functions (add, find, del_item, del) are implemented upon a stack model*/
-static void gf_memory_add_stack(memory_element **p, void *ptr, int size, char *filename, int line)
-{
- memory_element *element = (memory_element*)MALLOC(sizeof(memory_element)+strlen(filename));
- element->ptr = ptr;
- element->size = size;
- element->line = line;
- element->next = *p;
- strcpy((char*)&element->filename, filename);
- *p = element;
-}
-static int gf_memory_find_stack(memory_element *p, void *ptr)
-{
- memory_element *element = p;
- while (element) {
- if (element->ptr == ptr) {
- return 1;
- }
- element = element->next;
- }
- return 0;
-}
-
-/*returns the size of the deleted item*/
-static int gf_memory_del_item_stack(memory_element **p, void *ptr)
-{
- int size;
- memory_element *curr_element=*p, *prev_element=NULL;
- while (curr_element) {
- if (curr_element->ptr == ptr) {
- if (prev_element) prev_element->next = curr_element->next;
- else *p = curr_element->next;
- size = curr_element->size;
- FREE(curr_element);
- return size;
- }
- prev_element = curr_element;
- curr_element = curr_element->next;
- }
- return 0;
-}
-
-static void gf_memory_del_stack(memory_element **p)
-{
- memory_element *curr_element=*p, *next_element;
- while (curr_element) {
- next_element = curr_element->next;
- FREE(curr_element);
- curr_element = next_element;
- }
- *p = NULL;
-}
-
-
-#if GPAC_MEMORY_TRACKING_HASH_TABLE
-
-/*this list is implemented as a stack to minimise the cost of freeing recent allocations*/
-static void gf_memory_add(memory_list *p, void *ptr, int size, char *filename, int line)
-{
- unsigned int pos;
- if (!*p) *p = (memory_list) CALLOC(HASH_ENTRIES, sizeof(memory_element*));
- assert(*p);
-
- pos = gf_memory_hash(ptr);
- gf_memory_add_stack(&((*p)[pos]), ptr, size, filename, line);
-}
-
-
-static int gf_memory_find(memory_list p, void *ptr)
-{
- unsigned int pos;
- assert(p);
- if (!p) return 0;
- pos = gf_memory_hash(ptr);
- return gf_memory_find_stack(p[pos], ptr);
-}
-
-static int gf_memory_del_item(memory_list *p, void *ptr)
-{
- unsigned int pos;
- int ret;
- memory_element **sub_list;
- if (!*p) *p = (memory_list) CALLOC(HASH_ENTRIES, sizeof(memory_element*));
- assert(*p);
- pos = gf_memory_hash(ptr);
- sub_list = &((*p)[pos]);
- if (!sub_list) return 0;
- ret = gf_memory_del_item_stack(sub_list, ptr);
- if (ret && !((*p)[pos])) {
- /*check for deletion*/
- int i;
- for (i=0; i<HASH_ENTRIES; i++)
- if (&((*p)[i])) break;
- if (i==HASH_ENTRIES) {
- FREE(*p);
- p = NULL;
- }
- }
- return ret;
-}
-
-static void gf_memory_del(memory_list *p)
-{
- int i;
- for (i=0; i<HASH_ENTRIES; i++)
- gf_memory_del_stack(&((*p)[i]));
- FREE(*p);
- p = NULL;
-}
-
-#else
-
-#define gf_memory_add gf_memory_add_stack
-#define gf_memory_del gf_memory_del_stack
-#define gf_memory_del_item gf_memory_del_item_stack
-#define gf_memory_find gf_memory_find_stack
-
-#endif
-
-
-#endif /*GPAC_MEMORY_TRACKING*/
-
-
#include <gpac/tools.h>
-/*GPAC memory tracking*/
-#ifdef GPAC_MEMORY_TRACKING
-
-#include <gpac/thread.h>
-
-/*global lists of allocations and deallocations*/
-memory_list memory_add = NULL, memory_rem = NULL;
-GF_Mutex *gpac_allocations_lock = NULL;
-
-static void register_address(void *ptr, size_t size, char *filename, int line)
-{
- /*mutex initialization*/
- if (gpac_allocations_lock == 0) {
- assert(!memory_add);
- assert(!memory_rem);
- gpac_allocations_lock = (GF_Mutex*)1; /*must be non-null to avoid a recursive infinite call*/
- gpac_allocations_lock = gf_mx_new("gpac_allocations_lock");
- }
- else if (gpac_allocations_lock == (void*)1) {
- /*we're initializing the mutex (ie called by the gf_mx_new() above)*/
- return;
- }
-
- /*lock*/
- gf_mx_p(gpac_allocations_lock);
-
- gf_memory_add(&memory_add, ptr, size, filename, line);
- gf_memory_del_item(&memory_rem, ptr); /*the same block can be reallocated, so remove it from the deallocation list*/
-
- /*update stats*/
- gpac_allocated_memory += size;
- gpac_nb_alloc_blocs++;
-
- //gf_memory_log(GF_MEMORY_DEBUG, "register %6d bytes at 0x%08X (%8d Bytes in %4d Blocks allocated)\n", size, ptr, gpac_allocated_memory, gpac_nb_alloc_blocs);
-
- /*unlock*/
- gf_mx_v(gpac_allocations_lock);
-}
-
-/*returns the size of the unregistered block*/
-static int unregister_address(void *ptr, char *filename, int line)
-{
- int size = 0; /*default: failure*/
-
- /*lock*/
- gf_mx_p(gpac_allocations_lock);
-
- if (!memory_add) {
- if (!memory_rem) {
- /*assume we're rather destroying the mutex (ie calling the gf_mx_del() below)
- than being called by free() before the first allocation occured*/
- return 1;
- //gf_memory_log(GF_MEMORY_ERROR, "calling free() before the first allocation occured\n");
- //assert(0);
- }
- } else {
- if (!gf_memory_find(memory_add, ptr)) {
- if (!gf_memory_find(memory_rem, ptr)) {
- gf_memory_log(GF_MEMORY_ERROR, "trying to free a never allocated block (0x%08X)\n", ptr);
- //assert(0); /*don't assert since this is often due to allocations that occured out of gpac (fonts, etc.)*/
- } else {
- gf_memory_log(GF_MEMORY_ERROR, "the block 0x%08X has already been freed line%5d from %s\n", line, filename);
- assert(0);
- }
- } else {
- size = gf_memory_del_item(&memory_add, ptr);
- assert(size>=0);
-
- /*update stats*/
- gpac_allocated_memory -= size;
- gpac_nb_alloc_blocs--;
-
- //gf_memory_log(GF_MEMORY_DEBUG, "unregister %6d bytes at 0x%08X (%8d bytes in %4d blocks remaining)\n", size, ptr, gpac_allocated_memory, gpac_nb_alloc_blocs);
-
- /*the allocation list is empty: free the lists to avoid a leak (we should be exiting)*/
- if (!memory_add) {
- assert(!gpac_allocated_memory);
- assert(!gpac_nb_alloc_blocs);
-
- /*we destroy the mutex we own, then we return*/
- gf_mx_del(gpac_allocations_lock);
- gpac_allocations_lock = NULL;
-
- gf_memory_log(GF_MEMORY_DEBUG, "the allocated-blocks-list is empty: the freed-blocks-list will be emptied too.\n");
- gf_memory_del(&memory_rem);
-
- return size;
- } else {
- gf_memory_add(&memory_rem, ptr, size, filename, line);
- }
- }
- }
-
- /*unlock*/
- gf_mx_v(gpac_allocations_lock);
-
- return size;
-}
-
-static void gf_memory_log(unsigned int level, const char *fmt, ...)
-{
- va_list vl;
- char msg[255]; /*since we print*/
- assert(strlen(fmt) < 80);
- va_start(vl, fmt);
- vsprintf(msg, fmt, vl);
- GF_LOG(level, GF_LOG_MEMORY, (msg));
- va_end(vl);
-}
-
-/*prints allocations sum-up*/
-void gf_memory_size()
-{
- gf_memory_log(GF_MEMORY_INFO, "Total: %d bytes allocated on %d blocks\n", gpac_allocated_memory, gpac_nb_alloc_blocs);
-}
-
-/*prints the state of current allocations*/
-void gf_memory_print()
-{
- /*if lists are empty, the mutex is also NULL*/
- if (!memory_add) {
- assert(!gpac_allocations_lock);
- gf_memory_log(GF_MEMORY_INFO, "gf_memory_print(): the memory tracker is not initialized.\n");
- } else {
- int i=0;
- assert(gpac_allocations_lock);
-
- /*lock*/
- gf_mx_p(gpac_allocations_lock);
-#if GPAC_MEMORY_TRACKING_HASH_TABLE
- for (i=0; i<HASH_ENTRIES; i++) {
- memory_element *curr_element = memory_add[i], *next_element;
-#else
- {
- memory_element *curr_element = memory_add, *next_element;
-#endif
- while (curr_element) {
- next_element = curr_element->next;
- gf_memory_log(GF_MEMORY_INFO, "Memory Block 0x%08X allocated line%5d from %s\n", curr_element->ptr, curr_element->line, &curr_element->filename);
- curr_element = next_element;
- }
- }
- gf_memory_size();
-
- /*unlock*/
- gf_mx_v(gpac_allocations_lock);
- }
-}
-
-#endif
-
-
static char szTYPE[5];
+
GF_EXPORT
const char *gf_4cc_to_str(u32 type)
{
}
-static const char *szProg[] =
+static const char *szProg[] =
{
" ",
"= ",
static u64 prev_pos = 0;
static u64 prev_pc = 0;
-static void gf_on_progress_stdout(char *_title, u64 done, u64 total)
+static void gf_on_progress_stdout(const char *_title, u64 done, u64 total)
{
Double prog;
u32 pos;
- char *szT = _title ? (char *)_title : (char *) "";
+ const char *szT = _title ? (char *)_title : (char *) "";
prog = (double) done;
prog /= total;
pos = MIN((u32) (20 * prog), 20);
prev_pos = 0;
prev_pc = 0;
}
- if (done==total) {
+ if (done==total) {
u32 len = strlen(szT) + 40;
while (len) { fprintf(stdout, " "); len--; };
fprintf(stdout, "\r");
static void *user_cbk;
GF_EXPORT
-void gf_set_progress(char *title, u64 done, u64 total)
+void gf_set_progress(const char *title, u64 done, u64 total)
{
if (prog_cbk) {
prog_cbk(user_cbk, title, done, total);
else if (!stricmp(val, "cache")) flags |= GF_LOG_CACHE;
else if (!stricmp(val, "audio")) flags |= GF_LOG_AUDIO;
else if (!stricmp(val, "mem")) flags |= GF_LOG_MEMORY;
+ else if (!stricmp(val, "module")) flags |= GF_LOG_MODULE;
+ else if (!stricmp(val, "mutex")) flags |= GF_LOG_MUTEX;
if (!sep) break;
sep[0] = ':';
val = sep+1;
return "BitStream Not Compliant";
case GF_CODEC_NOT_FOUND:
return "Media Codec not found";
-
+
/*DMIF errors - local and control plane */
case GF_URL_ERROR:
return "Requested URL is not valid or cannot be found";
case GF_STREAM_NOT_FOUND:
return "Media Channel couldn't be found";
-
+
case GF_IP_ADDRESS_NOT_FOUND:
return "IP Address Not Found";
case GF_IP_CONNECTION_FAILURE:
return "IP Connection Failed";
case GF_IP_NETWORK_FAILURE:
return "Network Unreachable";
-
+
case GF_IP_NETWORK_EMPTY:
return "Network Timeout";
case GF_IP_SOCK_WOULD_BLOCK:
{
register u32 i;
u32 crc = 0xffffffff;
- if (!data) return 0;
+ if (!data) return 0;
for (i=0; i<len; i++)
crc = (crc << 8) ^ gf_crc_table[((crc >> 24) ^ *data++) & 0xff];
-
+
return crc;
}
const char *gpac_features()
{
const char *features = ""
-#ifdef GPAC_FIXED_POINT
- "GPAC_FIXED_POINT "
+#ifdef GPAC_FIXED_POINT
+ "GPAC_FIXED_POINT "
#endif
#ifdef GPAC_MEMORY_TRACKING
"GPAC_MEMORY_TRACKING "
#ifdef GPAC_DISABLE_STREAMING
"GPAC_DISABLE_STREAMING "
#endif
-
+
;
return features;
}
}
GF_EXPORT
-u32 gf_list_count(GF_List *ptr)
+u32 gf_list_count(const GF_List *ptr)
{
if (! ptr) return 0;
return ptr->entryCount;
}
GF_EXPORT
-u32 gf_list_count(GF_List *ptr)
+u32 gf_list_count(const GF_List *ptr)
{
if (!ptr) return 0;
return ptr->entryCount;
gf_mx2d_add_matrix(_this, &tmp);
}
-static Fixed gf_mx2d_get_determinent(GF_Matrix2D *_this)
-{
- if (_this)
- return gf_mulfix(_this->m[0], _this->m[4]) - gf_mulfix(_this->m[1], _this->m[3]);
- return 0;
-}
-
GF_EXPORT
void gf_mx2d_inverse(GF_Matrix2D *_this)
{
+#ifdef GPAC_FIXED_POINT
+ Float _det, _max;
+ s32 sign, scale;
+#endif
Fixed det;
GF_Matrix2D tmp;
if(!_this) return;
if (gf_mx2d_is_identity(*_this)) return;
- det = gf_mx2d_get_determinent(_this);
+
+#ifdef GPAC_FIXED_POINT
+ /*we must compute the determinent as a float to avoid fixed-point overflow*/
+ _det = FIX2FLT(_this->m[0])*FIX2FLT(_this->m[4]) - FIX2FLT(_this->m[1])*FIX2FLT(_this->m[3]);
+ if (!_det) {
+ gf_mx2d_init(*_this);
+ return;
+ }
+ sign = _det<0 ? -1 : 1;
+ _det *= sign;
+ scale = 1;
+ _max = FIX2FLT(FIX_MAX);
+ while (_det / scale > _max) {
+ scale *= 10;
+ }
+ det = sign * FLT2FIX(_det/scale);
+#else
+ det = gf_mulfix(_this->m[0], _this->m[4]) - gf_mulfix(_this->m[1], _this->m[3]);
if (!det) {
gf_mx2d_init(*_this);
return;
}
+#endif
+
tmp.m[0] = gf_divfix(_this->m[4], det);
tmp.m[1] = -1 * gf_divfix(_this->m[1], det);
- tmp.m[2] = gf_mulfix(_this->m[1], _this->m[5]) - gf_mulfix(_this->m[4], _this->m[2]);
- tmp.m[2] = gf_divfix(tmp.m[2], det);
+ tmp.m[2] = gf_mulfix(gf_divfix(_this->m[1], det), _this->m[5]) - gf_mulfix(gf_divfix(_this->m[4], det), _this->m[2]);
+
tmp.m[3] = -1 * gf_divfix(_this->m[3], det);
tmp.m[4] = gf_divfix(_this->m[0], det);
- tmp.m[5] = gf_mulfix(_this->m[3], _this->m[2]) - gf_mulfix(_this->m[0],_this->m[5]);
- tmp.m[5] = gf_divfix(tmp.m[5], det);
+ tmp.m[5] = gf_mulfix( gf_divfix(_this->m[3], det), _this->m[2]) - gf_mulfix( gf_divfix(_this->m[5], det), _this->m[0]);
+
+#ifdef GPAC_FIXED_POINT
+ if (scale>1) {
+ tmp.m[0] /= scale;
+ tmp.m[1] /= scale;
+ tmp.m[2] /= scale;
+ tmp.m[3] /= scale;
+ tmp.m[4] /= scale;
+ tmp.m[5] /= scale;
+ }
+#endif
+
gf_mx2d_copy(*_this, tmp);
}
GF_EXPORT
void gf_mx_inverse(GF_Matrix *mx)
{
- Fixed det;
+#ifdef GPAC_FIXED_POINT
+ Float _det, _max;
+ s32 sign, scale;
+#endif
+ Fixed det;
GF_Matrix rev;
gf_mx_init(rev);
assert(! ((mx->m[3] != 0) || (mx->m[7] != 0) || (mx->m[11] != 0) || (mx->m[15] != FIX_ONE)) );
+
+#ifdef GPAC_FIXED_POINT
+ /*we must compute the determinent as a float to avoid fixed-point overflow*/
+ _det = FIX2FLT(mx->m[0])*FIX2FLT(mx->m[5])*FIX2FLT(mx->m[10]);
+ _det += FIX2FLT(mx->m[1])*FIX2FLT(mx->m[6])*FIX2FLT(mx->m[8]);
+ _det += FIX2FLT(mx->m[2])*FIX2FLT(mx->m[4])*FIX2FLT(mx->m[9]);
+ _det -= FIX2FLT(mx->m[2])*FIX2FLT(mx->m[5])*FIX2FLT(mx->m[8]);
+ _det -= FIX2FLT(mx->m[1])*FIX2FLT(mx->m[4])*FIX2FLT(mx->m[10]);
+ _det -= FIX2FLT(mx->m[0])*FIX2FLT(mx->m[6])*FIX2FLT(mx->m[9]);
+
+ if (!_det) {
+ gf_mx2d_init(*mx);
+ return;
+ }
+ sign = _det<0 ? -1 : 1;
+ _det *= sign;
+ scale = 1;
+ _max = FIX2FLT(FIX_MAX);
+ while (_det / scale > _max) {
+ scale *= 10;
+ }
+ det = sign * FLT2FIX(_det/scale);
+#else
det = gf_mulfix(gf_mulfix(mx->m[0], mx->m[5]) , mx->m[10]);
det += gf_mulfix(gf_mulfix(mx->m[1], mx->m[6]) , mx->m[8]);
det += gf_mulfix(gf_mulfix(mx->m[2], mx->m[4]) , mx->m[9]);
det -= gf_mulfix(gf_mulfix(mx->m[2], mx->m[5]) , mx->m[8]);
det -= gf_mulfix(gf_mulfix(mx->m[1], mx->m[4]) , mx->m[10]);
det -= gf_mulfix(gf_mulfix(mx->m[0], mx->m[6]) , mx->m[9]);
+ if (!det) {
+ gf_mx2d_init(*mx);
+ return;
+ }
+#endif
-// if (gf_mulfix(det) < FIX_EPSILON) return;
/* Calculate inverse(A) = adj(A) / det(A) */
rev.m[0] = gf_muldiv(mx->m[5], mx->m[10], det) - gf_muldiv(mx->m[6], mx->m[9], det);
rev.m[6] = -gf_muldiv(mx->m[0], mx->m[6], det) + gf_muldiv(mx->m[2], mx->m[4], det);
rev.m[10] = gf_muldiv(mx->m[0], mx->m[5], det) - gf_muldiv(mx->m[1], mx->m[4], det);
+#ifdef GPAC_FIXED_POINT
+ if (scale>1) {
+ rev.m[0] /= scale;
+ rev.m[4] /= scale;
+ rev.m[8] /= scale;
+ rev.m[1] /= scale;
+ rev.m[5] /= scale;
+ rev.m[9] /= scale;
+ rev.m[2] /= scale;
+ rev.m[6] /= scale;
+ rev.m[10] /= scale;
+ }
+#endif
+
/* do translation part*/
rev.m[12] = -( gf_mulfix(mx->m[12], rev.m[0]) + gf_mulfix(mx->m[13], rev.m[4]) + gf_mulfix(mx->m[14], rev.m[8]) );
rev.m[13] = -( gf_mulfix(mx->m[12], rev.m[1]) + gf_mulfix(mx->m[13], rev.m[5]) + gf_mulfix(mx->m[14], rev.m[9]) );
#include <gpac/config_file.h>
#include <gpac/tools.h>
+
+#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
+#include <gpac/modules/video_out.h>
+#include <gpac/modules/audio_out.h>
+#include "sdl_out.h"
+
+/*hack I'm not proud of. If you're young and innocent never do that*/
+void* (*SDL_Module_Load_Video) (void);
+void* (*SDL_Module_Load_Audio) (void);
+GF_EXPORT void gf_iphone_set_sdl_video_module(void* (*SDL_Module) (void)) {
+ SDL_Module_Load_Video = SDL_Module;
+}
+GF_EXPORT void gf_iphone_set_sdl_audio_module(void* (*SDL_Module) (void)) {
+ SDL_Module_Load_Audio = SDL_Module;
+}
+#endif
+
+
GF_EXPORT
GF_ModuleManager *gf_modules_new(const char *directory, GF_Config *config)
{
GF_ModuleManager *tmp;
- if (!directory || !strlen(directory) || (strlen(directory) > GF_MAX_PATH)) return NULL;
-
+ u32 loadedModules;
+ if (!directory || !strlen(directory) || (strlen(directory) > GF_MAX_PATH)){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Cannot load modules from directory %s, sanity check fails.\n", directory));
+ return NULL;
+ }
GF_SAFEALLOC(tmp, GF_ModuleManager);
if (!tmp) return NULL;
strcpy(tmp->dir, directory);
tmp->plug_list = gf_list_new();
if (!tmp->plug_list) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("OUT OF MEMORY, cannot create list of modules !!!\n", directory));
gf_free(tmp);
return NULL;
}
tmp->cfg = config;
- gf_modules_refresh(tmp);
+ loadedModules = gf_modules_refresh(tmp);
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Loaded %d modules from directory %s.\n", loadedModules, directory));
return tmp;
}
GF_BaseInterface *gf_modules_load_interface(GF_ModuleManager *pm, u32 whichplug, u32 InterfaceFamily)
{
const char *opt;
- char szKey[10];
+ char szKey[32];
ModuleInstance *inst;
GF_BaseInterface *ifce;
- if (!pm) return NULL;
+ if (!pm){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] gf_modules_load_interface() : No Module Manager set\n"));
+ return NULL;
+ }
inst = (ModuleInstance *) gf_list_get(pm->plug_list, whichplug);
- if (!inst) return NULL;
-
+ if (!inst){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] gf_modules_load_interface() : no module %d exist.\n", whichplug));
+ return NULL;
+ }
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Load interface...%s\n", inst->name));
/*look in cache*/
- opt = gf_cfg_get_key(pm->cfg, "PluginsCache", inst->name);
+ if (!pm->cfg){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] No pm->cfg has been set !!!\n"));
+ return NULL;
+ }
+ opt = gf_cfg_get_key(pm->cfg, "PluginsCache", inst->name);
if (opt) {
- sprintf(szKey, "%s:yes", gf_4cc_to_str(InterfaceFamily));
- if (!strstr(opt, szKey)) return NULL;
+ const char * ifce_str = gf_4cc_to_str(InterfaceFamily);
+ snprintf(szKey, 32, "%s:yes", ifce_str ? ifce_str : "(null)");
+ if (!strstr(opt, szKey)){
+ return NULL;
+ }
}
-
if (!gf_modules_load_library(inst)) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot load library %s\n", inst->name));
gf_cfg_set_key(pm->cfg, "PluginsCache", inst->name, "Invalid Plugin");
return NULL;
}
-
if (!inst->query_func) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Library %s missing GPAC export symbols\n", inst->name));
gf_cfg_set_key(pm->cfg, "PluginsCache", inst->name, "Invalid Plugin");
}
i=0;
while (si[i]) i++;
-
+
key = gf_malloc(sizeof(char) * 10 * i);
key[0] = 0;
i=0;
while (si[i]) {
- sprintf(szKey, "%s:yes ", gf_4cc_to_str(si[i]));
+ snprintf(szKey, 32, "%s:yes ", gf_4cc_to_str(si[i]));
strcat(key, szKey);
if (InterfaceFamily==si[i]) found = 1;
i++;
}
if (!inst->query_func || !inst->query_func(InterfaceFamily) ) goto err_exit;
-
ifce = (GF_BaseInterface *) inst->load_func(InterfaceFamily);
/*sanity check*/
if (!ifce) goto err_exit;
-
+#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
+ if (!strcmp(inst->name, "gm_sdl_out.dylib")) {
+ if (InterfaceFamily == GF_VIDEO_OUTPUT_INTERFACE) {
+ ifce = SDL_Module_Load_Video();
+ fprintf(stderr, "*** Loading SDL Video: 0x%p ***\n", ifce);
+ } else if (InterfaceFamily == GF_AUDIO_OUTPUT_INTERFACE) {
+ ifce = SDL_Module_Load_Audio();
+ fprintf(stderr, "*** Loading SDL Audio: 0x%p ***\n", ifce);
+ }
+ }
+#endif
if (!ifce->module_name || (ifce->InterfaceType != InterfaceFamily)) {
inst->destroy_func(ifce);
goto err_exit;
}
gf_list_add(inst->interfaces, ifce);
-
/*keep track of parent*/
ifce->HPLUG = inst;
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Load interface %s DONE.\n", inst->name));
return ifce;
err_exit:
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Load interface %s exit label, freing library...\n", inst->name));
gf_modules_unload_library(inst);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Load interface %s EXIT.\n", inst->name));
return NULL;
}
const char *file_name;
u32 i, count;
GF_BaseInterface *ifce;
+ if (!pm || !plug_name || !pm->plug_list || !pm->cfg){
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] gf_modules_load_interface_by_name has bad parameters pm=%p, plug_name=%s.\n", pm, plug_name));
+ return NULL;
+ }
count = gf_list_count(pm->plug_list);
-
/*look for cache entry*/
file_name = gf_cfg_get_key(pm->cfg, "PluginsCache", plug_name);
+
if (file_name) {
+
for (i=0; i<count; i++) {
ModuleInstance *inst = (ModuleInstance *) gf_list_get(pm->plug_list, i);
if (!strcmp(inst->name, file_name)) {
}
}
}
-
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Plugin %s of type %d not found in cache, searching for it...\n", plug_name, InterfaceFamily));
for (i=0; i<count; i++) {
ifce = gf_modules_load_interface(pm, i, InterfaceFamily);
if (!ifce) continue;
if (ifce->module_name && !stricmp(ifce->module_name, plug_name)) {
/*update cache entry*/
gf_cfg_set_key(pm->cfg, "PluginsCache", plug_name, ((ModuleInstance*)ifce->HPLUG)->name);
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Added plugin cache %s for %s\n", plug_name, ((ModuleInstance*)ifce->HPLUG)->name));
return ifce;
}
gf_modules_close_interface(ifce);
}
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("[Core] Plugin %s not found in %d modules.\n", plug_name, count));
return NULL;
}
#endif
-void gf_delete_file(char *fileName)
+GF_Err gf_delete_file(const char *fileName)
{
-
#if defined(_WIN32_WCE)
TCHAR swzName[MAX_PATH];
CE_CharToWide(fileName, swzName);
- DeleteFile(swzName);
+ return (DeleteFile(swzName)==0) ? GF_IO_ERR : GF_OK;
#elif defined(WIN32)
- DeleteFile(fileName);
+ /* success if != 0 */
+ return (DeleteFile(fileName)==0) ? GF_IO_ERR : GF_OK;
#else
- remove(fileName);
+ /* success is == 0 */
+ return ( remove(fileName) == 0) ? GF_OK : GF_IO_ERR;
#endif
}
-void gf_move_file(char *fileName, char *newFileName)
+void gf_move_file(const char *fileName, const char *newFileName)
{
#if defined(_WIN32_WCE)
TCHAR swzName[MAX_PATH];
{
#if defined(_WIN32_WCE)
return (u64) ftell(fp);
-#elif defined(GPAC_CONFIG_WIN32) //mingw or cygwin
+#elif defined(GPAC_CONFIG_WIN32) /* mingw or cygwin */
return (u64) ftell(fp);
#elif defined(WIN32)
return (u64) _ftelli64(fp);
-#elif defined(GPAC_CONFIG_LINUX) && !defined(ANDROID)
+#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
return (u64) ftello64(fp);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
return (u64) ftello(fp);
{
#if defined(_WIN32_WCE)
return (u64) fseek(fp, (s32) offset, whence);
-#elif defined(GPAC_CONFIG_WIN32) //mingw or cygwin
+#elif defined(GPAC_CONFIG_WIN32) /* mingw or cygwin */
return (u64) fseek(fp, (s32) offset, whence);
#elif defined(WIN32)
return (u64) _fseeki64(fp, offset, whence);
-#elif defined(GPAC_CONFIG_LINUX) && !defined(ANDROID)
+#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
return fseeko64(fp, (off64_t) offset, whence);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
return fseeko(fp, (off_t) offset, whence);
{
#if defined(WIN32)
return fopen(file_name, mode);
-#elif defined(GPAC_CONFIG_LINUX) && !defined(ANDROID)
+#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
return fopen64(file_name, mode);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
return fopen(file_name, mode);
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
#endif
+
#else
+
static u64 last_cpu_u_k_time = 0;
static u64 last_cpu_idle_time = 0;
static u64 mem_at_startup = 0;
#endif
}
-#endif //WIN32
+#endif /* WIN32 */
#if defined(__sh__)
/* Avoid exception for denormalized floating point values */
return 1;
}
+
+#elif defined(GPAC_CONFIG_DARWIN) && !defined(GPAC_IPHONE)
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <mach/mach_init.h>
+#include <mach/mach_host.h>
+#include <mach/mach_port.h>
+#include <mach/mach_traps.h>
+#include <mach/task_info.h>
+#include <mach/thread_info.h>
+#include <mach/thread_act.h>
+#include <mach/vm_region.h>
+#include <mach/vm_map.h>
+#include <mach/task.h>
+#include <mach/shared_memory_server.h>
+
+static u64 total_physical_memory = 0;
+
+Bool gf_sys_get_rti(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
+{
+ size_t length;
+ u32 entry_time, i, percent;
+ int mib[6];
+ int result;
+ int pagesize;
+ u64 process_u_k_time;
+ mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
+ vm_statistics_data_t vmstat;
+ task_t task;
+ kern_return_t error;
+ thread_array_t thread_table;
+ thread_basic_info_t thi;
+ thread_basic_info_data_t thi_data;
+ unsigned table_size;
+ struct task_basic_info ti;
+ double utime, stime;
+
+ entry_time = gf_sys_clock();
+ if (last_update_time && (entry_time - last_update_time < refresh_time_ms)) {
+ memcpy(rti, &the_rti, sizeof(GF_SystemRTInfo));
+ return 0;
+ }
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ length = sizeof(pagesize);
+ if (sysctl(mib, 2, &pagesize, &length, NULL, 0) < 0) {
+ return 0;
+ }
+
+ if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat, &count) != KERN_SUCCESS) {
+ return 0;
+ }
+
+ the_rti.physical_memory = (vmstat.wire_count + vmstat.active_count + vmstat.inactive_count + vmstat.free_count)* pagesize;
+ the_rti.physical_memory_avail = vmstat.free_count * pagesize;
+
+ if (!total_physical_memory) {
+ mib[0] = CTL_HW;
+ mib[1] = HW_PHYSMEM;
+ length = sizeof(result);
+ if (sysctl(mib, 2, &result, &length, NULL, 0) >= 0) {
+ total_physical_memory = result;
+ }
+ }
+
+
+ error = task_for_pid(mach_task_self(), the_rti.pid, &task);
+ if (error) {
+ return 0;
+ }
+
+ percent = 0;
+ utime = ti.user_time.seconds + ti.user_time.microseconds * 1e-6;
+ stime = ti.system_time.seconds + ti.system_time.microseconds * 1e-6;
+ error = task_threads(task, &thread_table, &table_size);
+ assert(error == KERN_SUCCESS);
+ thi = &thi_data;
+ for (i = 0; i != table_size; ++i) {
+ count = THREAD_BASIC_INFO_COUNT;
+ error = thread_info(thread_table[i], THREAD_BASIC_INFO, (thread_info_t)thi, &count);
+ assert(error == KERN_SUCCESS);
+ if ((thi->flags & TH_FLAGS_IDLE) == 0) {
+ utime += thi->user_time.seconds + thi->user_time.microseconds * 1e-6;
+ stime += thi->system_time.seconds + thi->system_time.microseconds * 1e-6;
+ percent += (u32) (100 * (double)thi->cpu_usage / TH_USAGE_SCALE);
+ }
+ }
+ error = vm_deallocate(mach_task_self(), (vm_offset_t)thread_table, table_size * sizeof(thread_array_t));
+ mach_port_deallocate(mach_task_self(), task);
+
+ process_u_k_time = utime + stime;
+
+ the_rti.sampling_instant = last_update_time;
+
+ if (last_update_time) {
+ the_rti.sampling_period_duration = (entry_time - last_update_time);
+ the_rti.process_cpu_time_diff = (process_u_k_time - last_process_k_u_time) * 10;
+
+ the_rti.total_cpu_time_diff = the_rti.sampling_period_duration;
+ /*TODO*/
+ the_rti.cpu_idle_time = 0;
+ the_rti.total_cpu_usage = 0;
+ if (!the_rti.process_cpu_time_diff) the_rti.process_cpu_time_diff = the_rti.total_cpu_time_diff;
+
+ the_rti.process_cpu_usage = percent;
+ } else {
+ mem_at_startup = the_rti.physical_memory_avail;
+ }
+ the_rti.process_memory = mem_at_startup - the_rti.physical_memory_avail;
+
+#ifdef GPAC_MEMORY_TRACKING
+ the_rti.gpac_memory = gpac_allocated_memory;
+#endif
+
+ last_process_k_u_time = process_u_k_time;
+ last_cpu_idle_time = 0;
+ last_update_time = entry_time;
+ memcpy(rti, &the_rti, sizeof(GF_SystemRTInfo));
+ return 1;
+}
+//linux
#else
Bool gf_sys_get_rti(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
if (f) {
while (fgets(line, 1024, f) != NULL) {
if (!strnicmp(line, "MemTotal:", 9)) {
- sscanf(line, "MemTotal: %"LLD" kB", &the_rti.physical_memory);
+ sscanf(line, "MemTotal: "LLU" kB", &the_rti.physical_memory);
the_rti.physical_memory *= 1024;
}else if (!strnicmp(line, "MemFree:", 8)) {
- sscanf(line, "MemFree: %"LLD" kB", &the_rti.physical_memory_avail);
+ sscanf(line, "MemFree: "LLU" kB", &the_rti.physical_memory_avail);
the_rti.physical_memory_avail *= 1024;
break;
}
#endif
+char * gf_get_default_cache_directory(){
+#ifdef _WIN32_WCE
+ return gf_strdup( "\\windows\\temp" );
+#elif defined(WIN32)
+ char szPath[512];
+ GetWindowsDirectory(szPath, 507);
+ if (szPath[strlen(szPath)-1] != '\\')
+ strcat((char*)szPath, "\\");
+ strcat((char *)szPath, "Temp");
+ return gf_strdup( szPath );
+#else
+ return gf_strdup("/tmp");
+#endif
+}
+
+
+
Bool gf_sys_get_battery_state(Bool *onBattery, u32 *onCharge, u32*level, u32 *batteryLifeTime, u32 *batteryFullLifeTime)
{
#endif
return 1;
}
+
+
+struct GF_GlobalLock {
+ const char * resourceName;
+};
+
+
+#ifndef WIN32
+#define CPF_CLOEXEC 1
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+struct _GF_GlobalLock_opaque {
+ char * resourceName;
+ char * pidFile;
+ int fd;
+};
+
+GF_GlobalLock * gf_create_PID_file( const char * resourceName )
+{
+ const char * prefix = "/gpac_lock_";
+ const char * dir = gf_get_default_cache_directory();
+ char * pidfile;
+ int flags;
+ int status;
+ pidfile = gf_malloc(strlen(dir)+strlen(prefix)+strlen(resourceName)+1);
+ strcpy(pidfile, dir);
+ strcat(pidfile, prefix);
+ /* Use only valid names for file */
+ {
+ const char *res;
+ char * pid = &(pidfile[strlen(pidfile)]);
+ for (res = resourceName; *res ; res++){
+ if (*res >= 'A' && *res <= 'z')
+ *pid = * res;
+ else
+ *pid = '_';
+ pid++;
+ }
+ *pid = '\0';
+ }
+ int fd = open(pidfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd == -1)
+ goto exit;
+ /* Get the flags */
+ flags = fcntl(fd, F_GETFD);
+ if (flags == -1){
+ goto exit;
+ }
+ /* Set FD_CLOEXEC, so exclusive lock will be removed on exit, so even if GPAC crashes,
+ * lock will be allowed for next instance */
+ flags |= FD_CLOEXEC;
+ /* Now, update the flags */
+ if (fcntl(fd, F_SETFD, flags) == -1){
+ goto exit;
+ }
+
+ /* Now, we try to lock the file */
+ {
+ struct flock fl;
+ fl.l_type = F_WRLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = fl.l_len = 0;
+ status = fcntl(fd, F_SETLK, &fl);
+ }
+
+ if (status == -1) {
+ goto exit;
+ }
+
+ if (ftruncate(fd, 0) == -1){
+ goto exit;
+ }
+ /* Write the PID */
+ {
+ int sz = 100;
+ char * buf = gf_malloc( sz );
+ sz = snprintf(buf, sz, "%ld\n", (long) getpid());
+ if (write(fd, buf, sz) != sz){
+ gf_free(buf);
+ goto exit;
+ }
+ }
+ sync();
+ {
+ GF_GlobalLock * lock = gf_malloc( sizeof(GF_GlobalLock));
+ lock->resourceName = gf_strdup(resourceName);
+ lock->pidFile = pidfile;
+ lock->fd = fd;
+ return lock;
+ }
+exit:
+ if (fd >= 0)
+ close(fd);
+ return NULL;
+}
+
+#else /* WIN32 */
+#pragma message("gf_global_resource_lock() not implemented")
+struct _GF_GlobalLock_opaque {
+ char * resourceName;
+};
+
+#endif
+
+
+GF_GlobalLock * gf_global_resource_lock(const char * resourceName){
+#ifdef WIN32
+ GF_GlobalLock * lock = gf_malloc(sizeof(GF_GlobalLock));
+ lock->resourceName = gf_strdup( resourceName );
+ /* TODO : implement this properly for Windows... */
+ return lock;
+#else /* WIN32 */
+ return gf_create_PID_file(resourceName);
+#endif /* WIN32 */
+}
+
+/*!
+ * Unlock a previouly locked resource
+ * \param lock The resource to unlock
+ * \return GF_OK if evertything went fine
+ */
+GF_Err gf_global_resource_unlock(GF_GlobalLock * lock){
+ if (!lock)
+ return GF_BAD_PARAM;
+#ifndef WIN32
+ assert( lock->pidFile);
+ close(lock->fd);
+ if (unlink(lock->pidFile))
+ perror("Failed to unlink lock file");
+ gf_free(lock->pidFile);
+ lock->pidFile = NULL;
+ lock->fd = -1;
+#endif /* not defined WIN32 */
+ if (lock->resourceName)
+ gf_free(lock->resourceName);
+ lock->resourceName = NULL;
+ gf_free(lock);
+ return GF_OK;
+}
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#else
if (inst->lib_handle) dlclose(inst->lib_handle);
#endif
- gf_list_del(inst->interfaces);
- gf_free(inst->name);
+ if (inst->interfaces)
+ gf_list_del(inst->interfaces);
+ inst->interfaces = NULL;
+ if (inst->name)
+ gf_free(inst->name);
+ inst->name = NULL;
gf_free(inst);
}
#else
char path[GF_MAX_PATH];
s32 _flags;
+ const char * error;
#endif
-
+
if (inst->lib_handle) return 1;
GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Load module file %s\n", inst->name));
#else
sprintf(path, "%s%c%s", inst->plugman->dir, GF_PATH_SEPARATOR, inst->name);
#endif
-
+
#ifdef WIN32
inst->lib_handle = LoadLibrary(path);
if (!inst->lib_handle) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot load module file %s, error is %s\n", path, dlerror()));
return 0;
}
+ error = dlerror(); /* Clear any existing error */
inst->query_func = (QueryInterfaces) dlsym(inst->lib_handle, "QueryInterfaces");
+ error = dlerror();
+ if (error)
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot resolve symbol QueryInterfaces in module file %s, error is %s\n", path, error));
inst->load_func = (LoadInterface) dlsym(inst->lib_handle, "LoadInterface");
+ error = dlerror();
+ if (error)
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot resolve symbol LoadInterface in module file %s, error is %s\n", path, error));
inst->destroy_func = (ShutdownInterface) dlsym(inst->lib_handle, "ShutdownInterface");
+ error = dlerror();
+ if (error)
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot resolve symbol ShutdownInterface in module file %s, error is %s\n", path, error));
#endif
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Load module file %s : DONE\n", inst->name));
return 1;
}
GF_ModuleManager *pm = cbck;
if (strstr(item_name, "nposmozilla")) return 0;
- if (strncmp(item_name, "gm_", 3)) return 0;
+ if (strncmp(item_name, "gm_", 3) && strncmp(item_name, "libgm_", 6)) return 0;
if (gf_module_is_loaded(pm, item_name) ) return 0;
#if CHECK_MODULE
#else
_flags =RTLD_LAZY;
#endif
-
- ModuleLib = dlopen(file, _flags);
- if (!ModuleLib) goto next;
- query_func = (QueryInterface) dlsym(ModuleLib, "QueryInterface");
- load_func = (LoadInterface) dlsym(ModuleLib, "LoadInterface");
- del_func = (ShutdownInterface) dlsym(ModuleLib, "ShutdownInterface");
+ ModuleLib = dlopen(item_name, _flags);
+ if (!ModuleLib) {
+ GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot load module file %s, error is %s\n", item_name, dlerror()));
+ goto next;
+ }
+
+ query_func = (QueryInterface) dlsym(ModuleLib, "QueryInterface");
+ load_func = (LoadInterface) dlsym(ModuleLib, "LoadInterface");
+ del_func = (ShutdownInterface) dlsym(ModuleLib, "ShutdownInterface");
dlclose(ModuleLib);
#endif
- if (!load_func || !query_func || !del_func) return 0;
+ if (!load_func || !query_func || !del_func){
+ GF_LOG(GF_LOG_WARNING, GF_LOG_CORE,
+ ("[Core] Could not find some signatures in module %s: QueryInterface=%p, LoadInterface=%p, ShutdownInterface=%p\n",
+ item_name, load_func, query_func, del_func));
+ return 0;
+ }
#endif
inst->interfaces = gf_list_new();
inst->plugman = pm;
inst->name = gf_strdup(item_name);
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Added module %s.\n", inst->name));
gf_list_add(pm->plug_list, inst);
return 0;
}
u32 gf_modules_refresh(GF_ModuleManager *pm)
{
if (!pm) return 0;
-
#ifdef WIN32
gf_enum_directory(pm->dir, 0, enum_modules, pm, ".dll");
#elif defined(__APPLE__)
+#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_sdl_out.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_soft_raster.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_dummy_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_ctx_load.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_svg_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_mp3_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_aac_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_img_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_bifs_dec.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_gpac_js.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_isom_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_laser_dec.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_odf_dec.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_rtp_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_mpegts_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_ft_font.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_widgetman.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+ {
+ ModuleInstance *inst;
+ GF_SAFEALLOC(inst, ModuleInstance);
+ inst->interfaces = gf_list_new();
+ inst->plugman = pm;
+ inst->name = gf_strdup("gm_mpd_in.dylib");
+ gf_list_add(pm->plug_list, inst);
+ }
+#else
gf_enum_directory(pm->dir, 0, enum_modules, pm, ".dylib");
+#endif
#else
+ GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Refreshing list of modules in directory %s...\n", pm->dir));
gf_enum_directory(pm->dir, 0, enum_modules, pm, ".so");
#endif
#define ENOTCONN WSAENOTCONN
#define ECONNRESET WSAECONNRESET
#define EMSGSIZE WSAEMSGSIZE
-#define ECONNABORTED WSAECONNABORTED
+#define ECONNABORTED WSAECONNABORTED
#define ENETDOWN WSAENETDOWN
+#define EINTR WSAEINTR
+#define EBADF WSAEBADF
#define LASTSOCKERROR WSAGetLastError()
}
GF_EXPORT
-Bool gf_net_is_ipv6(char *address)
+Bool gf_net_is_ipv6(const char *address)
{
char *sep;
if (!address) return 0;
}
#ifdef GPAC_HAS_IPV6
-static struct addrinfo *gf_sk_get_ipv6_addr(char *PeerName, u16 PortNumber, int family, int flags, int sock_type)
+static struct addrinfo *gf_sk_get_ipv6_addr(const char *PeerName, u16 PortNumber, int family, int flags, int sock_type)
{
struct addrinfo *res=NULL;
struct addrinfo hints;
return res;
}
-static Bool gf_sk_ipv6_set_remote_address(GF_Socket *sock, char *address, u16 PortNumber)
+static Bool gf_sk_ipv6_set_remote_address(GF_Socket *sock, const char *address, u16 PortNumber)
{
struct addrinfo *res = gf_sk_get_ipv6_addr(address, PortNumber, AF_UNSPEC, 0, (sock->flags & GF_SOCK_IS_TCP) ? SOCK_STREAM : SOCK_DGRAM);
if (!res) return 0;
}
-static void gf_sk_gf_free(GF_Socket *sock)
+static void gf_sk_free(GF_Socket *sock)
{
/*leave multicast*/
if (sock->socket && (sock->flags & GF_SOCK_IS_MULTICAST) ) {
void gf_sk_del(GF_Socket *sock)
{
- gf_sk_gf_free(sock);
+ gf_sk_free(sock);
#ifdef WIN32
wsa_init --;
if (!wsa_init) WSACleanup();
//connects a socket to a remote peer on a given port
-GF_Err gf_sk_connect(GF_Socket *sock, char *PeerName, u16 PortNumber, char *local_ip)
+GF_Err gf_sk_connect(GF_Socket *sock, const char *PeerName, u16 PortNumber, const char *local_ip)
{
s32 ret;
#ifdef GPAC_HAS_IPV6
u32 type = (sock->flags & GF_SOCK_IS_TCP) ? SOCK_STREAM : SOCK_DGRAM;
struct addrinfo *res, *aip, *lip;
- gf_sk_gf_free(sock);
+ gf_sk_free(sock);
res = gf_sk_get_ipv6_addr(PeerName, PortNumber, AF_UNSPEC, AI_PASSIVE, type);
if (!res) return GF_IP_CONNECTION_FAILURE;
//binds the given socket to the specified port. If ReUse is true
//this will enable reuse of ports on a single machine
-GF_Err gf_sk_bind(GF_Socket *sock, char *local_ip, u16 port, char *peer_name, u16 peer_port, u32 options)
+GF_Err gf_sk_bind(GF_Socket *sock, const char *local_ip, u16 port, const char *peer_name, u16 peer_port, u32 options)
{
#ifdef GPAC_HAS_IPV6
struct addrinfo *res, *aip;
s32 optval;
if (!sock || sock->socket) return GF_BAD_PARAM;
+
+#ifndef WIN32
+ if(!local_ip){
+ if(!peer_name || !strcmp(peer_name,"localhost")){
+ peer_name="127.0.0.1";
+ }
+ }
+#endif
#ifdef GPAC_HAS_IPV6
type = (sock->flags & GF_SOCK_IS_TCP) ? SOCK_STREAM : SOCK_DGRAM;
}
//send length bytes of a buffer
-GF_Err gf_sk_send(GF_Socket *sock, char *buffer, u32 length)
+GF_Err gf_sk_send(GF_Socket *sock, const char *buffer, u32 length)
{
GF_Err e;
u32 count;
#endif
}
-GF_Err gf_sk_setup_multicast(GF_Socket *sock, char *multi_IPAdd, u16 MultiPortNumber, u32 TTL, Bool NoBind, char *local_interface_ip)
+GF_Err gf_sk_setup_multicast(GF_Socket *sock, const char *multi_IPAdd, u16 MultiPortNumber, u32 TTL, Bool NoBind, char *local_interface_ip)
{
s32 ret;
u32 flag;
}
-
-
//fetch nb bytes on a socket and fill the buffer from startFrom
//length is the allocated size of the receiving buffer
//BytesRead is the number of bytes read from the network
ready = select(sock->socket+1, &Group, NULL, NULL, &timeout);
if (ready == SOCKET_ERROR) {
switch (LASTSOCKERROR) {
+ case EBADF:
+ GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[socket] cannot select, BAD descriptor\n"));
+ return GF_IP_CONNECTION_CLOSED;
case EAGAIN:
return GF_IP_SOCK_WOULD_BLOCK;
+ case EINTR:
+ /* Interrupted system call, not really important... */
+ return GF_IP_NETWORK_EMPTY;
default:
GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[socket] cannot select (error %d)\n", LASTSOCKERROR));
return GF_IP_NETWORK_FAILURE;
}
}
- if (!FD_ISSET(sock->socket, &Group)) {
+ if (!ready || !FD_ISSET(sock->socket, &Group)) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[socket] nothing to be read\n"));
return GF_IP_NETWORK_EMPTY;
}
#endif
-
if (sock->flags & GF_SOCK_HAS_PEER)
res = recvfrom(sock->socket, (char *) buffer + startFrom, length - startFrom, 0, (struct sockaddr *)&sock->dest_addr, &sock->dest_addr_len);
- else
+ else {
res = recv(sock->socket, (char *) buffer + startFrom, length - startFrom, 0);
+ /* souchay : Added for Linux, if we cannot read, it means we have been disconnected, beahviour may be different
+ * on some OSs... in such case, a #ifdef directive shoud be used
+ */
+ if (res == 0)
+ return GF_IP_CONNECTION_CLOSED;
+ }
if (res == SOCKET_ERROR) {
res = LASTSOCKERROR;
//send length bytes of a buffer
-GF_Err gf_sk_send_to(GF_Socket *sock, char *buffer, u32 length, char *remoteHost, u16 remotePort)
+GF_Err gf_sk_send_to(GF_Socket *sock, const char *buffer, u32 length, char *remoteHost, u16 remotePort)
{
u32 count, remote_add_len;
s32 res;
//send length bytes of a buffer
-GF_Err gf_sk_send_wait(GF_Socket *sock, char *buffer, u32 length, u32 Second )
+GF_Err gf_sk_send_wait(GF_Socket *sock, const char *buffer, u32 length, u32 Second )
{
GF_Err e;
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
+#ifdef GPAC_ANDROID
+#include <jni.h>
+#endif
+
#include <gpac/thread.h>
#if defined(WIN32) || defined(_WIN32_WCE)
#include <sched.h>
#include <pthread.h>
#include <semaphore.h>
+#include <errno.h>
typedef pthread_t TH_HANDLE ;
#endif
u32 id;
char *log_name;
#endif
+#ifdef GPAC_ANDROID
+ u32 (*RunBeforeExit)(void *param);
+#endif
};
static const char *log_th_name(u32 id)
{
u32 i, count;
-
+
if (!id) id = gf_th_id();
count = gf_list_count(thread_bank);
for (i=0; i<count; i++) {
tmp->log_name = gf_strdup(name);
} else {
char szN[20];
- sprintf(szN, "0x%p", tmp);
+ sprintf(szN, "0x%p", (void*)tmp);
tmp->log_name = gf_strdup(szN);
}
log_add_thread(tmp);
return tmp;
}
+
+#ifdef GPAC_ANDROID
+#include <pthread.h>
+
+static pthread_key_t currentThreadInfoKey = 0;
+
+/* Unique allocation of key */
+static pthread_once_t currentThreadInfoKey_once = PTHREAD_ONCE_INIT;
+
+GF_Err gf_register_before_exit_function(GF_Thread *t, u32 (*toRunBeforePthreadExit)(void *param) )
+{
+ if (!t)
+ return GF_BAD_PARAM;
+ t->RunBeforeExit = toRunBeforePthreadExit;
+ return GF_OK;
+}
+
+/* Unique key allocation */
+static void currentThreadInfoKey_alloc()
+{
+ /* We do not use any destructor */
+ pthread_key_create(¤tThreadInfoKey, NULL);
+}
+
+GF_Thread * gf_th_current(){
+ return pthread_getspecific(currentThreadInfoKey);
+}
+
+#endif /* GPAC_ANDROID */
+
+
#ifdef WIN32
DWORD WINAPI RunThread(void *ptr)
{
/* Signal the caller */
if (! t->_signal) goto exit;
-
+#ifdef GPAC_ANDROID
+ pthread_once(¤tThreadInfoKey_once, ¤tThreadInfoKey_alloc);
+ pthread_setspecific(currentThreadInfoKey, t);
+#endif /* GPAC_ANDROID */
t->status = GF_THREAD_STATUS_RUN;
gf_sema_notify(t->_signal, 1);
#ifndef GPAC_DISABLE_LOG
t->id = gf_th_id();
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Thread %s] At %d Entering thread proc - thread ID 0x%08x\n", t->log_name, gf_sys_clock(), t->id));
+ GF_LOG(GF_LOG_INFO, GF_LOG_MUTEX, ("[Thread %s] At %d Entering thread proc - thread ID 0x%08x\n", t->log_name, gf_sys_clock(), t->id));
#endif
/* Each thread has its own seed */
exit:
#ifndef GPAC_DISABLE_LOG
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Thread %s] At %d Exiting thread proc\n", t->log_name, gf_sys_clock()));
+ GF_LOG(GF_LOG_INFO, GF_LOG_MUTEX, ("[Thread %s] At %d Exiting thread proc\n", t->log_name, gf_sys_clock()));
#endif
t->status = GF_THREAD_STATUS_DEAD;
t->Run = NULL;
t->threadH = NULL;
return ret;
#else
+
+#ifdef GPAC_ANDROID
+ #ifndef GPAC_DISABLE_LOG
+ GF_LOG(GF_LOG_INFO, GF_LOG_MUTEX, ("[Thread %s] RunBeforeExit=%p\n", t->log_name, t->RunBeforeExit));
+ #endif
+ if (t->RunBeforeExit)
+ t->RunBeforeExit(t->args);
+#endif /* GPAC_ANDROID */
pthread_exit((void *)0);
return (void *)ret;
#endif
}
/*wait for the child function to call us - do NOT return before, otherwise the thread status would
- be unknown*/
+ be unknown*/
gf_sema_wait(t->_signal);
gf_sema_del(t->_signal);
t->_signal = NULL;
TerminateThread(t->threadH, dw);
t->threadH = NULL;
} else {
- WaitForSingleObject(t->threadH, INFINITE);
+ WaitForSingleObject(t->threadH, INFINITE);
}
#else
if (Destroy) {
-#ifdef ANDROID
+#ifdef GPAC_ANDROID
pthread_kill(t->threadH, SIGQUIT);
#else
pthread_cancel(t->threadH);
t->threadH = 0;
} else {
/*gracefully wait for Run to finish*/
- pthread_join(t->threadH, NULL);
+ pthread_join(t->threadH, NULL);
}
#endif
}
Thread_Stop(t, 0);
#ifdef WIN32
// if (t->threadH) CloseHandle(t->threadH);
+#else
+ /* It is necessary to free pthread handle */
+ if (t->threadH)
+ pthread_detach(t->threadH);
+ t->threadH = 0;
#endif
#ifndef GPAC_DISABLE_LOG
GF_Mutex *tmp = gf_malloc(sizeof(GF_Mutex));
if (!tmp) return NULL;
memset(tmp, 0, sizeof(GF_Mutex));
-
+
#ifdef WIN32
tmp->hMutex = CreateMutex(NULL, FALSE, NULL);
if (!tmp->hMutex) {
tmp->log_name = gf_strdup(name);
} else {
char szN[20];
- sprintf(szN, "0x%p", tmp);
+ sprintf(szN, "0x%p", (void*)tmp);
tmp->log_name = gf_strdup(szN);
}
+ assert( tmp->log_name);
#endif
return tmp;
#endif
#ifndef GPAC_DISABLE_LOG
gf_free(mx->log_name);
+ mx->log_name = NULL;
#endif
gf_free(mx);
}
if (mx->HolderCount == 0) {
#ifndef GPAC_DISABLE_LOG
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Mutex %s] At %d Released by thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(mx->Holder) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MUTEX, ("[Mutex %s] At %d Released by thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(mx->Holder) ));
#endif
mx->Holder = 0;
#ifdef WIN32
u32 gf_mx_p(GF_Mutex *mx)
{
+#ifndef WIN32
+ int retCode;
+#endif
u32 caller;
assert(mx);
if (!mx) return 0;
#ifndef GPAC_DISABLE_LOG
if (mx->Holder)
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Mutex %s] At %d Thread %s waiting a release from thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(caller), log_th_name(mx->Holder) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MUTEX, ("[Mutex %s] At %d Thread %s waiting a release from thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(caller), log_th_name(mx->Holder) ));
#endif
#ifdef WIN32
break;
}
#else
- if (pthread_mutex_lock(&mx->hMutex) != 0 ) {
+ retCode = pthread_mutex_lock(&mx->hMutex);
+ if (retCode != 0 ) {
+#ifndef GPAC_DISABLE_LOG
+ if (retCode == EINVAL)
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MUTEX, ("[Mutex %p=%s] Not properly initialized.\n", mx, mx->log_name));
+ if (retCode == EDEADLK)
+ GF_LOG(GF_LOG_ERROR, GF_LOG_MUTEX, ("[Mutext %p=%s] Deadlock detected.\n", mx, mx->log_name));
+#endif /* GPAC_DISABLE_LOG */
assert(0);
return 0;
}
-#endif
+#endif /* NOT WIN32 */
mx->HolderCount = 1;
mx->Holder = caller;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Mutex %s] At %d Grabbed by thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(mx->Holder) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MUTEX, ("[Mutex %s] At %d Grabbed by thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(mx->Holder) ));
return 1;
}
switch (WaitForSingleObject(mx->hMutex, 1)) {
case WAIT_ABANDONED:
case WAIT_TIMEOUT:
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Mutex %s] At %d Couldn't be locked by thread %s (grabbed by thread %s)\n", mx->log_name, gf_sys_clock(), log_th_name(caller), log_th_name(mx->Holder) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MUTEX, ("[Mutex %s] At %d Couldn't be locked by thread %s (grabbed by thread %s)\n", mx->log_name, gf_sys_clock(), log_th_name(caller), log_th_name(mx->Holder) ));
return 0;
default:
break;
}
#else
if (pthread_mutex_trylock(&mx->hMutex) != 0 ) {
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Mutex %s] At %d Couldn't release it for thread %s (grabbed by thread %s)\n", mx->log_name, gf_sys_clock(), log_th_name(caller), log_th_name(mx->Holder) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MUTEX, ("[Mutex %s] At %d Couldn't release it for thread %s (grabbed by thread %s)\n", mx->log_name, gf_sys_clock(), log_th_name(caller), log_th_name(mx->Holder) ));
return 0;
}
#endif
mx->Holder = caller;
mx->HolderCount = 1;
- GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Mutex %s] At %d Grabbed by thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(mx->Holder) ));
+ GF_LOG(GF_LOG_DEBUG, GF_LOG_MUTEX, ("[Mutex %s] At %d Grabbed by thread %s\n", mx->log_name, gf_sys_clock(), log_th_name(mx->Holder) ));
return 1;
}
TimeOut += gf_sys_clock();
do {
if (!sem_trywait(hSem)) return 1;
- gf_sleep(1);
+ gf_sleep(1);
} while (gf_sys_clock() < TimeOut);
return 0;
#endif
}
}
}
- s = start = gp->points[i];
+ if ( i < gp->n_points )
+ s = start = gp->points[i];
i++;
}
}
--- /dev/null
+/*
+ * GPAC - Multimedia Framework C SDK
+ *
+ * Copyright (c) Jean Le Feuvre 2000-2005
+ * All rights reserved
+ *
+ * This file is part of GPAC / common tools sub-project
+ *
+ * GPAC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GPAC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#include <gpac/ringbuffer.h>
+
+GF_Ringbuffer * gf_ringbuffer_new(u32 sz)
+{
+ GF_Ringbuffer *rb;
+
+ rb = gf_malloc (sizeof (GF_Ringbuffer));
+ if (sz % 2 != 0)
+ sz++;
+ rb->size = sz;
+ rb->size_mask = rb->size;
+ rb->size_mask -= 1;
+ rb->write_ptr = 0;
+ rb->read_ptr = 0;
+ rb->buf = gf_malloc (rb->size);
+ rb->mx = gf_mx_new("RingBufferMutex");
+ return rb;
+}
+
+void gf_ringbuffer_del(GF_Ringbuffer * ringbuffer){
+ if (!ringbuffer)
+ return;
+ gf_mx_p(ringbuffer->mx);
+ gf_free( ringbuffer->buf);
+ ringbuffer->mx = NULL;
+ gf_mx_v(ringbuffer->mx);
+}
+
+/*!
+ * Return the number of bytes available for writing. This is the
+ * number of bytes in front of the write pointer and behind the read
+ * pointer.
+ * \param The ringbuffer
+ */
+static u32 gf_ringbuffer_available_for_write (GF_Ringbuffer * rb)
+{
+ u32 w, r;
+
+ w = rb->write_ptr;
+ r = rb->read_ptr;
+
+ if (w > r) {
+ return ((r - w + rb->size) & rb->size_mask) - 1;
+ } else if (w < r) {
+ return (r - w) - 1;
+ } else {
+ return rb->size - 1;
+ }
+}
+
+u32 gf_ringbuffer_available_for_read (GF_Ringbuffer * rb)
+{
+ size_t w, r;
+
+ w = rb->write_ptr;
+ r = rb->read_ptr;
+
+ if (w > r) {
+ return w - r;
+ } else {
+ return (w - r + rb->size) & rb->size_mask;
+ }
+}
+
+u32 gf_ringbuffer_read(GF_Ringbuffer *rb, u8 *dest, u32 szDest)
+{
+ u32 free_sz, sz2, to_read, n1, n2;
+
+ if ((free_sz = gf_ringbuffer_available_for_read(rb)) == 0) {
+ return 0;
+ }
+
+ to_read = szDest > free_sz ? free_sz : szDest;
+
+ sz2 = rb->read_ptr + to_read;
+
+ if (sz2 > rb->size) {
+ n1 = rb->size - rb->read_ptr;
+ n2 = sz2 & rb->size_mask;
+ } else {
+ n1 = to_read;
+ n2 = 0;
+ }
+
+ memcpy (dest, &(rb->buf[rb->read_ptr]), n1);
+ rb->read_ptr += n1;
+ rb->read_ptr &= rb->size_mask;
+
+ if (n2) {
+ memcpy (dest + n1, &(rb->buf[rb->read_ptr]), n2);
+ rb->read_ptr += n2;
+ rb->read_ptr &= rb->size_mask;
+ }
+
+ return to_read;
+}
+
+u32 gf_ringbuffer_write (GF_Ringbuffer * rb, const u8 *src, u32 sz)
+{
+ u32 free_sz, sz2, to_write, n1, n2;
+
+ if ((free_sz = gf_ringbuffer_available_for_write(rb)) == 0) {
+ return 0;
+ }
+
+ to_write = sz > free_sz ? free_sz : sz;
+
+ sz2 = rb->write_ptr + to_write;
+
+ if (sz2 > rb->size) {
+ n1 = rb->size - rb->write_ptr;
+ n2 = sz2 & rb->size_mask;
+ } else {
+ n1 = to_write;
+ n2 = 0;
+ }
+
+ memcpy (&(rb->buf[rb->write_ptr]), src, n1);
+ rb->write_ptr += n1;
+ rb->write_ptr &= rb->size_mask;
+
+ if (n2) {
+ memcpy (&(rb->buf[rb->write_ptr]), src + n1, n2);
+ rb->write_ptr += n2;
+ rb->write_ptr &= rb->size_mask;
+ }
+ return to_write;
+}
+
#include <gpac/token.h>
-static GFINLINE s32 gf_tok_is_char_in_set(char TestChar, char *TestSet)
+static GFINLINE s32 gf_tok_is_char_in_set(const char TestChar, const char *TestSet)
{
u32 i, Len;
Len = strlen(TestSet);
}
GF_EXPORT
-s32 gf_token_get(char *Buffer, s32 Start, char *Separator, char *Container, s32 ContainerSize)
+s32 gf_token_get(const char *Buffer, s32 Start, const char *Separator, char *Container, s32 ContainerSize)
{
s32 i, start, end, Len;
return (end+1);
}
-s32 gf_token_get_strip(char *Buffer, s32 Start, char *Separator, char *strip_set, char *Container, s32 ContainerSize)
+s32 gf_token_get_strip(const char *Buffer, s32 Start, const char *Separator, const char *strip_set, char *Container, s32 ContainerSize)
{
u32 i, k, len;
s32 res = gf_token_get(Buffer, Start, Separator, Container, ContainerSize);
GF_EXPORT
-s32 gf_token_get_line(char *Buffer, u32 Start, u32 Size, char *LineBuffer, u32 LineBufferSize)
+s32 gf_token_get_line(const char *Buffer, u32 Start, u32 Size, char *LineBuffer, u32 LineBufferSize)
{
u32 offset;
s32 i, End, Total;
}
GF_EXPORT
-s32 gf_token_find(char *Buffer, u32 Start, u32 Size, char *Pattern)
+s32 gf_token_find(const char *Buffer, u32 Start, u32 Size, const char *Pattern)
{
u32 i, j, flag;
s32 Len;
--- /dev/null
+#include <gpac/unicode.h>
+/**
+ * This code has been adapted from http://www.ietf.org/rfc/rfc2640.txt
+ * Full Copyright Statement
+
+ Copyright (C) The Internet Society (1999). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC Editor function is currently provided by the
+ Internet Society.
+ */
+
+u32
+utf8_to_ucs4(u32 * ucs4_buf, u32 utf8_len, unsigned char *utf8_buf)
+{
+ const unsigned char *utf8_endbuf = utf8_buf + utf8_len;
+ u32 ucs_len = 0;
+ assert( ucs4_buf );
+ assert( utf8_buf );
+
+ while (utf8_buf != utf8_endbuf) {
+
+ if ((*utf8_buf & 0x80) == 0x00) { /* ASCII chars no
+ * conversion needed */
+ *ucs4_buf++ = (u32) * utf8_buf;
+ utf8_buf++;
+ ucs_len++;
+ } else if ((*utf8_buf & 0xE0) == 0xC0)
+ //In the 2 byte utf - 8 range
+ {
+ *ucs4_buf++ = (u32) (((*utf8_buf - 0xC0) * 0x40)
+ + (*(utf8_buf + 1) - 0x80));
+ utf8_buf += 2;
+ ucs_len++;
+ } else if ((*utf8_buf & 0xF0) == 0xE0) { /* In the 3 byte utf-8
+ * range */
+ *ucs4_buf++ = (u32) (((*utf8_buf - 0xE0) * 0x1000)
+ + ((*(utf8_buf + 1) - 0x80) * 0x40)
+ + (*(utf8_buf + 2) - 0x80));
+
+ utf8_buf += 3;
+ ucs_len++;
+ } else if ((*utf8_buf & 0xF8) == 0xF0) { /* In the 4 byte utf-8
+ * range */
+ *ucs4_buf++ = (u32)
+ (((*utf8_buf - 0xF0) * 0x040000)
+ + ((*(utf8_buf + 1) - 0x80) * 0x1000)
+ + ((*(utf8_buf + 2) - 0x80) * 0x40)
+ + (*(utf8_buf + 3) - 0x80));
+ utf8_buf += 4;
+ ucs_len++;
+ } else if ((*utf8_buf & 0xFC) == 0xF8) { /* In the 5 byte utf-8
+ * range */
+ *ucs4_buf++ = (u32)
+ (((*utf8_buf - 0xF8) * 0x01000000)
+ + ((*(utf8_buf + 1) - 0x80) * 0x040000)
+ + ((*(utf8_buf + 2) - 0x80) * 0x1000)
+ + ((*(utf8_buf + 3) - 0x80) * 0x40)
+ + (*(utf8_buf + 4) - 0x80));
+ utf8_buf += 5;
+ ucs_len++;
+ } else if ((*utf8_buf & 0xFE) == 0xFC) { /* In the 6 byte utf-8
+ * range */
+ *ucs4_buf++ = (u32)
+ (((*utf8_buf - 0xFC) * 0x40000000)
+ + ((*(utf8_buf + 1) - 0x80) * 0x010000000)
+ + ((*(utf8_buf + 2) - 0x80) * 0x040000)
+ + ((*(utf8_buf + 3) - 0x80) * 0x1000)
+ + ((*(utf8_buf + 4) - 0x80) * 0x40)
+ + (*(utf8_buf + 5) - 0x80));
+ utf8_buf += 6;
+ ucs_len++;
+ }
+ }
+ return (ucs_len);
+}
+
prot_type = URL_GetProtocolType(pathName);
if (prot_type != GF_URL_TYPE_RELATIVE) {
- outPath = gf_strdup(pathName);
+ char *sep = NULL;
+ if (pathName[0]=='/') sep = strstr(parentName, "://");
+ if (sep) sep = strchr(sep+3, '/');
+ if (sep) {
+ u32 len;
+ sep[0] = 0;
+ len = strlen(parentName);
+ outPath = (char*)gf_malloc(sizeof(char)*(len+1+strlen(pathName)));
+ strcpy(outPath, parentName);
+ strcat(outPath, pathName);
+ sep[0] = '/';
+ } else {
+ outPath = gf_strdup(pathName);
+ }
goto check_spaces;
}
if (szChar[2]=='x')
sscanf(szChar, "&#x%x;", &val);
else
- sscanf(szChar, "&#%d;", &val);
+ sscanf(szChar, "&#%ud;", &val);
wchar[0] = val;
srcp = wchar;
j += gf_utf8_wcstombs(&value[j], 20, &srcp);
SAX_STATE_CDATA,
SAX_STATE_DONE,
SAX_STATE_XML_PROC,
- SAX_STATE_SYNTAX_ERROR,
+ SAX_STATE_SYNTAX_ERROR
};
typedef struct
} GF_XMLSaxAttribute;
-//#define NO_GZIP
+/* #define NO_GZIP */
struct _tag_sax_parser
} else {
i++;
}
-// if ((c=='[') && (parser->buffer[parser->elt_name_start-1 + i-2]=='A') ) break;
+/* if ((c=='[') && (parser->buffer[parser->elt_name_start-1 + i-2]=='A') ) break; */
if (parser->current_pos+1+i==parser->line_size) {
i=0;
goto exit;
if (!nl_size) return GF_OK;
if ( (parser->alloc_size < size+nl_size+1)
-// || (parser->alloc_size / 2 ) > size+nl_size+1
+/* || (parser->alloc_size / 2 ) > size+nl_size+1 */
)
{
parser->alloc_size = size+nl_size+1;
}
GF_EXPORT
-GF_Err gf_xml_sax_parse(GF_SAXParser *parser, void *string)
+GF_Err gf_xml_sax_parse(GF_SAXParser *parser, const void *string)
{
GF_Err e;
char *current;
e = gf_xml_sax_init(parser, szLine);
if (e) return e;
parser->file_pos = 4;
+ /* souchay : not sure for next 2 lines, but it works better it seems */
+ parser->elt_start_pos = 0;
+ parser->current_pos = 0;
return xml_sax_read_file(parser);
}
return GF_OK;
}
+
GF_EXPORT
u32 gf_xml_sax_get_line(GF_SAXParser *parser) { return parser->line + 1 ; }
--- /dev/null
+@echo off\r
+cd /d %~dp0\r
+for /f "delims=" %%a in ('svnversion') do echo #define GPAC_SVN_REVISION "%%a" > test.h \r
+if not exist include\gpac\version.h goto create \r
+ECHO n|COMP test.h include\gpac\version.h > nul \r
+if errorlevel 1 goto create\r
+DEL test.h\r
+exit/b\r
+:create\r
+MOVE /Y test.h include\gpac\version.h\r